<%@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(); } 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); %> <fl:getMessage code="A1013" alt="Calcul des plages de disponibilité"/> ">
" target="POPUP" url='xml_select_multiple_list.fl?id=<%=xmlListSelect%>&field=IntActID'>
'); calcLength();">
" js='doSubmit();'>
<% 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)); %> <% } cal.add(Calendar.MINUTE, AvailabilityCalculationAction.NB_MIN_IN_ONE_SLOT); } %> <% 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++) { %> <% cal.add(Calendar.MINUTE, AvailabilityCalculationAction.NB_MIN_IN_ONE_SLOT); } %> <% 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); %> <% for (int slot = 0; slot < nbSlots; slot++) { %> <% cal.add(Calendar.MINUTE, AvailabilityCalculationAction.NB_MIN_IN_ONE_SLOT); } %> <% } %>
colspan="2" <% } %> ><%= hourFormat.format(cal.getTime()) %>
<%= minFormat.format(cal.getTime()) %>
<%= Utils.formatToWebDate(session, cal.getTime(), false) %> 

" width="9" height="18">