Edit C:\Windows\install\galaxie_p01_01-10\marketing\criteria2\view.jsp
<% /****************************************************************************** * Copyright (c) 2000-2004 e-Deal * * e-Deal S.A. * 55 rue Brillat Savarin * 75013 Paris * France * * T: +33 (0)1 53 80 80 30 * F: +33 (0)1 73 01 69 77 * http://www.e-deal.com * * La diffusion de ce code source sous quelque forme que ce soit sans * l'autorisation de E-DEAL est interdite. * * Vous êtes autorisés à modifier ce code source uniquement pour votre usage * propre et sous réserve que les mentions de copyright demeurent intactes. * * Ce code est fourni en l'état. Aucune garantie d'aucune sorte, explicite ou * implicite n'est donnée. En aucun cas E-DEAL ne pourra être tenu pour * responsable des dommages pouvant résulter de l'utilisation de ce code * source. * * ******************************************************************************/ %><%@page session="true" import="com.edeal.frontline.*,com.edeal.frontline.navigation.FlRequest,java.util.*"%> <%@ page import="com.edeal.frontline.Criteria2Bean" %> <%@ page import="com.edeal.frontline.FieldNotInitializedException" %> <%@page import="com.edeal.frontline.display.TargettingFieldInterfaceManager"%> <%@page import="com.edeal.frontline.display.TargettingFieldInterface"%> <%@page import="com.edeal.frontline.helper.*"%><%@page import="com.edeal.frontline.helper.custom.*"%> <%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %> <% //recuperation du contexte final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(getClass()); String contextPath = (String)session.getAttribute("contextPath"); if(contextPath == null) { contextPath = request.getContextPath(); } FlContext context = Frontline.getContext(contextPath); DataDictionary dico = context.getDataDictionary(); FlRequest flRequest=new FlRequest(request); String paramID = Utils.getRequestParameter(context, request, "id"); String paramNode = Utils.getRequestParameter(context, request, "Node"); String paramEdit = Utils.getRequestParameter(context, request, "Edit"); String paramTemplate = (String) session.getAttribute("idPattern"); String paramSe2ID = Utils.getRequestParameter(context, request, "SelID"); Criteria2Bean obj = new Criteria2Bean(paramID, session); Criteria2Helper criteriaHelper=BasicHelper.factory(obj); String Cr2Se2 = null; try { Cr2Se2 = obj.getCr2Se2ID(); }catch(FieldNotInitializedException ex) {} Selection2Bean se2Bean = new Selection2Bean(); try { se2Bean = new Selection2Bean(Cr2Se2, session); } catch (FrontlineException fe) { logger.warn("FrontlineException occured while creating a new Selection2Bean."); logger.warn("Message: " + fe.getMessage()); logger.warn("Cause: " + fe.getCause()); } catch (AccessDeniedException ade) { logger.warn("AccessDeniedException occured while creating a new Selection2Bean."); logger.warn("Message: " + ade.getMessage()); logger.warn("Cause: " + ade.getCause()); } int Cond =0; try { Cond = se2Bean.getSe2Condition(); }catch(FieldNotInitializedException ex) {} boolean isSelection = false; boolean isHole =false; String Belong="Belong"; String ParamBelong = Utils.getRequestParameter(context, request, "Belong"); boolean isBelong = ParamBelong != null; boolean isEdit = false; if(paramEdit == null) { paramEdit = "0"; isEdit = false; } else { isEdit = "1".equals(paramEdit); } // Template Display Processing String Cr2Condition = null ; try { Cr2Condition = obj.getCr2Condition(); }catch(FieldNotInitializedException ex) {} // c'est liée à une condition type String se2OldID = null ; try { se2OldID = obj.getCr2Se2IDold(); }catch(FieldNotInitializedException ex) {} String condName = null; //faut aussi voir le cas si le parent est un lien vers condition type if (Cond == 0 && Cr2Condition != null) { isSelection = true; Selection2Bean seBean = new Selection2Bean(Cr2Condition, session); try { condName = seBean.getSe2Name(); } catch(FieldNotInitializedException ex) { } } boolean trou = false; try { trou = obj.isCr2IsTemplate(); }catch(FieldNotInitializedException ex) {} if(trou && Cond==0){ isHole = true; } String object = null; String objectDisplay = null; try { object = obj.getCr2FobID(); }catch(FieldNotInitializedException ex) {} if (object != null){ //[JSA].rather display the alias instead of the objectname. If not possible, use the former method try { // JSA: rather display the alias instead of the objectname objectDisplay = Utils.getMessage(session,obj.getCr2TempName(),obj.getCr2TempName()); } catch(FieldNotInitializedException ex) {} try { if (objectDisplay==null) { // if no display, then use the data dictionnary objectDisplay = (new ObjectsBean(object,context)).getObjDisplay(); } } catch(FieldNotInitializedException ex) { objectDisplay=Utils.getMessage(session, "L60E0", "<non spécifié>"); } } // is Agraggate Node //******************************* boolean IsAgraggate= false; String CardOpe = null; try { CardOpe = obj.getCr2CardOpe(); } catch(FieldNotInitializedException ex) {} if (CardOpe != null) { IsAgraggate=true; } String AgraggateLabel = ""; try { AgraggateLabel = obj.getCr2CardLabel(); } catch (FieldNotInitializedException e) {} String _Label = Utils.getMessage(session, AgraggateLabel, Utils.getMessage(session, "L60E0", "<non spécifié>")); //************************************ // a Child of a Agraggate Node // ******************************** boolean IsAgraggateChild = false; String Parent = null; String CardOp = null; try { Parent = obj.getCr2ParentID(); } catch (FieldNotInitializedException e) {} try { CardOp = obj.getCr2FldID(); } catch (FieldNotInitializedException e) {} if (Parent != null) { Criteria2Bean objParent = new Criteria2Bean(Parent, session); Criteria2Helper objParentHlpr=BasicHelper.factory(objParent); String CardParent = null ; Vector objChildren= objParentHlpr.getChildren(); try { CardParent = objParent.getCr2CardOpe(); } catch (FieldNotInitializedException e) {} if(CardParent != null ) { if( CardOp == null && (objChildren.size()>1)) { /* try { // obj.delete(); } catch (AccessDeniedException e) {}*/ } IsAgraggateChild = true; } } // is Template //************************************** boolean type =false; String label =""; String Field = null; try { Field = obj.getCr2FldID(); } catch (FieldNotInitializedException ex){} try { label = obj.getCr2TempName(); } catch (FieldNotInitializedException ex){} try { type = obj.isCr2IsTemplate(); } catch (FieldNotInitializedException ex){} //******************************************************** boolean isValueNeeded = true; try { String strOpeID = obj.getCr2Ope(); isValueNeeded = !"exist".equals(dico.getRefCode("Cr2Ope", strOpeID)); } catch (FieldNotInitializedException ex) { } %> <table class="container" width="100%"> <tr class="fieldline"> <% Vector children = new Vector(); children = criteriaHelper.getChildren(); //c'est un noeud d'agregat dans une condition type if ((IsAgraggate && !type) || (IsAgraggate && Cond == 1)){ if (isBelong){ if(children != null && children.size() > 0) { for(int i = 0; i < children.size(); i++) { String childID = (String)children.elementAt(i); request.setAttribute("Criteria2", new Criteria2Bean(childID, session)); %> <% String valueV1 = paramNode + "." + i; %> <jsp:include page="view.jsp" flush="true"> <jsp:param name="id" value="<%= childID %>"/> <jsp:param name="GrpID" value="<%= obj.getID() %>"/> <jsp:param name="Node" value="<%= valueV1 %>"/> <jsp:param name="Edit" value="<%= paramEdit %>"/> <jsp:param name="Belong" value="<%= ParamBelong %>"/> </jsp:include> <% } } }else { //else de isBelong %> <td width="1%" style="background-color: #ffff00;border: thin solid #ffff00" valign="top"> <% if(isEdit) { %><input name="id" type="checkbox" value="<%= obj.getID() %>"><% } else { %> <% } %> <td width="100%" style="border: thin solid #ffff00;"> <table width="100%"> <tr> <td bgcolor="#ffff00" class="dataValue"> <% if(type && Cond != 0) { String label1 = Utils.getMessage(session, label, Utils.getMessage(session, "L60E0", "<non spécifié>")); if(isEdit) { %> <a href="javascript:doEditAg('<%= obj.getID() %>')"><%=_Label%> </a> <% } else { %><%=_Label%><% } %> <fl:getProperty name="Criteria2" property="Cr2CardOpe" alt=" "/> <%=label1%> <% } else { if(isEdit) { %> <a href="javascript:doEditAg('<%= obj.getID() %>')"><%=_Label%> </a> <% } else { %><%=_Label%><% } %> <fl:getProperty name="Criteria2" property="Cr2CardOpe" alt=" "/> <fl:getProperty name="Criteria2" property="Cr2Card" alt=" "/> <% } %> </td> </tr> </table> <% if(children != null && children.size() > 0) { for(int i = 0; i < children.size(); i++) { String childID = (String)children.elementAt(i); request.setAttribute("Criteria2", new Criteria2Bean(childID, session)); %> <%= i == 0 ? "" : (obj.isCr2And() ? Utils.getMessage(session, "L604B", "et") : Utils.getMessage(session, "L604C", "ou")) %><br> <% String valueV2 = paramNode + "." + i; %> <jsp:include page="view.jsp" flush="true"> <jsp:param name="id" value="<%= childID %>"/> <jsp:param name="GrpID" value="<%= obj.getID() %>"/> <jsp:param name="Node" value="<%= valueV2 %>"/> <jsp:param name="Edit" value="<%= paramEdit %>"/> </jsp:include> <% } } %> <% if(isEdit) { %><a href="javascript:doAdd('<%= obj.getID() %>')"><img border="0" src="<fl:webapp/>/icons/ico/save_all_long.gif" width="74px" height="17px"/></a><% } else { %> <% } %> </td> <% }//fin du else de isBelong %> <% } else if(isSelection) { //else if du c'est un noeud d'agregat : cette fois ci c'est une condition type isBelong = true; %> <td width="1%" style="background-color: #99FF00; border:thin solid #99FF00;" valign="top"> <% if(isEdit) { %><input name="id" type="checkbox" value="<%= obj.getID() %>"><% } else { %> <% } %></td> <td width="100%" style="border:thin solid #99FF00;"> <table width="100%"> <tr> <td bgcolor="#99FF00" class="dataValue"> <% String[] fieldS = {"Cr2ID"}; String[][] querySEdit = {{"Cr2Se2ID = "+Utils.formatToSQL(context, Cr2Se2),"Cr2CardOpe = null", "Cr2TempName <> null"}}; String[] fieldA={"Cr2ID"}; String[][] queryAEdit={{"Cr2Se2ID = "+Utils.formatToSQL(context, Cr2Se2), "Cr2Ope = null", "Cr2TempName <> null"}}; Vector listA = Criteria2Bean.listSummary(session, fieldA, queryAEdit); Vector list = Criteria2Bean.listSummary(session, fieldS, querySEdit); Utils.showQuery(fieldS,querySEdit); Utils.showQuery(fieldA,queryAEdit); int h = list.size(); int m=listA.size(); boolean isVisible = true; if (h==0 && m==0){ isVisible = false; } if(isEdit && isVisible) { %><a href="javascript:doEditTemp('<%= paramID %>')"><%=condName%></a><%} else {%><%=condName%><%}%> </td> </tr> </table> </td> <% if(children != null && children.size() > 0 ) { for(int i = 0; i < children.size(); i++) { String childID = (String)children.elementAt(i); request.setAttribute("Criteria2", new Criteria2Bean(childID, session)); if (!isBelong){ %> <%= i == 0 ? "" : (obj.isCr2And() ? Utils.getMessage(session, "L604B", "et") : Utils.getMessage(session, "L604C", "ou")) %><br> <% } %> <% String valueV3 = paramNode + "." + i; %> <jsp:include page="view.jsp" flush="true"> <jsp:param name="id" value="<%= childID %>"/> <jsp:param name="GrpID" value="<%= obj.getID() %>"/> <jsp:param name="Node" value="<%= valueV3 %>"/> <jsp:param name="Edit" value="<%= paramEdit %>"/> <jsp:param name="Belong" value="<%= Belong %>"/> </jsp:include> <% } %> <%-- The following table is to correct a visual bug.... It's a hack and it's ugly but it works --%> <table class="container" width="100%"> <tr class="fieldline"> <% } %> <% }else if(children != null && children.size() > 0 ) { //else de if condition type donc c'est un critére normal parent //c'est ici que j'ai le probléme car cet agregat a des noeuds donc on les vois pas %> <% request.setAttribute("Criteria2", obj); String Card = null; try{ Card = obj.getCr2CardOpe(); }catch (FieldNotInitializedException ex){} if(Card != null ) { %> <td width="<%= isValueNeeded ? "50%" : "50%" %>" class="dataValue"><%=_Label%> <fl:getProperty name="Criteria2" property="Cr2CardOpe" alt=" "/> </td> <td class="dataValue"> <fl:getProperty name="Criteria2" property="Cr2Card" alt=" "/></td> </tr></table> <% } %> <% if(isBelong){ for(int i = 0; i < children.size(); i++) { String childID = (String)children.elementAt(i); request.setAttribute("Criteria2", new Criteria2Bean(childID, session)); %> <% String valueV4 = paramNode + "." + i; %> <jsp:include page="view.jsp" flush="true"> <jsp:param name="id" value="<%= childID %>"/> <jsp:param name="GrpID" value="<%= obj.getID() %>"/> <jsp:param name="Node" value="<%= valueV4 %>"/> <jsp:param name="Edit" value="<%= paramEdit %>"/> <jsp:param name="Belong" value="<%= ParamBelong %>"/> </jsp:include> <% } } else { %> <td width="1%" style="background-color:#e1f0ff;border:thin solid #e1f0ff;" valign="top"><% if(isEdit) { %><input name="id" type="checkbox" value="<%= obj.getID() %>"><% } else { %> <% } %></td> <td width="100%" style="border:thin solid #e1f0ff;"> <% for(int i = 0; i < children.size(); i++) { String childID = (String)children.elementAt(i); request.setAttribute("Criteria2", new Criteria2Bean(childID, session)); %> <%= i == 0 ? "" : (obj.isCr2And() ? Utils.getMessage(session, "L604B", "et") : Utils.getMessage(session, "L604C", "ou")) %><br> <% String valueV5 = paramNode + "." + i; %> <jsp:include page="view.jsp" flush="true"> <jsp:param name="id" value="<%= childID %>"/> <jsp:param name="GrpID" value="<%= obj.getID() %>"/> <jsp:param name="Node" value="<%= valueV5 %>"/> <jsp:param name="Edit" value="<%= paramEdit %>"/> </jsp:include> <% } %> <% if(isEdit) { %> <a href="javascript:doAdd('<%= obj.getID() %>')"><img border="0" src="<fl:webapp/>/icons/ico/save_all_long.gif" width="74px" height="17px"/></a> <% } %> </td> <% } %> <% }else if(isHole){ //fin de voir tous les fils alors c'est un critére à afficher %> <% request.setAttribute("Criteria2", obj); String Card = null; try{ Card = obj.getCr2CardOpe(); }catch (FieldNotInitializedException ex){} if(Card != null ) { %> <td width="<%= isValueNeeded ? "50%" : "50%" %>" class="dataValue"><%=_Label%> <fl:getProperty name="Criteria2" property="Cr2CardOpe" alt=" "/> </td> <td class="dataValue"> <fl:getProperty name="Criteria2" property="Cr2Card" alt=" "/></td> </tr></table> <% } else { %> <td width="<%= isValueNeeded ? "50%" : "50%" %>" class="dataValue"><%if (Field !=null){ %><fl:getProperty name="Criteria2" property="Cr2FldID" alt=" " bean="true"/><%}%> <fl:getMessage code="L65B3" alt="de"/> <%=objectDisplay%> <%= obj.isCr2Not() ? Utils.getMessage(session, "L2006", "Non") + " " : "" %> <fl:getProperty name="Criteria2" property="Cr2Ope" alt=" "/></td> <% String Fld = null ; try { Fld = obj.getCr2FldID(); }catch (FieldNotInitializedException exChx) {} if (Fld != null){ %> <td class="dataValue"> <% FieldBean fld = dico.getFieldByID(Fld); Vector vectChx = null; try { vectChx = obj.getCr2Chx(); } catch (FieldNotInitializedException exChx) { vectChx = new Vector(); } Vector vectDisplay = new Vector(); try { //if field is fob String fobID = fld.getFldFobID(); ObjectsBean fob = dico.getTable("id", fobID); if (!vectChx.isEmpty()){ StringTokenizer st = new StringTokenizer((String)vectChx.elementAt(0),";"); while (st.hasMoreTokens()) { vectDisplay.addElement(fob.toString(session, st.nextToken())); } } } catch (FieldNotInitializedException exFob) { try { String refID = fld.getFldTabID(); String fldSql = fld.getFldSql(); for(int i = 0; i < vectChx.size(); i++) { vectDisplay.addElement(dico.getRefDisp(session, fldSql, (String)vectChx.elementAt(i))); } } catch (FieldNotInitializedException exRef) { String fldType = null; try { fldType = dico.getRefCode("FldFltID", fld.getFldFltID()); } catch (FieldNotInitializedException exTyp) {}; if("BIT".equals(fldType)) { for(int i = 0; i < vectChx.size(); i++) { vectDisplay.addElement("1".equals((String)vectChx.elementAt(i)) ? Utils.getMessage(session, "L2005", "Oui") : Utils.getMessage(session, "L2006", "Non")); } } else { vectDisplay = vectChx; } } } for(int i = 0; i < vectDisplay.size(); i++) { Object chxDisplay = vectDisplay.elementAt(i); %> <%=chxDisplay%> <br> <% } %> </td> </tr></table> <% } }// } else { //fin du else de is Hole ... if ((!isBelong)){ request.setAttribute("Criteria2", obj); %> <td width="1%" style="background-color:#e1f0ff;border:thin solid #e1f0ff;" valign="top"><% if(isEdit) { %><input name="id" type="checkbox" value="<%= obj.getID() %>"><% } else { %> <% } %></td> <td width="<%= isValueNeeded ? "50%" : "50%" %>" style="border:thin solid #e1f0ff;" class="dataValue"><% if(isEdit) { %><a href="javascript:doEdit('<%= obj.getID() %>')"><% } %><%if (Field !=null){ %><fl:getProperty name="Criteria2" property="Cr2FldID" alt=" " bean="true"/><%}%><% if(isEdit) { %></a><% } %> <fl:getMessage code="L65B3" alt="de"/> <%=objectDisplay%> <%= obj.isCr2Not() ? Utils.getMessage(session, "L2006", "Non") + " " : "" %><fl:getProperty name="Criteria2" property="Cr2Ope" alt=" "/></td> <%} } %> <% if(!isBelong){ if(isValueNeeded) { if(type && Cond != 0 && !IsAgraggate) { label = Utils.getMessage(session, label, Utils.getMessage(session, "L60E0", "<non spécifié>")); %> <td style="border:thin solid #e1f0ff;" class="dataValue"> <%=label%> <br> </td> <%} else if (!IsAgraggate){ String Fld = null ; try { Fld = obj.getCr2FldID(); }catch (FieldNotInitializedException exChx) {} if (Fld != null){ %> <td style="border:thin solid #e1f0ff;" class="dataValue"> <% StringBuffer valueDisplay=new StringBuffer(); FieldBean fld = dico.getFieldByID(Fld); TargettingFieldInterfaceManager tfim=TargettingFieldInterfaceManager.factory(context); String readhtml=null; if (tfim.hasCustomInterface(fld.getFldSql())) { Criteria2Bean criteria=(Criteria2Bean)obj; readhtml=tfim.getHtmlForFieldRead(session,flRequest,fld.getFldSql(),se2Bean,criteria); } if (readhtml!=null) { out.append(readhtml); } else { Vector vectChx = null; try { vectChx = obj.getCr2Chx(); } catch (FieldNotInitializedException exChx) { vectChx = new Vector(); } Vector vectDisplay = new Vector(); try { //if field is fob String fobID = fld.getFldFobID(); ObjectsBean fob = dico.getTable("id", fobID); for(int i = 0; i < vectChx.size(); i++) { String vectChxValue = (String)vectChx.elementAt(i); if("$$CurrentDate$$".equals(vectChxValue)||"$$ActID$$".equals(vectChxValue)){ vectDisplay.addElement(vectChxValue); } else { vectDisplay.addElement(fob.toString(session, vectChxValue)); } } } catch (FieldNotInitializedException exFob) { try { String refID = fld.getFldTabID(); String fldSql = fld.getFldSql(); for(int i = 0; i < vectChx.size(); i++) { vectDisplay.addElement(dico.getRefDisp(session, fldSql, (String)vectChx.elementAt(i))); } } catch (FieldNotInitializedException exRef) { String fldType = null; try { fldType = dico.getRefCode("FldFltID", fld.getFldFltID()); } catch (FieldNotInitializedException exTyp) {}; if("BIT".equals(fldType)) { for(int i = 0; i < vectChx.size(); i++) { vectDisplay.addElement("1".equals(vectChx.elementAt(i)) ? Utils.getMessage(session, "L2005", "Oui") : Utils.getMessage(session, "L2006", "Non")); } } else { vectDisplay = vectChx; } } } for(int i = 0; i < vectDisplay.size(); i++) { Object chxDisplay = vectDisplay.elementAt(i); valueDisplay.append(chxDisplay.toString()+"<br>"); } } %> <%=valueDisplay.toString()%> </td> <% } } }else { %> <td> <br> </td> <% } } %> <% if ( !isBelong || se2OldID == null || Parent == null) { %> </tr> </table> <% } %>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de