Edit C:\Windows\install\galaxie_p01_01-10\marketing\document\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="com.edeal.frontline.FrontlineException" %> <%@ page import="com.edeal.frontline.DataDictionary" %> <%@ page import="java.util.*" %> <%@ page import="java.text.*" %> <%@ page import="com.edeal.frontline.*" %> <%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %> <link href="<fl:webapp/>/css/smalltabs_css.jsp" rel="stylesheet" type="text/css"> <jsp:useBean class="com.edeal.frontline.DocumentBean" id="Document" 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 id = null; try { id = Document.getID(); } catch (FieldNotInitializedException fnie) { } String[] fields= {"ObjID","ObjDisplay"}; String[] orderBy = {"ObjDisplay"}; String radicals = context.getContextParameter("Marketing.RefDocument.Objects"); String currentDocType = null; Vector rads = Utils.explodeList(radicals,";"); String[] tmpArray = new String[rads.size()]; for (int i=0; i < rads.size(); i++) { tmpArray[i] = "ObjRadical="+Utils.formatToSQL(context, (String)rads.elementAt(i)); } Vector list = new Vector(); if (rads.size() > 0) { String[][] query = {tmpArray}; list =ObjectsBean.listSummary(context,fields,query,orderBy,true); } else { list =ObjectsBean.listSummary(context,fields,orderBy); } String currentObj = ""; try { currentObj = Document.getDocObjID(); } catch(FrontlineException fex) { } //Gestion des nouvelles Version de documents String from = Utils.getRequestParameter(context, request, "from"); String version = ""; String versionForNewDoc= ""; if (from != null) { try { /*Si c'est un from calculer la nouvelle version */ String temp = (String) Document.getDocVersion(); if ( temp.indexOf("OLD") == -1 ) { version = "OLD-"+temp; } if(!temp.startsWith("NEW-")){ versionForNewDoc = "NEW-"+temp; }else{ versionForNewDoc = temp; } /* Si c'est un from mettre 1 à l'archive de l'ancien */ String docID = Document.getID(); DocumentBean oldDoc = new DocumentBean(docID,session); oldDoc.setDocIsArchive(true); try { currentDocType = (String) oldDoc.getCustomProperty("DocOppType_"); } catch(FrontlineException fex) { } oldDoc.save(); } catch(FrontlineException ex) { } Document.setDocID(""); Document.setDocAttFileName(null); Document.setDocAttID(null); } DecimalFormat df = FlLocale.getInstance(session).getDecimalFormat("000000"); int ref = CounterFactory.getCounter(context, "DocCode"); SimpleDateFormat sdf = FlLocale.getInstance(session).getSimpleDateFormat("yyyyMM"); // Id de l'objet Opportunity String oppObjID = null; try { String[] fieldsOpp = {"ObjID"}; String[][] queryOpp = {{"ObjSql = 'Opportunity'"}}; Vector listOpp = ObjectsBean.listSummary(context, fieldsOpp, queryOpp); // on prend le premier si la liste n'est pas vide if(listOpp != null && !listOpp.isEmpty()) { Hashtable tab = (Hashtable)listOpp.firstElement(); oppObjID = (String)tab.get("ObjID"); } } catch (Exception e) { oppObjID =""; } // Id de l'objet Catalogue String catObjID = null; try { String[] fieldscat = {"ObjID"}; String[][] queryCat = {{"ObjSql = 'Catalogue_'"}}; Vector listCat = ObjectsBean.listSummary(context, fieldscat, queryCat); // on prend le premier si la liste n'est pas vide if(listCat != null && !listCat.isEmpty()) { Hashtable tab = (Hashtable)listCat.firstElement(); catObjID = (String)tab.get("ObjID"); } } catch (Exception e) { catObjID =""; } %> <script type="text/javascript" language="javascript"> function doDocObjectChange() { doRefreshDocument(); } function doOnLoad() { //doDocObjectChange(); } function doRefreshDocument() { var f = document.forms[0]; f.action = "<fl:webapp/>/refresh_document.fl"; f.submit(); } function CheckAll(admin) { var mf = document.forms[0]; for (var i = 0 ; i < mf.DocRolesID.length; i++) { if (mf.allchecked.checked == true) { mf.DocRolesID[i].checked = true; } else if ( mf.DocRolesID[i].value != admin) { mf.DocRolesID[i].checked =false; } } } function doSubmit() { var f = document.forms[0]; if(f.DocAttID.value == ''){ alert('<fl:getMessage code="L63DD" alt="Veuillez renseigner le champ fichier"/>'); return; } if ((f.DocVersion.value).indexOf("OLD") != -1) { window.alert('<fl:getMessage code="M6023" alt="Veuillez changer le numéro de version" js="true"/>'); f.DocVersion.focus(); return false; } presentFieldsValue(); return true; } </script> <fl:form action="/save_document.fl" bean="Document"> <fl:bigTabs objectTitle="<%=Utils.getMessage(session, \"L63DE\", false, true, \"Document\")%>" ou="<%= \"/edit_document.fl\" + (id != null ? \"?id=\" + id : \"\")%>"> <table class="container"> <tr> <td colspan="3"> <table class="container" cellpadding="0"> <tr class="fieldline"> <td><fl:label field="DocTitle" labelClassName="labelTitreFiche" code="F2016"/></td> <td class="fieldTitreFiche"><fl:input property="DocTitle" mandatoryMsgCode="M201C"/></td> </tr> </table> </td> </tr> <tr class="ligne_separation"><td></td></tr> <tr> <td class="column2"> <table class="data_column" cellpadding="0"> <fl:autodisplay name="Document" zone="DocCol1" edit="true" tableDivTag="false" /> <tr class="fieldline"> <td class="dataLabel"> <fl:label field="DocObjID" code="L6594" /> </td> <td class="dataValue"> <div class="input select"> <select id="DocObjID" name="DocObjID" class="input select" onchange="doDocObjectChange();"> <option></option> <% for ( int i = 0; i < list.size(); i++) { Hashtable currObj = (Hashtable) list.elementAt(i); String objID = (String) currObj.get("ObjID"); String objDisplay = (String) currObj.get("ObjDisplay"); %> <option value="<%= objID %>"<%= (objID.equals(currentObj) ? " selected" : "") %>><%= objDisplay %></option> <% } %> </select> </div> </td> </tr> <tr class="fieldline"> <td class="dataLabel"> <fl:label field="DocAttFileName" code="F003C"/> </td> <td class="dataValue"> <fl:attach name="Document" colID="DocAttID" mandatory="true" htmlClass="chpsTextObligatoire"/> </td> </tr> </table> </td> <td class="separation"><div class="separation"></div></td> <td class="column2"> <table class="data_column" cellpadding="0"> <tr class="fieldline"> <td class="dataLabel"> <fl:label field="DocVersion" code="F602D"/> </td> <td class="dataValue"> <div> <input type="hidden" name="mandatory" value="DocVersion"> <%if (currentDocType != null) { %> <input type="hidden" name="DocOppType_" value="<%=currentDocType%>"> <% }%> <input type="hidden" id="mandatory.DocVersion" name="mandatory.DocVersion" value="<fl:getMessage code="L63E0" alt="Veuillez renseigner le champ Version"/>"> <input class="input text chpsTextObligatoire" type="text" name="DocVersion" value="<% if (from != null) { %><%= versionForNewDoc %><% } else { %><fl:getProperty name="Document" property="DocVersion" alt="" /><% } %>" /> <span id="DocVersion_msg" class="mandatory_alert" style="display: none">!</span> </div> </td> </tr> <% if (id == null) { %> <tr class="fieldline"> <td class="dataLabel"> <fl:label field="DocCode" code="F602C"/> </td> <td class="dataValue"> <div> <input type="hidden" name="DocCode" maxlength="100" value="<%= sdf.format(new Date()) %>-<%= df.format(ref) %>"><%= sdf.format(new Date()) %>-<%= df.format(ref) %> </div> </td> </tr> <% } else { %> <fl:fieldEdit property="DocCode" readOnly="true"/> <% } %> <fl:fieldEdit name="Document" property="DocIsArchive" /> <fl:fieldEdit name="Document" property="DocIsWord" /> <%-- Si jamais on a choisi une Opp --%> <% if (currentObj.equalsIgnoreCase(oppObjID) || currentObj.equalsIgnoreCase(catObjID)) {%> <fl:fieldEdit name="Document" property="DocOppType_" mandatoryMsgCode="MF098"/> <%} %> <fl:autodisplay name="Document" zone="DocCol2" edit="true" tableDivTag="false"/> </table> </td> </tr> </table> <table class="container"> <tr class="titrePartie"> <td colspan="2"> <fl:getMessage code="F2024" alt="Notes"/> </td> </tr> <tr class="ligne_separation_couleur"><td colspan="2"></td></tr> <tr class="ligne_separation"><td></td></tr> <tr class="fieldline"> <td colspan="2"> <fl:input name="Document" property="DocNotes" width="100%" rows="5" alt=""/> </td> </tr> <tr class="ligne_separation"><td></td></tr> </table> <fl:smallTabs name="DocumentTabs"> <fl:sTab id="Dispo" title="<%= Utils.getMessage(session, \"L60C5\", \"Disponibilité\") %>"> <table class="container"> <tr> <td class="column2"> <table class="container" cellpadding="0"> <% String idAdmin = dico.getRefIdByCode("DocRolesID","ADMIN"); Vector roles = null; Vector checkVector = null; try{ roles= dico.getRefList(session, "DocRolesID"); }catch(FrontlineException fe){} //Il ne faut pas checker les roles si nous sommes en creation try{ checkVector = Document.getDocRolesID(); }catch(FieldNotInitializedException fnie){} %> <tr><td class="dataValue" width="100%" colspan="2"><input type="checkbox" name="allchecked" onClick="javascript:CheckAll('<%=idAdmin%>');">Tous</input></td></tr> <% for ( int i=0; i < roles.size() ; i++) { String checked=""; Vector currRoles = (Vector) roles.elementAt(i); String idR = (String) currRoles.elementAt(0); if (id!=null && checkVector!= null){ if ( checkVector.contains(idR)) checked="CHECKED "; } //if ( idAdmin.equals(idR)) checked += " onClick=\"this.checked=1\""; if ( idAdmin.equals(idR)) checked = "checked=\"checked\" onClick=\"this.checked=1\""; String role = (String) currRoles.elementAt(1); %> <tr> <td class="dataValue" width="100%" colspan="2"> <input type="checkbox" name="DocRolesID" <%=checked%> value="<%=idR%>"><%=role%> </td> </tr> <%}%> </table> </td> <td class="separation"><div class="separation"></div></td> <td class="column2"> </td> </tr> </table> </fl:sTab> <fl:sTab id="ATTACHMENT" title="<%= Utils.getMessage(session, \"F6032\", \"Documents Connexes\") %>"> <table class="container"> <tr> <td class="column2"> <table class="container" cellpadding="0"> <fl:fieldEdit property="DocDocID"/> </table> </td> <td class="separation"><div class="separation"></div></td> <td class="column2"></td> </tr> </table> </fl:sTab> </fl:smallTabs> </fl:bigTabs> </fl:form>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de