Edit C:\galaxie\deploy\Tomcat6\webapps\galaxie\common\mail\sendmail_opportunity.jsp
<%@page import="com.edeal.frontline.FrontlineException"%> <%@page import="com.edeal.frontline.BasicBean"%> <%@page session="true" %> <%@ page import="java.util.List" %> <%@ page import="java.util.Map" %> <%@ page import="java.util.Vector" %> <%@ page import="java.util.Hashtable" %> <%@ page import="java.util.Iterator" %> <%@ page import="com.edeal.frontline.navigation.FlRequest" %> <%@ page import="com.edeal.frontline.FlContext" %> <%@ page import="com.edeal.frontline.Utils" %> <%@ page import="com.edeal.frontline.navigation.WebUtils"%> <%@ page import="com.edeal.frontline.DataDictionary"%> <%@ page import="com.edeal.frontline.MessagesBean"%> <%@ page import="com.edeal.frontline.OpportunityBean"%> <%@ page import="com.edeal.frontline.EnterpriseBean"%> <%@ page import="com.edeal.frontline.PersonBean"%> <%@ page import="com.edeal.frontline.FieldNotInitializedException" %> <jsp:useBean class="com.edeal.frontline.MessagesBean" id="Messages" scope="request"/> <%@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 id = flRequest.getRequestParameterOrAttribute("id"); // il faut rappatrier la LngID String oppEntid = null; String oppPerid = null; String lngId = null; OpportunityBean oppor = new OpportunityBean(id, context); String lngFRId = null; try{ lngFRId = dico.getRefIdByCode("Lna", "Te1", "fr_FR"); }catch(FrontlineException fle){ } try { oppEntid = oppor.getOppEntID(); // on recupère la langue réferente du client Tiers EnterpriseBean ent = new EnterpriseBean(oppEntid, context); try { lngId = (String) ent.getCustomProperty("EntRefLngID_"); // on recupère la langue réferente du client Tiers } catch (FieldNotInitializedException fnie) { oppPerid = oppor.getOppPerID(); PersonBean pers = new PersonBean(oppPerid, context); try{ lngId = (String) pers.getCustomProperty("PerLngRef_"); } catch(FieldNotInitializedException exc){ // FR par défaut lngId = lngFRId; } } } catch (FieldNotInitializedException fnie) { try{ oppPerid = oppor.getOppPerID(); PersonBean pers = new PersonBean(oppPerid, context); try{ lngId = (String) pers.getCustomProperty("PerLngRef_"); } catch(FieldNotInitializedException exc){ // FR par défaut lngId = lngFRId; } } catch(FieldNotInitializedException ex) { lngId = lngFRId; } } String sfwID = flRequest.getRequestParameterOrAttribute("SfwID"); String type = (String)flRequest.getAttribute("type"); String title = (String)flRequest.getAttribute("title"); String typOppDoc = ""; typOppDoc = (String)flRequest.getAttribute("typOppDoc"); String display = (String)flRequest.getAttribute("display"); String mailTo = (String)flRequest.getAttribute("mailTo"); String clientCase = ""; clientCase = (String)flRequest.getAttribute("clientCase"); String docFamily = null; clientCase = flRequest.getParameter("clientCase"); if(clientCase != null && clientCase.equalsIgnoreCase("1")) { try{ docFamily = context.getDataDictionary().getRefIdByCode("Fdc", "Te1", "GUEST"); }catch(Exception e){ } } else if(clientCase != null && clientCase.equalsIgnoreCase("2")) { try{ docFamily = context.getDataDictionary().getRefIdByCode("Fdc", "Te1", "TIERS"); }catch(Exception e){ } } else if(clientCase != null && clientCase.equalsIgnoreCase("3")) { try{ docFamily = context.getDataDictionary().getRefIdByCode("Fdc", "Te1", "TIERS"); }catch(Exception e){ } } //String modelType = "Person".equals(type) ? "MODELE" : "OPPMODELE"; String modelType = "MODELE"; // initialisation du modèle par défaut String code = null; String idModDefaut = ""; String dispModele = ""; String devisDocTyp= null; String commandeDocTyp= null; String factureDocTyp= null; String staciDocTyp= null; String avoirDocTyp = null; try { devisDocTyp = dico.getRefIdByCode("To_", "Te1", "DEV"); commandeDocTyp = dico.getRefIdByCode("To_", "Te1", "ORD"); factureDocTyp = dico.getRefIdByCode("To_", "Te1", "FAC"); avoirDocTyp = dico.getRefIdByCode("To_", "Te1", "AVO"); staciDocTyp = dico.getRefIdByCode("To_", "Te1", "STC"); } catch (Exception e) { devisDocTyp =""; commandeDocTyp =""; factureDocTyp =""; staciDocTyp =""; } if(typOppDoc.equalsIgnoreCase(devisDocTyp)) { code = "DEV"; } else if (typOppDoc.equalsIgnoreCase(commandeDocTyp)) { code = "ORD"; } else if (typOppDoc.equalsIgnoreCase(factureDocTyp)) { code = "FAC"; } else if (typOppDoc.equalsIgnoreCase(staciDocTyp)) { code = "STC"; } else if (typOppDoc.equalsIgnoreCase(avoirDocTyp)) { code = "AVO"; } if(code != null) { if("FAC".equals(code)){ String[] fieldsQuery = {"MsgID", "MsgSubject"}; String sqlQuery = new String("SELECT MsgID, MsgSubject FROM Messages WHERE MsgCode LIKE 'FAC__' AND MsgLngRef = " + Utils.formatToSQL(context, lngId)); String[] orderBy = {"MsgCrDt DESC"}; Vector listRes = BasicBean.listSQL(context, fieldsQuery, sqlQuery); if(listRes != null && !listRes.isEmpty()) { Hashtable tab = (Hashtable)listRes.firstElement(); idModDefaut = (String)tab.get("MsgID"); dispModele = (String)tab.get("MsgSubject"); } else{ if(!lngFRId.equals(lngId)){ sqlQuery = new String("SELECT MsgID, MsgSubject FROM Messages WHERE MsgCode = 'FACFR' "); listRes = BasicBean.listSQL(context, fieldsQuery, sqlQuery); if(listRes != null && !listRes.isEmpty()) { Hashtable tab = (Hashtable)listRes.firstElement(); idModDefaut = (String)tab.get("MsgID"); dispModele = (String)tab.get("MsgSubject"); } } } } else{ String[] fieldsQuery = {"MsgID", "MsgSubject"}; String[][] queryList = {{"MsgCode = '" + code + "'"}}; String[] orderBy = {"MsgCrDt DESC"}; Vector listRes = MessagesBean.listSummary(context, fieldsQuery, queryList); if(listRes != null && !listRes.isEmpty()) { Hashtable tab = (Hashtable)listRes.firstElement(); idModDefaut = (String)tab.get("MsgID"); dispModele = (String)tab.get("MsgSubject"); } } } %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script type="text/javascript" src="<fl:webapp/>/js/ajax/ajax.js"></script> <script type="text/javascript" src="<fl:webapp/>/js/edit_js.jsp"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/edeal/libraries/json.org/json2/json2.js"></script> <script type="text/javascript"> function doWord(id, obj, informat) { format = "Word"; if (informat && informat == "PDF") { format = "PDF"; } window.open('<fl:webapp/>/fusion_document.fl?format=' + format + '&idObj=' + id + '&object=' + obj, 'listOpp', 'menubar=no,status=no,toolbar=no,scrollbars=auto,resizable=yes,width=860,height=460'); } function loadModel(id) { if(id == '' || id == null){ alert('<fl:getMessage code="M9005" alt="Veuillez choisir un modèle" js="true"/>'); return; } var url = "<fl:webapp/>/load_obj_model_.fl?id=" + id + "&objID=<%= id %>&type=<%= type %>&lngId=<%= lngId %>&option=Send.Facture.Produit.FusionParams"; $.getJSON(url, function(data) { if(data.Status == "OK"){ $("#MsgSubject").val(decodeURIComponent(data.MsgSubject)); insertContents(decodeURIComponent(data.MsgBody)); $("#ModelMsgAttID").val(data.MsgAttID); $("#ModelMsgDocID").val(data.MsgDocID); } }); } function doSend() { var f = document.forms[0]; getFusion(); if (f.MsgTo.value == '') { document.getElementById('MsgTo_msg').style.display = "inline"; alert('<fl:getMessage code="L810C" alt="Veuillez saisir un destinataire" js="true"/>'); f.MsgTo.focus(); } else if (f.MsgSubject.value == '') { document.getElementById('MsgSubject_msg').style.display = "inline"; alert('<fl:getMessage code="M6033" alt="Veuillez saisir un sujet" js="true"/>'); f.MsgSubject.focus(); } else if (isEmptyContents()) { alert('<fl:getMessage code="M9029" alt="Veuillez saisir un contenu pour le message" js="true"/>'); } else if ($("#FusionPdf").val() == '' && $("#FusionWord").val() == '') { alert('<fl:getMessage code="M0016" alt="Veuillez sélectionner un fichier." js="true"/>'); } else { sendMessage(); } } function sendMessage() { var f = document.forms[0]; var msgBody = encodeURI(getContents()); var msgContent = getContents(); var msgSubject = encodeURI(f.MsgSubject.value); var file = $("#ModelMsgAttID").val(); file += (file != "" ? "|" : "") + $("input[name='MsgAttID']").val(); var doc = $("#ModelMsgDocID").val(); doc += (doc != "" ? "|" : "") + $("input[name='MsgDocID']").val(); getFusion(); var fusionPdf = $("#FusionPdf").val(); var fusionWord = $("#FusionWord").val(); var fields = {"MsgSubject" : msgSubject, "MsgBody" : msgBody, "MsgAttID" : file, "MsgDocID" : doc, "FusionPdf" : fusionPdf, "FusionWord" : fusionWord}; var jsondata = JSON.stringify(fields); //openPopupLayerWaiting(jjsondatasonstr, '<fl:webapp/>/send_mail_obj.fl?objID=<%= id %>&type=<%= type %>&MsgTo=' + $("#MsgTo").val() + '&WithInter=' + $("#with_interaction").is(":checked")', "", waitingPopupOperationStatus); $.openPopupLayer({ name: "WaitingPopup", width: "auto", height: "auto", url: "<fl:webapp/>/waiting_send_mail.fl", cache: false, success : function(result){ $.ajax({ data: jsondata, type: "POST", url: '<fl:webapp/>/send_mail_obj_opportunity.fl?objID=<%= id %>&typOppDoc=<%=typOppDoc%>&type=<%= type %>&MsgTo=' + $("#MsgTo").val() + '&WithInter=' + $("#with_interaction").is(":checked"), timeout: 20000, contentType: "application/json;charset=utf-8", dataType: 'json', async: true, success: analyseResponse }); } }); } function analyseResponse(data) { if (data != null) { if (data.Status == "OK"){ $("#hourGlass").html(""); } else { $("#status").val("KO"); $("#waiting_popup").attr("src", "<fl:webapp/>/js/progressbar/images/failure.png"); $("#detail_popup").html(decodeURIComponent(data.Detail)); } $("#msg_popup").html(decodeURIComponent(data.Msg)); } else { $("#status").val("KO"); $("#waiting_popup").attr("src", "<fl:webapp/>/js/progressbar/images/failure.png"); $("#detail_popup").html(decodeURIComponent(data.Detail)); } } function loadListDoc() { var ajaxUrl = _grid__ListDocWord_js_.getAjaxUrl(); var params = {}; params["object"] = '<%= type %>'; _grid__ListDocWord_js_.callAjaxForHtml(ajaxUrl, params, false); } function doOnLoad(){ loadListDoc(); load_ckeditor(); loadModel($('#MsgID').val()); } function getFusion() { var doc_pdf_id = ""; var doc_word_id = ""; var checkbox_word = $("input[type=checkbox][name=fusion_word]:checked"); var checkbox_pdf = $("input[type=checkbox][name=fusion_pdf]:checked"); var checkbox_word_length = $("input[type=checkbox][name=fusion_word]:checked").length; var checkbox_pdf_length = $("input[type=checkbox][name=fusion_pdf]:checked").length; checkbox_word.each( function(i) { doc_word_id += $(this).attr("ed:docid"); if (i < checkbox_word_length - 1) { doc_word_id += "|"; } } ); checkbox_pdf.each( function(j) { doc_pdf_id += $(this).attr("ed:docid"); if (j < checkbox_pdf_length - 1) { doc_pdf_id += "|"; } } ); $('#FusionPdf').val(doc_pdf_id); $('#FusionWord').val(doc_word_id); } function goBack(){ var url = "<fl:link url="<%= \"/read_\"+ type.toLowerCase() + \".fl\" %>"/>"; //test if there is already param in url, if(url.indexOf("?")==-1){ url+="?"; } else{ url+="&"; } url+= "id=<%= id %>"; document.location = url; } </script> <fl:bigTabs listTitle="" objectTitle="<%= Utils.getMessage(session, \"L700F\", false, true, \"Envoi\") %>" ou=""> <div style="text-align: left"> <fieldset> <legend align=top><%= display %></legend> <span class="dataLabel"><%= title %></span> </fieldset> <br/> <fieldset> <legend align=top><fl:getMessage code="L8116" alt="Documents"/></legend> <div> <table class="container" cellpadding="0" width="100%"> <tr class="fieldline"> <td> <table class="container" cellpadding="0" width="100%"> <tr class="fieldline"> <td> <div> <% if(docFamily != null) {%> <fl:grid name="ListDocWord" ajaxUrl="<%= \"/obj_fusion_document_ajax_opportunity.fl?&lngID=\" + lngId + \"&docCatID=\" + docFamily + \"&typOppDoc=\" + typOppDoc + \"&id=\" + id %>" ></fl:grid> <%} else { %> <fl:grid name="ListDocWord" ajaxUrl="<%= \"/obj_fusion_document_ajax_opportunity.fl?&lngID=\" + lngId + \"&typOppDoc=\" + typOppDoc + \"&id=\" + id %>" ></fl:grid> <%} %> </div> </td> </tr> </table> </td> </tr> </table> </div> </fieldset> <br/> <fl:form action="" bean="Messages" method="POST"> <input type="hidden" name="ModelMsgAttID" id="ModelMsgAttID" value=""/> <input type="hidden" name="ModelMsgDocID" id="ModelMsgDocID" value=""/> <input type="hidden" name="FusionWord" id="FusionWord" value=""/> <input type="hidden" name="FusionPdf" id="FusionPdf" value=""/> <fieldset> <legend align=top><fl:getMessage code="F6002" alt="Message"/></legend> <br/> <div id="message_modele" style="padding-left:5px"> <table><tr><td> <table cellpadding="0" width="100%"> <tr> <td class="dataLabel" id="MsgID_label"> <div style="padding-right: 10px"> <label title="<fl:getMessage code="L6352" alt="Modèle"/>" for="MsgID"><fl:getMessage code="L6352" alt="Modèle" /></label> </div> </td> <td class="dataValue" id="MsgID_value"> <div class="input fieldTable"> <table cellspacing="0" cellpadding="0" class="fieldTable"> <tr valign="top"> <td class="principalText bigFieldPart"> <div class="fobLeftDiv"> <input type="hidden" value="<%=idModDefaut%>" class="input" name="MsgID" id="MsgID"/> <input type="text" class="input fob" onfocus="displayOnFocus(this);acResizeDisplayDiv(this);" autocomplete="off" value="<%=dispModele%>" name="lblMsgID" id="lblMsgID" style="width: 150px;"/> </div> </td> <td class="smallFieldPart"> <span id="MsgID_icons"> <table style="height: 100%; width: 100%"> <tr> <td> <a href="javascript:var langCurrent = $('#langageID').val(); var win = window.open('<fl:webapp/>/select.fl?type=Messages&field=MsgID&formIndex=0&query=MsgObjID:ObjSql=\'<%=type %>\'\|MsgType:RefVal=\'<%=modelType %>\'', 'SelectActor', 'menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,width=800,height=400')"> <img title="<fl:getMessage code="A2003" alt="Sélectionner"/>" alt="<fl:getMessage code="A2003" alt="Sélectionner"/>" class="icon" src="<fl:webapp/>/icons/ico/rechercher.gif"/> </a> </td> <td> <a href="javascript:var f = window.document.forms[0]; f.MsgID.value = f.lblMsgID.value = ''; acLastCompleteValues['lblMsgID'] = '';acLastCompleteValues['MsgID'] = ''; void('')" class="fob"> <img title="<fl:getMessage code="A3005" alt="Vider le champ"/>" alt="<fl:getMessage code="A3005" alt="Vider le champ"/>" class="icon" src="<fl:webapp/>/icons/ico/supprimer.gif"/> </a> </td> <td> <a href="javascript: loadModel($('#MsgID').val());"> <img title="<fl:getMessage code="L7033" alt="Charger le modèle"/>" alt="<fl:getMessage code="L7033" alt="Charger le modèle"/>" class="icon" src="<fl:webapp/>/icons/ico/importer.gif"/> </a> </td> </tr> </table> </span> <script language="javascript"> var _MsgID_query = "MsgObjID:ObjSql='<%=type %>'|MsgType:RefVal='<%=modelType %>'";runOnTime("installFobAC(document.forms[0].lblMsgID);", 1000); </script> </td> </tr> </table> </div> </td> </tr> </table> </td> <td> <input type="checkbox" checked="checked" id="with_interaction" name="with_interaction"/><fl:getMessage code="L6039" alt="Créer interaction"/> </td> </tr> </table> </div> <div id="message_place" style="width: 99%;padding-left: 5px"> <table class="container" cellpadding="0"> <tr> <td colspan="5" class="titreFiche"> <table class="container" cellpadding="0"> <tr class="fieldline"> <td> <div><label title="À" for="MsgTo" class="titreFiche">À</label></div> </td> </tr> <tr class="fieldline"> <td> <div class="input text"><input type="hidden" value="MsgTo" name="mandatory"/><input type="hidden" value="Veuillez spécifier le destinataire du message." name="mandatory.MsgTo" id="mandatory.MsgTo"/><input type="text" class="input text chpsTextObligatoire" maxlength="255" value="<%= mailTo %>" name="MsgTo" id="MsgTo"/><span style="display: none" class="mandatory_alert" id="MsgTo_msg">!</span></div> </td> </tr> <tr class="fieldline"> <td> <fl:label field="MsgSubject" labelClassName="titreFiche"/> </td> </tr> <tr class="fieldline"> <td> <fl:input property="MsgSubject" mandatoryMsgCode="M000C" /> </td> </tr> </table> </td> </tr> <tr class="ligne_separation"><td colspan="5"></td></tr> <tr> <td class="titrePartie" colspan="5"><fl:label field="MsgBody"/></td> </tr> <tr> <td class="dataValue noPaddingLeft" colspan="5"><fl:input height="340px" property="MsgBody" nodiv="true"/></td> </tr> <tr class="ligne_separation"><td></td></tr> </table> <link href="<fl:webapp/>/css/smalltabs_css.jsp" rel="stylesheet" type="text/css"> <fl:smallTabs name="AttachmentsTabs"> <fl:sTab id="files" title="<%= Utils.getMessage(session, \"L201C\", false, true, \"Documents joints\") %>"> <fl:attach name="Messages" colID="MsgAttID" edit="true"/> </fl:sTab> <fl:sTab id="docs" title="<%= Utils.getMessage(session, \"L813E\", false, true, \"Références documentaire\") %>"> <table class="container" cellpadding="0"> <tr> <td class="column2"> <table class="container" cellpadding="0"> <tr class="fieldline"> <td class="column2"> <table class="container" cellpadding="0"> <fl:fieldEdit property="MsgDocID" name="Messages"/> </table> </td> </tr> <tr class="fieldline"><td></td></tr> </table> </td> <td style="width:20px"></td> <td class="column2"></td> </tr> </table> </fl:sTab> </fl:smallTabs> </div> </fieldset> </fl:form> </div> </div> </fl:bigTabs> <!-- CKEditor --> <script type="text/javascript" src="<fl:webapp/>/js/wysiwyg/ckeditor/ckeditor.js"></script> <script type="text/javascript" src="<fl:webapp/>/js/wysiwyg/ckeditor/adapters/jquery.js"></script> <script type="text/javascript"> var simpleLinkURL = ''; var simpleLinkText = ''; var desType = 'Solicitation'; var CKEditor_loaded = false; var editor; <% boolean hasFileStorageService = false; boolean hasUrlTrackingService = false; %> function load_ckeditor(){ var instance = CKEDITOR.instances['MsgBody']; if(instance) { CKEDITOR.remove(instance); } editor = CKEDITOR.replace('MsgBody', { <%if(hasFileStorageService){%> filebrowserImageBrowseUrl : '<fl:webapp/>/js/wysiwyg/filemanager/index.jsp', filebrowserWindowWidth : 1024, filebrowserWindowHeight : 400, <%}%> height : "330", resize_enabled : false, toolbar : [ ['Format','Font','FontSize','-','Bold','Italic','Underline','StrikeThrough','-','Undo','Redo','-','Cut','Copy','Paste','Find','Replace','-','Outdent','Indent','-','Print'], '/', ['NumberedList','BulletedList','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], [<%if(hasFileStorageService){%>'Image',<%}%>'Table','-','Link','Flash','Smiley','TextColor','BGColor','Source','-','FusionButton','SimpleLinkButton'<%if(hasUrlTrackingService){%>,'TrackingLinkButton','SnippetButton'<%}%>] ] }); CKEditor_loaded = true; CKEDITOR.on( 'dialogDefinition', function( ev ){ var dialogName = ev.data.name; var dialogDefinition = ev.data.definition; if ( dialogName == 'image' ){ dialogDefinition.removeContents('advanced'); // Get a reference to the 'Image Info' tab. var infoTab = dialogDefinition.getContents('info'); // Remove unnecessary widgets from the 'Image Info' tab. infoTab.remove('txtHeight'); infoTab.remove('txtWidth'); infoTab.remove('txtBorder'); infoTab.remove('txtHSpace'); infoTab.remove('txtVSpace'); infoTab.remove('cmbAlign'); infoTab.remove('btnLockSizes');// infoTab.remove('btnResetSize'); infoTab.remove('previewImage'); infoTab.remove('ImagePreviewLoader'); infoTab.remove('ImagePreviewBox'); infoTab.remove('previewImage'); } }); CKEDITOR.on('pluginsLoaded', function( ev ){ //Fusion button editor.addCommand('fusionCommand', { exec : function(editor) { getFusionField(); } }); editor.ui.addButton('FusionButton', { label : '<fl:getMessage code="F7066" alt="Fusion" js="true"/>', command : 'fusionCommand', icon: '<fl:webapp/>/icons/fusion.gif' }); }); } function insertFusionField(sqlName, lbl, id){ var value = '<span id="' + id + '" title="' + sqlName + '" ed:fusionfield="' + sqlName + '">$$' + lbl + '$$</span> '; if ( editor.mode == 'wysiwyg' ){ editor.insertHtml(value); } if (fusionFieldPopUp != null) { window.setTimeout("fusionFieldPopUp.focus()",400); } } function insertContents(value){ editor.setData(value); } function getContents(){ return editor.getData(); } function isEmptyContents(){ var editor_val = editor.document.getBody().getText(); if (editor_val != '') { return false ; } return true ; //return ( ("" == getContents()) || ('<br />\n' == getContents()) || ('<br />' == getContents())); } var fusionFieldPopUp; var snippetPopUp; function getFusionField(){ if (desType != '') { fusionFieldPopUp = window.open('<fl:link list="false" url="/fusion_popup.fl"/>?destype='+desType, '<fl:getMessage code="F7066" alt="Fusion"/>', 'toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no, width=500, height=200'); }else{ alert("Veuillez sélectionner un objet concerné."); } } </script>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de