### Eclipse Workspace Patch 1.0
#P jahia-root
Index: war/src/main/webapp/engines/shared/category_field.jsp
===================================================================
--- war/src/main/webapp/engines/shared/category_field.jsp (revision 26817)
+++ war/src/main/webapp/engines/shared/category_field.jsp (working copy)
@@ -46,5 +46,5 @@
%>
-
+
Index: taglib/src/main/resources/META-INF/tags/ajax/categoriespicker.tag
===================================================================
--- taglib/src/main/resources/META-INF/tags/ajax/categoriespicker.tag (revision 26940)
+++ taglib/src/main/resources/META-INF/tags/ajax/categoriespicker.tag (working copy)
@@ -74,7 +74,7 @@
+ rootKey="${startCategoryKey}" readonly="${readonly}" multiple="${multiple}"/>
defaultSelectedCategories = new ArrayList();
boolean foundNoSelectionMarker = false;
+
+ String rootCategoryKey = theField.getDefinition().getItemDefinition().getSelectorOptions().get("root");
+ Category startCategory = (rootCategoryKey != null) ? Category.getCategory(rootCategoryKey, jParams.getUser()) : null;
+
String fieldDefaultValue = theField.getDefinition().getDefaultValue();
// the field default value contains a combination of :
@@ -218,7 +222,6 @@
// [rootCategoryKey]defaultCategoryKey1,defaultCategory2,...
// the rootCategoryKey part is optional.
- Category startCategory = null;
logger.debug("fieldDefaultValue: " + fieldDefaultValue);
if ((fieldDefaultValue != null) && !"".equals(fieldDefaultValue)) {
@@ -226,9 +229,6 @@
int defaultCategoryKeysStartPos = 0;
if ((fieldDefaultValue.indexOf("]") > 0) &&
(fieldDefaultValue.indexOf("[") == 0)) {
- // we have detected a root category key
- String rootCategoryKey = fieldDefaultValue.substring(1, fieldDefaultValue.indexOf("]"));
- startCategory = Category.getCategory(rootCategoryKey, jParams.getUser());
defaultCategoryKeysStartPos = fieldDefaultValue.indexOf("]") + 1;
}