Edit C:\galaxie\Back\galaxie\marketing\criteria\edit.jsp
<% /****************************************************************************** * Copyright (c) 2000-2005 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"%> <%@ page import="com.edeal.frontline.navigation.FlRequest" %> <%@ page import="com.edeal.frontline.FlContext" %> <%@ page import="com.edeal.frontline.Utils" %> <%@ page import="com.edeal.frontline.FieldNotInitializedException" %> <%@ page import="java.util.Date" %> <%@ page import="java.util.Vector" %> <%@ page import="com.edeal.frontline.ActorBean" %> <%@ page import="java.util.Calendar" %> <%@ page import="com.edeal.frontline.DataDictionary" %> <%@ page import="com.edeal.frontline.FlLocale" %> <%@ page import="com.edeal.frontline.FrontlineException" %> <%@ page import="com.edeal.frontline.FieldBean" %> <%@ page import="com.edeal.frontline.ObjectsBean" %> <%@ page import="com.edeal.frontline.controller.actions.SelectAction" %> <%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %> <jsp:useBean class="com.edeal.frontline.CriteriaBean" id="Criteria" scope="request"/> <% 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 paramRootFld = flRequest.getRequestParameterOrAttribute("RootFld"); String paramCtrID = flRequest.getRequestParameterOrAttribute("CtrID"); String paramGrpID = flRequest.getRequestParameterOrAttribute("GrpID"); String selectedTab = flRequest.getRequestParameterOrAttribute("selectedTab"); String src = flRequest.getRequestParameterOrAttribute("Src"); String id = null; try { id = Criteria.getID(); } catch (FieldNotInitializedException fnie) { } String selectedStr = ""; try { selectedStr = Criteria.getCriFldID(); } catch (FieldNotInitializedException fnie) {} String table = null; try { table = dico.getTable("id", Criteria.getCriFobID()).getObjSql(); } catch (FrontlineException fe) {} String fldID = null; try { fldID = Criteria.getCriFldID(); } catch (FieldNotInitializedException fnie) {} String criOpe = null; try { criOpe = Criteria.getCriOpe(); } catch (FieldNotInitializedException fnie) {} boolean hasField = fldID != null; 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; if(hasField) { fld = dico.getFieldByID(fldID); try { isControledByRef = (fld.getFldTabID() != null); } catch (FieldNotInitializedException ex) { } try { isControledByFob = (fld.getFldFobID() != null); } catch (FieldNotInitializedException ex) { } if (fld.isBoolean()) { ctlOpe = new String[]{"=", "<>"}; isBoolean = true; } else if (fld.isDate() || fld.isTime() || fld.isDateTime()) { ctlOpe = new String[]{"=", "<>", "<", ">", "<=", ">=", "exist"}; isDate = true; } else if (fld.isFloat() || fld.isDouble()) { ctlOpe = new String[]{"=", "<>", "<", ">", "<=", ">=", "in", "exist"}; isDecimal = true; isNumeric = true; } else if (fld.isInteger() || fld.isLong() || fld.isByte() || fld.isShort()) { ctlOpe = new String[]{"=", "<>", "<", ">", "<=", ">=", "in", "exist"}; isInteger = true; isNumeric = true; } else if (fld.isString()) { 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"}; } } Vector vectChx = new Vector(); try { vectChx = Criteria.getCriChx(); } catch (FieldNotInitializedException fnie) { } if (hasField) { for (int i = 0; i < ctlOpe.length; i++) { try { String opeID = dico.getRefIdByCode("CriOpe", ctlOpe[i]); String opeDisp = (String)dico.getRefDisp(session, "CriOpe", opeID); isMultipleValues = isMultipleValues || (opeID.equals(criOpe) && "in".equals(ctlOpe[i])); if(opeID.equals(criOpe)) { isOpeSelected = true; isValueNeeded = !"exist".equals(ctlOpe[i]); } } catch (Exception ex) { } } } String actionUrl = "save_criteria_create.fl"; FieldBean fldBean = null; String objID = null; String objName = null; ObjectsBean objBean = null; String pageName=null; if (id != null) { actionUrl = "save_criteria_edit.fl"; } else{ try{ fldBean = dico.getFieldByName(paramRootFld); }catch(FrontlineException fe){} if (fldBean!=null){ try{ objID = fldBean.getFldObjID(); }catch(FieldNotInitializedException fNe){} if (objID!=null){ try{ objBean = new ObjectsBean(objID, session); }catch(FrontlineException e){} if (objBean!=null){ try{ String radName = objBean.getObjRadical(); if (radName!=null && !"".equals(radName)){ if (radName.equals("Sel")){ pageName = "/edit_selection.fl"; } //Ajouter ici les autres radicaux pour la redirection } }catch(Exception e){} } } } } %> <html> <head> <title><fl:getMessage code="L2025" alt="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 type="text/javascript" language="javascript"> function CheckNumeric() { var f = document.forms[0]; var num = f.CriChx.value; if (isNaN(num)){ alert ("<fl:getMessage code="M001B" alt="La valeur saisie n\'est pas correcte." js="true"/>"); f.CriChx.value=""; f.CriChx.focus(); return -1; } } function doRefresh() { var f = document.forms[0]; f.action = '<fl:link url="/refresh_criteria.fl?1=1"/>'; <% if (src!=null){ %> f.action += '&Src=<%=src%>'; <%}%> doExitConf = false; f.submit(); } function closeWindow() { window.close(); } var submitFlags = false; function doSubmit() { if(!submitFlags) { submitFlags = true; var f = document.forms[0]; <% if (isOpeSelected) { if (isValueNeeded) { 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'; } f.CriChx.value = f.lblDate.value + ' ' + f.lblTime.value; } <% } else if(isNumeric) { %> if(!f.CriChx.value) { window.alert('<fl:getMessage code="" alt="Veuillez saisir une valeur." js="true"/>'); f.CriChx.focus(); submitFlags = false; return; }else if (isNaN(f.CriChx.value)){ alert ("<fl:getMessage code="M001B" alt="La valeur saisie n\'est pas correcte." js="true"/>"); f.CriChx.value=""; f.CriChx.focus(); submitFlags = false; return; } <% } else { if(isControledByRef) { %> if(f.CriChx.selectedIndex < 0) { window.alert('<fl:getMessage code="M2008" alt="Veuillez sélectionner au moins une valeur." js="true"/>'); submitFlags = false; return; } <% } else if(isControledByFob) { %> if(!f.CriChx.value) { window.alert('<fl:getMessage code="M2009" alt="Veuillez spécifier une valeur." js="true"/>'); submitFlags = false; return; } <% } else { %> if(!f.CriChx.value) { window.alert('<fl:getMessage code="M2009" alt="Veuillez spécifier une valeur." js="true"/>'); f.CriChx.focus(); submitFlags = false; return; } <% } } } %> var url = window.opener.location.href; <% if (id != null) { %> f.action = '<fl:webapp/>/save_criteria_edit.fl'; <% } else { %> f.action = '<fl:webapp/>/save_criteria_create.fl'; <% } %>//id --> celui du critere. url = '<%=flRequest.computeURL("/edit_selection.fl?id="+paramCtrID)%>'; var openerLoc = window.opener.location; var newPath = openerLoc.pathname; var slashIdx = newPath.lastIndexOf("/"); <% String parentPageUrl = "edit_selection.fl"; if (src!=null){ if ("Script".equals(src)) { parentPageUrl = "edit_scriptelementtransition.fl"; } else if ("SelectionJou".equals(src)) { parentPageUrl = "edit_selectionjournalist.fl"; } } %> newPath = newPath.substring(0, slashIdx + 1) + '<%= parentPageUrl %>'; url = openerLoc.protocol + "//" + openerLoc.host + newPath + openerLoc.search; var selectedTab = window.opener.CriteriaTabs_selectedSTab; url = replaceParam(url, 'CriteriaTabs_selectedSTab', selectedTab); url = replaceParam(url, 'id', '<%= paramCtrID %>'); f.$$returnedHtmlHead.value = '<scr' + 'ipt type="text/javascript" language="javascript">window.opener.location = "' + url + '";window.top.close();</scr' + 'ipt>'; f.submit(); <% } %> } } </script> </head> <body style="overflow: auto; height: 100%;"> <fl:form action="" bean="Criteria" multivalSeparator=";"> <input type="hidden" name="CriFobID" value="<fl:getProperty name="Criteria" property="CriFobID" alt=""/>"/> <input type="hidden" name="selectedTab" value="<%= selectedTab %>"/> <input type="hidden" name="$$returnedHtmlHead" value=""/> <input type="hidden" name="$$returnedHtmlBody" value="Closing..."/> <% if(paramGrpID != null) { %> <input name="GrpID" type="hidden" value="<%= paramGrpID %>"> <% } %> <% if(paramRootFld != null) { %> <input name="RootFld" type="hidden" value="<%= paramRootFld %>"> <% } %> <% if(paramCtrID != null) { %> <input name="CtrID" type="hidden" value="<%= paramCtrID %>"> <% } %> <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"> <table class="container" cellpadding="0"> <tr class="fieldline"> <td class="dataValue" style="white-space: nowrap; width: 10%;"> <fl:label field="CriNot"/> </td> <% if (!hasField) {%> <td class="dataValue" style="white-space: nowrap; text-align: left; width: 90%;"> <fl:label field="CriFldID"/> </td> <% } else {%> <td class="dataValue" style="white-space: nowrap; width:30%;"> <fl:label field="CriFldID"/> </td> <td class="dataValue" style="white-space: nowrap; width:30%"> <fl:label field="CriOpe"/> </td> <td class="dataValue" style="white-space: nowrap; width:30%"> <% if (isOpeSelected && isValueNeeded) { %> <fl:label field="CriChx"/> <% } %> </td> <% } %> </tr> <tr style="vertical-align: top"> <td class="dataValue" style="white-space: nowrap; width: 10%;"> <fl:input property="CriNot"/> </td> <% if (!hasField) { %> <td class="dataValue" style="white-space: nowrap; text-align: left; width: 90%;"> <select name="CriFldID" id="CriFldID" onChange="doRefresh();" class="input select" style="width: 30%;"> <option></option> <fl:getFields table="<%= table %>" type="select" selection="true" selected="<%= selectedStr %>"/> </select> </td> <% } else {%> <td class="dataValue" style="white-space: nowrap; width:30%"> <select name="CriFldID" id="CriFldID" onChange="doRefresh();" class="input select"> <option></option> <fl:getFields table="<%= table %>" type="select" selection="true" selected="<%= selectedStr %>"/> </select> </td> <td class="dataValue" style="white-space: nowrap; width:30%"> <select name="CriOpe" id="CriOpe" onChange="doRefresh();" class="input select"> <option></option> <% for (int i = 0; i < ctlOpe.length; i++) { try { String opeID = dico.getRefIdByCode("CriOpe", ctlOpe[i]); String opeDisp = (String)dico.getRefDisp(session, "CriOpe", opeID); %> <option value="<%= opeID %>"<%= opeID.equals(criOpe) ? " selected" : "" %>><%= opeDisp %></option> <% } catch (Exception ex) { } } %> </select> </td> <td class="dataValue" style="white-space: nowrap; width:30%"> <% if (isOpeSelected && isValueNeeded) { %> <% if (isControledByFob) { ObjectsBean ctlFob = dico.getTable("id", fld.getFldFobID()); if (isMultipleValues) { %> <input name="CriChx" type="hidden" value="<%= vectChx != null && !vectChx.isEmpty() ? Utils.formatToWeb(Utils.implodeList(vectChx, ";"), true) : "" %>"> <input name="evalCriChx" type="hidden" value=""> <div class="input select"><select class="input selectMultiple" name="lblCriChx" multiple="multiple" size="5" style="width: 100%" onfocus="eval(document.forms[0].evalCriChx.value); document.forms[0].evalCriChx.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></div> <a id="CriChx" href="javascript:var win = window.open('<fl:webapp/>/select_multiple.fl?type=<%= ctlFob.getObjSql() %>&field=CriChx', 'CriChx', 'menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,width=<%= SelectAction.SELECT_WINDOW_WIDTH %>,height=500')"><img src="<fl:webapp/>/icons/ico/rechercher.gif" border="0" width="17" height="17" alt="<fl:getMessage code="A305F" alt="Choisir une valeur"/>"></a> <a href="javascript:unselectMultiple('CriChx')"><img src="<fl:webapp/>/icons/ico/supprimer.gif" border="0" alt="<fl:getMessage code="A3005" alt="Vider le champ"/>"></a> <% } else { %> <input name="CriChx" type="hidden" value="<%= vectChx != null && !vectChx.isEmpty() ? Utils.formatToWeb((String)vectChx.firstElement(), true) : "" %>"> <input name="lblCriChx" class="input fob" type="text" value="<%= vectChx != null && !vectChx.isEmpty() ? Utils.formatToWeb(ctlFob.toString(session, (String)vectChx.firstElement()), true) : "" %>" style="width: 100%" readonly="readonly" onfocus="this.blur();"> <a id="CriChx" href="javascript:var win = window.open('<fl:webapp/>/select.fl?type=<%= ctlFob.getObjSql() %>&field=CriChx', 'CriChx', 'menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,width=500,height=500')"><img src="<fl:webapp/>/icons/ico/rechercher.gif" border="0" width="17" height="17" alt="<fl:getMessage code="A305F" alt="Choisir une valeur"/>"></a> <a href="javascript:doVoid(window.document.forms[0].CriChx.value = window.document.forms[0].lblCriChx.value = '')"><img src="<fl:webapp/>/icons/ico/supprimer.gif" border="0" alt="<fl:getMessage code="A3005" alt="Vider le champ"/>"></a> <% } } else if (isControledByRef) { Vector vectRef = dico.getRefList(session, fld.getFldSql()); %> <select class="input select" name="CriChx" id="CriChx"<%= isMultipleValues ? " multiple size=\"5\"" : "" %>> <% 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) { String strDate = ""; String strTime = ""; if(vectChx.size() > 0) { java.util.Date date = Utils.formatDateFromWeb(session, (String)vectChx.firstElement()); strDate = Utils.formatToWebDate(session, date, true); strTime = Utils.formatToWebTime(session, date, true).substring(0, 5); } %> <input id="CriChx" name="lblDate" class="input date" 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" width="17" height="17" border="0"></a> <input name="lblTime" class="input time" type="text" value="<%= strTime %>" size="5" maxlength="5" onBlur="ctrlHourField(this, '<fl:getMessage code="M200C" alt="Veuillez saisir une heure correcte." js="true"/>');"> <input name="CriChx" type="hidden" value=""> <% } else if (isNumeric) { %> <input name="CriChx" class="input number" style="text-align:right;" type="text" value="<fl:getProperty name="Criteria" property="CriChx" alt="" edit="true" separator=";"/>" size="40" style="width: 100%"> <% if (isMultipleValues) { %> <br><span class="comment"><fl:getMessage code="L202E" alt="Séparer les valeurs multiples par des points virgules"/></span> <% } } else if (isText) { %> <input name="CriChx" class="input text" type="text" style="text-align:left;" value="<fl:getProperty name="Criteria" property="CriChx" alt="" edit="true" separator=";"/>" size="40" style="width: 100%"> <% 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 class="input select" id="CriChx" name="CriChx"> <option value="1"><fl:getMessage code="L2005" alt="Oui"/></option> <option value="0"><fl:getMessage code="L2006" alt="Non"/></option> </select> <% } %> <% } else if (isOpeSelected) { %> <input name="CriChx" type="hidden" value=""> <% } %> </td> <% } %> </tr> <tr class="ligne_separation"><td colspan="2"> </td></tr> </table> </fl:bigTabs> <br> <div class="validation" align="center"><a href="javascript:doSubmit();"> <img src="<fl:link url="/icons/ico/valid_green_long.gif"/>"> </a> <a href="javascript:closeWindow();"> <img src="<fl:link url="/icons/ico/fermer_red_long.gif"/>"></a></div> </div> </fl:form> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de