Edit C:\galaxie\Back\galaxie\common\attachment\select_multiple.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" contentType="text/html; charset=UTF-8"%> <%@ page import="com.edeal.frontline.navigation.FlRequest" %> <%@ page import="com.edeal.frontline.FlContext" %> <%@ page import="com.edeal.frontline.Utils" %> <%@ page import="java.util.Vector" %> <%@ page import="com.edeal.frontline.FieldNotInitializedException" %> <%@page import="org.apache.commons.fileupload.servlet.ServletFileUpload"%> <%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %> <jsp:useBean id="Attachment" class="com.edeal.frontline.AttachmentBean" 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(); boolean isMultipart = ServletFileUpload.isMultipartContent(request); // String multivalSeparator = null; String initAttID = null; String initAttFileName = null; String idColName = null; String fileNameColName = null; String id = null; String multivalSeparator = flRequest.getParameter("multivalSeparator"); if (isMultipart) { //multivalSeparator = (String)flRequest.getAttribute("multivalSeparator"); initAttID = (String)flRequest.getAttribute("initAttID"); initAttFileName = (String)flRequest.getAttribute("initAttFileName"); idColName = (String)flRequest.getAttribute("IDColName"); fileNameColName = (String)flRequest.getAttribute("FileNameColName"); id = (String)flRequest.getAttribute("id"); } else { // multivalSeparator = flRequest.getParameter("multivalSeparator"); initAttID = flRequest.getParameter("initAttID"); initAttFileName = flRequest.getParameter("initAttFileName"); idColName = flRequest.getParameter("IDColName"); fileNameColName = flRequest.getParameter("FileNameColName"); id = flRequest.getParameter("id"); } if (multivalSeparator == null) { multivalSeparator = "|"; } String attachID = null; try { if (Attachment != null) { attachID = Attachment.getID(); } } catch (FieldNotInitializedException fnie) { } Vector oldID = new Vector(); if (initAttID != null) { oldID = Utils.explodeList(initAttID, multivalSeparator); } Vector oldNames = new Vector(); if (initAttFileName != null) { oldNames = Utils.explodeList(initAttFileName, multivalSeparator); } if (attachID != null && !oldID.contains(attachID)) { oldID.addElement(attachID); try { oldNames.addElement(Attachment.getAttDesc()); } catch (FieldNotInitializedException fnie) { try { oldNames.addElement(Attachment.getAttFileName()); } catch (FieldNotInitializedException fnie2) { } } } if (id != null && oldID.contains(id)) { int index = oldID.indexOf(id); Vector ids = new Vector(); Vector names = new Vector(); for (int i = 0; i < oldID.size(); i++) { if (i != index) { ids.addElement(oldID.elementAt(i)); names.addElement(oldNames.elementAt(i)); } } oldID = ids; oldNames = names; } %> <html> <head> <title><fl:getMessage code="L6043" alt="Gestion des fichiers attachés"/></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 type="text/javascript" language="javascript" src="<fl:webapp/>/js/edeal/libraries/jquery/jquery.js"></script> <script language="javascript" type="text/javascript" src="<fl:webapp/>/js/ajax/ajax.js"></script> <script language="javascript" type="text/javascript" src="<fl:link url="/common/attachment/select_multiple_js.jsp"/>"></script> <script language="javascript" type="text/javascript"> function transfertAttachements(){ var docSelect = window.opener.document.forms[0].LesFichiersAttaches<%= idColName %>; var monSelect = document.forms[0].ListeAttachements; while (docSelect.options.length > 0) { docSelect.options[docSelect.options.length - 1] = null; } var ids = ""; var fileNames = ""; var chaineEval = 'leDocSelect = document.forms[0].LesFichiersAttaches<%= idColName %>;'; for (i = 0; i < monSelect.options.length; i++){ var idFichier = monSelect.options[i].value; if (idFichier != "VIDE") { var nomFichier = monSelect.options[i].text; //nomFichier = nomFichier.split('\'').join('\\\''); //nomFichier = nomFichier.split("\"").join("\\\""); var optionNomFichier=nomFichier.replace(/\'/g,"\\'").replace(/\"/g,'\"'); if (ids != '') { ids += '<%= multivalSeparator %>'; } if (fileNames != '') { fileNames += '<%= multivalSeparator %>'; } ids += monSelect.options[i].value; fileNames += nomFichier; chaineEval += 'leDocSelect.options[' + i.toString() + '] = new Option(\'' + optionNomFichier + '\', \'' + monSelect.options[i].value + '\'); '; } } window.opener.document.forms[0].<%= idColName %>.value = ids; window.opener.document.forms[0].<%= fileNameColName %>.value = fileNames; window.opener.document.forms[0].PourEval.value = chaineEval; window.opener.document.forms[0].DoEval.value = '1'; docSelect.focus(); self.close(); } function supprimerAttachement() { if (document.forms[0].ListeAttachements.selectedIndex > -1) { var id = document.forms[0].ListeAttachements.options[document.forms[0].ListeAttachements.selectedIndex].value; if (document.forms[0].ListeAttachements.options.length >= 1 && id != "VIDE") { doAjax("<fl:webapp/>/delete_attachment_multiple.fl?id=" + id); } } } function supprimerMassAttachement() { if (document.forms[0].ListeAttachements.selectedIndex > -1) { var id = document.forms[0].ListeAttachements.options[document.forms[0].ListeAttachements.selectedIndex].value; if (document.forms[0].ListeAttachements.options.length >= 1 && id != "VIDE") { var arrMassSelectID = new Array(); $("#ListeAttachements option:selected").each(function(){ alert($(this).val()); arrMassSelectID.push($(this).val()); }); if (arrMassSelectID.length > 0){ var jsonstr = JSON.stringify(arrMassSelectID); $.ajax({ data: jsonstr, type: "POST", url: "<fl:webapp/>/delete_mass_attachment_multiple.fl", timeout: 20000, contentType: "application/json;charset=utf-8", dataType: 'json' }); } } } } function ajouterAttachement() { var f = document.forms[0]; if (f.elements[0].value != "" && f.AttFile.value != "") { f.action = "<fl:link url="<%= \"/add_attachment.fl?IDColName=\" + idColName + \"&FileNameColName=\" + fileNameColName +\"&multivalSeparator=\" + multivalSeparator%>"/>" if (f.AttDesc.value == '') { f.AttDesc.value = traiteNom(f.AttFile.value); } f.submit(); } } </script> </head> <body> <form name="_GestionAttachements" method="post" action="" enctype="multipart/form-data"> <input type="hidden" name="$$multivalSeparator" value="<%= multivalSeparator %>"> <input type="hidden" name="IDColName" value="<%= idColName %>"> <input type="hidden" name="FileNameColName" value="<%= fileNameColName %>"> <input type="hidden" name="initAttID" value="<%= oldID != null && oldID.size() > 0 ? Utils.implodeList(oldID, multivalSeparator) : "" %>"> <input type="hidden" name="initAttFileName" value="<%= oldNames != null && oldNames.size() > 0 ? Utils.implodeList(oldNames, multivalSeparator) : "" %>"> <input type="hidden" name="SaveOptions" value="0"> <div id="object_css" style="top:0px;left: 0px;height: 100%;"> <fl:bigTabs objectTitle="<%= Utils.getMessage(session, \"L201C\", \"Documents joints\") %>"> <table class="container" cellpadding="0"> <tr class="ligne_separation"><td> </td></tr> <tr> <td class="titrePartie">1. <fl:getMessage code="L6040" alt="Choisir un fichier et y associer un commentaire"/></td> </tr> <tr valign="top"> <td width="100%" class="dataValue"><input class="chpsTextObligatoire" style="font:12px" size="37" type="file" name="AttFile"></td> </tr> <tr valign="top"> <td width="100%" class="dataValue"><input name="AttDesc" value="" size="30"></td> </tr> <tr class="ligne_separation"><td> </td></tr> <tr class="ligne_separation_couleur"><td></td></tr> <tr class="ligne_separation"><td></td></tr> <tr> <td class="titrePartie">2. <fl:getMessage code="L6041" alt="Ajouter le fichier sélectionné à la liste ou en supprimer un"/></td> </tr> </table> <table class="container" cellpadding="0"> <tr valign="top"> <td width="50%" class="transparent"> <select name="ListeAttachements" id="ListeAttachements" multiple size="5"> <% if (oldID == null || oldID.size() == 0) { %> <option value="VIDE"><fl:getMessage code="L6042" alt="--- Aucun fichier attaché ---"/></option> <% } else { for (int i = 0; i < oldID.size(); i++) { %> <option value="<%= oldID.elementAt(i) %>"><%= (String)oldNames.elementAt(i) %></option> <% } %> <% } %> </select> </td> <td width="50%" style="text-align: center"> <br> <a href="javascript:ajouterAttachement();"><img src="<fl:link url="/icons/ico/save_all_long.gif"/>" alt="<fl:getMessage code="A000F" alt="Ajouter"/>"></a> <br> <br> <a href="javascript:supprimerAttachement();"><img src="<fl:link url="/icons/ico/supprimer_long.gif"/>" alt="<fl:getMessage code="A0007" alt="Supprimer"/>"></a> <br> </td> </tr> </table> </fl:bigTabs> <br> <div align="center" style="width: 100%"> <a href="javascript:transfertAttachements();"><img src="<fl:link url="/icons/ico/valid_green_long.gif"/>" alt="<fl:getMessage code="A2001" alt="Valider"/>"></a> <a href="javascript:window.self.close();"><img src="<fl:link url="/icons/ico/fermer_red_long.gif"/>" alt="<fl:getMessage code="A2002" alt="Annuler"/>"></a> </div> </form> <div id="waiting" style="display:none"><fl:getMessage code="L639B" alt="Chargement ..."/></div> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de