From 202f9d59576f3d586fe0adb802bb96477b5b494e Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Thu, 26 Oct 2006 17:42:08 +0000 Subject: [PATCH] . Message for "Website" changes to "Web Project" for appropriate wizards and actions . New JSF component called SelectList - This generic selection component displays a graphical list of items, each with an optional icon, label, description and tooltip. - The list has three selection modes; single select (radio), multi-select (checkbox) and 'active' selection mode. - The 'active' selection mode renders any child command components (such as ActionLink or CommandButton components) which can then data-bind to each row item in the list. i.e. to allow buttons or links with context for each item. - This various selection modes covers the usage for 4 different screens in the WCM wireframes . Forms page (new step 2) added to Create Web Project wizard - this is currently mostly a test page for the SelectList component git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4236 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/messages/webclient.properties | 38 +-- config/alfresco/web-client-config-wizards.xml | 14 +- .../web/bean/wcm/CreateWebsiteWizard.java | 43 ++++ .../web/ui/common/component/UISelectList.java | 231 +++++++++++++++--- .../web/ui/common/tag/SelectListTag.java | 114 +++++---- .../ui/repo/component/UIUserGroupPicker.java | 1 - .../web/ui/wcm/component/UIUserSandboxes.java | 1 - source/web/WEB-INF/alfresco.tld | 52 ++-- source/web/css/main.css | 12 + .../jsp/wcm/create-website-wizard/details.jsp | 2 +- .../jsp/wcm/create-website-wizard/forms.jsp | 46 ++++ 11 files changed, 432 insertions(+), 122 deletions(-) create mode 100644 source/web/jsp/wcm/create-website-wizard/forms.jsp diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index d18915e27e..82c82aa5c2 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -798,29 +798,33 @@ template_space=Template Space select_template=Select the template you want to use. # Create Website Wizard messages -create_website=Create Website -create_website_title=Create Website Wizard -create_website_desc=This wizard helps you create a new website space. -website_details=Website Details -create_website_step1_title=Step One - Website Details -create_website_step1_desc=Enter the information about the website. +create_website=Create Web Project +create_website_title=Create Web Project Wizard +create_website_desc=This wizard helps you create a new web project space. +website_details=Web Project Details +create_website_step1_title=Step One - Web Project Details +create_website_step1_desc=Enter the information about the web project. +website_forms=Form Templates +create_website_step2_title=Step Two - Form Templates +create_website_step2_desc=Setup the forms you want to use in this project. +website_select_form=Select Form website_invite=Invite Users -create_website_step2_title=Step Two - Invite Users -create_website_step2_desc=Select users and their roles. +create_website_step3_title=Step Three - Invite Users +create_website_step3_desc=Select users and their roles. website_notify=Email Users -create_website_step3_title=Step Three - Notify Users -create_website_step3_desc=Notify the invited users. -create_website_finish_instruction=To close this wizard and create your website space click Finish. To review or change your selections click Back. +create_website_step4_title=Step Four - Notify Users +create_website_step4_desc=Notify the invited users. +create_website_finish_instruction=To close this wizard and create your web project space click Finish. To review or change your selections click Back. create_website_summary_users=Users and Roles # Delete Website Dialog messages -delete_website=Delete Website -delete_website_info=To remove this website and all associated user sandboxes, click OK. -delete_website_confirm=Are you sure you want to delete the website \"{0}\" and all associated user sandboxes? +delete_website=Delete Web Project +delete_website_info=To remove this web project and all associated user sandboxes, click OK. +delete_website_confirm=Are you sure you want to delete the web project \"{0}\" and all associated user sandboxes? # Browse Website and Sandboxes messages title_browse_website=Browse Website -website_info=Use this view to browse the staging area and user sandboxes for a website. +website_info=Use this view to browse the staging area and user sandboxes for a web project. staging_sandbox=Staging Sandbox user_sandboxes=User Sandboxes sandbox_preview=Preview Website @@ -830,7 +834,7 @@ sandbox_submitall=Submit All sandbox_icon=Browse Website import_website_content=Import Website Content title_browse_sandbox=Browse Sandbox -sandbox_info=Use this view to browse the files and folders within the sandbox for a website. +sandbox_info=Use this view to browse the files and folders within the sandbox for a web project. sandbox_title=Website ''{0}'' sandbox ''{1}'' sandbox_staging=Staging website_browse_folders=Browse Folders @@ -839,7 +843,7 @@ creator=Creator modified_items=Modified Items store_created_on=Created On store_created_by=Created By -store_working_users=There are {0} user(s) working on this website. +store_working_users=There are {0} user(s) working on this web project. avm_node_deleted=Deleted submit=Submit submit_success=Successfully submitted item: {0} diff --git a/config/alfresco/web-client-config-wizards.xml b/config/alfresco/web-client-config-wizards.xml index d219d042e5..0bda56cb71 100644 --- a/config/alfresco/web-client-config-wizards.xml +++ b/config/alfresco/web-client-config-wizards.xml @@ -15,18 +15,24 @@ description-id="create_website_step1_desc" instruction-id="default_instruction" /> - - + - - + + + + getFormsList() + { + List forms = new ArrayList(); + UIListItem item = new UIListItem(); + item.setValue("0001"); + item.setLabel("Company Press Release"); + item.setDescription("Standard monthly press release form"); + item.setTooltip("Standard monthly press release form"); + item.setImage(WebResources.IMAGE_SANDBOX_32); + forms.add(item); + item = new UIListItem(); + item.setValue("0002"); + item.setLabel("Company Site Note"); + item.setDescription("Main site footer node"); + item.setTooltip("Basic footer node addition form"); + item.setImage(WebResources.IMAGE_SANDBOX_32); + forms.add(item); + item = new UIListItem(); + item.setValue("0003"); + item.setLabel("Index Generator"); + item.setDescription("Complete site index"); + item.setTooltip("Complete site index generation form"); + item.setImage(WebResources.IMAGE_SANDBOX_32); + forms.add(item); + return forms; + } + + public String[] getFormsSelectedValue() + { + return testValue; + } + + public void setFormsSelectedValue(String[] value) + { + testValue = value; + } + + private String[] testValue = new String[] {"0001"}; + /** * @return the InviteWebsiteUsersWizard delegate bean diff --git a/source/java/org/alfresco/web/ui/common/component/UISelectList.java b/source/java/org/alfresco/web/ui/common/component/UISelectList.java index b489ea129f..112c8435b3 100644 --- a/source/java/org/alfresco/web/ui/common/component/UISelectList.java +++ b/source/java/org/alfresco/web/ui/common/component/UISelectList.java @@ -19,44 +19,50 @@ package org.alfresco.web.ui.common.component; import java.io.IOException; import java.util.Collection; import java.util.Iterator; -import java.util.List; import java.util.Map; import javax.faces.component.NamingContainer; import javax.faces.component.UICommand; import javax.faces.component.UIComponent; import javax.faces.component.UIForm; +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 org.alfresco.web.ui.common.Utils; /** + * The SelectList component displays a graphical list of items, each with a label and icon image. + * The list has three selection modes; single select (radio), multi-select (checkbox) and active + * selection mode (child action components). + * + * The value for the component is collection of UIListItem objects or a UIListItems instance. + * + * For passive single and multi-select modes, the selected value(s) can be retrieved from the component. + * For active selection mode, appropriate child components such as Command buttons or Action Links + * will be rendered for each item in the list, data-binding to the specified 'var' variable should be + * used to bind required params. It is then up to the developer to retrieve the selected item param + * from the actionListener of the appropriate child component. + * * @author Kevin Roast */ -public class UISelectList extends UICommand +public class UISelectList extends UIInput { private Boolean multiSelect; - private String buttonLabel; + private Boolean activeSelect; // ------------------------------------------------------------------------------ - // Construction + // Component Impl /** - * Default Constructor + * Default constructor */ public UISelectList() { setRendererType(null); } - - - // ------------------------------------------------------------------------------ - // Component Impl /** * @see javax.faces.component.UIComponent#getFamily() @@ -75,7 +81,7 @@ public class UISelectList extends UICommand // standard component attributes are restored by the super class super.restoreState(context, values[0]); this.multiSelect = (Boolean)values[1]; - this.buttonLabel = (String)values[2]; + this.activeSelect = (Boolean)values[2]; } /** @@ -87,26 +93,38 @@ public class UISelectList extends UICommand // standard component attributes are saved by the super class values[0] = super.saveState(context); values[1] = this.multiSelect; - values[2] = this.buttonLabel; + values[2] = this.activeSelect; return (values); } /** - * @see javax.faces.render.Renderer#decode(javax.faces.context.FacesContext, javax.faces.component.UIComponent) + * @see javax.faces.component.UIComponentBase#decode(javax.faces.context.FacesContext) */ - public void decode(FacesContext context, UIComponent component) + public void decode(FacesContext context) { Map requestMap = context.getExternalContext().getRequestParameterMap(); - String fieldId = getHiddenFieldName(context, component); - String value = (String)requestMap.get(fieldId); + Map valuesMap = context.getExternalContext().getRequestParameterValuesMap(); - // we encoded the value to start with our Id - if (value != null && value.startsWith(component.getClientId(context) + NamingContainer.SEPARATOR_CHAR)) - { - String selectedValue = value.substring(component.getClientId(context).length() + 1); - } + // save the selected values that match our component Id + setSubmittedValue((String[])valuesMap.get(getClientId(context))); } + /** + * @see javax.faces.component.UIComponentBase#encodeChildren(javax.faces.context.FacesContext) + */ + public void encodeChildren(FacesContext context) throws IOException + { + // we encode child components explicity + } + + /** + * @see javax.faces.component.UIComponentBase#getRendersChildren() + */ + public boolean getRendersChildren() + { + return true; + } + /** * @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext) */ @@ -117,8 +135,29 @@ public class UISelectList extends UICommand return; } + // Prepare the data-binding variable "var" ready for the each cycle of + // renderering for the child components. + String var = (String)getAttributes().get("var"); + Map requestMap = context.getExternalContext().getRequestMap(); + ResponseWriter out = context.getResponseWriter(); + out.write(""); } /** @@ -159,14 +212,106 @@ public class UISelectList extends UICommand * @param item UIListItem representing the item to render */ private void renderItem(FacesContext context, ResponseWriter out, UIListItem item) + throws IOException { - } - - /** - * @see javax.faces.component.UICommand#broadcast(javax.faces.event.FacesEvent) - */ - public void broadcast(FacesEvent event) throws AbortProcessingException - { + boolean activeSelect = isActiveSelect(); + + // begin the row, add tooltip if present + String tooltip = item.getTooltip(); + out.write(""); + + if (activeSelect == false) + { + // we are rendering passive select list, so either multi or single selection using + // checkboxes or radio button control respectively + boolean multiSelect = isMultiSelect(); + String id = getClientId(context); + String itemValue = item.getValue().toString(); + out.write(""); + } + + // optional 32x32 pixel icon + String icon = item.getImage(); + if (icon != null) + { + out.write(""); // give pixel space around edges + out.write(Utils.buildImageTag(context, icon, 32, 32, "")); + out.write(""); + } + + // label and description text + String description = item.getDescription(); + out.write("
"); + out.write(item.getLabel()); + out.write("
"); + if (description != null) + { + out.write(description); + } + out.write("
"); + + if (activeSelect) + { + // we are rendering an active select list with child components next to each item + // get the child components and look for compatible Command objects + out.write("'); + for (Iterator i = getChildren().iterator(); i.hasNext(); /**/) + { + UIComponent child = (UIComponent)i.next(); + if (child instanceof UICommand) + { + out.write(""); + Utils.encodeRecursive(context, child); + out.write(""); + } + } + out.write(""); + } } @@ -208,25 +353,37 @@ public class UISelectList extends UICommand } /** - * @return Returns the action button label. + * Get the active selection mode flag + * + * @return true for active selection mode, false otherwise */ - public String getButtonLabel() + public boolean isActiveSelect() { - ValueBinding vb = getValueBinding("buttonLabel"); + ValueBinding vb = getValueBinding("activeSelect"); if (vb != null) { - this.buttonLabel = (String)vb.getValue(getFacesContext()); + this.activeSelect = (Boolean)vb.getValue(getFacesContext()); } - return this.buttonLabel; + if (this.activeSelect != null) + { + return this.activeSelect.booleanValue(); + } + else + { + // return the default + return false; + } } /** - * @param buttonLabel The action button label to set. + * Set true for active selection mode, false otherwise + * + * @param activeSelect True for active selection */ - public void setButtonLabel(String buttonLabel) + public void setActiveSelect(boolean activeSelect) { - this.buttonLabel = buttonLabel; + this.activeSelect = activeSelect; } diff --git a/source/java/org/alfresco/web/ui/common/tag/SelectListTag.java b/source/java/org/alfresco/web/ui/common/tag/SelectListTag.java index edcfa24fb3..181683b384 100644 --- a/source/java/org/alfresco/web/ui/common/tag/SelectListTag.java +++ b/source/java/org/alfresco/web/ui/common/tag/SelectListTag.java @@ -16,7 +16,6 @@ */ package org.alfresco.web.ui.common.tag; -import javax.faces.component.UICommand; import javax.faces.component.UIComponent; /** @@ -46,10 +45,12 @@ public class SelectListTag extends HtmlComponentTag protected void setProperties(UIComponent component) { super.setProperties(component); - setActionProperty((UICommand)component, this.action); - setActionListenerProperty((UICommand)component, this.actionListener); setBooleanProperty(component, "multiSelect", this.multiSelect); - setStringProperty(component, "buttonLabel", this.buttonLabel); + setBooleanProperty(component, "activeSelect", this.activeSelect); + setStringStaticProperty(component, "var", this.var); + setStringProperty(component, "itemStyle", this.itemStyle); + setStringProperty(component, "itemStyleClass", this.itemStyleClass); + setStringProperty(component, "value", this.value); } /** @@ -58,62 +59,89 @@ public class SelectListTag extends HtmlComponentTag public void release() { super.release(); - this.action = null; - this.actionListener = null; this.multiSelect = null; - this.buttonLabel = null; + this.activeSelect = null; + this.var = null; + this.itemStyle = null; + this.itemStyleClass = null; + this.value = null; } /** - * Set the action + * Set the multi-select mode * - * @param action the action - */ - public void setAction(String action) - { - this.action = action; - } - - /** - * Set the actionListener - * - * @param actionListener the actionListener - */ - public void setActionListener(String actionListener) - { - this.actionListener = actionListener; - } - - /** - * Set the multiSelect - * - * @param multiSelect the multiSelect + * @param multiSelect the multi-select mode */ public void setMultiSelect(String multiSelect) { this.multiSelect = multiSelect; } - + /** - * Set the buttonLabel + * Set the active selection mode * - * @param buttonLabel the buttonLabel + * @param activeSelect the active selection mode */ - public void setButtonLabel(String buttonLabel) + public void setActiveSelect(String activeSelect) { - this.buttonLabel = buttonLabel; + this.activeSelect = activeSelect; + } + + /** + * Set the variable name for row item context + * + * @param var the variable name for row item context + */ + public void setVar(String var) + { + this.var = var; + } + + /** + * Set the item Style + * + * @param itemStyle the item Style + */ + public void setItemStyle(String itemStyle) + { + this.itemStyle = itemStyle; } + /** + * Set the item Style Class + * + * @param itemStyleClass the item Style Class + */ + public void setItemStyleClass(String itemStyleClass) + { + this.itemStyleClass = itemStyleClass; + } + + /** + * Set the selected value + * + * @param value the selected value + */ + public void setValue(String value) + { + this.value = value; + } - /** the multiSelect */ + /** the selected value */ + private String value; + + /** the itemStyle */ + private String itemStyle; + + /** the itemStyleClass */ + private String itemStyleClass; + + /** the multi-select mode */ private String multiSelect; - /** the buttonLabel */ - private String buttonLabel; - - /** the action */ - private String action; - - /** the actionListener */ - private String actionListener; + /** the active selection mode */ + private String activeSelect; + + /** the variable name for row item context */ + private String var; } diff --git a/source/java/org/alfresco/web/ui/repo/component/UIUserGroupPicker.java b/source/java/org/alfresco/web/ui/repo/component/UIUserGroupPicker.java index fd99017deb..5ea28fd1d0 100644 --- a/source/java/org/alfresco/web/ui/repo/component/UIUserGroupPicker.java +++ b/source/java/org/alfresco/web/ui/repo/component/UIUserGroupPicker.java @@ -74,7 +74,6 @@ public class UIUserGroupPicker extends UICommand public void decode(FacesContext context) { Map requestMap = context.getExternalContext().getRequestParameterMap(); - Map valuesMap = context.getExternalContext().getRequestParameterValuesMap(); String fieldId = getHiddenFieldName(context); String value = (String)requestMap.get(fieldId); diff --git a/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java b/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java index abfcd8da51..7663f866e3 100644 --- a/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java +++ b/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java @@ -149,7 +149,6 @@ public class UIUserSandboxes extends SelfRenderingComponent public void decode(FacesContext context) { Map requestMap = context.getExternalContext().getRequestParameterMap(); - Map valuesMap = context.getExternalContext().getRequestParameterValuesMap(); String fieldId = getClientId(context); String value = (String)requestMap.get(fieldId); diff --git a/source/web/WEB-INF/alfresco.tld b/source/web/WEB-INF/alfresco.tld index 3ced834476..0409f044d0 100644 --- a/source/web/WEB-INF/alfresco.tld +++ b/source/web/WEB-INF/alfresco.tld @@ -1845,10 +1845,14 @@ The SelectList component displays a graphical list of items, each with a label and icon image. - The list has three selection modes; single select (radio), multi-select (checkbox) and command - button single item select (action). - The value for the component is a bound list of SelectListItem objects. - The selected value can be retrieved from the component or during the actionListener event handler. + The list has three selection modes; single select (radio), multi-select (checkbox) and active + selection mode (child action components). + The value for the component is collection of UIListItem objects or a UIListItems instance. + For passive single and multi-select modes, the selected value(s) can be retrieved from the component. + For active selection mode, appropriate child components such as Command buttons or Action Links + will be rendered for each item in the list, data-binding to the specified 'var' variable should be + used to bind required params. It is then up to the developer to retrieve the selected item param + from the actionListener of the appropriate child component. @@ -1881,6 +1885,24 @@ true + + itemStyle + false + true + + + + itemStyleClass + false + true + + + + var + false + true + + multiSelect false @@ -1888,26 +1910,20 @@ - buttonLabel + activeSelect false true - - action - false - true - - - - actionListener - false - true - - value - true + false + true + + + + values + false true diff --git a/source/web/css/main.css b/source/web/css/main.css index 07afece7a9..8668b703bc 100644 --- a/source/web/css/main.css +++ b/source/web/css/main.css @@ -559,3 +559,15 @@ a.topToolbarLinkHighlight, a.topToolbarLinkHighlight:link, a.topToolbarLinkHighl { padding-bottom: 8px; } + +.selectListTable +{ + border: 1px solid #999999; + padding: 2px; +} + +.selectListItem +{ + background-color: #eeeeee; + border-bottom: 2px solid #ffffff; +} diff --git a/source/web/jsp/wcm/create-website-wizard/details.jsp b/source/web/jsp/wcm/create-website-wizard/details.jsp index 30f3319fd4..d99eb5f94b 100644 --- a/source/web/jsp/wcm/create-website-wizard/details.jsp +++ b/source/web/jsp/wcm/create-website-wizard/details.jsp @@ -72,7 +72,7 @@
diff --git a/source/web/jsp/wcm/create-website-wizard/forms.jsp b/source/web/jsp/wcm/create-website-wizard/forms.jsp new file mode 100644 index 0000000000..9920ca7de2 --- /dev/null +++ b/source/web/jsp/wcm/create-website-wizard/forms.jsp @@ -0,0 +1,46 @@ +<%-- + Copyright (C) 2005 Alfresco, Inc. + + Licensed under the Mozilla Public License version 1.1 + with a permitted attribution clause. You may obtain a + copy of the License at + + http://www.alfresco.org/legal/license.txt + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + either express or implied. See the License for the specific + language governing permissions and limitations under the + License. +--%> +<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> +<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> +<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> +<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> + +<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> +<%@ page isELIgnored="false" %> + + + + + + + + + + + + + + + + + + + +
- +