Merged V3.2 to HEAD

17136: Merged V3.1 to V3.2
      17134: Fix for ETHREEOH-3076 - Unfriendly error appears at the Advanced search page when clicking "Ok" button not selecting a category.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@17139 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2009-10-23 15:42:30 +00:00
parent 923af7affd
commit 6178a24372

View File

@@ -68,7 +68,9 @@ public abstract class BaseAjaxItemPicker extends UIInput
protected static final String ID_ID = "id"; protected static final String ID_ID = "id";
protected static final String ID_NAME = "name"; protected static final String ID_NAME = "name";
protected static final String ID_ICON = "icon"; protected static final String ID_ICON = "icon";
protected static final String EMPTY = "empty";
protected static final String FOLDER_IMAGE_PREFIX = "/images/icons/"; protected static final String FOLDER_IMAGE_PREFIX = "/images/icons/";
/** label to be displayed before an item is selected */ /** label to be displayed before an item is selected */
@@ -142,9 +144,9 @@ public abstract class BaseAjaxItemPicker extends UIInput
String value = (String)requestMap.get(fieldId); String value = (String)requestMap.get(fieldId);
if (value != null) if (value != null)
{ {
if (value.equals("empty")) if (value.equals(EMPTY))
{ {
this.setSubmittedValue(new String("empty")); this.setSubmittedValue(new String(EMPTY));
} }
else if (value.length() != 0) else if (value.length() != 0)
{ {
@@ -210,15 +212,23 @@ public abstract class BaseAjaxItemPicker extends UIInput
} }
else else
{ {
submitted = (List<NodeRef>)getSubmittedValue(); Object value = getSubmittedValue();
if (submitted == null) if (value == null)
{ {
submitted = (List<NodeRef>)getValue(); value = getValue();
} }
// special case to submit empty lists on multi-select values if (value instanceof List)
else if (submitted.equals("empty"))
{ {
submitted = null; submitted = (List<NodeRef>)value;
}
else if (value instanceof String)
{
// special case for "empty" submitted value
if (!value.equals(EMPTY))
{
submitted = new ArrayList<NodeRef>(1);
submitted.add(new NodeRef(value.toString()));
}
} }
} }
if (submitted != null) if (submitted != null)