Edit C:\galaxie\Back\galaxie\sales\interaction\read.jsp
<%@page import="java.io.ByteArrayInputStream"%> <%@page import="java.io.InputStream"%> <%@page import="org.apache.commons.io.IOUtils"%> <%@page import="java.io.StringWriter"%> <%@page import="javax.mail.internet.MimeUtility"%> <%@page import="com.edeal.frontline.EventBean"%> <%@page import="com.edeal.frontline.OpportunityBean"%> <%@page import="com.edeal.frontline.PersonEventBean"%> <%@page import="com.edeal.frontline.helper.InteractionBaseHelper"%> <%@page import="com.edeal.frontline.helper.InteractionBaseHelper.ContextObjectInformation"%> <%@page import="java.util.HashMap"%> <%@page import="com.edeal.frontline.ObjectsBean"%> <%@page import="com.edeal.frontline.AttachmentBean"%> <% /****************************************************************************** * Copyright (c) 2000-2013 E-DEAL * * E-DEAL S.A. * 41, rue Périer * 92120 Montrouge * France * * T: +33 (0)1 73 03 29 80 * 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.MessagesBean" %> <%@ page import="com.edeal.frontline.FrontlineException" %> <%@ 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="java.util.Date" %> <%@ page import="java.util.Vector" %> <%@ page import="java.util.Iterator" %> <%@ page import="java.util.Hashtable" %> <%@ page import="com.edeal.frontline.SalesInvestBean" %> <%@ page import="com.edeal.frontline.FlLocale" %> <%@ page import="com.edeal.frontline.DataDictionary" %> <%@ page import="com.edeal.frontline.grid.functions.InteractionSyntaxActions" %> <%@ page import="com.edeal.frontline.helper.ContextHelper" %> <%@ taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %> <jsp:useBean class="com.edeal.frontline.InteractionBean" id="Interaction" scope="request"/> <% EventBean event = (EventBean) request.getAttribute("event"); EventBean eventFromPersonEvent = (EventBean) request.getAttribute("eventFromPersonEvent"); OpportunityBean opportunity = (OpportunityBean) request.getAttribute("opportunity"); PersonEventBean personEvent = (PersonEventBean) request.getAttribute("personEvent"); 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(); InteractionBaseHelper ibh = new InteractionBaseHelper(Interaction); HashMap<ObjectsBean, ContextObjectInformation> contextObjectInformation = ibh.getContextObjectInformation(); String typeInterID = ""; String typeInteraction = ""; String titreFen = ""; String codetitreFen = ""; Vector reservationsIDs = null; String resaIDs = ""; Vector todosIDs = null; String tdIDs = ""; Vector correspondancesIDs = null; String corrIDs = ""; try{ reservationsIDs = (Vector)Interaction.getCustomProperty("IntReserv_"); resaIDs = Utils.implodeList(reservationsIDs, ";"); } catch (FieldNotInitializedException e){ } try{ typeInterID = (String)Interaction.getCustomProperty("IntType_"); }catch(FieldNotInitializedException e){ typeInterID = ""; } if(typeInterID.equals(dico.getRefIdByCode("IntType_", "ACT"))){ titreFen = "Todo"; codetitreFen ="FF072"; typeInteraction = "TODO"; try{ correspondancesIDs = (Vector)Interaction.getCustomProperty("IntCorr_"); corrIDs = Utils.implodeList(correspondancesIDs, ";"); } catch (FieldNotInitializedException e){ } } else if (typeInterID.equals(dico.getRefIdByCode("IntType_", "COR"))){ titreFen = "Correspondance"; codetitreFen ="FF09A"; typeInteraction = "CORR"; try{ todosIDs = (Vector)Interaction.getCustomProperty("IntTodo_"); tdIDs = Utils.implodeList(todosIDs, ";"); } catch (FieldNotInitializedException e){ } } else { titreFen = "Interaction"; codetitreFen ="L30B2"; } String id = null; try { id = Interaction.getID(); } catch (FieldNotInitializedException fnie) { } FlLocale locale = FlLocale.getInstance(session); boolean has5columns = Interaction.hasPlaceDisplay() || Interaction.hasOperationDisplay(); Date today = new Date(); long retard = 0; Date dateInt = null; try { dateInt = Interaction.getIntDate(); retard = (today.getTime() - dateInt.getTime()) / 86400000; } catch (FieldNotInitializedException ex) { } long dureeH = 0; long dureeM = 0; Date begHour = null; Date endHour = null; try { begHour = Interaction.getIntTimeBeg(); } catch (FieldNotInitializedException ex) { } try { endHour = Interaction.getIntTimeEnd(); } catch (FieldNotInitializedException ex) { } long dureeMin = 0; if(begHour != null && endHour != null) { dureeMin = (endHour.getTime() - begHour.getTime()) / 60000; dureeH = dureeMin / 60; dureeM = dureeMin % 60; } String statusId = null; try { statusId = Interaction.getIntStiID(); } catch (FieldNotInitializedException ex) { } String status = ""; try { status = dico.getRefCode("IntStiID", statusId); } catch (FrontlineException ex) { logger.error("Error occurred during int status recovering with int status id '"+statusId+"'",ex); } //category code String catCode = null; try{ catCode = (String) dico.getRefDisp("Acv", "Te2", Interaction.getIntAtvID()); } catch (FrontlineException e){ } //category code String subCatCode = null; try{ subCatCode = (String) dico.getRefCode("Acv", null, Interaction.getIntAtvID()); } catch (FrontlineException e){ } boolean isIntExceptionalCostActive = SalesInvestBean.isIntExceptionalCostActive(context); String activite = null; try { activite = Interaction.getIntAtvID(); } catch (FieldNotInitializedException fnie) { } String cpgID = null; try { cpgID = Interaction.getIntCpgID(); } catch (FieldNotInitializedException fnie) { } String intPlace = null; try { intPlace = Interaction.getIntPlace(); } catch (FieldNotInitializedException fnie) { } Vector<String> corresList = null; try { corresList = Interaction.getIntCorID(); } catch (FieldNotInitializedException fnie) { } String intReport = null; try { intReport = Interaction.getIntReport(); } catch (FieldNotInitializedException fnie) { } intReport = intReport == null ? "" : intReport; boolean isGeoLocalized = true; try { Interaction.getIntGeoCodeStatusID(); } catch (FieldNotInitializedException e) { isGeoLocalized = false; } String solicitationID = null; try { solicitationID = (String) Interaction.getCustomProperty("IntSolicitation_"); } catch (FieldNotInitializedException e) { } String sentmailID = null; String msgContent = ""; String startingFlag = "Content-Transfer-Encoding: "; int startingFlaglength = 0; MessagesBean msgBean = null; boolean decode = false; try { sentmailID = (String) Interaction.getIntMsgID(); if(sentmailID != null) { msgBean = new MessagesBean( sentmailID , context); msgContent = msgBean.getMsgBody(); int indexDeb = -1; indexDeb = msgContent.indexOf(startingFlag+"7bit");//BASE64 QUOTED-PRINTABLE 8BIT 7BIT BINARY x-token if(indexDeb>=0){ startingFlaglength = startingFlag.length() + "7bit".length(); }else{ indexDeb = msgContent.indexOf(startingFlag+"8bit"); if(indexDeb>=0){ startingFlaglength = startingFlag.length() + "8bit".length(); }else{ decode = true; indexDeb = msgContent.indexOf(startingFlag+"quoted-printable"); if(indexDeb>=0){ startingFlaglength = startingFlag.length() + "quoted-printable".length(); }else{ decode = false; indexDeb = msgContent.indexOf(startingFlag+"binary"); if(indexDeb>=0){ startingFlaglength = startingFlag.length() + "binary".length(); }else{ indexDeb = msgContent.indexOf(startingFlag+"base64"); if(indexDeb>=0){ startingFlaglength = startingFlag.length() + "base64".length(); }else{ indexDeb = msgContent.indexOf(startingFlag+"x-token"); if(indexDeb<0) throw new Exception("");//We can not translate the MessageBody ! else{ startingFlaglength = startingFlag.length() + "x-token".length(); } } } } } } indexDeb = indexDeb + startingFlaglength; msgContent = msgContent.substring(indexDeb); int indexFin = msgContent.indexOf("------"); msgContent = msgContent.substring(0 , indexFin); if(decode){ String msgContent2 = msgBean.getMsgBody(); msgContent = msgContent2.substring(msgContent2.indexOf(msgContent)+msgContent.length()+"------".length()); indexDeb = msgContent.indexOf(startingFlag+"quoted-printable"); startingFlaglength = startingFlag.length() + "quoted-printable".length(); indexDeb = indexDeb + startingFlaglength; msgContent = msgContent.substring(indexDeb); indexFin = msgContent.indexOf("------"); msgContent = msgContent.substring(0 , indexFin); try{ //msgContent = MimeUtility.decodeText(msgContent); InputStream inst = new ByteArrayInputStream(msgContent.getBytes()); inst.close(); inst = MimeUtility.decode(inst, "quoted-printable"); StringWriter writer = new StringWriter(); IOUtils.copy(inst, writer, "UTF-8"); msgContent = writer.toString(); }catch(Exception ee){ logger.error(ee.getMessage()); ee.printStackTrace(); } } } } catch (Exception e) { //logger.error(e.getMessage()); //e.printStackTrace(); try{ msgContent = msgBean.getMsgBody(); msgContent = e.getMessage() + "<br/>" + msgContent; }catch(Exception e2){ //logger.error(e2.getMessage()); //e2.printStackTrace(); } } /* 0041739: Relance de correspondance http://u-project2.umanis.com/view.php?id=41739 */ String intParentID; try{ intParentID = Interaction.getIntParentID(); }catch(FieldNotInitializedException fne){ intParentID = null; } %> <script type="text/javascript" language="javascript"> function refreshCorDetails(id) { doAjax("<fl:webapp/>/cor_details_list_ajax.fl?id="+id, corDetailsCallBack); } function corDetailsCallBack(arrIndex) { if (eDealXmlhttpArr[arrIndex].readyState == 4) { hideWaiting(); document.getElementById("CORDETAILS").innerHTML=eDealXmlhttpArr[arrIndex].responseText; } } function refreshCorres() { _grid__CORRSLIST_js_.render(); } function refreshTodos() { _grid__TODSLIST_js_.render(); } function refreshReservs() { _grid__RESINLIST_js_.render(); } function refreshCorrchild() { _grid__CORRCHILD_js_.render(); } $(document).ready(function() { if (tabCorpIsFirst()) { refreshCorDetails('<%= id %>'); } }); function tabCorpIsFirst() { return InteractionTabs_divIds[0] == 'CORDETAILS'; } function sendInvitation() { <% if (corresList != null && !corresList.isEmpty()) { %> window.open('<fl:webapp/>/popup_templates_mail.fl?objSql=Interaction&objID=<%= id %>', 'EMAIL', 'menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,width=700,height=350'); <% } %> } function doOnLoad() { <%if(typeInteraction.equals("CORR")){ %> refreshTodos(); <%} else if (typeInteraction.equals("TODO")){%> refreshCorres(); <% } %> } function doRefresh() { window.top.location.reload(); } <% if(request.getParameter("downloadFusion")!=null) { %> $(document).ready(function () { window.setTimeout("window.location=\"<%= request.getParameter("downloadFusion") %>\"", 3000); }); <% } %> </script> <link href="<fl:webapp/>/css/smalltabs_css.jsp" rel="stylesheet" type="text/css"> <!-- CSS of listAjax_car_details.jsp in order to don't include them in innerHTML via Ajax, because IE doesn't apply them --> <style type="text/css"> .intReport { border: 1px solid #9EC6D0; padding : 0px 10px 0px 10px; margin-top: 5px; min-height: 20px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; overflow: auto; } </style> <fl:bigTabs objectTitle="<%= Utils.getMessage(session, codetitreFen, titreFen) %>" ou="<%= \"/read_interaction.fl\" + (id != null ? \"?id=\" + id : \"\") %>"> <table class="container" cellpadding="0"> <tr> <td class="column2"> <table class="container" cellpadding="0"> <tr class="fieldline"> <td class="dataLabel"><fl:label field="IntDate"/></td> <td nowrap="nowrap"> <fl:getProperty name="Interaction" property="IntDate" alt=" "/> </td> <td> <% if (Interaction.hasTimePeriodDisplay()) { String begHourS = Utils.formatToWebTime(session, begHour, true); String endHourS = Utils.formatToWebTime(session, endHour, true); boolean isMorning = false; boolean isAfternoon = false; boolean isAllDay = false; if ("08:30:00".equals(begHourS) && "12:00:00".equals(endHourS)) { isMorning = true; } else if ("14:00:00".equals(begHourS) && "17:30:00".equals(endHourS)) { isAfternoon = true; } else if ("08:30:00".equals(begHourS) && "17:30:00".equals(endHourS)) { isAllDay = true; } if (isMorning) { %> <fl:getMessage code="L62AC" alt="matin"/> <% } else if (isAfternoon) { %> <fl:getMessage code="F60AC" alt="après-midi"/> <% } else if (isAllDay) { %> <fl:getMessage code="L62AD" alt="Toute la journée"/> <% } %> </td> </tr> <%} else { if(typeInteraction.equals("CORR")){%> <fl:fieldRead property="IntCatID"/> <%}%> <fl:fieldRead property="IntTimeBeg" format="HH:mm"/> <fl:fieldRead property="IntTimeEnd" format="HH:mm"/> <% } %> <tr class="ligne_separation"><td></td></tr> <tr class="ligne_separation"><td></td></tr> <%---------------------- Tester s'il faut afficher la liste des correspondants en dehors du cas d'une TODO------------------------%> <% String correspondents = ""; if(typeInteraction.equals("CORR")){ correspondents = InteractionSyntaxActions.getIntCorrespondentHtml(session,context,id); %> <tr class="fieldline"> <td class="dataLabel" id="IntCorID_label"><fl:label field="IntCorID"/></td> <td class="dataValue" id="IntCorID_value"> <div> <%=correspondents%> </div> </td> </tr> <fl:fieldRead property="IntTiersConc_" separator="<br>" bean="true" href="true" disp="<%= flRequest.computeURL(\"/read_enterprise.fl\") %>"/> <fl:fieldRead property="IntSentMailID" separator="<br>" bean="true" href="true" disp="<%= flRequest.computeURL(\"/download\") %>"/> <% if (solicitationID != null) { %> <fl:fieldRead property="IntSolicitation_" separator="<br>" bean="true" href="true" disp="<%= flRequest.computeURL(\"/read_solicitation.fl\") %>"/> <%} %> <%} %> <tr class="ligne_separation"><td></td></tr> <%---------------------- Seulement si c'est une TODO------------------------%> <% if(typeInteraction.equals("TODO")){%> <fl:fieldRead property="IntPrevMail_" valueCodeIfTrue="L2005" valueCodeIfFalse="L2006"/> <fl:fieldRead property="IntTiersConc_" separator="<br>" bean="true" href="true" disp="<%= flRequest.computeURL(\"/read_enterprise.fl\") %>"/> <%}%> <%---------------------- Seulement si c'est une TODO------------------------%> </table> </td> <td class="separation"><div class="separation"></div></td> <td class="column2"> <table class="container" cellpadding="0"> <fl:fieldRead property="IntTheme_"/> <fl:fieldRead property="IntSubject"/> <tr class="ligne_separation"><td></td></tr> <fl:fieldRead property="IntActID" separator="<br>" bean="true" href="true" disp="<%= flRequest.computeURL(\"/read_actor.fl\") %>"/> <fl:fieldRead property="IntDestPrincipal_" separator="<br>" bean="true" href="true" disp="<%= flRequest.computeURL(\"/read_actor.fl\") %>"/> <fl:fieldRead property="IntDestCopie_" separator="<br>" bean="true" href="true" disp="<%= flRequest.computeURL(\"/read_actor.fl\") %>"/> <fl:fieldRead property="IntStiID"/> <% if(intParentID!=null){ %> <fl:fieldRead property="IntParentID" bean="true" href="true" disp="<%= flRequest.computeURL(\"/read_interaction.fl\") %>"/> <% } %> </table> </td> </tr> </table> <table class="container" cellpadding="0"> <tr> <td colspan="2"> <fl:label field="IntReport"/> <fl:input height="350px" property="IntReport" nodiv="true"/> </td> </tr> </table> <% if(sentmailID != null) { %> <table class="container" cellpadding="0"> <tr> <td colspan="2"> <fl:notes name="IntNotes_" title="<%= Utils.getMessage(session, \"FF298\", \"Corps du Message e-mail envoyé\") %>" nbPix="32"> <%=msgContent %> </fl:notes> </td> </tr> </table> <%} %> <fl:notes name="IntNotes_" title="<%= Utils.getMessage(session, \"L64B4\", \"Commentaires\") %>" nbPix="32"><fl:getProperty name="Interaction" property="IntNotes_" alt=""/></fl:notes> <fl:smallTabs name="InteractionTabs"> <%---------------------- Seulement si c'est une TODO------------------------%> <% if(typeInteraction.equals("TODO")){%> <fl:sTab id="STab1" title="Correspondances" onselect="refreshCorres();"> <fl:grid name="CORRSLIST" ajaxUrl="<%= \"/embedded_list_ajax.fl?code=CORRSLIST&IntID=\" + corrIDs %>" /> </fl:sTab> <%}%> <%---------------------- Seulement si c'est une Correspondance------------------------%> <% if(typeInteraction.equals("CORR")){%> <fl:sTab id="STab2" title="Todos" onselect="refreshTodos();"> <fl:grid name="TODSLIST" ajaxUrl="<%= \"/embedded_list_ajax.fl?code=TODSLIST&IntID=\" + tdIDs %>" /> </fl:sTab> <%}%> <fl:sTab id="ATTACHMENT" title="<%= Utils.getMessage(session, \"L201C\", \"Documents joints\") %>" > <fl:attach name="Interaction" colID="IntAttID" edit="false" listFobs="true"/> </fl:sTab> <%---------------------- Seulement si c'est une Correspondance------------------------%> <% if(typeInteraction.equals("CORR")){%> <fl:sTab id="STab3" title="Réservations" onselect="refreshReservs();"> <fl:grid name="RESINLIST" ajaxUrl="<%= \"/embedded_list_ajax.fl?code=RESINLIST&Rs_ID=\" + resaIDs %>" /> </fl:sTab> <%}%> <%---------------------- Seulement si c'est une Correspondance------------------------%> <% if(typeInteraction.equals("CORR")){ String TabIntAssociees = null; try { TabIntAssociees = context.getContextParameter("Sales.Interaction.Renvoi.TabIntAssociees"); } catch (Exception e) { } if(TabIntAssociees!=null && "true".equalsIgnoreCase(TabIntAssociees)){ %> <fl:sTab id="STab4" title="Correspondances associées" onselect="refreshCorrchild();"> <fl:grid name="CORRCHILD" ajaxUrl="<%= \"/embedded_list_ajax.fl?code=CORRCHILD&IntParentID=\" + id %>" /> </fl:sTab> <%}}%> </fl:smallTabs> </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 editor = CKEDITOR.replace('IntReport', { toolbar : [ ] }); 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'); } }); 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())); } </script>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de