From ab0ef4480469c8da94a4484840cf289f7f7aa6f2 Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Tue, 27 Nov 2007 15:07:08 +0000 Subject: [PATCH] Ajax picker enhancements and fixes. Ajax File Picker component implemented (ready for web-client collaboration UI). Ajax space/category pickers replace old JSF pickers in existing JSP pages. Advanced Search category selector now support multi-selection of categories. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7446 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../web/bean/AdvancedSearchDialog.java | 20 ++- .../org/alfresco/web/bean/BrowseBean.java | 6 +- .../alfresco/web/bean/ajax/PickerBean.java | 108 ++++++++++-- .../ui/repo/component/BaseAjaxItemPicker.java | 157 +++++++++++++++--- .../repo/component/UIAjaxCategoryPicker.java | 2 +- .../ui/repo/component/UIAjaxFilePicker.java | 50 ++++++ .../web/ui/repo/tag/AjaxFileSelectorTag.java | 43 +++++ .../web/ui/repo/tag/AjaxItemSelectorTag.java | 4 +- source/web/WEB-INF/faces-config-repo.xml | 5 + source/web/WEB-INF/repo.tld | 90 ++++++++++ source/web/css/main.css | 1 + source/web/css/picker.css | 11 +- source/web/jsp/actions/check-out.jsp | 8 +- source/web/jsp/actions/copy.jsp | 8 +- source/web/jsp/actions/import.jsp | 9 +- source/web/jsp/actions/link-category.jsp | 6 +- source/web/jsp/actions/move.jsp | 8 +- source/web/jsp/actions/simple-workflow.jsp | 20 +-- source/web/jsp/actions/transform-image.jsp | 8 +- source/web/jsp/actions/transform.jsp | 8 +- .../jsp/categories/edit-node-categories.jsp | 5 +- source/web/jsp/dialog/advanced-search.jsp | 4 +- source/web/jsp/dialog/checkout-file.jsp | 9 +- .../web/jsp/dialog/edit-simple-workflow.jsp | 24 +-- .../jsp/dialog/edit-space-simple-workflow.jsp | 24 +-- source/web/jsp/dialog/export.jsp | 10 +- source/web/jsp/rules/in-category.jsp | 6 +- .../create-space-wizard/from-existing.jsp | 8 +- source/web/jsp/trashcan/recover-item.jsp | 6 +- source/web/jsp/trashcan/recover-listed.jsp | 6 +- .../jsp/wizard/new-user/user-properties.jsp | 5 +- source/web/scripts/ajax/picker.js | 145 +++++++++++----- 32 files changed, 643 insertions(+), 181 deletions(-) create mode 100644 source/java/org/alfresco/web/ui/repo/component/UIAjaxFilePicker.java create mode 100644 source/java/org/alfresco/web/ui/repo/tag/AjaxFileSelectorTag.java diff --git a/source/java/org/alfresco/web/bean/AdvancedSearchDialog.java b/source/java/org/alfresco/web/bean/AdvancedSearchDialog.java index ae41a487ca..2c944a07e2 100644 --- a/source/java/org/alfresco/web/bean/AdvancedSearchDialog.java +++ b/source/java/org/alfresco/web/bean/AdvancedSearchDialog.java @@ -72,6 +72,7 @@ import org.alfresco.web.data.QuickSort; import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.component.UIModeList; import org.alfresco.web.ui.common.component.UIPanel.ExpandedEvent; +import org.alfresco.web.ui.repo.component.UIAjaxCategoryPicker; import org.alfresco.web.ui.repo.component.UICategorySelector; import org.alfresco.web.ui.repo.component.UISearchCustomProperties; @@ -936,16 +937,21 @@ public class AdvancedSearchDialog extends BaseDialogBean */ public void addCategory(ActionEvent event) { - UICategorySelector selector = (UICategorySelector)event.getComponent().findComponent("catSelector"); + UIAjaxCategoryPicker selector = (UIAjaxCategoryPicker)event.getComponent().findComponent("catSelector"); UISelectBoolean chkChildren = (UISelectBoolean)event.getComponent().findComponent("chkCatChildren"); - NodeRef categoryRef = (NodeRef)selector.getValue(); - if (categoryRef != null) + List categoryRefs = (List)selector.getValue(); + if (categoryRefs != null) { - Node categoryNode = new MapNode(categoryRef); - // add a value bound propery used to indicate if searching across children is selected - categoryNode.getProperties().put(INCLUDE_CHILDREN, chkChildren.isSelected()); - properties.getCategories().add(categoryNode); + for (NodeRef categoryRef : categoryRefs) + { + Node categoryNode = new MapNode(categoryRef); + // add a value bound propery used to indicate if searching across children is selected + categoryNode.getProperties().put(INCLUDE_CHILDREN, chkChildren.isSelected()); + properties.getCategories().add(categoryNode); + } + // clear selector value after the list has been populated + selector.setValue(null); } } diff --git a/source/java/org/alfresco/web/bean/BrowseBean.java b/source/java/org/alfresco/web/bean/BrowseBean.java index 6915e95f53..be2a1bffc3 100644 --- a/source/java/org/alfresco/web/bean/BrowseBean.java +++ b/source/java/org/alfresco/web/bean/BrowseBean.java @@ -527,8 +527,7 @@ public class BrowseBean implements IContextListener MapNode node = null; // look for Space folder node - if (this.dictionaryService.isSubClass(type, ContentModel.TYPE_FOLDER) == true && - this.dictionaryService.isSubClass(type, ContentModel.TYPE_SYSTEM_FOLDER) == false) + if (this.dictionaryService.isSubClass(type, ContentModel.TYPE_FOLDER)) { // create our Node representation node = new MapNode(nodeRef, this.nodeService, fileInfo.getProperties()); @@ -782,8 +781,7 @@ public class BrowseBean implements IContextListener this.contentNodes.add(node); } // look for Space folder node - else if (this.dictionaryService.isSubClass(type, ContentModel.TYPE_FOLDER) == true && - this.dictionaryService.isSubClass(type, ContentModel.TYPE_SYSTEM_FOLDER) == false) + else if (this.dictionaryService.isSubClass(type, ContentModel.TYPE_FOLDER)) { // create our Node representation node = new MapNode(nodeRef, this.nodeService, fileInfo.getProperties()); diff --git a/source/java/org/alfresco/web/bean/ajax/PickerBean.java b/source/java/org/alfresco/web/bean/ajax/PickerBean.java index 80b85afd82..079771e422 100644 --- a/source/java/org/alfresco/web/bean/ajax/PickerBean.java +++ b/source/java/org/alfresco/web/bean/ajax/PickerBean.java @@ -34,13 +34,16 @@ import javax.transaction.UserTransaction; import org.alfresco.model.ApplicationModel; import org.alfresco.model.ContentModel; import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.model.FileFolderService; import org.alfresco.service.cmr.model.FileInfo; import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.FileTypeImageSize; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.search.CategoryService; import org.alfresco.web.app.Application; +import org.alfresco.web.app.servlet.DownloadContentServlet; import org.alfresco.web.app.servlet.ajax.InvokeCommand; import org.alfresco.web.bean.BrowseBean; import org.alfresco.web.bean.repository.Repository; @@ -55,6 +58,8 @@ import org.apache.commons.logging.LogFactory; */ public class PickerBean { + private static final String FOLDER_IMAGE_PREFIX = "/images/icons/"; + private static Log logger = LogFactory.getLog(PickerBean.class); private CategoryService categoryService; @@ -134,6 +139,8 @@ public class PickerBean { out.writeNullValue("id"); out.writeValue("name", "Categories"); + out.writeValue("isroot", true); + out.writeValue("selectable", false); } else { @@ -178,12 +185,14 @@ public class PickerBean tx.begin(); List childRefs; + NodeRef companyHomeRef = new NodeRef(Repository.getStoreRef(), Application.getCompanyRootId(fc)); NodeRef parentRef = null; Map params = fc.getExternalContext().getRequestParameterMap(); String strParentRef = (String)params.get("parent"); if (strParentRef == null || strParentRef.length() == 0) { - parentRef = new NodeRef(Repository.getStoreRef(), Application.getCompanyRootId(fc)); + parentRef = companyHomeRef; + strParentRef = parentRef.toString(); } else { @@ -195,15 +204,11 @@ public class PickerBean out.startObject(); out.startValue("parent"); out.startObject(); - if (strParentRef == null || strParentRef.length() == 0) + out.writeValue("id", strParentRef); + out.writeValue("name", Repository.getNameForNode(this.internalNodeService, parentRef)); + if (parentRef.equals(companyHomeRef)) { - out.writeNullValue("id"); - out.writeValue("name", Repository.getNameForNode(this.internalNodeService, parentRef)); - } - else - { - out.writeValue("id", strParentRef); - out.writeValue("name", Repository.getNameForNode(this.internalNodeService, parentRef)); + out.writeValue("isroot", true); } out.endObject(); out.endValue(); @@ -217,7 +222,7 @@ public class PickerBean out.writeValue("id", folder.getNodeRef().toString()); out.writeValue("name", (String)folder.getProperties().get(ContentModel.PROP_NAME)); String icon = (String)folder.getProperties().get(ApplicationModel.PROP_ICON); - out.writeValue("icon", (icon != null ? icon + "-16.gif" : BrowseBean.SPACE_SMALL_DEFAULT + ".gif")); + out.writeValue("icon", FOLDER_IMAGE_PREFIX + (icon != null ? icon + "-16.gif" : BrowseBean.SPACE_SMALL_DEFAULT + ".gif")); out.endObject(); } @@ -234,4 +239,87 @@ public class PickerBean try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} } } + + @InvokeCommand.ResponseMimetype(value=MimetypeMap.MIMETYPE_HTML) + public void getFileFolderNodes() throws Exception + { + FacesContext fc = FacesContext.getCurrentInstance(); + + UserTransaction tx = null; + try + { + tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true); + tx.begin(); + + DictionaryService dd = Repository.getServiceRegistry(fc).getDictionaryService(); + + List childRefs; + NodeRef companyHomeRef = new NodeRef(Repository.getStoreRef(), Application.getCompanyRootId(fc)); + NodeRef parentRef = null; + Map params = fc.getExternalContext().getRequestParameterMap(); + String strParentRef = (String)params.get("parent"); + if (strParentRef == null || strParentRef.length() == 0) + { + parentRef = companyHomeRef; + strParentRef = parentRef.toString(); + } + else + { + parentRef = new NodeRef(strParentRef); + } + List items = this.fileFolderService.list(parentRef); + + JSONWriter out = new JSONWriter(fc.getResponseWriter()); + out.startObject(); + out.startValue("parent"); + out.startObject(); + out.writeValue("id", strParentRef); + out.writeValue("name", Repository.getNameForNode(this.internalNodeService, parentRef)); + if (parentRef.equals(companyHomeRef)) + { + out.writeValue("isroot", true); + } + out.writeValue("selectable", false); + out.endObject(); + out.endValue(); + out.startValue("children"); + out.startArray(); + + // filter out those children that are not spaces + for (FileInfo item : items) + { + out.startObject(); + out.writeValue("id", item.getNodeRef().toString()); + String name = (String)item.getProperties().get(ContentModel.PROP_NAME); + out.writeValue("name", name); + if (dd.isSubClass(this.internalNodeService.getType(item.getNodeRef()), ContentModel.TYPE_FOLDER)) + { + // found a folder + String icon = (String)item.getProperties().get(ApplicationModel.PROP_ICON); + out.writeValue("icon", FOLDER_IMAGE_PREFIX + (icon != null ? icon + "-16.gif" : BrowseBean.SPACE_SMALL_DEFAULT + ".gif")); + out.writeValue("selectable", false); + } + else + { + // must be a file + String icon = Utils.getFileTypeImage(fc, name, FileTypeImageSize.Small); + out.writeValue("icon", icon); + out.writeValue("url", DownloadContentServlet.generateBrowserURL(item.getNodeRef(), name)); + } + out.endObject(); + } + + out.endArray(); + out.endValue(); + out.endObject(); + + tx.commit(); + } + catch (Throwable err) + { + Utils.addErrorMessage("PickerBean exception in getFileFolderNodes()", err); + fc.getResponseWriter().write("ERROR: " + err.getMessage()); + try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} + } + } } \ No newline at end of file diff --git a/source/java/org/alfresco/web/ui/repo/component/BaseAjaxItemPicker.java b/source/java/org/alfresco/web/ui/repo/component/BaseAjaxItemPicker.java index 837720e5bf..6180b9244e 100644 --- a/source/java/org/alfresco/web/ui/repo/component/BaseAjaxItemPicker.java +++ b/source/java/org/alfresco/web/ui/repo/component/BaseAjaxItemPicker.java @@ -25,17 +25,25 @@ package org.alfresco.web.ui.repo.component; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import java.util.Map; import java.util.ResourceBundle; +import java.util.StringTokenizer; import javax.faces.component.UIInput; import javax.faces.context.FacesContext; import javax.faces.context.ResponseWriter; import javax.faces.el.ValueBinding; -import javax.faces.event.AbortProcessingException; -import javax.faces.event.FacesEvent; +import javax.transaction.UserTransaction; +import org.alfresco.model.ContentModel; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.web.app.Application; +import org.alfresco.web.bean.repository.Repository; +import org.alfresco.web.ui.common.Utils; +import org.springframework.web.jsf.FacesContextUtils; /** * @author Kevin Roast @@ -110,16 +118,23 @@ public abstract class BaseAjaxItemPicker extends UIInput Map requestMap = context.getExternalContext().getRequestParameterMap(); String fieldId = getHiddenFieldName(); String value = (String)requestMap.get(fieldId); - - - } - - /** - * @see javax.faces.component.UIInput#broadcast(javax.faces.event.FacesEvent) - */ - public void broadcast(FacesEvent event) throws AbortProcessingException - { - super.broadcast(event); + if (value != null && value.length() != 0) + { + if (getSingleSelect() == true) + { + NodeRef ref = new NodeRef(value); + this.setSubmittedValue(ref); + } + else + { + List refs = new ArrayList(5); + for (StringTokenizer t = new StringTokenizer(value, ","); t.hasMoreTokens(); /**/) + { + refs.add(new NodeRef(t.nextToken())); + } + this.setSubmittedValue(refs); + } + } } /** @@ -134,17 +149,83 @@ public abstract class BaseAjaxItemPicker extends UIInput ResponseWriter out = fc.getResponseWriter(); + String formClientId = Utils.getParentForm(fc, this).getClientId(fc); + Map attrs = this.getAttributes(); ResourceBundle msg = Application.getBundle(fc); - // TODO: from submitted value or 'none' - String selection = "none"; + // get values from submitted value or none selected + String selection = null; + List submitted = null; + if (getSingleSelect() == true) + { + NodeRef ref = (NodeRef)getSubmittedValue(); + if (ref == null) + { + Object objRef = getValue(); + if (objRef instanceof String) + { + ref = new NodeRef((String)objRef); + } + else if (objRef instanceof NodeRef) + { + ref = (NodeRef)objRef; + } + } + if (ref != null) + { + submitted = new ArrayList(1); + submitted.add(ref); + } + } + else + { + submitted = (List)getSubmittedValue(); + if (submitted == null) + { + submitted = (List)getValue(); + } + } + if (submitted != null) + { + UserTransaction tx = null; + try + { + tx = Repository.getUserTransaction(fc, true); + tx.begin(); + + StringBuilder buf = new StringBuilder(128); + NodeService nodeService = (NodeService)FacesContextUtils.getRequiredWebApplicationContext( + fc).getBean("nodeService"); + for (NodeRef value : submitted) + { + String name = (String)nodeService.getProperty(value, ContentModel.PROP_NAME); + if (buf.length() != 0) + { + buf.append(", "); + } + buf.append(name); + } + selection = buf.toString(); + + // commit the transaction + tx.commit(); + } + catch (Throwable err) + { + try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} + } + } + // generate the Ids for our script object and containing DIV element String divId = getId(); String objId = divId + "Obj"; + + // generate the script to create and init our script object String contextPath = fc.getExternalContext().getRequestContextPath(); out.write(""); + // generate the DIV structure for our component as expected by the script object out.write("
") ; - out.write(" "); - out.write("
"); - out.write(" <" + selection + ">"); - out.write(" "); - out.write(msg.getString(getLabel())); + out.write(" "); + // current selection displayed as link and message to launch the selector + out.write(" "); // container for item navigation @@ -181,10 +282,11 @@ public abstract class BaseAjaxItemPicker extends UIInput out.write(" "); out.write(" "); out.write("
"); - out.write(" "); out.write("
"); + out.write(" "); out.write("
"); out.write("
"); // container for item selection @@ -193,14 +295,17 @@ public abstract class BaseAjaxItemPicker extends UIInput out.write("
"); out.write(" "); out.write(" "); - out.write("
"); - out.write(" "); - // container for selected items + // container for the selected items out.write("
"); out.write("
"); } @@ -331,6 +436,6 @@ public abstract class BaseAjaxItemPicker extends UIInput */ protected String getHiddenFieldName() { - return this.getClientId(getFacesContext()); + return this.getId() + "-value"; } } diff --git a/source/java/org/alfresco/web/ui/repo/component/UIAjaxCategoryPicker.java b/source/java/org/alfresco/web/ui/repo/component/UIAjaxCategoryPicker.java index e506339a55..7488ae762b 100644 --- a/source/java/org/alfresco/web/ui/repo/component/UIAjaxCategoryPicker.java +++ b/source/java/org/alfresco/web/ui/repo/component/UIAjaxCategoryPicker.java @@ -44,6 +44,6 @@ public class UIAjaxCategoryPicker extends BaseAjaxItemPicker @Override protected String getDefaultIcon() { - return "category_small.gif"; + return "/images/icons/category_small.gif"; } } diff --git a/source/java/org/alfresco/web/ui/repo/component/UIAjaxFilePicker.java b/source/java/org/alfresco/web/ui/repo/component/UIAjaxFilePicker.java new file mode 100644 index 0000000000..dad7a5992c --- /dev/null +++ b/source/java/org/alfresco/web/ui/repo/component/UIAjaxFilePicker.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing + */ +package org.alfresco.web.ui.repo.component; + +/** + * @author Kevin Roast + */ +public class UIAjaxFilePicker extends BaseAjaxItemPicker +{ + @Override + public String getFamily() + { + return "org.alfresco.faces.AjaxFilePicker"; + } + + @Override + protected String getServiceCall() + { + return "PickerBean.getFileFolderNodes"; + } + + @Override + protected String getDefaultIcon() + { + // none required - we always return an icon name in the service call + return null; + } +} diff --git a/source/java/org/alfresco/web/ui/repo/tag/AjaxFileSelectorTag.java b/source/java/org/alfresco/web/ui/repo/tag/AjaxFileSelectorTag.java new file mode 100644 index 0000000000..596d0e1602 --- /dev/null +++ b/source/java/org/alfresco/web/ui/repo/tag/AjaxFileSelectorTag.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +/* + * Created on 25-May-2005 + */ +package org.alfresco.web.ui.repo.tag; + + +/** + * @author Kevin Roast + */ +public class AjaxFileSelectorTag extends AjaxItemSelectorTag +{ + /** + * @see javax.faces.webapp.UIComponentTag#getComponentType() + */ + public String getComponentType() + { + return "org.alfresco.faces.AjaxFilePicker"; + } +} diff --git a/source/java/org/alfresco/web/ui/repo/tag/AjaxItemSelectorTag.java b/source/java/org/alfresco/web/ui/repo/tag/AjaxItemSelectorTag.java index 88d2c260bc..c113491395 100644 --- a/source/java/org/alfresco/web/ui/repo/tag/AjaxItemSelectorTag.java +++ b/source/java/org/alfresco/web/ui/repo/tag/AjaxItemSelectorTag.java @@ -29,14 +29,14 @@ package org.alfresco.web.ui.repo.tag; import javax.faces.component.UIComponent; -import org.alfresco.web.ui.common.tag.BaseComponentTag; +import org.alfresco.web.ui.common.tag.HtmlComponentTag; /** * Base class for the item selector tag * * @author Kevin Roast */ -public abstract class AjaxItemSelectorTag extends BaseComponentTag +public abstract class AjaxItemSelectorTag extends HtmlComponentTag { /** the value */ private String value; diff --git a/source/web/WEB-INF/faces-config-repo.xml b/source/web/WEB-INF/faces-config-repo.xml index d9508da34c..1bb9b4649c 100644 --- a/source/web/WEB-INF/faces-config-repo.xml +++ b/source/web/WEB-INF/faces-config-repo.xml @@ -218,6 +218,11 @@ org.alfresco.faces.AjaxCategoryPicker org.alfresco.web.ui.repo.component.UIAjaxCategoryPicker + + + org.alfresco.faces.AjaxFilePicker + org.alfresco.web.ui.repo.component.UIAjaxFilePicker + diff --git a/source/web/WEB-INF/repo.tld b/source/web/WEB-INF/repo.tld index acd63f202a..5bcac2c912 100644 --- a/source/web/WEB-INF/repo.tld +++ b/source/web/WEB-INF/repo.tld @@ -2227,6 +2227,18 @@ true + + style + false + true + + + + styleClass + false + true + + value false @@ -2281,6 +2293,84 @@ true + + style + false + true + + + + styleClass + false + true + + + + value + false + true + + + + label + true + true + + + + initialSelection + false + true + + + + singleSelect + false + true + + + + disabled + false + true + + + + + ajaxFileSelector + org.alfresco.web.ui.repo.tag.AjaxFileSelectorTag + JSP + + + id + false + true + + + + binding + false + true + + + + rendered + false + true + + + + style + false + true + + + + styleClass + false + true + + value false diff --git a/source/web/css/main.css b/source/web/css/main.css index 6605597846..afc87a6457 100644 --- a/source/web/css/main.css +++ b/source/web/css/main.css @@ -422,6 +422,7 @@ a.topToolbarLinkHighlight, a.topToolbarLinkHighlight:link, a.topToolbarLinkHighl { border: 1px dashed #cccccc; padding: 4px; + display: inline; } .selectedItems diff --git a/source/web/css/picker.css b/source/web/css/picker.css index 640028a0cd..c121824ab9 100644 --- a/source/web/css/picker.css +++ b/source/web/css/picker.css @@ -1,8 +1,3 @@ -.pickerNoSelectedItems -{ - margin-top: 2px -} - .pickerSelectedItems { padding-left: 6px; @@ -112,7 +107,7 @@ img.pickerActionButton div.pickerResultsRow { padding: 4px; - height: 16px; + height: auto; } .pickerResultsOddRow @@ -142,7 +137,7 @@ div.pickerResultsRow float: right; } -div.pickerDoneButton +div.pickerButtons { margin: 0 auto; width: 50px; @@ -155,6 +150,8 @@ div.pickerDoneButton div.pickerFinishControls { text-align: center; + padding: 0px 64px 0px 64px; + height: 2em; } .pickerNavBreadcrumb diff --git a/source/web/jsp/actions/check-out.jsp b/source/web/jsp/actions/check-out.jsp index 7a9488a531..b0ed3b4eed 100644 --- a/source/web/jsp/actions/check-out.jsp +++ b/source/web/jsp/actions/check-out.jsp @@ -113,10 +113,10 @@ : - + diff --git a/source/web/jsp/actions/copy.jsp b/source/web/jsp/actions/copy.jsp index ae516b9c74..4e6f7e5c87 100644 --- a/source/web/jsp/actions/copy.jsp +++ b/source/web/jsp/actions/copy.jsp @@ -113,10 +113,10 @@ : - + diff --git a/source/web/jsp/actions/import.jsp b/source/web/jsp/actions/import.jsp index 948afade00..ccab834a00 100644 --- a/source/web/jsp/actions/import.jsp +++ b/source/web/jsp/actions/import.jsp @@ -113,11 +113,10 @@ : - + <%-- diff --git a/source/web/jsp/actions/link-category.jsp b/source/web/jsp/actions/link-category.jsp index 024db983c2..2945e7dd69 100644 --- a/source/web/jsp/actions/link-category.jsp +++ b/source/web/jsp/actions/link-category.jsp @@ -113,9 +113,9 @@ : - + diff --git a/source/web/jsp/actions/move.jsp b/source/web/jsp/actions/move.jsp index ce69d3dc0c..3fda424c3c 100644 --- a/source/web/jsp/actions/move.jsp +++ b/source/web/jsp/actions/move.jsp @@ -113,10 +113,10 @@ : - + diff --git a/source/web/jsp/actions/simple-workflow.jsp b/source/web/jsp/actions/simple-workflow.jsp index 4373e081ea..581da354dd 100644 --- a/source/web/jsp/actions/simple-workflow.jsp +++ b/source/web/jsp/actions/simple-workflow.jsp @@ -175,11 +175,11 @@ : - + @@ -231,11 +231,11 @@ : - + diff --git a/source/web/jsp/actions/transform-image.jsp b/source/web/jsp/actions/transform-image.jsp index 51656857d8..4c2ec5fd61 100644 --- a/source/web/jsp/actions/transform-image.jsp +++ b/source/web/jsp/actions/transform-image.jsp @@ -128,10 +128,10 @@ : - + diff --git a/source/web/jsp/actions/transform.jsp b/source/web/jsp/actions/transform.jsp index fceb32ac79..5cc0e7949e 100644 --- a/source/web/jsp/actions/transform.jsp +++ b/source/web/jsp/actions/transform.jsp @@ -122,10 +122,10 @@ : - + diff --git a/source/web/jsp/categories/edit-node-categories.jsp b/source/web/jsp/categories/edit-node-categories.jsp index 883f9baf90..a6b4fe7cb2 100644 --- a/source/web/jsp/categories/edit-node-categories.jsp +++ b/source/web/jsp/categories/edit-node-categories.jsp @@ -44,8 +44,9 @@ noSelectedItemsMsg="#{msg.no_selected_categories}" styleClass="selector"> - + diff --git a/source/web/jsp/dialog/advanced-search.jsp b/source/web/jsp/dialog/advanced-search.jsp index 6573315359..147d3cf6ee 100644 --- a/source/web/jsp/dialog/advanced-search.jsp +++ b/source/web/jsp/dialog/advanced-search.jsp @@ -184,7 +184,7 @@ - + @@ -203,7 +203,7 @@ diff --git a/source/web/jsp/dialog/checkout-file.jsp b/source/web/jsp/dialog/checkout-file.jsp index 33c8b42283..d83ff3beb7 100644 --- a/source/web/jsp/dialog/checkout-file.jsp +++ b/source/web/jsp/dialog/checkout-file.jsp @@ -69,10 +69,11 @@
- +
<%-- Space selector to allow user to pick a Space --%> - + +
diff --git a/source/web/jsp/dialog/edit-simple-workflow.jsp b/source/web/jsp/dialog/edit-simple-workflow.jsp index 0e051f8f10..53cf3f8fb0 100644 --- a/source/web/jsp/dialog/edit-simple-workflow.jsp +++ b/source/web/jsp/dialog/edit-simple-workflow.jsp @@ -98,12 +98,12 @@
: - + @@ -158,12 +158,12 @@ : - + diff --git a/source/web/jsp/dialog/edit-space-simple-workflow.jsp b/source/web/jsp/dialog/edit-space-simple-workflow.jsp index dd5953e7a0..73f5871307 100644 --- a/source/web/jsp/dialog/edit-space-simple-workflow.jsp +++ b/source/web/jsp/dialog/edit-space-simple-workflow.jsp @@ -102,12 +102,12 @@ : - + @@ -162,12 +162,12 @@ : - + diff --git a/source/web/jsp/dialog/export.jsp b/source/web/jsp/dialog/export.jsp index ce5b436f9a..bea9ae074d 100644 --- a/source/web/jsp/dialog/export.jsp +++ b/source/web/jsp/dialog/export.jsp @@ -64,10 +64,12 @@ onkeyup="javascript:checkButtonState();" /> : - + + + diff --git a/source/web/jsp/rules/in-category.jsp b/source/web/jsp/rules/in-category.jsp index 80c4d0d547..902cd787d7 100644 --- a/source/web/jsp/rules/in-category.jsp +++ b/source/web/jsp/rules/in-category.jsp @@ -113,9 +113,9 @@ : - + diff --git a/source/web/jsp/spaces/create-space-wizard/from-existing.jsp b/source/web/jsp/spaces/create-space-wizard/from-existing.jsp index 8a257c32a9..80a19b8167 100644 --- a/source/web/jsp/spaces/create-space-wizard/from-existing.jsp +++ b/source/web/jsp/spaces/create-space-wizard/from-existing.jsp @@ -63,10 +63,10 @@ - + diff --git a/source/web/jsp/trashcan/recover-item.jsp b/source/web/jsp/trashcan/recover-item.jsp index 86ec00a062..86482f9a19 100644 --- a/source/web/jsp/trashcan/recover-item.jsp +++ b/source/web/jsp/trashcan/recover-item.jsp @@ -63,8 +63,10 @@ - + + diff --git a/source/web/jsp/trashcan/recover-listed.jsp b/source/web/jsp/trashcan/recover-listed.jsp index 06f267746b..d336420b6f 100644 --- a/source/web/jsp/trashcan/recover-listed.jsp +++ b/source/web/jsp/trashcan/recover-listed.jsp @@ -68,8 +68,10 @@ :  - + + diff --git a/source/web/jsp/wizard/new-user/user-properties.jsp b/source/web/jsp/wizard/new-user/user-properties.jsp index 3e44482aa9..4c3629f6f2 100644 --- a/source/web/jsp/wizard/new-user/user-properties.jsp +++ b/source/web/jsp/wizard/new-user/user-properties.jsp @@ -203,7 +203,10 @@ : - + diff --git a/source/web/scripts/ajax/picker.js b/source/web/scripts/ajax/picker.js index 0c85a6946b..d70f22ec10 100644 --- a/source/web/scripts/ajax/picker.js +++ b/source/web/scripts/ajax/picker.js @@ -28,7 +28,10 @@ var AlfPicker = new Class( id: null, /* variable name being used */ - varName: null, + varName: null, + + /* form Id to submit when selection complete */ + formClientId: null, /* the item the picker will start with */ startId: null, @@ -57,13 +60,15 @@ var AlfPicker = new Class( /* single selection mode flag */ singleSelect: false, - initialize: function(id, varName, service, singleSelect) + /* initial display style of the outer div */ + initialDisplayStyle: null, + + initialize: function(id, varName, service, formClientId, singleSelect) { this.id = id; this.varName = varName; - this.parent = this.startId; - this.selected = []; this.service = service; + this.formClientId = formClientId; if (singleSelect != undefined) { this.singleSelect = singleSelect; @@ -82,7 +87,13 @@ var AlfPicker = new Class( showSelector: function() { + // init selector state + this.selected = []; + this.stack = []; + + this.initialDisplayStyle = $(this.id + "-noitems").getStyle("display"); $(this.id + "-selector").setStyle("display", "block"); + $(this.id + "-selected").empty(); $(this.id + "-selected").setStyle("display", "block"); $(this.id + "-noitems").setStyle("display", "none"); if (this.singleSelect) @@ -90,7 +101,7 @@ var AlfPicker = new Class( $(this.id + "-finish").setStyle("display", "none"); } - // simulate an ajax request for children of start item + // first ajax request for the children of the start item this.getChildData(this.startId, this.populateChildren); }, @@ -115,7 +126,15 @@ var AlfPicker = new Class( addItem: function(index) { - var item = this.items[index]; + var item; + if (index != -1) + { + item = this.items[index]; + } + else + { + item = this.parent; + } // add item to list of selected items this.selected.push(item); @@ -154,7 +173,7 @@ var AlfPicker = new Class( itemDiv.injectInside($(this.id + "-selected")); // set the background image now the itemdiv has been added to the DOM (for IE) - itemDiv.setStyle("background-image", "url(" + getContextPath() + "/images/icons/" + item.icon + ")"); + itemDiv.setStyle("background-image", "url(" + getContextPath() + item.icon + ")"); // set opacity the style now the item has been added to the DOM (for IE) $E('.pickerSelectedIcon', itemDiv).setStyle("opacity", 0); @@ -253,10 +272,23 @@ var AlfPicker = new Class( doneClicked: function() { - $(this.id + "-selector").setStyle("display", "none"); - $(this.id + "-value").setProperty("value", this.selected); + var ids = ""; + for (i=0; i