Edit C:\Windows\install\galaxie_p01_15-09\sales\interaction\availability.jsp
<%@page import="com.edeal.frontline.ObjectsBean"%> <%@page import="org.json.JSONObject"%> <%@page import="org.json.JSONArray"%> <%@page import="com.edeal.frontline.helper.InteractionBaseHelper"%> <% /****************************************************************************** * 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"%> <%@ page import="com.edeal.frontline.navigation.FlRequest" %> <%@ page import="com.edeal.frontline.DataDictionary" %> <%@ page import="com.edeal.frontline.FlContext" %> <%@ page import="com.edeal.frontline.ActorBean" %> <%@ page import="java.util.Vector" %> <%@ page import="com.edeal.frontline.Utils" %> <%@ page import="java.text.DecimalFormat" %> <%@ page import="com.edeal.frontline.FlLocale" %> <%@ page import="java.util.GregorianCalendar" %> <%@ page import="java.text.SimpleDateFormat" %> <%@ page import="java.util.Calendar" %> <%@ page import="com.edeal.frontline.controller.actions.AvailabilityCalculationAction" %> <%@ page import="java.util.Date" %> <%@ page import="com.edeal.frontline.controller.actions.SelectAction" %> <%@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(); FlLocale flLocale = FlLocale.getInstance(session); DecimalFormat lengthDF = flLocale.getDecimalFormat("###0.##"); Date beginDate = new Date(); try { beginDate = Utils.formatDateFromWeb(session, flRequest.getRequestParameterOrAttribute("date")); } catch (Exception e) { } String multivalSeparator = Utils.getRequestParameter(context, request, "$$multivalSeparator"); if (multivalSeparator == null || "null".equals(multivalSeparator) ) { multivalSeparator = "|"; } String actor = flRequest.getRequestParameterOrAttribute("actor"); Vector actorIDs; if (actor == null) { actorIDs = new Vector<String>(); } else { actorIDs = Utils.explodeList(actor, multivalSeparator); } Vector actors = new Vector(); ObjectsBean objBean = dico.getTable("sql", "Actor"); String xmlListSelect = objBean.getObjSelectListID(); ActorBean actorBean; JSONArray result = new JSONArray(); JSONObject anItem; if (actorIDs != null) { for (int i = 0 ; i < actorIDs.size() ; i++) { try { actorBean = new ActorBean((String)actorIDs.elementAt(i), session); actors.addElement(actorBean); anItem = new JSONObject().put("value", actorBean.getID()).put("label", actorBean.toString()); result.put(anItem); } catch (Exception e) { } } } for (int i = 0 ; i < actorIDs.size(); i++) { String actName; try { actName = actors.elementAt(i).toString(); } catch (Exception e) { actName = ""; } } String beginHour = context.getContextParameter("HourOfBeginningOfDay"); if (beginHour == null) { beginHour = "08:00"; } int begHour = 8; int begMin = 1; if (beginHour.indexOf(":") < 0) { try { begHour = Integer.parseInt(beginHour); } catch (NumberFormatException nfe) { } } else if (beginHour.indexOf(":") == 0) { begHour = 0; try { begMin = Integer.parseInt(beginHour.substring(1)) + 1; } catch (NumberFormatException nfe) { } } else { try { begHour = Integer.parseInt(beginHour.substring(0, beginHour.indexOf(":"))); } catch (NumberFormatException nfe) { } try { begMin = Integer.parseInt(beginHour.substring(beginHour.indexOf(":") + 1)) + 1; } catch (NumberFormatException nfe) { } } String endHourS = context.getContextParameter("HourOfEndOfDay"); if (endHourS == null) { endHourS = "19:00"; } int endHour = 19; int endMin = 1; if (endHourS.indexOf(":") < 0) { try { endHour = Integer.parseInt(endHourS); } catch (NumberFormatException nfe) { } } else if (endHourS.indexOf(":") == 0) { endHour = 0; try { endMin = Integer.parseInt(endHourS.substring(1)) + 1; } catch (NumberFormatException nfe) { } } else { try { endHour = Integer.parseInt(endHourS.substring(0, endHourS.indexOf(":"))); } catch (NumberFormatException nfe) { } try { endMin = Integer.parseInt(endHourS.substring(endHourS.indexOf(":") + 1)) + 1; } catch (NumberFormatException nfe) { } } int length = 60; try { length = Integer.parseInt(flRequest.getRequestParameterOrAttribute("length")); // en minutes } catch (NumberFormatException e) { } int nbSlots = ((endHour * 60 + endMin) - (begHour * 60 + begMin)) / AvailabilityCalculationAction.NB_MIN_IN_ONE_SLOT; String origin = flRequest.getRequestParameterOrAttribute("origin"); GregorianCalendar beginCalendar = flLocale.getCalendar(); beginCalendar.setTime(beginDate); %> <html> <head> <title><fl:getMessage code="A1013" alt="Calcul des plages de disponibilité"/></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"> <link rel="stylesheet" type="text/css" href="<fl:link url="/common/select/select_css.jsp"/>"> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/checkFields.jsp"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/ajax/sarissa.js"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/ajax/ajax.js"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/master_js.jsp"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/ac/fobAC_js.jsp"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/calendar.jsp"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/utils.js"></script> <style type="text/css"> th.availability_header { font-size: 12px; font-family: Arial,Verdana,sans-serif; color: rgb(43, 71, 137); background-color: rgb(235, 244, 246); font-weight: bold; border: 1px dashed #9EC6D0; } .legend { text-align: center; width: 100%; } .table_legend { width: 100%; } #availability_table { visibility: hidden; } .criteria_label { display: block; float: left; } .criteria_field { display: block; float: left; } .available { font-size: small; font-size: expression("x-small"); font-family: Arial,Verdana,sans-serif; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); border: 1px dashed #9EC6D0; cursor: pointer; } .busy { font-size: small; font-size: expression("x-small"); font-family: Arial,Verdana,sans-serif; color: rgb(0, 0, 0); background-color: rgb(43, 71, 137); border: 1px dashed #9EC6D0; cursor: auto; } .notEnoughTime { font-size: small; font-size: expression("x-small"); font-family: Arial,Verdana,sans-serif; color: rgb(43, 71, 137); background-color: rgb(191, 217, 223); font-weight: bold; border: 1px dashed #9EC6D0; cursor: auto; } </style> <script type="text/javascript" language="javascript"> nbSlots = <%= nbSlots %>; dates = [<% for (int i = 0; i < AvailabilityCalculationAction.NB_DAYS; i++) { if (i > 0) { beginCalendar.add(Calendar.DAY_OF_YEAR, 1);%>, <% } %>'<%= Utils.formatToWebDate(session, beginCalendar.getTime(), false) %>'<% } %>]; avStatus = [ <% for (int i = 0; i < AvailabilityCalculationAction.NB_DAYS; i++) { %><%= i > 0 ? ", " : "" %>[<% for (int j = 0; j < nbSlots; j++) { %><%= j > 0 ? ", " : "" %><%= AvailabilityCalculationAction.BUSY %><% } %> ]<% } %> ]; function redraw() { document.getElementById('body_middle').style.visibility = 'hidden'; document.getElementById('availability_table').style.visibility = 'hidden'; for (var i = 0; i < dates.length; i++) { var node = document.getElementById('day' + i); node.innerHTML = dates[i]; } for (var i = 0; i < avStatus.length; i++) { for (var j = 0; j < avStatus[i].length; j++) { var node = document.getElementById(i + ':' + j); if (avStatus[i][j] == <%= AvailabilityCalculationAction.AVAILAIBLE %>) { node.className = "available"; node.setAttribute("createint", "true"); node.setAttribute("date", dates[i]); node.setAttribute("title", dates[i] + " " + node.getAttribute("time")); } else if (avStatus[i][j] == <%= AvailabilityCalculationAction.NOT_ENOUGH_TIME %>) { node.className = "notEnoughTime"; node.setAttribute("createint", "false"); node.setAttribute("date", dates[i]); node.setAttribute("title", dates[i] + " " + node.getAttribute("time")); } else { node.className = "busy"; node.setAttribute("createint", "false"); node.setAttribute("date", dates[i]); node.setAttribute("title", dates[i] + " " + node.getAttribute("time")); } } } document.getElementById('availability_table').style.visibility = 'visible'; document.getElementById('body_middle').style.visibility = 'visible'; } function createInt(node) { var date = node.getAttribute("date"); var time = node.getAttribute("time"); var allowed = node.getAttribute("createInt"); if (allowed == "true") { <% if ("interaction".equalsIgnoreCase(origin)) { %> var f = document.forms[0]; var mf = window.top.opener.document.forms[0]; mf.IntDate.value = date; mf.IntTimeBeg.value = time; // calcul de l'heure de fin // calcul heure debut en minute var index = time.indexOf(hourSeparator); if (index >= 0) { begHour = time.substring(0, index); begMinute = time.substring(index + 1); beginInMinute = Number(begHour) * 60 + Number(begMinute); end = beginInMinute + Number(f.length.value); } endHour = '00' + Math.floor(end / 60).toString(); endHour = endHour.substring(endHour.length - 2); endMinute = '00' + (end % 60).toString(); endMinute = endMinute.substring(endMinute.length - 2); mf.IntTimeEnd.value = endHour + hourSeparator + endMinute; var edMan = window.top.opener.edManager; var currentActView = edManager.getViewByID("IntActID"); if (edMan) { var view = edMan.getViewByID("IntActID"); if (view) { view.model.reset(); view.model = currentActView.model; /*currentActView.model.each(function(modelItem) { view.model.add(modelItem, {silent:true}); });*/ view.render(); view.$el.focus(); } } /*var chaineEval = "leSelect = document.forms[0].lblIntActID;"; chaineEval += "while (leSelect.options.length > 0) leSelect.options[leSelect.options.length - 1] = null;"; for (i=0 ; i< f.lblIntActID.options.length ; i++) { chaineEval += "leSelect.options[" + i + "] = new Option(\"" + f.lblIntActID.options[i].text + "\" , \"" + f.lblIntActID.options[i].text + "\");"; } window.top.opener.document.forms[0].evalIntActID.value = chaineEval; window.top.opener.document.forms[0].IntActID.value = f.IntActID.value; window.top.opener.document.forms[0].lblIntActID.focus();*/ window.top.close(); <% } else if ("agenda".equalsIgnoreCase(origin)) {%> window.open('<fl:webapp/>/create_interaction.fl?fromAgenda=1&initIntDate=' + date + '&initIntTimeBeg=' + time + '&initIntActID=<%=actor%>' , 'CreateInteraction'); <%}else { %> alert("Création d'une interaction le " + date + " à " + time); <% } %> } } function doSubmit() { var f = document.forms[0]; var actorView = edManager.getViewByID("IntActID"); isSubmit = true; if (actorView.model.length == 0) { alert("<fl:getMessage code="M300F" alt="Veuillez renseigner au moins un acteur" js="true"/>"); return; } if (f.length.value=='') { alert("<fl:getMessage code="M3011" alt="Veuillez renseigner une durée" js="true"/>"); return; } if (f.IntDate.value=='') { alert("<fl:getMessage code="M3010" alt="Veuillez renseigner une date de début" js="true"/>"); return; } var table = document.getElementById("availability_table"); table.style.visibility = "hidden"; var td = document.getElementById("body_middle"); td.style.visibility = "hidden"; doAjax("<fl:webapp/>/availability_ajax.fl?IntActID=" + Utils.getNormalizedValuesFromView("IntActID") + "&IntDate=" + f.IntDate.value + "&length=" + f.length.value); } function onremoveactor() { var actorView = edManager.getViewByID("IntActID"); if (actorView.model.length > 0) { doSubmit(); } } function doOnLoad() { var f = document.forms[0]; f.IntDate.value = '<%= Utils.formatToWebDate(session, beginDate, true) %>'; } function calcLength() { var f = document.forms[0]; f.length.value = toSysNum(f.duree.value) * 60; } $(document).ready(loadMainContent); function loadMainContent() { var context = new edContext('{}'); $(document).one("edApplication_onInitialize", computeEdViews); var application = new edApplication({path: "<fl:webapp/>/", isgeolocalizationactivated: false, geocoderkey: "" }); } function computeEdViews() { edManager.createEdViewsFromHTML(); } </script> <!--[if IE 7]> <script type="text/javascript" language="javascript" src="./js/edeal/libraries/json.org/json2/json2.js"></script> <![endif]--> <script type="text/javascript" language="javascript" src="./js/edeal/context/edContext.js"></script> <script type="text/javascript" language="javascript" src="./js/edeal/application/edApplication.js"></script> <script type="text/javascript" language="javascript" src="./js/edeal/libraries/includeJS/include.js"></script> <script type="text/javascript" language="javascript" src="./js/edeal/tools/utils.js"></script> <script type="text/javascript" language="javascript" src="./js/edeal/managers/edManager.js"></script> </head> <body> <form> <table class="global" cellpadding="0"> <tr> <td class="header_top_left"></td> <td class="header_top_middle"></td> <td class="header_top_right"></td> </tr> <tr> <td class="header_center_left_long" style="height: auto;"></td> <td class="header_center_middle title"> <table class="container" cellpadding="0"> <tr> <td style="width: 99%; vertical-align: top;"> <div class="criteriaTableDiv" style="text-align: center;vertical-align: top;"> <table class="container" cellpadding="0"> <tr class="fieldline"> <td style="width: 50px;" nowrap> <table class="container" cellpadding="0"> <tr> <td class="criteriaLabel" nowrap> <label for="IntActID" title="Acteurs"><fl:getMessage code="F1050" alt="Acteur(s)"/></label> </td> </tr> <tr> <td> <edLink image='icons/ico/rechercher.gif' values="<fl:getMessage code="A2003" alt="Sélectionner"/>" target="POPUP" url='xml_select_multiple_list.fl?id=<%=xmlListSelect%>&field=IntActID'></edLink> </td> </tr> </table> </td> <td style="width: 185px; padding-left: 5px;"> <!--<fl:input property="IntActID" nodiv="true" style="vertical-align: top;"/>--> <edAutoComplete id="IntActID" isMultiValued="true" isRequired="false" values='<%=result.toString()%>' autocomplete='{"objname": "ActID", "searchtype": "FOB", "minimumCharacters": 2}' actions='{"sort": {"active": false}, "add": {"active": true, "authorizedouble": false}, "remove": {"active": true}}' onRender='doSubmit();' onaddmodeltocollection='doSubmit();' onremovemodelfromcollection='onremoveactor();' > </edAutoComplete> </td> <td nowrap> <span class="criteriaLabel leftMargin10" style="vertical-align: top;"><fl:getMessage code="L302F" alt="Jour début"/></span> <fl:input property="IntDate" htmlClass="criteriaField" nodiv="true" size="8" style="vertical-align: top; width: auto"/> <span class="criteriaLabel leftMargin10" style="vertical-align: top;"><fl:getMessage code="F0055" alt="Durée"/></span> <input type="hidden" name="length" value="<%= length %>"> <input type="text" size="1" name="duree" class="criteriaField" style="text-align: right;vertical-align: top; width:auto;" value="<%= lengthDF.format((float)(new Integer(length).floatValue() / 60)) %>" onFocus="this.select();" onChange="ctrlNumField(this, 'float', '<fl:getMessage code="M2003" alt="Le format du champs est incorrect, veuillez corriger." js="true"/>'); calcLength();"> <span class="criteriaLabel" style="vertical-align: top;"><fl:getMessage code="L6063" alt="h"/></span> </td> </tr> </table> </div> </td> <td style="width: 1%; text-align: left; padding-right: 10px;"> <edLink image='icons/ico/valider.gif' values="<fl:getMessage code="A2001" alt="Valider"/>" js='doSubmit();'></edLink> <!-- <input type="image" src="<fl:link url="/icons/ico/valider.gif"/>" class="search_button"> --> </td> </tr> </table> </td> <td class="header_center_right_long" style="height: auto;"></td> </tr> <tr> <td class="header_bottom_left"></td> <td class="header_bottom_middle"></td> <td class="header_bottom_right"></td> </tr> <tr> <td class="body_left"></td> <td class="body_middle" id="body_middle"> <table class="container" id="availability_table" cellpadding="0"> <thead> <tr> <th rowspan="2"></th> <% GregorianCalendar cal = flLocale.getCalendar(); cal.setTime(beginDate); cal.set(Calendar.HOUR_OF_DAY, begHour); cal.set(Calendar.MINUTE, begMin); cal.add(Calendar.MINUTE, -1); SimpleDateFormat hourFormat = flLocale.getSimpleDateFormat("HH"); SimpleDateFormat minFormat = flLocale.getSimpleDateFormat("mm"); SimpleDateFormat hourMinFormat = flLocale.getSimpleDateFormat("HH:mm"); for (int slot = 0; slot < nbSlots; slot++) { if (slot % 2 == 0 || slot == nbSlots) { boolean needColspan = !((slot == 0 && cal.get(Calendar.MINUTE) == 30) || (slot == nbSlots && cal.get(Calendar.MINUTE) == 0)); %> <th class="availability_header" <% if (needColspan) { %>colspan="2" <% } %> ><%= hourFormat.format(cal.getTime()) %></th> <% } cal.add(Calendar.MINUTE, AvailabilityCalculationAction.NB_MIN_IN_ONE_SLOT); } %> </tr> <tr> <% cal.setTime(beginDate); cal.set(Calendar.HOUR_OF_DAY, begHour); cal.set(Calendar.MINUTE, begMin); cal.add(Calendar.MINUTE, -1); for (int slot = 0; slot < nbSlots; slot++) { %> <th class="availability_header"><%= minFormat.format(cal.getTime()) %></th> <% cal.add(Calendar.MINUTE, AvailabilityCalculationAction.NB_MIN_IN_ONE_SLOT); } %> </tr> </thead> <tbody> <% for (int day = 0; day < AvailabilityCalculationAction.NB_DAYS; day++) { cal.setTime(beginDate); cal.add(Calendar.DAY_OF_YEAR, day); cal.set(Calendar.HOUR_OF_DAY, begHour); cal.set(Calendar.MINUTE, begMin); cal.add(Calendar.MINUTE, -1); %> <tr> <th class="availability_header" id="day<%= day %>"><%= Utils.formatToWebDate(session, cal.getTime(), false) %></th> <% for (int slot = 0; slot < nbSlots; slot++) { %> <td id="<%= day %>:<%= slot %>" class="busy" title="<%= Utils.formatToWebDate(session, cal.getTime(), false) %> <%= hourMinFormat.format(cal.getTime()) %>" date="<%= Utils.formatToWebDate(session, cal.getTime(), false) %>" time="<%= hourMinFormat.format(cal.getTime()) %>" createint="false" onclick="createInt(this);"> </td> <% cal.add(Calendar.MINUTE, AvailabilityCalculationAction.NB_MIN_IN_ONE_SLOT); } %> </tr> <% } %> </tbody> </table> <br/> <div class="legend"> <table class="table_legend" align="center"> <tbody> <tr> <td class="available" style="width: 15px"><img src="<fl:webapp/>/icons/spacer.gif" height="1" width="15"/></td> <td class="dataValue" style="width: auto; white-space: nowrap;"><fl:getMessage code="L3036" alt="Tous les acteurs sont disponibles"/></td> </tr> <tr> <td class="notEnoughTime" style="width: 15px"><img src="<fl:webapp/>/icons/spacer.gif" height="1" width="15"/></td> <td class="dataValue" style="width: auto; white-space: nowrap;"><fl:getMessage code="L3037" alt="Tous les acteurs sont disponibles mais il n'y a pas assez de temps pour l'interaction"/></td> </tr> <tr> <td class="busy" style="width: 15px"><img src="<fl:webapp/>/icons/spacer.gif" height="1" width="15"/></td> <td class="dataValue" style="width: auto; white-space: nowrap;"><fl:getMessage code="L3038" alt="Au moins un acteur est indisponible."/></td> </tr> </tbody> </table> </div> </td> <td class="body_right"></td> </tr> <tr> <td class="body_bottom_left"></td> <td class="body_bottom_middle"><img src="<fl:link url="/icons/popup/pop14.gif"/>" width="9" height="18"></td> <td class="body_bottom_right"></td> </tr> </table> <div id="waiting" style="display:none"><fl:getMessage code="L639B" alt="Chargement ..."/></div> </form> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de