Edit C:\Windows\install\galaxie_p01_01-10\marketing\criteria2\edit.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.custom.*,org.w3c.dom.Node,java.util.*"%> <%@ page import="com.edeal.frontline.SelectionManager.GroupNode" %> <%@ page import="com.edeal.frontline.navigation.FlRequest" %> <%@page import="org.apache.commons.lang.StringUtils"%> <%@ page import="com.edeal.frontline.SelectionManager.ObjectNode" %> <%@ page import="com.edeal.frontline.SelectionManager.SubGroupNode" %> <%@ page import="com.edeal.frontline.FieldNotInitializedException" %> <%@ page import="com.edeal.frontline.AccessDeniedException" %> <%@ page import="com.edeal.frontline.Selection2Bean" %> <%@ page import="com.edeal.frontline.ObjectsBean" %> <%@page import="com.edeal.frontline.display.TargettingFieldInterfaceManager"%> <%@page import="com.edeal.frontline.display.TargettingFieldInterface"%> <%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %> <jsp:useBean class="com.edeal.frontline.Criteria2Bean" id="Criteria2" scope="request"/> <% // JSA class used to keep label code and translation class DisplayObjectName { public String label; public String labelCode; DisplayObjectName(String labelCode,String label) { this.label=label; this.labelCode=labelCode; } } // GGH replace the vector of table to a vector of this object "DisplayField" class DisplayField implements Comparable { public String fldID; public String fldDisplay; DisplayField(String fldID,String fldDisplay) { this.fldID=fldID; this.fldDisplay=fldDisplay; } public int compareTo(Object o) { DisplayField displayField = (DisplayField) o; return this.fldDisplay.toUpperCase().compareTo(displayField.fldDisplay.toUpperCase()); } } //Recuperation du context final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(getClass()); FlRequest flRequest = new FlRequest(request); FlContext context = flRequest.getContext(); DataDictionary dico = context.getDataDictionary(); String lngID = FlLocale.getInstance(session).getLanguageID(); TargettingFieldInterfaceManager tfim=TargettingFieldInterfaceManager.factory(context); //si la langue dans fllocal est null alors français pas defaut if(lngID == null) { try { lngID = dico.getRefIdByCode("Lng", "Val", "fr_FR"); } catch (Exception ex) { } } //Recuperation des paramétres //je recupere le groupe id (id du critére parent) String paramGrpID = Utils.getRequestParameter(context, request, "GrpID"); //j'instancie un criteria bean parent try { paramGrpID = Criteria2.getCr2ParentID(); }catch (FieldNotInitializedException e){ paramGrpID = Utils.getRequestParameter(context, request, "GrpID"); Criteria2.setCr2ParentID(paramGrpID); } Criteria2Bean criteriaParent = null; if (paramGrpID == null) { criteriaParent = new Criteria2Bean(context); } else { criteriaParent = new Criteria2Bean(paramGrpID,context); } String SubGroup = null; boolean isSub = false; try { SubGroup = criteriaParent.getCr2SubGroup(); isSub= SubGroup != null && !"null".equals(SubGroup); }catch (FieldNotInitializedException ex){} //je recupere l'id du ciblage que je suis entrain de créer et sulequel je veux editer ce critére String paramSe2ID = null; try { paramSe2ID = Criteria2.getCr2Se2ID(); }catch (FieldNotInitializedException e){} if (paramSe2ID == null) { paramSe2ID = Utils.getRequestParameter(context, request, "se2ID"); Criteria2.setCr2Se2ID(paramSe2ID); } Selection2Bean selection2Bean = null; boolean condition_type = false; try { selection2Bean = new Selection2Bean(paramSe2ID,session); }catch (AccessDeniedException e){} if (selection2Bean != null) { try { int cond = selection2Bean.getSe2Condition(); condition_type = cond == 1; }catch (FieldNotInitializedException e){} } //si je suis en edition alors je recupere l'id du critére String id = null; try { id = Criteria2.getCr2ID(); }catch (FieldNotInitializedException e){} //on uilise le shéma xml pour recuperer la liste des objets à faire Vector<DisplayObjectName> VectObject = new Vector(); Vector VectObjectShadow = new Vector(); Vector objects = new Vector(); //ici on parse le xml et on construit la liste des objets String Model = flRequest.getRequestParameterOrAttribute("Se2Model"); if (StringUtils.isEmpty(Model)) { try { Model = selection2Bean.getSe2Model(); } catch (FieldNotInitializedException ex) { logger.error("criteria2/edit.jsp no model set !!!!",ex); } catch (NullPointerException npe) { logger.error("criteria2/edit.jsp selection2bean is null",npe); } } SelectionManager Selman= new SelectionManager(context,Model); Selman.parse(); SelectionManager.GroupNode groupNode = Selman.getResultGroup(); if(isSub){ SelectionManager.SubGroupNode subGR = Selman.getSubGroupById(SubGroup); objects = subGR.getVectObjects(); } else { objects = groupNode.getVectObjects(); } Vector subgroup = Selman.getResultSubGroup(); String label = null; try { label = Criteria2.getCr2TempName(); } catch (FieldNotInitializedException fnie) { } if (objects != null && objects.size()>0){ for (int i=0; i<objects.size();i++){ SelectionManager.ObjectNode Nodeobj = (SelectionManager.ObjectNode)objects.elementAt(i); boolean isVisible = Nodeobj.isShowCriteria(); if(isVisible){ String Name1 = Nodeobj.getName(); String objID = dico.getTable("sql",Name1).getID(); String Name = Nodeobj.getDisplayLabel(); String _Label = Utils.getMessage(session, Name, Name); String Alias = Nodeobj.getAlias(); // JSA //VectObject.addElement(_Label); VectObject.addElement(new DisplayObjectName(Name,_Label)); VectObjectShadow.addElement(objID+"|"+Alias+"|"+Name1); } } } if (subgroup != null && subgroup.size()>0){ for (int i=0; i<subgroup.size();i++){ SelectionManager.SubGroupNode Sub = (SelectionManager.SubGroupNode)subgroup.elementAt(i); if(!isSub){ String Name = (String) Sub.getDisplayLabel(); String _Label_ = Utils.getMessage(session, Name, Name); VectObject.addElement(new DisplayObjectName("","------------")); VectObjectShadow.addElement((String)"----------"); VectObject.addElement(new DisplayObjectName(Name,_Label_)); String sbgroup = (String) Sub.getID(); VectObjectShadow.addElement((String)"Agraggate "+sbgroup+"|"+Name); } } } //si je fais un refresh je dois recuperer des paramétres pour les utiliser dans ma page //recuperation de l'objet en cours String paramObject = null; String paramObjectID = null; try { paramObjectID = Criteria2.getCr2FobID(); ObjectsBean objBean = new ObjectsBean(paramObjectID,context); paramObject = objBean.getObjSql(); logger.debug("dans le try catch le paramObject is " + paramObject); }catch (FieldNotInitializedException e){} logger.debug("le param object is " + paramObject); if (paramObject == null) paramObject = Utils.getRequestParameter(context, request, "Cr2Fob"); //recupere l'alias du critére String paramAlias = null; try { paramAlias = Criteria2.getCr2Alias(); }catch (FieldNotInitializedException e){} //je recupere le nom du champ pour le remmetre selectionné String paramCFldID = null; try { paramCFldID = Criteria2.getCr2FldID(); }catch (FieldNotInitializedException e){} //je recupere l'operation String paramCOpe = null; try { paramCOpe = Criteria2.getCr2Ope(); }catch (FieldNotInitializedException e){} //je regarde si je recupere un temp String isTempValue = Utils.getRequestParameter(context, request, "temp"); if (isTempValue != null && "1".equals(isTempValue)) { Criteria2.setCr2IsTemplate(true); }else if (isTempValue != null && "0".equals(isTempValue)) { Criteria2.setCr2IsTemplate(false); } //je regarde si je recupere un freeValue boolean freeValue = false; String isCr2IsFreeValue = Utils.getRequestParameter(context, request, "freeValue"); Vector cr2ChxVectorValue = null; if((isTempValue == null && isCr2IsFreeValue == null) || (!"1".equals(isTempValue) && ("true".equals(isCr2IsFreeValue) || "1".equals(isCr2IsFreeValue)))){ try{ cr2ChxVectorValue = Criteria2.getCr2Chx(); } catch (FieldNotInitializedException e){ } } if ( (cr2ChxVectorValue!= null && !cr2ChxVectorValue.isEmpty() && ("$$CurrentDate$$".equals(cr2ChxVectorValue.firstElement()) || "$$ActID$$".equals(cr2ChxVectorValue.firstElement())) ) || (isCr2IsFreeValue != null && "1".equals(isCr2IsFreeValue)) ) { freeValue = true; }else if (isCr2IsFreeValue != null && "0".equals(isCr2IsFreeValue)) { freeValue = false; } //est ce que c'est un trou alors isTemplate = true boolean trou = false; try { trou = Criteria2.isCr2IsTemplate(); }catch (FieldNotInitializedException e){ } boolean doNotChangeTrou = Utils.getRequestParameter(context, request, "notChangeTrou") != null; if (condition_type && id == null && !doNotChangeTrou) { Criteria2.setCr2IsTemplate(true); trou = true; } //je recupére le vector des choix Vector vectChx = new Vector(); try { vectChx = Criteria2.getCr2Chx(); }catch (FieldNotInitializedException e){} boolean isEdit = false; boolean IsAgraggate = false; // ******************* Processing Cr2Chx ********************// FieldBean fld = null; String[] ctlOpe = {}; String fldType = null; boolean isOpeSelected = false; boolean isValueNeeded = true; boolean isMultival = false; boolean isControledByRef = false; boolean isControledByFob = false; boolean isMultipleValues = false; boolean isBoolean = false; boolean isDate = false; boolean isDecimal = false; boolean isInteger = false; boolean isNumeric = false; boolean isText = false; boolean hasCustomUi = false; Vector cond = new Vector(); if (paramCFldID != null){ cond = Utils.explodeList(paramCFldID,"|"); } boolean pattern = false; if (cond.size()>0 && "Condition".equals(cond.elementAt(0))){ pattern = true; } String criteriaFieldName=null; if(paramCFldID != null && !pattern && ! "".equals(paramCFldID) && !"null".equals(paramCFldID)) { fld = dico.getFieldByID(paramCFldID); criteriaFieldName=fld.getFldSql(); try { fldType = dico.getRefCode("FldFltID", fld.getFldFltID()); } catch (FieldNotInitializedException ex) {}; try { isControledByRef = (fld.getFldTabID() != null); } catch (FieldNotInitializedException ex) {}; try { isControledByFob = (fld.getFldFobID() != null); } catch (FieldNotInitializedException ex) {}; try { hasCustomUi = tfim.hasCustomInterface(fld.getFldSql()); } catch (Exception e) {} if("BIT".equals(fldType)) { ctlOpe = new String[]{"=", "<>"}; isBoolean = true; } else if("DATE".equals(fldType) || "TIME".equals(fldType) || "TIMESTAMP".equals(fldType)) { ctlOpe = new String[]{"=", "<>", "<", ">", "<=", ">=", "exist"}; isDate = true; } else if("FLOAT|DOUBLE".equals(fldType) || "REAL".equals(fldType)) { ctlOpe = new String[]{"=", "<>", "<", ">", "<=", ">=", "in", "exist"}; isDecimal = true; isNumeric = true; } else if("INTEGER".equals(fldType) || "BIGINT".equals(fldType) || "SMALLINT".equals(fldType) || "DECIMAL|NUMERIC".equals(fldType) || "TINYINT".equals(fldType)) { ctlOpe = new String[]{"=", "<>", "<", ">", "<=", ">=", "in", "exist"}; isInteger = true; isNumeric = true; } else if("CHAR|VARCHAR|LONGVARCHAR|CLOB".equals(fldType)) { ctlOpe = new String[]{"=", "<>", "like", "in", "begin", "exist","<", ">", "<=", ">="}; isText = true; } if(fld.isFldMultival()) { ctlOpe = new String[]{"=", "contains", "exist"}; isMultipleValues = true; } else if(isControledByRef || isControledByFob) { ctlOpe = new String[]{"=", "<>", "in", "exist"}; } } //si Cr2IsTemplate a été coché alors je dois vider les choix. boolean isTemplate = false; try{ isTemplate = Criteria2.isCr2IsTemplate(); if(isTemplate && condition_type) { //je dois vider les choix normal Criteria2.setCr2Chx(null); }else { Criteria2.setCr2TempNameLabel(null); } }catch (FieldNotInitializedException e){} if (paramCFldID != null && !"null".equals(paramCFldID)){ for(int i = 0; i < ctlOpe.length; i++) { try { String opeID = dico.getRefIdByCode("Cr2Ope", ctlOpe[i]); String opeDisp = (String)dico.getRefDisp(session, "Cr2Ope", opeID); String operation = ""; if (!"".equals(opeDisp)){ operation=opeDisp; } isMultipleValues = isMultipleValues || (opeID.equals(paramCOpe) && "in".equals(ctlOpe[i])); if(opeID.equals(paramCOpe)) { isOpeSelected = true; isValueNeeded = !"exist".equals(ctlOpe[i]); } } catch (Exception ex) { } } } String sfwID = flRequest.getParameter("SfwID"); %> <html> <head> <title>E-DEAL CRM</title> <link rel="stylesheet" type="text/css" href="<fl:webapp/>/css/common_css.jsp"> <link rel="stylesheet" type="text/css" href="<fl:webapp/>/css/master_css.jsp"> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/master_js.jsp"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/checkFields.jsp"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/presentField.js"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/utils.js"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/calendar.jsp"></script> <script language="javascript"> function doVoid(p) { return; } var submitFlags = false; function doRefresh(){ var f = document.forms[0]; doExitConf = false; f.action = '<fl:link url="/refresh_criteria2.fl?notChangeTrou=1"/>'; obj = f.Object.options[f.Object.selectedIndex].value; fob = f.Object.options[f.Object.selectedIndex].text; var Agraggate= obj.substring(0,9); var label = obj.substring(10); if (Agraggate=="Agraggate"){ var vab = label.split('|'); var label = vab[1]; var sbgroup = vab[0]; f.action = '<fl:webapp/>/refresh_agraggate.fl?label='+label+'&se2ID=<%=paramSe2ID%>&sbgroup='+sbgroup+'&Group=<%=paramGrpID%>&SfwID=<%=sfwID%>'; f.submit(); }else { var tab = obj.split('|'); var objectName =tab[2]; var objectAlias = tab[1]; var objID = tab[0]; f.Cr2Fob.value = objectName; f.Cr2FobID.value = objID; f.Cr2Alias.value = objectAlias; if(f.Cr2IsFreeValue != null && f.Cr2IsFreeValue.checked){ if(f.Cr2IsTemplate != null && f.Cr2IsTemplate.checked){ f.action = '<fl:link url="<%=\"/refresh_criteria2.fl?notChangeTrou=1&freeValue=1&temp=1&SfwID=\" + sfwID%>"/>'; } else { f.action = '<fl:link url="<%=\"/refresh_criteria2.fl?notChangeTrou=1&freeValue=1&temp=0&SfwID=\" + sfwID%>"/>'; } } else { if(f.Cr2IsTemplate != null && f.Cr2IsTemplate.checked){ f.action = '<fl:link url="<%=\"/refresh_criteria2.fl?notChangeTrou=1&freeValue=0&temp=1&SfwID=\" + sfwID%>"/>'; } else { f.action = '<fl:link url="<%=\"/refresh_criteria2.fl?notChangeTrou=1&freeValue=0&temp=0&SfwID=\" + sfwID%>"/>'; } } f.submit(); } } function doRefreshTemp(){ var f = document.forms[0]; if (f.Cr2IsTemplate != null && f.Cr2IsTemplate.checked) { f.action = '<fl:link url="<%=\"/refresh_criteria2.fl?temp=1&freeValue=0¬ChangeTrou=1&SfwID=\" + sfwID%>"/>'; } else { if (f.Cr2IsFreeValue != null && f.Cr2IsFreeValue.checked) { f.action = '<fl:link url="<%=\"/refresh_criteria2.fl?temp=0&freeValue=1¬ChangeTrou=1&SfwID=\" + sfwID%>"/>'; } else { f.action = '<fl:link url="<%=\"/refresh_criteria2.fl?temp=0&freeValue=0¬ChangeTrou=1&SfwID=\" + sfwID%>"/>'; } } doExitConf = false; f.submit(); } function doRefreshFreeValue(){ var f = document.forms[0]; if (f.Cr2IsFreeValue != null && f.Cr2IsFreeValue.checked) { f.action = '<fl:link url="<%=\"/refresh_criteria2.fl?temp=0&freeValue=1¬ChangeTrou=1&SfwID=\" + sfwID%>"/>'; } else { if (f.Cr2IsTemplate != null && f.Cr2IsTemplate.checked) { f.action = '<fl:link url="<%=\"/refresh_criteria2.fl?temp=1&freeValue=0¬ChangeTrou=1&SfwID=\" + sfwID%>"/>'; } else { f.action = '<fl:link url="<%=\"/refresh_criteria2.fl?temp=0&freeValue=0¬ChangeTrou=1&SfwID=\" + sfwID%>"/>'; } } doExitConf = false; f.submit(); } function doRefreshOp(){ var f = document.forms[0]; Cr2Field = f.Cr2FldID.options[f.Cr2FldID.selectedIndex].value; var cond = Cr2Field.substring(0,9); var id = Cr2Field.substring(10); f.Cr2Condition.value=id; doExitConf = false; if(f.Cr2Chx != null){ f.Cr2Chx.value = null; } if (cond=="Condition"){ if(f.Cr2IsFreeValue != null && f.Cr2IsFreeValue.checked){ if(f.Cr2IsTemplate != null && f.Cr2IsTemplate.checked){ f.action = '<fl:link url="<%=\"/refresh_template.fl?notChangeTrou=1&freeValue=1&temp=1&SfwID=\" + sfwID%>"/>'; } else { f.action = '<fl:link url="<%=\"/refresh_template.fl?notChangeTrou=1&freeValue=1&temp=0&SfwID=\" + sfwID%>"/>'; } } else { if(f.Cr2IsTemplate != null && f.Cr2IsTemplate.checked){ f.action = '<fl:link url="<%=\"/refresh_template.fl?notChangeTrou=1&freeValue=0&temp=1&SfwID=\" + sfwID%>"/>'; } else { f.action = '<fl:link url="<%=\"/refresh_template.fl?notChangeTrou=1&freeValue=0&temp=0&SfwID=\" + sfwID%>"/>'; } } }else { if(f.Cr2IsFreeValue != null && f.Cr2IsFreeValue.checked){ if(f.Cr2IsTemplate != null && f.Cr2IsTemplate.checked){ f.action = '<fl:link url="<%=\"/refresh_criteria2.fl?notChangeTrou=1&freeValue=1&temp=1&SfwID=\" + sfwID%>"/>'; } else { f.action = '<fl:link url="<%=\"/refresh_criteria2.fl?notChangeTrou=1&freeValue=1&temp=0&SfwID=\" + sfwID%>"/>'; } } else { if(f.Cr2IsTemplate != null && f.Cr2IsTemplate.checked){ f.action = '<fl:link url="<%=\"/refresh_criteria2.fl?notChangeTrou=1&freeValue=0&temp=1&SfwID=\" + sfwID%>"/>'; } else { f.action = '<fl:link url="<%=\"/refresh_criteria2.fl?notChangeTrou=1&freeValue=0&temp=0&SfwID=\" + sfwID%>"/>'; } } } f.submit(); } function doRefreshOpValue(){ var f = document.forms[0]; if(f.Cr2IsFreeValue != null && f.Cr2IsFreeValue.checked){ if(f.Cr2IsTemplate != null && f.Cr2IsTemplate.checked){ f.action = '<fl:link url="<%=\"/refresh_criteria2.fl?notChangeTrou=1&freeValue=1&temp=1&SfwID=\" + sfwID%>"/>'; } else { f.action = '<fl:link url="<%=\"/refresh_criteria2.fl?notChangeTrou=1&freeValue=1&temp=0&SfwID=\" + sfwID%>"/>'; } } else { if(f.Cr2IsTemplate != null && f.Cr2IsTemplate.checked){ f.action = '<fl:link url="<%=\"/refresh_criteria2.fl?notChangeTrou=1&freeValue=0&temp=1&SfwID=\" + sfwID%>"/>'; } else { f.action = '<fl:link url="<%=\"/refresh_criteria2.fl?notChangeTrou=1&freeValue=0&temp=0&SfwID=\" + sfwID%>"/>'; } } doExitConf = false; f.submit(); } function doCancel() { window.close(); } function doSelect(field) { var f = document.forms[0]; window.open('<fl:link url="/select_label.fl?1=1"/>&field=' + field + '&lng=' + encodeURIComponent(f.lngID.value), 'select_label', 'width=1000,height=500,menubar=no,status=no,resizable=yes'); } function doRemove(field) { var f = window.document.forms[0]; if (f.elements[field] && f.elements[field].value) { f.elements[field].value = ''; } if (f.elements['lbl' + field] && f.elements['lbl' + field].value) { f.elements['lbl' + field].value = ''; } } function doSubmit() { if(!submitFlags) { submitFlags = true; var f = document.forms[0]; <% if (trou && isValueNeeded) { %> if(!f.Cr2TempName.value) { window.alert('<fl:getMessage code="M6059" alt="Veuillez saisir un libellé." js="true"/>'); submitFlags = false; return;javascript:doSubmit(); } <% } else { // 1 if(paramCOpe != null && !"exist".equals(dico.getRefCode("Cr2Ope", paramCOpe))) { // 2 if(isDate) { %> if(f.Cr2Chx.value != "$$CurrentDate$$"){ if(!f.lblDate.value) { window.alert('<fl:getMessage code="M2006" alt="Veuillez saisir une date." js="true"/>'); f.lblDate.focus(); submitFlags = false; return; } else { if(!f.lblTime.value) { f.lblTime.value = '00:00'; } f.Cr2Chx.value = f.lblDate.value + ' ' + f.lblTime.value; } } <% } else if(isNumeric) { %> if(!f.Cr2Chx.value) { window.alert('<fl:getMessage code="M2007" alt="Veuillez saisir une valeur." js="true"/>'); f.Cr2Chx.focus(); submitFlags = false; return; } prepNumsForSubmit(separateurDecimal, separateurMilliers, f.Cr2Chx); <% } else { //3 if(isControledByRef) { %> if(f.Cr2Chx.selectedIndex < 0) { window.alert('<fl:getMessage code="M2008" alt="Veuillez sélectionner au moins une valeur." js="true"/>'); f.Cr2Chx.focus(); submitFlags = false; return; } <% } else if(isControledByFob) { %> if(!f.Cr2Chx.value) { window.alert('<fl:getMessage code="M2009" alt="Veuillez spécifier une valeur." js="true"/>'); f.Cr2Chx.focus(); submitFlags = false; return; } <% } else { %> if(!f.Cr2Chx.value) { window.alert('<fl:getMessage code="M2009" alt="Veuillez spécifier une valeur." js="true"/>'); f.Cr2Chx.focus(); submitFlags = false; return; } <% } %> <% } // 3 %> <% }else if (paramCOpe != null && "exist".equals(dico.getRefCode("Cr2Ope", paramCOpe))) { %> <% } //2 } //1 %> // JSA --fill the cr2tempname in any case if it's empty (i.e. not user filled) if (f.Object) { if (f.Cr2TempName) { if (f.Cr2TempName.value=="") { var labelcode=f.Object.options[f.Object.selectedIndex].getAttribute("ed:labelcode"); f.Cr2TempName.value=labelcode; } } } f.action = '<fl:webapp/>/save_criteria2.fl?se2ID=<%= paramSe2ID %>&object=<%= paramObject %>&GrpID=<%= paramGrpID %>'; f.$$returnedHtmlHead.value = '<scr' + 'ipt type="text/javascript" language="javascript">window.opener.parent.refreshSelection(); window.close();</scr' + 'ipt>'; presentFieldsValue(); f.submit(); } } </script> </head> <body style="overflow: auto; height: 100%;" class="popup_body"> <div id="object_css" style="top:0px;left: 0px;right:0px;height:100%;"> <fl:bigTabs objectTitle="<%= Utils.getMessage(session, \"L6396\", false, true, \"Critère\") %>" ignoreList="true" showFooter="false"> <form action="" method="post"> <%if (id != null) { %> <input type="hidden" name="id" value="<%= id%>"> <% } %> <input name="$$returnedHtmlHead" type="hidden" value=""> <input name="$$returnedHtmlBody" type="hidden" value="Closing..."> <input name="$$presentFields" type="hidden" value="Cr2Not;Cr2FldID;Cr2Ope;Cr2Chx;Cr2IsTemplate;Cr2IsFreeValue;Cr2Alias;Cr2FobID;Cr2Condition"> <input name="$$multivalSeparator" type="hidden" value=";"> <input type="hidden" name="lngID" value="<%= Utils.formatToWeb(lngID, true) %>"> <input name="Cr2Se2ID" type="hidden" value="<%= (paramSe2ID == null ? "" : paramSe2ID) %>"> <input name="Cr2ParentID" type="hidden" value="<%= (paramGrpID == null ? "" : paramGrpID) %>"> <table class="container" cellpadding="3"> <tr class="fieldline"> <% if(condition_type) { %> <TD class="dataLabel" style="white-space: nowrap;width:5%"> <fl:getMessage code="F6039" alt="Paramètre"/> </TD> <% } %> <TD class="dataLabel" style="white-space: nowrap;width:5%"> <fl:getMessage code="L202F" alt="Négation"/> </TD> <TD class="dataLabel" style="white-space: nowrap;width:10%"> <fl:getMessage code="L81D7" alt="Calculé à l\'exécution"/> </TD> <TD class="dataLabel" style="white-space: nowrap;width:10%"> <fl:getMessage code="L6594" alt="Objet"/> </TD> <% ObjectsBean objetBean =null; if (paramObject != null) { try{ objetBean = dico.getTable("sql",paramObject); } catch (FrontlineException ex) { IsAgraggate = true; } if (objetBean != null){ %> <TD class="dataLabel" style="white-space: nowrap;width:10%"> <fl:getMessage code="L202C" alt="Champs associé :"/> </TD> <% } } %> <% if (paramCFldID != null && !"null".equals(paramCFldID)){ %> <TD class="dataLabel" style="white-space: nowrap;width:10%"> <fl:getMessage code="L202D" alt="Opérateurs :"/> </TD> <% } if(paramCOpe != null && !isValueNeeded) { %> <TD class="dataLabel" style="white-space:nowrap; width:50%"> </TD> <% } else if(isOpeSelected && trou) { %> <TD class="dataLabel" style="white-space:nowrap; width:60%"> <fl:getMessage code="F2001" alt="Libellé"/> </TD> <% } else if (isOpeSelected && ! trou) { %> <TD class="dataLabel" style="white-space:nowrap; width:50%"> <fl:getMessage code="L604A" alt="Valeurs associées"/> <% if(isControledByFob) { ObjectsBean ctlFob = dico.getTable("id", fld.getFldFobID()); if(isMultipleValues && ! freeValue) { %><br> <a href="javascript:var win = window.open('<fl:webapp/>/select_multiple.fl?type=<%= ctlFob.getObjSql() %>&field=Cr2Chx', 'Cr2Chx', 'menubar=no,status=no,toolbar=no,scrollbars=no,resizable=yes,width=850,height=570')"> <img src="<fl:webapp/>/icons/ico/rechercher.gif" class="icon" alt="<fl:getMessage code="A305F" alt="Choisir une valeur"/>"></a> <a href="javascript:unselectMultiple('Cr2Chx')"> <img src="<fl:webapp/>/icons/ico/supprimer.gif" class="icon" alt="<fl:getMessage code="A3005" alt="Vider le champ"/>"></a> <%}}%> </TD> <% } %> </tr> <tr style="vertical-align: top" class="fieldline"> <% if(condition_type) { %> <TD class="dataValue" style="white-space: nowrap;width:5%;"> <input name="Cr2IsTemplate" type="checkbox" value="<%=trou%>" <%= trou ? " checked" : "" %> onclick="doRefreshTemp();" onchange="doRefreshTemp()"> </TD> <% } %> <td class="dataValue" style="white-space: nowrap;width:5%;"> <% String paramCNot = null; try { paramCNot = Criteria2.isCr2Not() ? "1" : null; } catch (FieldNotInitializedException ex) { paramCNot = null; } %> <input name="Cr2Not" type="checkbox" value="true"<%= paramCNot == null ? "" : " checked" %>> </td> <TD class="dataValue" style="white-space: nowrap;width:5%;"> <input name="Cr2IsFreeValue" type="checkbox" value="<%=freeValue%>" <%= freeValue ? " checked" : "" %> onclick="doRefreshFreeValue();" onchange="doRefreshFreeValue()"> </TD> <TD class="dataValue" style="white-space: nowrap;width:10%;"> <select name="Object" onChange="doRefresh();"> <option></option> <% for (int i=0;i< VectObject.size();i++) { String object = VectObject.elementAt(i).label; String labelcode= VectObject.elementAt(i).labelCode; String objectshadow = (String) VectObjectShadow.elementAt(i); Vector vectFobAlias = Utils.explodeList(objectshadow,"|"); boolean objToSelect = false; if (vectFobAlias != null && vectFobAlias.size() > 2) { String fobName = (String) vectFobAlias.elementAt(2); objToSelect = fobName != null && fobName.equals(paramObject); String fobAlias=(String) vectFobAlias.elementAt(1); objToSelect = fobAlias != null && fobAlias.equals(paramAlias); } %> <option ed:labelcode="<%= labelcode %>" value="<%=objectshadow%>" <%= objToSelect ? " selected" : "" %>><%= object%></value> <% } %> </select> <input name="Cr2Fob" type="hidden" value="<%= paramObject %>"> <input name="Cr2FobID" type="hidden" value="<%= paramObjectID %>"> <input name="Cr2Alias" type="hidden" value="<%= paramAlias %>"> </TD> <% if (objetBean != null){ Vector vectFields = dico.getTableFields("sql", paramObject, true, false); // let's get the object field Vector Champs = new Vector(); for (int i = 0; i < vectFields.size(); i++) { FieldBean fldBean = (FieldBean) vectFields.elementAt(i); String fldID = null; try { fldID = fldBean.getID(); } catch (FieldNotInitializedException ex) {} String fldSQL = null; try { fldSQL = fldBean.getFldSql(); } catch (FieldNotInitializedException ex) {} boolean horsCible = false; try { horsCible = fldBean.isFldCriteria(); } catch (FieldNotInitializedException ex) {} if (!horsCible) { String fldDisplay = null; try { fldDisplay = fldBean.getFldDisplay(); } catch (FieldNotInitializedException ex) { fldDisplay = ""; } try { fldDisplay = Utils.getMessage(session, fldBean .getFldDisplayLabel(), false, true, fldDisplay); } catch (FieldNotInitializedException fnie) { } if ("".equals(fldDisplay)){ fldDisplay = fldSQL; } //String[] Fields = {fldID,fldDisplay}; //Champs.addElement(Fields); Champs.addElement(new DisplayField(fldID, fldDisplay)); } } // sort the fields java.util.Collections.sort(Champs); // and then add the eventual "question types" //String[] FieldsStat = {"","------------------------"}; // liste des conditions types Vector questionsToAdd=new Vector(); if(!condition_type) { //Champs.addElement(FieldsStat); //questionsToAdd.addElement(new DisplayField("", "------------------------")); String[] fieldS = {"Se2ID", "Se2Name"}; String[][] queryS = {{"Se2Condition = 1", "Se2Model:SmdObjID = "+Utils.formatToSQL(context, paramObjectID)}}; logger.debug("Query: " + paramObjectID); Vector list = Selection2Bean.listSummary(session, fieldS, queryS); logger.debug("Query: " + list); if (list != null && list.size() > 0) { for (int i = 0; i < list.size(); i++) { Hashtable row = (Hashtable) list.elementAt(i); String conditionID = (String) row.get("Se2ID"); String conditionName = (String) row.get("Se2Name"); //String[] Fields= {"Condition|"+conditionID,conditionName}; //Champs.addElement(Fields); questionsToAdd.addElement(new DisplayField("Condition|"+conditionID, conditionName)); } } if (!questionsToAdd.isEmpty()) { // sort them java.util.Collections.sort(questionsToAdd); Champs.addElement(new DisplayField("", "------------------------")); Champs.addAll(questionsToAdd); } } %> <td class="dataValue" style="white-space: nowrap;width:10%;"> <select id="Cr2FldID" name="Cr2FldID" onChange="doRefreshOp();"> <option></option> <% for (int i=0;i < Champs.size();i++){ //String[] field = (String []) Champs.elementAt(i); DisplayField field = (DisplayField) Champs.elementAt(i); %> <%-- <option value="<%=field[0]%>" <%= field[0].equals(paramCFldID) ? " selected" : "" %>><%=field[1]%></value> --%> <option value="<%=field.fldID%>" <%= field.fldID.equals(paramCFldID) ? " selected" : "" %>><%=field.fldDisplay%></value> <% } %> </select> <input name="Cr2Condition" type="hidden" value=""> </td> <% } %> <% if (paramCFldID != null && !"null".equals(paramCFldID)){ %> <td class="dataValue" style="white-space: nowrap;width:10%;"> <select name="Cr2Ope" onChange="doRefreshOpValue();"> <option></option> <% for(int i = 0; i < ctlOpe.length; i++) { try { String opeID = dico.getRefIdByCode("Cr2Ope", ctlOpe[i]); String opeDisp = (String)dico.getRefDisp(session, "Cr2Ope", opeID); String operation = ""; if (!"".equals(opeDisp)){ operation=opeDisp; } isMultipleValues = isMultipleValues || (opeID.equals(paramCOpe) && "in".equals(ctlOpe[i])); if(opeID.equals(paramCOpe)) { isOpeSelected = true; isValueNeeded = !"exist".equals(ctlOpe[i]); } %> <option value="<%= opeID %>"<%= opeID.equals(paramCOpe) ? " selected" : "" %>><%= operation %></option> <% } catch (Exception ex) { } } %> </select> </td> <% //on construit les inputs pour saisir les différentes valeurs. } if(paramCOpe != null && !isValueNeeded) { %> <% if(freeValue && isValueNeeded){ String cr2FldId = Criteria2.getCr2FldID(); String cr2FobId = Criteria2.getCr2FobID(); // If Actor fob field if(cr2FobId != null && !"".equals(cr2FobId)){ ObjectsBean objectsBean = new ObjectsBean(cr2FobId, session); if(objectsBean != null && "Actor".equals(objectsBean.getObjSql())){ if(Criteria2.getCr2Chx() != null){ Vector cr2ChxVector = Criteria2.getCr2Chx(); cr2ChxVector.clear(); Criteria2.getCr2Chx().add("$$ActID$$"); } else { Vector cr2ChxVector = new Vector(); cr2ChxVector.clear(); cr2ChxVector.add("$$ActID$$"); Criteria2.setCr2Chx(cr2ChxVector); } } } else if(cr2FldId != null){ FieldBean fldBean = new FieldBean(cr2FldId, session); // If a date type field if(fldBean != null && fldBean.isDate()){ if(Criteria2.getCr2Chx() != null){ Vector cr2ChxVector = Criteria2.getCr2Chx(); cr2ChxVector.clear(); Criteria2.getCr2Chx().add("$$CurrentDate$$"); } else { Vector cr2ChxVector = new Vector(); cr2ChxVector.clear(); cr2ChxVector.add("$$CurrentDate$$"); Criteria2.setCr2Chx(cr2ChxVector); } } } %> <input name="Cr2Chx" type="text" value="<% if(!isEdit) { %><fl:getProperty name="Criteria2" property="Cr2Chx" alt="" edit="true" separator=";"/><% } else { %><%=Utils.formatToWeb((String)vectChx.firstElement(), true)%><%}%>" size="40" style="width: 100%"> <%} else { %> <td class="dataValue" style="white-space:nowrap; width:50%"> <input name="Cr2Chx" type="hidden" value=""> <input name="Cr2TempName" type="hidden" value=""> </td> <%} %> <% } else if(isOpeSelected && trou) { %> <td class="dataValue" style="white-space:nowrap; width:60%"> <table class="container" cellpadding="1px"> <tr class="fieldline"> <td nowrap style="width:80%" class=""> <input name="lblCr2TempName" type="text" readonly value="<%= label == null ? "" : Utils.getMessage(session, label, Utils.getMessage(session, "L60E0", "<non spécifié>")) %>" size="50" onFocus="this.blur();" style="width: 100%"> <input name="Cr2TempName" type="hidden" value="<%= Utils.formatToWeb(label, true) %>"> </td> <td nowrap style="width:15%" class=""> <a href="javascript:doSelect('Cr2TempName')"><img src="<fl:webapp/>/icons/ico/rechercher.gif" alt="" class="icon"></a> <a href="javascript:doRemove('Cr2TempName')"><img src="<fl:webapp/>/icons/ico/supprimer.gif" alt="" class="icon"></a> <input name="Cr2Chx" type="hidden" value=""> </td> </tr> </table> </td> <% } else if (isOpeSelected && ! trou){ %> <td class="dataValue" style="white-space:nowrap; width:50%"> <input name="Cr2TempName" type="hidden" value=""> <% String htmlInput=null; if (hasCustomUi) { try { htmlInput=tfim.getHtmlForCriteriaEdit(session,flRequest,criteriaFieldName,selection2Bean,Criteria2); } catch (FrontlineException e) { logger.error("Exception in criteria edit:"+e.getMessage()); } } if (htmlInput!=null) { %> <%= htmlInput %> <% } else if(isControledByFob) { ObjectsBean ctlFob = dico.getTable("id", fld.getFldFobID()); %> <table border="0" cellpadding="1" cellspacing="0" width="100%"> <% if(freeValue){%> <tr valign="middle"> <% if(ctlFob != null && "Actor".equals(ctlFob.getObjSql())){ if(vectChx.isEmpty()){ Vector cr2ChxVec = new Vector(); cr2ChxVec.add("$$ActID$$"); Criteria2.setCr2Chx(cr2ChxVec); } } else { if(!vectChx.isEmpty() && "$$ActID$$".equals(vectChx.firstElement())){ vectChx.remove(0); } } %> <input name="Cr2Chx" type="text" value="<% if(!isEdit) { %><fl:getProperty name="Criteria2" property="Cr2Chx" alt="" edit="true" separator=";"/><% } else { %><%=Utils.formatToWeb((String)vectChx.firstElement(), true)%><%}%>" size="40" style="width: 100%"> </tr> <% } else if(isMultipleValues) { %> <tr valign="top"> <td width="100%"> <input name="Cr2Chx" type="hidden" value="<%= vectChx != null && !vectChx.isEmpty() ? Utils.formatToWeb(Utils.implodeList(vectChx, ";"), true) : "" %>"> <input name="evalCr2Chx" type="hidden" value=""> <select name="lblCr2Chx" multiple size="5" style="width: 100%" onfocus="eval(document.forms[0].evalCr2Chx.value); document.forms[0].evalCr2Chx.value = '';"> <% if(vectChx != null) { for(int i = 0; i < vectChx.size(); i++) { String strChx = (String)vectChx.elementAt(i); %> <option value="<%= Utils.formatToWeb(strChx, true) %>"><%= Utils.formatToWeb(ctlFob.toString(session, strChx), true) %></option> <% } } %> </select> </td> </tr> <% } else { %> <tr valign="middle"> <td width="90%"> <input name="Cr2Chx" type="hidden" value="<%= vectChx != null && !vectChx.isEmpty() ? Utils.formatToWeb((String)vectChx.firstElement(), true) : "" %>"> <input name="lblCr2Chx" type="text" value="<%= vectChx != null && !vectChx.isEmpty() ? Utils.formatToWeb(ctlFob.toString(session, (String)vectChx.firstElement()), true) : "" %>" style="width: 100%" readonly onfocus="this.blur();"> </td> <td nowrap width="10%"> <a href="javascript:var win = window.open('<fl:webapp/>/select.fl?type=<%= ctlFob.getObjSql() %>&field=Cr2Chx', 'Cr2Chx', 'menubar=no,status=no,toolbar=no,scrollbars=no,resizable=yes,width=800,height=400')"> <img src="<fl:webapp/>/icons/ico/rechercher.gif" class="icon" alt="<fl:getMessage code="A305F" alt="Choisir une valeur"/>"></a> <a href="javascript:doVoid(window.document.forms[0].Cr2Chx.value = window.document.forms[0].lblCr2Chx.value = '')"> <img src="<fl:webapp/>/icons/ico/supprimer.gif" class="icon" alt="<fl:getMessage code="A3005" alt="Vider le champ"/>"></a> </td> </tr> <% } %> </table> <% } else if(isControledByRef) { if(freeValue){%> <input name="Cr2Chx" type="text" value="<% if(!isEdit) { %><fl:getProperty name="Criteria2" property="Cr2Chx" alt="" edit="true" separator=";"/><% } else { %><%=Utils.formatToWeb((String)vectChx.firstElement(), true)%><%}%>" size="40" style="width: 100%"> <% } else { Vector vectRef = dico.getRefList(session, fld.getFldSql()); %> <select name="Cr2Chx"<%= isMultipleValues ? " multiple size=\"5\"" : "" %> style="width:100%"> <% if (!isMultipleValues) { %><option></option> <% } %> <% for(int i = 0; i < vectRef.size(); i++) { Vector row = (Vector)vectRef.elementAt(i); %> <option value="<%= (String)row.elementAt(0) %>"<%= vectChx.contains(row.elementAt(0)) ? " selected" : "" %>><%= Utils.formatToWeb(row.elementAt(1), false) %></option> <% } %> </select> <% } } else if(isDate) { if(freeValue){ try{ Vector cr2ChxVector = Criteria2.getCr2Chx(); cr2ChxVector.clear(); cr2ChxVector.add("$$CurrentDate$$"); } catch (FieldNotInitializedException e){ Vector cr2ChxVector = new Vector(); cr2ChxVector.clear(); cr2ChxVector.add("$$CurrentDate$$"); Criteria2.setCr2Chx(cr2ChxVector); } %> <input name="Cr2Chx" type="text" value="<% if(!isEdit) { %><fl:getProperty name="Criteria2" property="Cr2Chx" alt="" edit="true" separator=";"/><% } else { %><%=Utils.formatToWeb((String)vectChx.firstElement(), true)%><%}%>" size="40" style="width: 100%"> <% } else { String strDate = ""; String strTime = ""; String vectChxValue = null; if(!vectChx.isEmpty()){ vectChxValue = (String)vectChx.firstElement(); } java.util.Date date = null; if(vectChxValue != null && !"$$CurrentDate$$".equals(vectChxValue)){ date = Utils.formatDateFromWeb(session, vectChxValue); } strDate = Utils.formatToWebDate(session, date, true); String time = Utils.formatToWebTime(session, date, true); if(time != null && time.length()>5){ strTime = time.substring(0, 5); } %> <input name="lblDate" type="text" value="<%= strDate %>" size="10" maxlength="10" onBlur="ctrlDateField(this, '<fl:getMessage code="M200A" alt="Veuillez saisir une date correcte du type jj/mm/aaaa." js="true"/>');"> <a href="JavaScript:openCalendar(document.forms[0].lblDate)" onMouseOver="window.status='<fl:getMessage code="A2000" alt="Afficher le calendrier" js="true"/>';return true;" onMouseOut="window.status=' '; return true"><img src="<fl:webapp/>/icons/ico/clock_neutre.gif" class="icon"></a> <input name="lblTime" type="text" class="input date" value="<%= strTime %>" size="5" maxlength="5" onBlur="ctrlHourField(this, '<fl:getMessage code="M200C" alt="Veuillez saisir une heure correcte." js="true"/>');"> <input name="Cr2Chx" type="hidden" value=""> <% } } else if(isNumeric || isText) { %> <input name="Cr2Chx" type="text" value="<% if(!isEdit) { %><fl:getProperty name="Criteria2" property="Cr2Chx" alt="" edit="true" separator=";"/><% } else { %><%=Utils.formatToWeb((String)vectChx.firstElement(), true)%><%}%>" size="40" style="width: 100%"<% if(isNumeric && !isMultipleValues) { %> onBlur="ctrlNumField(this, '<%= isDecimal ? "float" : "integer" %>', '<fl:getMessage code="M001B" alt="La valeur saisie n\'est pas correcte." js="true"/>');"<% } %>> <% if(isMultipleValues) { %> <br><span class="comment"><fl:getMessage code="L202E" alt="Séparer les valeurs multiples par des points virgules"/></span> <% } } else if(isBoolean) { %> <select name="Cr2Chx"> <option value="1"><fl:getMessage code="L2005" alt="Oui"/></option> <option value="0"><fl:getMessage code="L2006" alt="Non"/></option> </select> <% } %> </td> <% } %> </tr> </table> </form> </fl:bigTabs> <br> <table class="container" width="100%"> <tr class="fieldline"> <td colspan="2" style="text-align: center;"> <% if(paramCOpe != null) { %> <a href="javascript:doSubmit();"><img src="<fl:webapp/>/icons/ico/valid_green_long.gif"></a> <% } %> <a href="javascript:doCancel()"><img src="<fl:webapp/>/icons/ico/fermer_red_long.gif"></a> </td> </tr> </table> </div> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de