Edit C:\Users\Administrator\Desktop\Back\galaxie - Copy\marketing\scriptelementresponsecriteria\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.*,java.util.*, com.edeal.frontline.navigation.*"%> <%@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()); 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); //this is true if this is an edition (not a creation) and it's the first pass boolean isFirstLoad = Utils.getRequestParameter(context, request, "Fst") != null; //the criteria the transition points to is actually the parent criteria //the response criteria itself is a child of that parent (the other child says what the LinkScriptElementid id is) CriteriaBean parentCri = (CriteriaBean)request.getAttribute("Criteria"); String parentID = null; try { parentID = parentCri.getID(); } catch (FieldNotInitializedException e) {} //child criteria CriteriaBean cri = (CriteriaBean)flRequest.getAttribute("cri");; String childID = (String)flRequest.getAttribute("childID"); try { // childID = cri.getID(); } catch (Exception e) {} //the root field is the field in which this criteria id is stored (e.g. SetCriSerID) String paramRootFld = Utils.getRequestParameter(context, request, "RootFld"); //the ctr id is the id of the object in which this criteria id is stored (e.g. SetID) String paramCtrID = Utils.getRequestParameter(context, request, "CtrID"); //this is the criteria id to which this criteria belongs (not supported in current use, but left in there) String paramGrpID = Utils.getRequestParameter(context, request, "GrpID"); //this is the script element for which this criteria is created String paramSceID = Utils.getRequestParameter(context, request, "SceID"); //this is the link script element for which this criteria is created String paramLseID = Utils.getRequestParameter(context, request, "LseID"); FieldBean fldBean = dico.getFieldByName(paramRootFld); //This is the SQL name of the object in which the criteria is stored (e.g. ScriptElementTransition) String ctrSql = ((ObjectsBean)dico.getTable("id", fldBean.getFldObjID())).getObjSql(); //if "not" was selected before last refresh String paramCNot = Utils.getRequestParameter(context, request, "CriNot"); if("".equals(paramCNot)) paramCNot = null; //get the operation that was selected before last refresh String paramCOpe = Utils.getRequestParameter(context, request, "CriOpe"); if("".equals(paramCOpe)) paramCOpe = null; //vector of choices for the criteria Vector vectChx = new Vector(); //initialize stuff for first load if(isFirstLoad) { try { paramCNot = cri.isCriNot() ? "1" : null; } catch (FieldNotInitializedException ex) { paramCNot = null; } try { paramCOpe = cri.getCriOpe(); } catch (FieldNotInitializedException ex) { paramCOpe = null; } try { vectChx = cri.getCriChx(); } catch (FieldNotInitializedException ex) { vectChx = new Vector(); } } // prepare data //this is the field this criteria uses FieldBean fld = (FieldBean)request.getAttribute("fld"); //true if an operation is selected in the dropdown list boolean isOpeSelected = ((Boolean) request.getAttribute("isOpeSelected")).booleanValue(); //true if the operation needs a value ("exists" doesn't need one for instance) boolean isValueNeeded = ((Boolean) request.getAttribute("isValueNeeded")).booleanValue(); //true if the operation can work with several choices ("in" for instance) boolean isMultipleValues = ((Boolean) request.getAttribute("isMultipleValues")).booleanValue(); //true if the field is controlled by a list of values ("SerPosition") boolean isControledByLst = ((Boolean) request.getAttribute("isControledByLst")).booleanValue(); //true if the field is free text ("SerText") boolean isText = ((Boolean) request.getAttribute("isText")).booleanValue(); //String sceLabel = (String)sceHashtable.get("SceLabel"); String sceLabel = flRequest.getRequestParameterOrAttribute("SceLabel"); Vector sceList = (Vector)request.getAttribute("sceList"); //array of possible operations for the field String[] ctlOpe = (String[]) request.getAttribute("ctlOpe"); Hashtable sceHashtable = (Hashtable)request.getAttribute("sceHashtable"); //END get all necessary info about the ScriptElement //This is the object the criteria targets ObjectsBean fob = dico.getTable("sql", "ScriptElementResponse"); String id = null; try{ id = parentCri.getID(); }catch(Exception e){ id=""; } String reload=flRequest.getRequestParameterOrAttribute("reload"); String criChx = flRequest.getRequestParameterOrAttribute("CriChx"); %> <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" href="<fl:webapp/>/css/master_css.jsp" type="text/css"> <script language="javascript" src="<fl:webapp/>/js/checkFields.jsp"></script> <script language="javascript" src="<fl:webapp/>/js/utils.js"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/ajax/sarissa.js"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/ajax/ajax.js"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/master_js.jsp"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/ac/fobAC_js.jsp"></script> <script language="javascript"> var submitFlags = false; //this gets called when the operation type is changed : reload list of choices function doChange(fldName) { if(!submitFlags) { submitFlags = true; var f = document.forms[0]; //f.action = '<fl:webapp/>/load?op=edit<fl:getProperty name="Criteria" property="CriID" alt="" preText="&id="/>'; f.action = '<fl:webapp/>/create_response_criteria.fl?reload=1'+'<%=(id!="" ? "&id="+id:"") %>'; f.submit(); } } //this gets called when user wants to save the criteria function doSubmit() { if(!submitFlags) { submitFlags = true; var f = document.forms[0]; //make sure we have all the necessary info <% if(paramCOpe != null && !"exist".equals(dico.getRefCode("CriOpe", paramCOpe))) { if(isControledByLst) { %> if(f.CriChx.selectedIndex < 0) { window.alert('<fl:getMessage code="M2008" alt="Veuillez sélectionner au moins une valeur." js="true"/>'); <% } 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; } <% } %> f.action = '<fl:webapp/>/save_response_criteria.fl'+'<%=(id!="" ? "?id="+id:"")%>'; f.$$returnedHtmlHead.value='<scr'+'ipt language=\"javascript\">window.top.opener.doReload();window.top.close();</scr'+'ipt>'; f.$$returnedHtmlBody.value='...'; f.submit(); } } function doCancel() { window.close(); } function doOnLoad(){ } </script> </head> <div class="main_body" style="border:none; height: 100%"> <body onload="doOnLoad()"> <fl:bigTabs objectTitle="<%=Utils.getMessage(session, \"L6222\", false, true, \"Réponse à\")+ \" \" + sceLabel%>"> <table border="0" width="100%"> <form method="post" action="javascript:doSubmit();"> <input name="op" type="hidden" value="save"> <input name="typ" type="hidden" value="Criteria"> <input name="$$presentFields" type="hidden" value="CriNot;CriFldID;CriOpe;CriChx"> <input name="$$multivalSeparator" type="hidden" value=";"> <input name="CriFldID" type="hidden" value="<%= fld.getFldID() %>"> <input name="CriFobID" type="hidden" value="<%= fob.getObjID() %>"> <input name="SceID" type="hidden" value="<%= paramSceID %>"> <input name="LseID" type="hidden" value="<%= paramLseID %>"> <input type="hidden" name="SceLabel" value="<%=sceLabel%>"> <input type="hidden" name="$$returnedHtmlHead" value=""> <input type="hidden" name="$$returnedHtmlBody" value="..."> <% if(parentID != null) { %><input name="parentID" type="hidden" value="<%= parentID %>"><% } %> <% 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 %>"> <% } %> <tr valign="top"> <td class="transparent" style="text-align : center" nowrap width="10%"> <input name="CriNot" type="checkbox" value="true"<%= paramCNot == null ? "" : " checked" %>><br> <span class="dataLabel">(<fl:getMessage code="L202F" alt="Négation"/>)</span> </td> <%-- drop down of all operations --%> <td class="transparent" nowrap width="10%"> <select name="CriOpe" onChange="doChange(this.name);"> <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); //logger.debug("isMultipleValues " + isMultipleValues + " / opeID " + opeID + " / paramCOpe " + paramCOpe + " / ctlOpe[i] " + ctlOpe[i]); 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" : "" %>><%= opeDisp %></option> <% } catch (Exception ex) { } } %> </select> </td> <% if(isOpeSelected && !isValueNeeded) { %> <td class="transparent" nowrap width="70%"><input name="CriChx" type="hidden" value=""></td> <% } else if(isOpeSelected) { %> <%-- choices area : drop down / select area if controled by list, text area if free text --%> <td class="transparent" nowrap width="70%"> <% if(isControledByLst) { %> <select name="CriChx"<%= isMultipleValues ? " multiple size=\"5\"" : "" %>> <% for(int i = 0; i < 15; i++) { String answer = (String)sceHashtable.get("SceLstAnswer" + i); if (answer != null) { %> <option value="<%= i %>"<%= vectChx.contains(new Integer(i).toString()) ? " selected" : "" %>><%= Utils.formatToWeb(answer, false) %></option> <% } } %> </select> <% } else if(isText) { String strResponse=""; if (!"1".equals(reload)){ Vector vectDisplay = new Vector(); try{ vectDisplay = (Vector) cri.getCriChx(); }catch(Exception e){vectDisplay = new Vector();}; for(int k=0; k<vectDisplay.size(); k++){ if (k>0) strResponse +=";"; strResponse += (String) vectDisplay.get(k); } }else strResponse = (criChx!=null ? criChx : ""); %> <input name="CriChx" type="text" value="<%=strResponse%>" style="width: 80%"> <% if(isMultipleValues) { %> <br><span class="dataLabel"><fl:getMessage code="L202E" alt="Séparer les valeurs multiples par des points virgules"/></span> <% } } %> </td> <% } %> </tr> </form> </table> </fl:bigTabs> <div style="text-align: center"> <table> <tr class="ligne_separation"> <td></td> </tr> <tr> <td width="50%"> </td> <% if(paramCOpe != null) { %> <td><a href="javascript:doSubmit()"><img src="<fl:webapp/>/icons/ico/valid_green_long.gif" alt="<fl:getMessage code="A2001" alt="Valider"/>" border="0"></a></td> <td> </td> <% } %> <td><a href="javascript:doCancel()"><img src="<fl:webapp/>/icons/ico/fermer_red_long.gif" alt="<fl:getMessage code="A2002" alt="Annuler"/>" border="0"></a></td> <td width="50%"> </td> </tr> </table> </div> </body> </div> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de