Edit C:\galaxie\Back\galaxie\marketing\populationv2\assignment.jsp
<% /****************************************************************************** * Copyright (c) 2000-2008 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.navigation.FlRequest" %> <%@ page import="com.edeal.frontline.FieldNotInitializedException" %> <%@ page import="com.edeal.frontline.AccessDeniedException" %> <%@ page import="com.edeal.frontline.PopulationEntryBean" %> <%@ page import="com.edeal.frontline.ObjectsBean" %> <%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %> <jsp:useBean class="com.edeal.frontline.PopulationBean" id="Population" scope="request"/> <% //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(); String popID = flRequest.getRequestParameterOrAttribute("popID"); String objsql = flRequest.getRequestParameterOrAttribute("objsql"); String fieldID = flRequest.getRequestParameterOrAttribute("fieldID"); PopulationBean Popbean = new PopulationBean(popID,context); String paramObjectID = null; Vector paramObjectIDs = new Vector(); String paramObject = null; String paramobjsql = null; Vector VectObject = new Vector(); Vector VectObjectShadow = new Vector(); Vector objects = new Vector(); ObjectsBean objetBean =null; String _Label_=null; //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 //recuperer la liste des objets à faire if (Popbean.isPopIsPer()){ paramObject ="Person"; try { _Label_ = Utils.getMessage(session, paramObject, paramObject); paramObjectID= dico.getTable("sql",_Label_).getID(); paramObjectIDs.addElement(paramObjectID); ObjectsBean objBean = new ObjectsBean(paramObjectID,context); paramobjsql=objBean.getObjSql(); paramObject = objBean.getObjDisplay(); logger.warn("dans le try catch le paramObject is " + paramObject); } catch (FieldNotInitializedException e) { } VectObject.addElement((String)paramObject); VectObjectShadow.addElement(paramobjsql + "|PpePerID"); } if (Popbean.isPopIsJou()) { paramObject ="Journalist"; try { _Label_ = Utils.getMessage(session, paramObject, paramObject); paramObjectID= dico.getTable("sql",_Label_).getID(); paramObjectIDs.addElement(paramObjectID); ObjectsBean objBean = new ObjectsBean(paramObjectID,context); paramobjsql=objBean.getObjSql(); paramObject = objBean.getObjDisplay(); logger.warn("dans le try catch le paramObject is " + paramObject); } catch (FieldNotInitializedException e){ } VectObject.addElement(paramObject); VectObjectShadow.addElement(paramobjsql + "|PpeJouID"); } if (Popbean.isPopIsEnt()) { paramObject ="Enterprise"; try { _Label_ = Utils.getMessage(session, paramObject, paramObject); paramObjectID= dico.getTable("sql",_Label_).getID(); paramObjectIDs.addElement(paramObjectID); ObjectsBean objBean = new ObjectsBean(paramObjectID,context); paramobjsql=objBean.getObjSql(); paramObject = objBean.getObjDisplay(); logger.warn("dans le try catch le paramObject is " + paramObject); } catch (FieldNotInitializedException e){ } VectObject.addElement(paramObject); VectObjectShadow.addElement(paramobjsql+"|PpeEntID"); } if (Popbean.isPopIsSup()) { paramObject ="Support"; try { _Label_ = Utils.getMessage(session, paramObject, paramObject); paramObjectID= dico.getTable("sql",_Label_).getID(); paramObjectIDs.addElement(paramObjectID); ObjectsBean objBean = new ObjectsBean(paramObjectID,context); paramobjsql = objBean.getObjSql(); paramObject = objBean.getObjDisplay(); logger.warn("dans le try catch le paramObject is " + paramObject); }catch (FieldNotInitializedException e){} VectObject.addElement(paramObject); VectObjectShadow.addElement(paramobjsql+"|PpeSupID"); } if (Popbean.isPopIsSil()){ paramObject ="Silhouette"; try { _Label_ = Utils.getMessage(session, paramObject, paramObject); paramObjectID= dico.getTable("sql",_Label_).getID(); paramObjectIDs.addElement(paramObjectID); ObjectsBean objBean = new ObjectsBean(paramObjectID,context); paramobjsql = objBean.getObjSql(); paramObject = objBean.getObjDisplay(); } catch (FieldNotInitializedException e) { } VectObject.addElement((String)paramObject); VectObjectShadow.addElement(paramobjsql+"|PpeSilID"); } try { paramObjectID = Popbean.getPopObj1(); if (paramObjectID != null){ paramObjectIDs.addElement(paramObjectID); ObjectsBean objBean = new ObjectsBean(paramObjectID,context); paramobjsql=objBean.getObjSql(); paramObject = objBean.getObjDisplay(); VectObject.addElement(paramObject); VectObjectShadow.addElement(paramobjsql + "|PpeFob1"); } }catch (FieldNotInitializedException e){ } try { paramObjectID = Popbean.getPopObj2(); if (paramObjectID != null){ paramObjectIDs.addElement(paramObjectID); ObjectsBean objBean = new ObjectsBean(paramObjectID,context); paramobjsql = objBean.getObjSql(); paramObject = objBean.getObjDisplay(); VectObject.addElement(paramObject); VectObjectShadow.addElement(paramobjsql + "|PpeFob2"); } } catch (FieldNotInitializedException e){ } try { paramObjectID = Popbean.getPopObj3(); if (paramObjectID != null){ paramObjectIDs.addElement(paramObjectID); ObjectsBean objBean = new ObjectsBean(paramObjectID,context); paramobjsql = objBean.getObjSql(); paramObject = objBean.getObjDisplay(); VectObject.addElement(paramObject); VectObjectShadow.addElement(paramobjsql + "|PpeFob3"); } } catch (FieldNotInitializedException e) { } try { paramObjectID = Popbean.getPopObj4(); if (paramObjectID != null){ paramObjectIDs.addElement(paramObjectID); ObjectsBean objBean = new ObjectsBean(paramObjectID,context); paramobjsql = objBean.getObjSql(); paramObject = objBean.getObjDisplay(); VectObject.addElement(paramObject); VectObjectShadow.addElement(paramobjsql + "|PpeFob4"); } } catch (FieldNotInitializedException e) { } try { paramObjectID = Popbean.getPopObj5(); if (paramObjectID != null){ paramObjectIDs.addElement(paramObjectID); ObjectsBean objBean = new ObjectsBean(paramObjectID,context); paramobjsql = objBean.getObjSql(); paramObject = objBean.getObjDisplay(); VectObject.addElement(paramObject); VectObjectShadow.addElement(paramobjsql + "|PpeFob5"); } } catch (FieldNotInitializedException e) { } //Récupèration du type du field choisi FieldBean fld = null; String fldType = null; 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; if (fieldID != null){ fld = dico.getFieldByID(fieldID); 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) {}; if("BIT".equals(fldType)) { isBoolean = true; } else if("DATE".equals(fldType) || "TIME".equals(fldType) || "TIMESTAMP".equals(fldType)) { isDate = true; } else if("FLOAT|DOUBLE".equals(fldType) || "REAL".equals(fldType)) { isDecimal = true; isNumeric = true; } else if("INTEGER".equals(fldType) || "BIGINT".equals(fldType) || "SMALLINT".equals(fldType) || "DECIMAL|NUMERIC".equals(fldType) || "TINYINT".equals(fldType)) { isInteger = true; isNumeric = true; } else if("CHAR|VARCHAR|LONGVARCHAR|CLOB".equals(fldType)) { isText = true; } if(fld.isFldMultival()) { isMultipleValues = true; } } String sfwID = flRequest.getParameter("SfwID"); //savoir si c'est un champs fob/mulivalué ou pas String fldSql = null; if (isControledByFob || isMultipleValues) { if (fieldID != null) { FieldBean fldBean = dico.getFieldByID(fieldID); try { fldSql = fldBean.getFldSql(); } catch (FieldNotInitializedException e){ logger.error("Error Field can not be intialized"); } } } %> <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> <style type="text/css"> .dataValueX { width: 30%; overflow: hidden; margin: 0px; padding-left: 10px; font-size: small; font-size: expression("small"); color: rgb(0, 0, 0); font-family: Arial, Verdana, sans-serif; vertical-align: auto; padding: 1px; } </style> <script language="javascript"> var submitFlags = false; function doCancel() { window.close(); } function doRefresh1(){ var f = document.forms[0]; obj = f.Object.options[f.Object.selectedIndex].value; f.action = '<fl:link url="<%=\"/refresh_assignment.fl?popID=\"+popID%>"/>&objsql='+obj; doExitConf = false; f.submit(); } function doRefresh2(){ var f = document.forms[0]; obj = f.Object.options[f.Object.selectedIndex].value; fld = f.Field.options[f.Field.selectedIndex].value; f.action = '<fl:link url="<%=\"/refresh_assignment.fl?popID=\"+popID%>"/>&objsql='+obj+'&fieldID='+fld; doExitConf = false; f.submit(); } function doSubmit() { if(!submitFlags) { submitFlags = true; var finalValue = ''; var f = document.forms[0]; obj = f.Object.options[f.Object.selectedIndex].value; fld = f.Field.options[f.Field.selectedIndex].value; <% if(isDate) { %> 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'; } finalValue = f.lblDate.value + ' ' + f.lblTime.value; } <% } else if(isNumeric) { %> if(!f.ValChx.value) { window.alert('<fl:getMessage code="M2007" alt="Veuillez saisir une valeur." js="true"/>'); f.ValChx.focus(); submitFlags = false; return; } prepNumsForSubmit(separateurDecimal, separateurMilliers, f.ValChx); finalValue = f.ValChx.value; <% } else { //3 if(isControledByRef) { %> <% if (isMultipleValues) { %> for (var i = 0; i < f.ValChx.options.length; i++) { if (f.ValChx.options[i].selected) { if (finalValue != '') { finalValue += ';'; } finalValue += f.ValChx.options[i].value; } } if (finalValue == '') { window.alert('<fl:getMessage code="M2008" alt="Veuillez sélectionner au moins une valeur." js="true"/>'); f.ValChx.focus(); submitFlags = false; return; } <% } else { %> if(f.ValChx.selectedIndex < 0) { window.alert('<fl:getMessage code="M2008" alt="Veuillez sélectionner au moins une valeur." js="true"/>'); f.ValChx.focus(); submitFlags = false; return; } finalValue = f.ValChx.value; <% } %> <% } else if(isControledByFob) { %> <% if (isMultipleValues) { %> if (f.ValChx.value == '') { window.alert('<fl:getMessage code="M2008" alt="Veuillez sélectionner au moins une valeur." js="true"/>'); f.ValChx.focus(); submitFlags = false; return; } finalValue = f.ValChx.value; <% } else { %> if(!f.ValChx.value) { window.alert('<fl:getMessage code="M2009" alt="Veuillez spécifier une valeur." js="true"/>'); f.ValChx.focus(); submitFlags = false; return; } finalValue = f.ValChx.value; <% } %> <% } else { %> if(!f.ValChx.value) { window.alert('<fl:getMessage code="M2009" alt="Veuillez spécifier une valeur." js="true"/>'); f.ValChx.focus(); submitFlags = false; return; } finalValue = f.ValChx.value; <% } %> <% } // 3 %> window.open('<fl:link url="<%= \"/process_assignment.fl?id=\" + popID + \"&fieldID=\" + fieldID %>"/>&objsql=' + obj + '&value=' + finalValue, 'Affectation<%= popID %>', 'width=400,height=200,menubar=no,status=no,resizable=yes,toolbar=no,location=no'); window.close(); } } function doVoid(p) { return; } </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, \"L65BE\", false, true, \"Affectation\") %>" ignoreList="true"> <form action="" method="post"> <input name="$$returnedHtmlHead" type="hidden" value=""> <input name="$$returnedHtmlBody" type="hidden" value="Closing..."> <input name="$$presentFields" type="hidden" value=""> <input name="$$multivalSeparator" type="hidden" value=";"> <input type="hidden" name="lngID" value="<%= Utils.formatToWeb(lngID, true) %>"> <table class="container" cellpadding="0"> <tr class="fieldline"> <TD class="dataValue" style="white-space: nowrap;width:10%"> <fl:getMessage code="" alt="Objet"/> </TD> <TD class="dataValue" style="white-space: nowrap;width:10%"> <fl:getMessage code="L202C" alt="Champs associé :"/> </TD> <TD class="dataValue" style="white-space: nowrap;width:10%"> </TD> <TD class="dataValue" 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) { %><br> <a href="javascript:var win = window.open('<fl:webapp/>/select_multiple.fl?type=<%= ctlFob.getObjSql() %>&field=ValChx', 'ValChx', '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('ValChx')"> <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"> <TD class="dataValue" style="white-space: nowrap;width:10%;"> <select name="Object" onChange="doRefresh1();"> <option></option> <% for (int i=0;i< VectObject.size();i++) { String object = (String) VectObject.elementAt(i); String objShadow =(String) VectObjectShadow.elementAt(i); %> <option value="<%=objShadow%>" <%= objShadow.equals(objsql) ? " selected" : "" %>><%= object%></value> <% } %> </select> </TD> <% if (objsql != null){ Vector vectobjfldsql = Utils.explodeList(objsql,"|"); String Name = (String)vectobjfldsql.get(0); try{ objetBean = dico.getTable("sql",Name); } catch (FrontlineException ex) {} if (objetBean != null){ Vector vectFields = dico.getTableFields("sql", Name, true, false); 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); } } %> <TD class="dataValue" style="white-space: nowrap;width:10%;"> <select name="Field" onChange="doRefresh2();"> <option></option> <% for (int i=0;i < Champs.size();i++){ String[] field = (String []) Champs.elementAt(i); %> <option value="<%=field[0]%>" <%= field[0].equals(fieldID) ? " selected" : "" %>><%=field[1]%></value> <% } %> </select> </TD> <% } } %> <% if(fieldID != null){ %> <TD class="dataValue" style="white-space: nowrap;padding-left:30px;width:10%;"> <fl:getMessage code="L65C1" alt="égal à"/> </TD> <td class="dataValue" style="white-space:nowrap; width:40%"> <% if(isControledByFob) { ObjectsBean ctlFob = dico.getTable("id", fld.getFldFobID()); %> <table border="0" cellpadding="1" cellspacing="0" width="100%"> <% if(isMultipleValues) { %> <tr valign="top"> <td width="100%"> <input name="ValChx" type="hidden" value=""> <input name="evalValChx" type="hidden" value=""> <select name="lblValChx" multiple size="5" style="width: 100%" onfocus="eval(document.forms[0].evalValChx.value); document.forms[0].evalValChx.value = '';"> <% %> </select> </td> </tr> <% } else { %> <tr valign="middle"> <td width="90%"> <input name="ValChx" type="hidden" value=""> <input name="lblValChx" type="text" value="" 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=ValChx', 'ValChx', '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].ValChx.value = window.document.forms[0].lblValChx.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) { Vector vectRef = dico.getRefList(session, fld.getFldSql()); %> <select name="ValChx"<%= 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) %>"><%= Utils.formatToWeb(row.elementAt(1), false) %></option> <% } %> </select> <% } else if(isDate) { String strDate = ""; String strTime = ""; %> <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="ValChx" type="hidden" value=""> <% } else if(isNumeric || isText) { %> <input name="ValChx" type="text" value="" size="40" style="width: 100%"<% if(isNumeric) { %> 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="ValChx"> <option value="1"><fl:getMessage code="L2005" alt="Oui"/></option> <option value="0"><fl:getMessage code="L2006" alt="Non"/></option> </select> <% } } %> </td> </tr> </table> </fl:bigTabs> <br> <table class="container" width="100%"> <tr class="fieldline"> <td colspan="2" style="text-align: center;"> <%if (fieldID != null){ %> <a href="javascript:doSubmit();"><img src="<fl:webapp/>/icons/ico/valid_green_long.gif" border="0" alt="<fl:getMessage code="A2001" alt="Valider"/>" title="<fl:getMessage code="A2001" alt="Valider"/>"></a> <%} %> <a href="javascript:doCancel()"><img src="<fl:webapp/>/icons/ico/fermer_red_long.gif" border="0" alt="<fl:getMessage code="L61B1" alt="Fermer la fenêtre"/>" title="<fl:getMessage code="L61B1" alt="Fermer la fenêtre"/>"></a> </td> </tr> </table> </div> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de