%@page session="true" contentType="text/html; charset=UTF-8"%>
<%@ page import="com.edeal.frontline.controller.actions.agenda.AgendaEntryList" %>
<%@ page import="com.edeal.frontline.controller.actions.agenda.AgendaEntry" %>
<%@ page import="com.edeal.frontline.navigation.FlRequest" %>
<%@ page import="com.edeal.frontline.*" %>
<%@ page import="org.json.JSONObject" %>
<%@ page import="java.util.Date" %>
<%@ page import="java.text.DateFormat" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="org.json.JSONArray" %><%
final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(getClass());
FlRequest flRequest = new FlRequest(request);
FlContext context = flRequest.getContext();
AgendaEntryList list = (AgendaEntryList)flRequest.getAttribute("AgendaEntryList");
String actId = (String) session.getAttribute("actorID");
DateFormat dfs = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
JSONArray array = null;
if (list != null && list.size() > 0) {
array = new JSONArray();
for (int i = 0; i < list.size();i++) {
AgendaEntry entry = list.getEntryAt(i);
String subject = entry.getSubject();
//subject=(subject==null)?"":Utils.formatToJavascript(subject);
String body = entry.getText();
//body=(body==null)?"":" "+Utils.formatToJavascript(body);
try {
JSONObject obj = new JSONObject();
obj.put("id", entry.getObjectID());
obj.put("title", subject + ((body == null) ? "" : body));
obj.put("start", dfs.format(entry.getBeginningDate()));
obj.put("end", dfs.format(entry.getEndDate()));
obj.put("allDay", new Boolean(false));
obj.put("url", "javascript:show(\'Interaction\',\'" + entry.getObjectID() + "\');");
obj.put("editable", actId.equalsIgnoreCase(flRequest.getParameter("actor")) ? new Boolean(true) : new Boolean(false));
obj.put("description", entry.getIcon());
obj.put("className", "class-" + entry.getCategory());
array.put(obj);
} catch (Exception e) {
logger.error("Exception occured in the Agenda JSON :" + e.getMessage());
}
} // for
}
String json = array == null ? null : array.toString();
logger.debug("json--------- : " + json);%>
<%= json %>