<%@ include file="/plugins/setup/setup_include_header.jsp" %><%-- __________________________________________________________________________________________ Used by calendar_db_calendarid_activemonth_list.rzt to create xml for list of months and calendar_db_calendarid_activeweek_list rzt to create xml file for list of weeks Create a list of periods that have events (YYYYMM or YYYYWW) for each calendar. See calendar_db_data.rzt for details regarding database template relationships. __________________________________________________________________________________________ --%> <% String TEMPLATE_VERSION = "05-14-2012"; %><%@include file="/plugins/calendar/calendar3.xml_common_include.jsp"%><% //XML--------------------------------- xmlBuilder.addTopXML("periods",TEMPLATE_VERSION); //------------------------------------ rz.fetch("calendar_config","default_calendar_name"); String masterid = rz.content; rz.fetch("calendar_names","calendar_name"); String calendarid = rz.recordid; xmlBuilder.addLog("masterid=" + masterid + " calendarid=" + calendarid); String fieldname = "year_month"; String template = "calendar_db_calendarid_activemonthsdata_YYYYMM"; String view = request.getParameter("view"); if (view != null && view.equals("week")) { fieldname = "year_week"; template = "calendar_db_calendarid_activeweeksdata_YYYYWW"; } xmlBuilder.addLog("fieldname=" + fieldname + " template=" + template); //XML------------------------------ // " output="none" options="noemptylistmessage" filter="<%=filter%>"><% while ( rz.listnext() ) { if (rz.listindex < 0) break; //no active records (e.g. no information available) if (rz.isgroupheader) havePeriod = false; //reset flag if year_month changes if (havePeriod) continue; //skip if already have this year_month String period = rz.fetch("calendar_mapping",fieldname); if (period.equals("")) continue; //----- If not master calendar, not current calendar nor rolled up to this calendar, skip if (!masterid.equals(calendarid) && !rz.fetch("calendar_mapping", "calendarid").equals(calendarid)) //****** Disable rollup ****** //&& (rz.fetch("calendar_events", "rollup") + "|").indexOf(calendarid+"|") == -1) continue; //skip this year_month if (period.length() < 4) //year missing { xmlBuilder.addLog("Year missing in field" + fieldname); continue; } if (period.length() < 6) //month or week missing { xmlBuilder.addLog(fieldname.substring(5) + " missing after year in field: " + fieldname); continue; } %><% havePeriod = true; //flag to skip this period String mapid = rz.recordid; String eventid = rz.fetch("calendar_mapping", "eventid"); String event_filter = "_recordid=" + rz.fetch("calendar_mapping", "eventid"); xmlBuilder.addLog("--------------------------------------------------------------------------"); xmlBuilder.addLog( "mapid=" + mapid + " " + period + " " + " (eventid=" + eventid + ") calendarid=" + rz.fetch("calendar_mapping","calendarid") + " rollup=" + rz.fetch("calendar_events", "rollup", "", event_filter) ); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ %><% /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ attr.clear(); attr.add("year=" + period.substring(0,4)); attr.add(view + "=" + period.substring(4,6)); //XML-------------------- // month or week tag xmlBuilder.addXML(view,period); //----------------------- %><% } %><% //XML--------------- xmlBuilder.closeXML(view+"s"); //----------------- //----- Add log entries to xml for debugging (cannot be top level tag) xmlBuilder.closeLog(); //----- Close top level tag and Output the XML //XML--------------- xmlBuilder.closeXML("periods"); //------------------ out.print(xmlBuilder.getXml()); %>