%-- #RevizeProperties USE REVIZE MENU (DOCUMENT PROPERTIES) TO EDIT DATA BELOW:
status=edit
options=
server=localhost:8080
projectName=demositeIII
label=
location=calendar_app/calendar_view_common/calendar_events-editform.jsp
version=
docType=editpage
subType=form
moduleName=calendar_events
fieldName=
channels=revize|Production|
description=New event creation
--%><%-- #BeginRZ-PageHeader
--%><%@ page language="java"
%><% String rzmodule = "calendar_events";
%><%@ include file="/util/setup_editform_header.jsp"
%><%-- #EndRZ-PageHeader --%>
Event Form
<%--
_____________________________________________________________________________________
See RZloadResources() for details on how page deviates from standard Revize edit page
_____________________________________________________________________________________
--%><%
%><%-- below include ONLY on calendar editform pages
--%><%@ include file="/util/setup_editform_javascript.jsp" %><%
%><%-- Below include on all calendar templates and edit pages --%>
<%@ include file="/plugins/calendar/calendar3.head_version_include.jsp" %><%--
//---------------------------------------------------------------------------------\\
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* DW use only (below tags NOT published); required files loaded during page setup *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
--%><% if (false) { %>
<% } %><%--
\\---------------------------------------------------------------------------------//
--%><%
/**********************************/
/*BOOKMARK Page specific JSP Code*/
/********************************/
String groupid = StringUtils.getParameter(request,"groupid");
String calendarid = StringUtils.getParameter(request,"calendarid");
String eventid = StringUtils.getParameter(request,"recordid");
String calid = rz.fetch("calendar_events","calendarid");
if (calendarid.length()> 0)
calid = calendarid;
String rollup_calendar_list = rz.fetch("calendar_names","rollup_calendar_list","","_recordid=" + calid);
/* _______________________________________________________________________
| |
| DCO 09-02-2014: support for repeat single date content override below |
| |
| NOTE: very little new code is used unless xml verion is 09-02-2014 |
|_______________________________________________________________________|
*/
boolean DEBUG = true;
String message = "";
String viewdate = StringUtils.getParameter(request,"viewdate");
String repeatId = StringUtils.getParameter(request,"repeatid");
String repeatDate = StringUtils.getParameter(request,"repeatdate");
String repeatWhere = ""; //used to fetch primary record field values
boolean repeatEdits = false;
Map repeatEditsMap = new HashMap();
Map repeatRecordsMap = new HashMap();
StringBuffer repeatFieldvalues = new StringBuffer("RZ.nothing=\"\";");
String xmlDataVersionStr = StringUtils.getParameter(request,"xmlDataVersion");
if (isRepeatContentOverride && xmlDataVersionStr.length() > 0)
{
try
{
xmlDataVersionStr = xmlDataVersionStr.replaceAll("/","-");
java.util.Date xmlDataVersion = StringUtils.parseDate(xmlDataVersionStr, "MM-dd-yyyy");
java.util.Date repeatVersion = StringUtils.parseDate("09-02-2014", "MM-dd-yyyy");
isRepeatContentOverride = repeatVersion.getTime() >= xmlDataVersion.getTime();
}
catch (Exception e) {}
}
while (isRepeatContentOverride)
{
String filter = "";
String format = "format=MM-dd-yyyy";
RegEx.Results results = null;
/****************************************************************/
/*BOOKMARK -----repeat single occurance properties found on url*/
/**************************************************************/
if (repeatId.length() > 0)
{
//----- If existing repeat single occurance record
if (!eventid.equals("new"))
{
rz.fetch("calendar_events","date_time_stamp");
if (!rz.content.equals(""))
message = "Displaying Content Saved on " + rz.content;
else
eventid = "new";
}
//----- If new repeat single occurance record, set to primary event content
if (eventid.equals("new"))
{
message = "Primary Event Content Displayed -- Updates will ONLY Apply to this Date";
repeatWhere = "recordid=" + repeatId;
// Create javascript to set RZ.fieldvalues[...] to use primary event content before
// snippet_helper_editform.js::RZeditformsetup() initializes non-text form fields.
for (int i=0; i 9)
{
repeatId = rz.content.substring(9);
repeatDate = rz.fetch("calendar_events","begin_date","format=MM-dd-yyyy");
break;
}
/*****************************************************************/
/*BOOKMARK -----repeat primary properties found in summary field*/
/***************************************************************/
String summary = rz.fetch("calendar_events","summary");
// backward compatibility for code before 09-02-2014
// convert ,; to ; at end of DATES: and ;- to ; at end of field
summary = summary.replaceFirst(",;",";").replaceFirst(";-",";");
%> <%=summary%><%
results = RegEx.match(summary, "EDITS:(.*)(?=;)");
if (results.isFound)
{
repeatEdits = true; //content override records created
// backward compatibility for code before 09-02-2014
results.group[1] = results.group[1].replaceAll("-(,|$)","$1");
//----- build list of ACTIVE repeat single occurance event records
// EDITS: items (mm-dd-yyyy=recordid) separated by commas
String edits[] = StringUtils.split(results.group[1],",");
StringUtils.console("------------------------");
StringUtils.console("edits: " + results.group[1]);
/*DCO 04-07-2017: no value unless REPEATID:...
for (int i=0;i 0)
{
filter = ",recordid="+recordid;
rz.fetch("calendar_events","begin_date", format+filter);
if (!date.equals(rz.content))
recordid = "";
else // add recordid if valid
repeatRecordsMap.put(date,recordid);
}
repeatEditsMap.put(date,recordid); // always add EDITS date
}
}
*/
}
/*****************************************************************************/
/*BOOKMARK -----build list of INACTIVE repeat single occurance event records*/
/***************************************************************************/
// This used to pass recordid to editform when called to edit
// content override record.
//
//TODO: Very expensive operation -- move into RZTagSupport ??
// Then this only needs to run here when EDITS: item is missing the recordid
//----- If repeat event content override have ever been selected fot this event
if (summary.indexOf("EDITS:") != -1)
{
filter = "summary=REPEATID:" + rz.editrecordid;
rz.listsetup("calendar_events", "noscript,noemptylistmessage", filter, "");
StringUtils.console("rzlist: filter=" + filter + " records=" + rz.listlength);
repeatRecordsMap = new HashMap();
repeatEditsMap = new HashMap();
while (rz.listnext())
{
if (rz.listindex < 0) continue;
if (!rz.fetch("calendar_events","summary").equals(filter))
continue; //history records not filtered
rz.fetch("calendar_events","begin_date",format);
StringUtils.console("begin_date["+rz.recordid+"]: " + rz.content);
// add to repeatRecordsMap if not already added
if (repeatRecordsMap.get(rz.content) == null)
repeatRecordsMap.put(rz.content,rz.recordid);
// update repeatEditsMap if recordid missing
// if (repeatEditsMap.get(rz.content) != null
// && (repeatEditsMap.get(rz.content)+"").length() == 0)
repeatEditsMap.put(rz.content,rz.recordid);
}
rz.listcomplete();
StringUtils.console(" ");
}
break;
}
%><%!
/**
* return json representation of java Map containing Strings
*/
String json(Map mapObj)
{
String json = "";
Iterator itr = mapObj.keySet().iterator();
while (itr.hasNext())
{
String key = itr.next() + "";
String value = "'" + mapObj.get(key) + "'";
String keyValue = "'" + key + "':" + value;
StringUtils.console(" json " + keyValue);
if (key.length() > 0)
json += "," + keyValue;
}
return "{" + StringUtils.sub(json,1) + "}";
}
/* _______________________________________________________________________
| |
| DCO 09-02-2014: support for repeat single date content override above |
|_______________________________________________________________________|
*/
/************************************/
/*BOOKMARK Page specific JavaScript*/
/**********************************/
%>
<%--
/*************************************************/
/* RZhidden class hides elements in browser but */
/* DW shows them as greyed out in design view */
/* Below css not published or rendered on jsp */
/*********************************************/
--%>
<% if (false){ %>
<% } %>
<%--
/***********************************/
/* Following css used by browsers */
/*********************************/
--%>
<%--
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
DELETE standard javascript include file after the body tag (if shown above)
It is included in the head section for edit pages and not used on templates
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
--%><%if (false){%>
NOTE: blocks with class="RZhidden" display with this background in DW only; they
are hidden when page displays in browser until changed by javascript or other CSS.