DynaActionForm calendardyna = (DynaActionForm) form;
try {
HttpSession session = request.getSession(true);
UserObject userobject = (UserObject) session.getAttribute("userobject");
int userID = userobject.getIndividualID();
int individualID = userobject.getIndividualID();
// Delegation
if (session.getAttribute("delegatorName") != null) {
userID = Integer.parseInt((String) session.getAttribute("delegatorName"));
}
if (request.getParameter("delegatorName") != null) {
userID = Integer.parseInt(request.getParameter("delegatorName"));
}
session.setAttribute("delegatorName", String.valueOf(userID));
calendardyna.set("delegatorName", session.getAttribute("delegatorName"));
Vector userColl = Delegator.getCalendarDelegatorIds(individualID, com.centraview.common.Constants.ACTIVITYMODULE,
com.centraview.common.Constants.VIEW, dataSource);
DDNameValue mydd = new DDNameValue(String.valueOf(individualID), (userobject.getfirstName() + ' ' + userobject.getlastName()));
userColl.add(mydd);
request.setAttribute("delegatorNameVec", userColl);
// Selected Acitivity Type
String activityType = request.getParameter("activityType");
if (session.getAttribute("activityType") == null) {
session.setAttribute("activityType", "All");
}
if (activityType != null) {
session.setAttribute("activityType", activityType);
}
activityType = (String) session.getAttribute("activityType");
calendardyna.set("activityType", activityType);
Vector activityTypeVec = new Vector();
activityTypeVec.add(new DDNameValue("All", "All Activities"));
activityTypeVec.add(new DDNameValue("Appointment", "Appointment"));
activityTypeVec.add(new DDNameValue("Meeting", "Meeting"));
activityTypeVec.add(new DDNameValue("Call", "Call"));
activityTypeVec.add(new DDNameValue("NextAction", "NextAction"));
activityTypeVec.add(new DDNameValue("OpportunityInfo", "OpportunityInfo"));
activityTypeVec.add(new DDNameValue("ProjectInfo", "ProjectInfo"));
activityTypeVec.add(new DDNameValue("Event", "Event"));
activityTypeVec.add(new DDNameValue("Task", "Task"));
request.setAttribute("activityTypeVec", activityTypeVec);
// What the hell??? what is the purpose of the default values here?
int timespan = 30;
TimeZone tz = null;
// get time zone from parameter or from preferences; worst case default to
// EST.
try {
if (request.getParameter("timeZone") != null) {
tz = TimeZone.getTimeZone(request.getParameter("timeZone"));
} else {
tz = TimeZone.getTimeZone((userobject.getUserPref()).getTimeZone());
}
} catch (Exception e) {
tz = TimeZone.getTimeZone("EST");
}
request.setAttribute("TZ", tz);
GlobalMasterLists globalMasterLists = GlobalMasterLists.getGlobalMasterLists(dataSource);
Vector timeZoneVec = (Vector) globalMasterLists.get("TimeZone");
request.setAttribute("timeZoneVec", timeZoneVec);
String timeZoneID = tz.getID();
calendardyna.set("timeZone", timeZoneID);
request.setAttribute("showAdvancedSearch", new Boolean(false));
request.setAttribute("showCustomViews", new Boolean(false));
request.setAttribute("showComposeButton", new Boolean(false));
request.setAttribute("showPrintButton", new Boolean(false));
request.setAttribute("searchButtonDescription", "Perform a quick search for activities information.");
request.setAttribute("newButtonValue", "Schedule");
HashMap moduleList = new HashMap();
if (globalMasterLists.get("moduleList") != null) {
moduleList = (HashMap) globalMasterLists.get("moduleList");
}
String moduleID = (String) moduleList.get("Activities");
request.setAttribute("moduleId", moduleID);
// if the type wasn't set on the parameter
// use the user preferences defaulting to daily view.
type = request.getParameter("Type");
if (type == null || type.length() <= 0) {
// Get the preferred view from the Preferences
UserPrefererences up = userobject.getUserPref();
String prefView = (up.getCalendarDefaultView() == null) ? "DAILY" : up.getCalendarDefaultView(); // default
// it
// to
// DAILY
if (prefView.equals("DAILY")) {