Author: adrianc
Date: Tue Jan 3 15:50:27 2012
New Revision: 1226837
URL:
http://svn.apache.org/viewvc?rev=1226837&view=revLog:
CreateUrlParam.groovy improvement. The original version had hard-coded parameters for calendar navigation - making it difficult to reuse the calendar screen in other applications. My previous commit removed that restriction, but it introduced bugs in the calendar event edit form. This commit permits applications to specify URL parameters for calendar navigation while preserving backward-compatible behavior.
Modified:
ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/CreateUrlParam.groovy
Modified: ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/CreateUrlParam.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/CreateUrlParam.groovy?rev=1226837&r1=1226836&r2=1226837&view=diff==============================================================================
--- ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/CreateUrlParam.groovy (original)
+++ ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/CreateUrlParam.groovy Tue Jan 3 15:50:27 2012
@@ -20,12 +20,16 @@
import java.util.*;
import org.ofbiz.base.util.*;
-Map urlParametersMap = UtilHttp.getQueryStringOnlyParameterMap(request);
-urlParametersMap.remove("period");
-urlParametersMap.remove("start");
-urlParametersMap.remove("form");
+// Allow containing screens to specify URL parameters to be included in calendar navigation links
+List urlParameterNames = context.urlParameterNames;
+if (urlParameterNames == null) {
+ urlParameterNames = UtilMisc.toList("fixedAssetId", "partyId", "workEffortTypeId", "calendarType", "hideEvents", "portalPageId");
+}
StringBuilder sb = new StringBuilder();
-for (entry in urlParametersMap.entrySet()) {
- sb.append("&").append(entry.getKey()).append("=").append(entry.getValue());
+for (entry in parameters.entrySet()) {
+ if (urlParameterNames.contains(entry.getKey())) {
+ Debug.logInfo("Adding parameter " + entry.getKey(), "CreateUrlParam");
+ sb.append("&").append(entry.getKey()).append("=").append(entry.getValue());
+ }
}
context.put("urlParam", sb.toString());