Edit C:\galaxie\Back\galaxie\common\synchro\synchroItemLookupAction.jsp
<%@page import="java.text.SimpleDateFormat"%> <%@page import="org.apache.commons.lang.time.DateUtils"%> <%@page import="org.apache.commons.lang.StringUtils"%><%@page session="true"%><%@ page import="java.util.*" %><%@ page import="com.edeal.frontline.*" %><%@ page import="com.edeal.frontline.navigation.*" %><%@ page import="com.edeal.frontline.synchro.*" %><% final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(getClass()); FlRequest flRequest = new FlRequest(request); FlContext context = flRequest.getContext(); String errorMessage = null; String actID = request.getParameter("SynActID"); logger.debug("Synching: " + actID); String[] keys = { "SymID", "ActMail" }; String query = "SELECT SymID, ActMail from SyncModel, Actor where ActSyncModel = SymID and ActID = " + Utils.formatToSQL(context, actID); String symID; String actMail = null; SyncModelBean smb = null; try { Vector resp = BasicBean.listSQL(context, keys, query); Hashtable row = (Hashtable)resp.elementAt(0); symID = (String)row.get("SymID"); actMail = (String)row.get("ActMail"); smb = new SyncModelBean(symID, context); } catch (Exception e) { logger.error("SymCode not set for user! ", e); } if (actMail == null || smb == null) { %> {"errorStr" : "User doesn't have an email addr, or doesn't have a sync model!"} <% logger.error("User doesn't have an email addr, or doesn't have a sync model!"); return; } SyncManager sm = new SyncManager(); sm.initialize(smb); SyncUser user = sm.getUserByEmail(actMail); ExternalSession synchSession = ExternalSession.getInstance(sm, context, sm.getExternalContext(), user); String json = ""; try { synchSession.logon(); String synExternalID = flRequest.getParameter("SynExternalID"); if (StringUtils.isNotEmpty(synExternalID)) { json = retrieveExternalRDV(synExternalID, sm, synchSession); } else { String dateStr = flRequest.getParameter("IntDate"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy"); Date date = sdf.parse(dateStr); json = retrieveRDVsByDate(date, sm, synchSession); } } catch (Exception e) { logger.error("Error using synchro motor", e); } finally { synchSession.logoff(); } %> <%= json %> <%! public String retrieveExternalRDV(String extID, SyncManager sm, ExternalSession session) { StringBuilder buf = new StringBuilder(); try { Appointment appt = (Appointment)session.getExtAppt(extID); if (appt == null) { buf.append("{"); buf.append("\"errorStr\" : \"RDV not found\""); buf.append("}"); } else { buf.append("{"); buf.append("\"dataType\" : \"extID\","); buf.append("\"subject\" : \"" + appt.getSubject() + "\","); buf.append("\"start\" : \"" + appt.getStartDate() + "\","); buf.append("\"end\" : \"" + appt.getEndDate() + "\""); buf.append("}"); } } catch (Exception e) { buf.append("{"); buf.append("\"errorStr\" : \"" + e.toString() + "\""); buf.append("}"); } return buf.toString(); } %> <%! public String retrieveRDVsByDate(Date dateToSearch, SyncManager sm, ExternalSession session) { StringBuilder buf = new StringBuilder(); ArrayList<Appointment> apptList = new ArrayList<Appointment>(); try { ExternalCollection extCol = session.getExtApptList(); while (extCol.hasMoreElements()) { Appointment appt = (Appointment)extCol.nextElement(); if (DateUtils.isSameDay(appt.getStartDate(), dateToSearch)) { apptList.add(appt); } } buf.append("{"); buf.append("\"dataType\" : \"date\","); buf.append("\"rdvListSize\" : \"" + apptList.size() + "\","); buf.append("\"rdvList\" : ["); for (int cnt = 0; cnt < apptList.size(); cnt++) { Appointment appt = apptList.get(cnt); if (cnt > 0) { buf.append(","); } buf.append("{\"subject\" : \"" + appt.getSubject() + "\","); buf.append("\"start\" : \"" + appt.getStartDate() + "\","); buf.append("\"end\" : \"" + appt.getEndDate() + "\"}"); } buf.append("]"); buf.append("}"); } catch (Exception e) { buf.append("{"); buf.append("\"errorStr\" : \"" + e.toString() + "\","); buf.append("}"); } return buf.toString(); } %>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de