Edit C:\galaxie\Back\galaxie\marketing\eventcriteria\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.*"%> <%@ page import="com.edeal.frontline.navigation.FlRequest" %> <%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %> <% 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 pID = flRequest.getParameter("id"); String pGrpID = flRequest.getParameter("GrpID"); String pRootFld = flRequest.getParameter("RootFld"); String pCtrID = flRequest.getParameter("CtrID"); FieldBean fldBean = dico.getFieldByName(pRootFld); String ctlSql = ((ObjectsBean)dico.getTable("id", fldBean.getFldObjID())).getObjSql(); String pPvtEventID = flRequest.getParameter("PvtEventID"); int pPvtStatus = -1; try { pPvtStatus = Integer.parseInt(flRequest.getParameter("PvtStatus")); } catch (Exception ex) { } String pPvtFrpID = flRequest.getParameter("PvtFrpID"); String[] pFrpBasicResponse = new String[3]; for (int i = 0; i < 3; i++) { pFrpBasicResponse[i] = flRequest.getParameter("FrpBasicResponse" + i); } if (!"1".equals(flRequest.getParameter("refresh")) && pID != null) { try { Vector children = (new CriteriaBean(pID, session)).getChildren(); CriteriaBean[] hCriBean = new CriteriaBean[6]; for (int i = 0; i < children.size(); i++) { try { CriteriaBean criBean = new CriteriaBean((String)children.elementAt(i), session); String fldSql = dico.getFieldByID(criBean.getCriFldID()).getFldSql(); if ("PvtEventID".equalsIgnoreCase(fldSql)) { pPvtEventID = (String)criBean.getCriChx().firstElement(); } else if ("PvtStatus".equalsIgnoreCase(fldSql)) { pPvtStatus = Integer.parseInt((String)criBean.getCriChx().firstElement()); } else if ("PvtFrpID".equalsIgnoreCase(fldSql)) { pPvtFrpID = "<>".equalsIgnoreCase(dico.getRefCode("CriOpe", criBean.getCriOpe())) ? "true" : "false"; } else if ("FrpBasicResponse0".equalsIgnoreCase(fldSql)) { pFrpBasicResponse[0] = (String)criBean.getCriChx().firstElement(); } else if ("FrpBasicResponse1".equalsIgnoreCase(fldSql)) { pFrpBasicResponse[1] = (String)criBean.getCriChx().firstElement(); } else if ("FrpBasicResponse2".equalsIgnoreCase(fldSql)) { pFrpBasicResponse[2] = (String)criBean.getCriChx().firstElement(); } } catch (Exception ex) { } } } catch (Exception ex) { } } String[][] strValues = new String[][]{ {"", Utils.getMessage(session, "L618A", "indifférent")}, {"true", Utils.getMessage(session, "L2005", "Oui")}, {"false", Utils.getMessage(session, "L2006", "Non")}}; String[] fields = new String[]{"EvtID", "EvtLabel"}; String[] orderBy = new String[]{"EvtLabel"}; Vector vectEvt = EventBean.listSummary(session, fields, orderBy); EventBean evtBean = null; if(vectEvt != null && !vectEvt.isEmpty()) { Hashtable row = (Hashtable)vectEvt.firstElement(); String fstEvtID = (String)row.get("EvtID"); if(pPvtEventID == null || "".equalsIgnoreCase(pPvtEventID)) { pPvtEventID = fstEvtID; } try { evtBean = new EventBean(pPvtEventID, session); } catch (Exception ex) { pPvtEventID = fstEvtID; evtBean = new EventBean(pPvtEventID, session); } } FormBean frmBean = null; if(evtBean != null) { String[][] frmQuery = new String[][]{{"FrmEventID = " + Utils.formatToSQL(context, pPvtEventID)}}; Vector vectFrm = FormBean.list(session, frmQuery); if(vectFrm != null && !vectFrm.isEmpty()) { frmBean = (FormBean)vectFrm.firstElement(); } } String objID = null; String objName = null; ObjectsBean objBean = null; String pageName=null; if (pID==null&& 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 language="javascript"> var submitFlags = false; function doRefresh() { var f = document.forms[0]; f.action = '<fl:link url="/edit_eventcriteria.fl?refresh=1" list="true"/>'; f.submit(); } function doSubmit() { if (!submitFlags) { submitFlags = true; var f = document.forms[0]; f.action = '<fl:link url="/save_eventcriteria.fl"/>'; var url = window.opener.location.href; <% if (pID==null){ %> url = '<%=flRequest.computeURL(pageName+"?id="+pCtrID)%>'; <% } %> url = '<%=flRequest.computeURL("/edit_selection.fl?id="+pCtrID)%>'; var openerLoc = window.opener.location; var newPath = openerLoc.pathname; var slashIdx = newPath.lastIndexOf("/"); <% String parentPageUrl = "edit_selection.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', '<%= pCtrID %>'); f.$$returnedHtmlHead.value = '<scr' + 'ipt type="text/javascript" language="javascript">window.opener.location = "' + url + '";window.top.close();</scr' + 'ipt>'; f.submit(); } } function doChangeCoupon() { var f = document.forms[0]; if (f.PvtFrpID.selectedIndex == 0 || f.PvtFrpID.selectedIndex == 2) { for (i = 0; i < 3; i++) { if (f.elements['FrpBasicResponse' + i]) { f.elements['FrpBasicResponse' + i].selectedIndex = 0; } } } } function doChangeQR(fld) { if (fld.selectedIndex > 0) { fld.form.PvtFrpID.selectedIndex = 1; } } function doCancel() { window.close(); } </script> </head> <body> <form method="post" action="javascript:doSubmit();"> <input name="op" type="hidden" value="save"> <input name="typ" type="hidden" value="Criteria"> <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=";"> <% if(pID != null) { %> <input name="id" type="hidden" value="<%= pID %>"> <% } %> <% if(pGrpID != null) { %> <input name="GrpID" type="hidden" value="<%= pGrpID %>"> <input name="GrpID" type="hidden" value="<%= pGrpID %>"> <% } %> <% if(pRootFld != null) { %> <input name="RootFld" type="hidden" value="<%= pRootFld %>"> <% } %> <% if(pCtrID != null) { %> <input name="CtrID" type="hidden" value="<%= pCtrID %>"> <% } %> <div id="object_css" style="top:0px;left: 0px;height:95%;"> <fl:bigTabs objectTitle="<%= Utils.getMessage(session, \"L6396\", false, true, \"Critère\") %>" ignoreList="true"> <table class="container" cellpadding="0"> <tr class="fieldline"> <td class="dataLabel"><fl:getMessage code="L305F" alt="Evénement"/></td> <td class="dataValue"> <select name="PvtEventID" onchange="doRefresh();"> <% for(int i = 0; i < vectEvt.size(); i++) { Hashtable row = (Hashtable)vectEvt.elementAt(i); String strID = (String)row.get("EvtID"); %> <option value="<%= Utils.formatToWeb(strID, true) %>"<%= strID.equalsIgnoreCase(pPvtEventID) ? " selected" : "" %>><%= Utils.formatToWeb((String)row.get("EvtLabel"), false) %></option> <% } %> </select> </td> </tr> <tr class="fieldline"> <td class="dataLabel"><fl:getMessage code="L618B" alt="Statut"/></td> <td class="dataValue"> <select name="PvtStatus"> <option value=""><%= Utils.getMessage(session, "L618A", "indifférent") %></option> <% for(int i = 0; i < 10; i++) { try { String strValue = (String)evtBean.getClass().getMethod("getEvtStatus" + i, null).invoke(evtBean, null); %> <option value="<%= Integer.toString(i) %>"<%= i == pPvtStatus ? " selected" : "" %>><%= Utils.formatToWeb(strValue, false) %></option> <% } catch (Exception ex) { } } %> </select> </td> </tr> <tr class="fieldline"> <td class="dataLabel"><fl:getMessage code="L618C" alt="Coupon réponse"/></td> <td class="dataValue"> <select name="PvtFrpID" onchange="doChangeCoupon();"> <% for(int i = 0; i < strValues.length; i++) { %> <option value="<%= Utils.formatToWeb(strValues[i][0], true) %>"<%= strValues[i][0].equalsIgnoreCase(pPvtFrpID) ? " selected" : "" %>><%= strValues[i][1] %></option> <% } %> </select> </td> </tr> <% for(int i = 0; i < 3; i++) { try { String strValue = (String)frmBean.getClass().getMethod("getFrmBasicQuestion" + i, null).invoke(frmBean, null); %> <tr class="fieldline"> <td class="dataLabel"><%= Utils.formatToWeb(strValue, false) %></td> <td class="dataValue"> <select name="FrpBasicResponse<%= i %>" onchange="doChangeQR(this);"> <% for(int j = 0; j < strValues.length; j++) { %> <option value="<%= Utils.formatToWeb(strValues[j][0], true) %>"<%= strValues[j][0].equalsIgnoreCase(pFrpBasicResponse[i]) ? " selected" : "" %>><%= strValues[j][1] %></option> <% } %> </select> </td> </tr> <% } catch (Exception ex) { } } %> </table> <div class="validation"><a href="javascript:doSubmit();"><input type="image" src="<fl:link url="/icons/ico/cochevalid.gif"/>" class="valid_button"></a> <a href="javascript:doCancel();"><img src="<fl:link url="/icons/ico/close.gif"/>" class="cancel_button"></a></div> </fl:bigTabs> </div> </form> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de