diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index cd2aa037c9..52d21fd8c3 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -519,6 +519,7 @@ success_inherit_permissions=Successfully changed Inherit Parent Permissions to ' success_not_inherit_permissions=Successfully changed Inherit Parent Permissions to 'No' apply_dashboard=Apply Dashboard apply_dashboard_info=Select a template to be applied to the Space as a Dashboard view. +apply_dashboard_doc_info=Select a template to be applied to the Document as a Dashboard view. # Export messages export_info=Exports metadata and content from this or all Spaces. @@ -800,6 +801,7 @@ title_edit_simple_workflow=Edit Simple Workflow title_edit_space=Edit Space Details title_rules=Space Rules title_space_details=Space Details +title_apply_template=Apply Template title_system_info=System Information title_undo_checkout=Undo Check Out title_update_file=Update File Content diff --git a/config/alfresco/templates/translatable.ftl b/config/alfresco/templates/translatable.ftl index 664f6e78e2..6d6e692a28 100644 --- a/config/alfresco/templates/translatable.ftl +++ b/config/alfresco/templates/translatable.ftl @@ -4,9 +4,11 @@ <#if hasAspect(document, "cm:translatable") = 1> Yes
- <#list document.assocs["cm:translations"] as t> - - + <#if document.assocs["cm:translations"]?exists> + <#list document.assocs["cm:translations"] as t> + + +
${t.content}
${t.content}
<#else> No
diff --git a/config/alfresco/templates/xpath_search.ftl b/config/alfresco/templates/xpath_search.ftl index 9d9a34c150..b81f9440d5 100644 --- a/config/alfresco/templates/xpath_search.ftl +++ b/config/alfresco/templates/xpath_search.ftl @@ -1,8 +1,8 @@ <#-- Shows use of the childByNamePath, childrenByXPath and childrenByLuceneSearch API --> -

Template Documents in 'Company Home/Data Dictionary/Content Templates':

+

Template Documents in 'Company Home/Data Dictionary/Presentation Templates':

-<#list companyhome.childByNamePath["Data Dictionary/Content Templates"].children as child> +<#list companyhome.childByNamePath["Data Dictionary/Presentation Templates"].children as child> <#if child.isDocument> diff --git a/config/alfresco/web-client-config-actions.xml b/config/alfresco/web-client-config-actions.xml index 5978b6e3a4..96ee52a93b 100644 --- a/config/alfresco/web-client-config-actions.xml +++ b/config/alfresco/web-client-config-actions.xml @@ -142,7 +142,7 @@ preview/images/icons/preview.gif#{BrowseBean.setupContentAction} - previewContent + dialog:previewContent #{actionContext.id} @@ -153,7 +153,7 @@ preview/images/icons/preview.gif#{BrowseBean.setupSpaceAction} - previewSpace + dialog:previewSpace #{actionContext.id} diff --git a/source/java/org/alfresco/web/bean/BaseDetailsBean.java b/source/java/org/alfresco/web/bean/BaseDetailsBean.java new file mode 100644 index 0000000000..9c464bab11 --- /dev/null +++ b/source/java/org/alfresco/web/bean/BaseDetailsBean.java @@ -0,0 +1,370 @@ +/* + * 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. + */ +package org.alfresco.web.bean; + +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Map; + +import javax.faces.application.FacesMessage; +import javax.faces.context.FacesContext; +import javax.faces.event.ActionEvent; +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.service.cmr.repository.TemplateImageResolver; +import org.alfresco.service.cmr.security.OwnableService; +import org.alfresco.web.app.Application; +import org.alfresco.web.bean.repository.Node; +import org.alfresco.web.bean.repository.Repository; +import org.alfresco.web.ui.common.Utils; +import org.alfresco.web.ui.common.Utils.URLMode; +import org.alfresco.web.ui.common.component.UIPanel.ExpandedEvent; + +/** + * Backing bean provided access to the details of a Node + * + * @author Kevin Roast + */ +public abstract class BaseDetailsBean +{ + private static final String MSG_SUCCESS_OWNERSHIP = "success_ownership"; + + /** BrowseBean instance */ + protected BrowseBean browseBean; + + /** The NavigationBean bean reference */ + protected NavigationBean navigator; + + /** NodeServuce bean reference */ + protected NodeService nodeService; + + /** OwnableService bean reference */ + protected OwnableService ownableService; + + /** Selected template Id */ + protected String template; + + protected Map panels = new HashMap(4, 1.0f); + + + // ------------------------------------------------------------------------------ + // Bean property getters and setters + + /** + * Sets the BrowseBean instance to use to retrieve the current Space + * + * @param browseBean BrowseBean instance + */ + public void setBrowseBean(BrowseBean browseBean) + { + this.browseBean = browseBean; + } + + /** + * @param navigator The NavigationBean to set. + */ + public void setNavigator(NavigationBean navigator) + { + this.navigator = navigator; + } + + /** + * @param nodeService The NodeService to set + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * Sets the ownable service instance the bean should use + * + * @param ownableService The OwnableService + */ + public void setOwnableService(OwnableService ownableService) + { + this.ownableService = ownableService; + } + + /** + * @return Returns the panels expanded state map. + */ + public Map getPanels() + { + return this.panels; + } + + /** + * @param panels The panels expanded state map. + */ + public void setPanels(Map panels) + { + this.panels = panels; + } + + /** + * Returns the Node this bean is currently representing + * + * @return The Node + */ + public abstract Node getNode(); + + /** + * Returns the id of the current space + * + * @return The id + */ + public String getId() + { + return getNode().getId(); + } + + /** + * Returns the name of the current space + * + * @return Name of the current space + */ + public String getName() + { + return getNode().getName(); + } + + /** + * Return the Alfresco NodeRef URL for the current node + * + * @return the Alfresco NodeRef URL + */ + public String getNodeRefUrl() + { + return getNode().getNodeRef().toString(); + } + + /** + * Returns the WebDAV URL for the current node + * + * @return The WebDAV url + */ + public String getWebdavUrl() + { + Node space = getLinkResolvedNode(); + return Utils.generateURL(FacesContext.getCurrentInstance(), space, URLMode.WEBDAV); + } + + /** + * Returns the CIFS path for the current node + * + * @return The CIFS path + */ + public String getCifsPath() + { + Node space = getLinkResolvedNode(); + return Utils.generateURL(FacesContext.getCurrentInstance(), space, URLMode.CIFS); + } + + /** + * Returns the URL to access the details page for the current node + * + * @return The bookmark URL + */ + public String getBookmarkUrl() + { + return Utils.generateURL(FacesContext.getCurrentInstance(), getNode(), URLMode.SHOW_DETAILS); + } + + /** + * Resolve the actual Node from any Link object that may be proxying it + * + * @return current Node or Node resolved from any Link object + */ + protected abstract Node getLinkResolvedNode(); + + /** + * @return Returns the template Id. + */ + public String getTemplate() + { + // return current template if it exists + NodeRef ref = (NodeRef)getNode().getProperties().get(ContentModel.PROP_TEMPLATE); + return ref != null ? ref.getId() : this.template; + } + + /** + * @param template The template Id to set. + */ + public void setTemplate(String template) + { + this.template = template; + } + + /** + * @return true if the current document has the 'templatable' aspect applied and + * references a template that currently exists in the system. + */ + public boolean isTemplatable() + { + NodeRef templateRef = (NodeRef)getNode().getProperties().get(ContentModel.PROP_TEMPLATE); + return (getNode().hasAspect(ContentModel.ASPECT_TEMPLATABLE) && + templateRef != null && nodeService.exists(templateRef)); + } + + /** + * @return String of the NodeRef for the dashboard template used by the space if any + */ + public String getTemplateRef() + { + NodeRef ref = (NodeRef)getNode().getProperties().get(ContentModel.PROP_TEMPLATE); + return ref != null ? ref.toString() : null; + } + + /** + * Returns a model for use by a template on the Details page. + * + * @return model containing current current node info. + */ + public abstract Map getTemplateModel(); + + /** Template Image resolver helper */ + protected TemplateImageResolver imageResolver = new TemplateImageResolver() + { + public String resolveImagePathForName(String filename, boolean small) + { + return Utils.getFileTypeImage(filename, small); + } + }; + + + // ------------------------------------------------------------------------------ + // Action event handlers + + /** + * Action handler to apply the selected Template and Templatable aspect to the current Space + */ + public String applyTemplate() + { + if (this.template != null && this.template.equals(TemplateSupportBean.NO_SELECTION) == false) + { + try + { + // apply the templatable aspect if required + if (getNode().hasAspect(ContentModel.ASPECT_TEMPLATABLE) == false) + { + this.nodeService.addAspect(getNode().getNodeRef(), ContentModel.ASPECT_TEMPLATABLE, null); + } + + // get the selected template from the Template Picker + NodeRef templateRef = new NodeRef(Repository.getStoreRef(), this.template); + + // set the template NodeRef into the templatable aspect property + this.nodeService.setProperty(getNode().getNodeRef(), ContentModel.PROP_TEMPLATE, templateRef); + + // reset node details for next refresh of details page + getNode().reset(); + } + catch (Exception e) + { + Utils.addErrorMessage(MessageFormat.format(Application.getMessage( + FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), e.getMessage()), e); + } + } + return getReturnOutcome(); + } + + /** + * Action handler to remove a dashboard template from the current Space + */ + public String removeTemplate() + { + try + { + // clear template property + this.nodeService.setProperty(getNode().getNodeRef(), ContentModel.PROP_TEMPLATE, null); + this.nodeService.removeAspect(getNode().getNodeRef(), ContentModel.ASPECT_TEMPLATABLE); + + // reset node details for next refresh of details page + getNode().reset(); + } + catch (Exception e) + { + Utils.addErrorMessage(MessageFormat.format(Application.getMessage( + FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), e.getMessage()), e); + } + return getReturnOutcome(); + } + + /** + * @return return to details page JSF navigation outcome + */ + protected abstract String getReturnOutcome(); + + /** + * Action Handler to take Ownership of the current Space + */ + public void takeOwnership(ActionEvent event) + { + FacesContext fc = FacesContext.getCurrentInstance(); + + UserTransaction tx = null; + + try + { + tx = Repository.getUserTransaction(fc); + tx.begin(); + + this.ownableService.takeOwnership(getNode().getNodeRef()); + + String msg = Application.getMessage(fc, MSG_SUCCESS_OWNERSHIP); + FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg); + String formId = Utils.getParentForm(fc, event.getComponent()).getClientId(fc); + fc.addMessage(formId + ':' + getPropertiesPanelId(), facesMsg); + + // commit the transaction + tx.commit(); + } + catch (Throwable e) + { + // rollback the transaction + try { if (tx != null) {tx.rollback();} } catch (Exception ex) {} + Utils.addErrorMessage(MessageFormat.format(Application.getMessage( + fc, Repository.ERROR_GENERIC), e.getMessage()), e); + } + } + + /** + * @return id of the properties panel component + */ + protected abstract String getPropertiesPanelId(); + + /** + * Save the state of the panel that was expanded/collapsed + */ + public void expandPanel(ActionEvent event) + { + if (event instanceof ExpandedEvent) + { + String id = event.getComponent().getId(); + // we prefix some panels with "no-" which we remove to give consistent behaviour in the UI + if (id.startsWith("no-") == true) + { + id = id.substring(3); + } + this.panels.put(id, ((ExpandedEvent)event).State); + } + } +} diff --git a/source/java/org/alfresco/web/bean/DocumentDetailsBean.java b/source/java/org/alfresco/web/bean/DocumentDetailsBean.java index cd92caaa3d..604d9ccd09 100644 --- a/source/java/org/alfresco/web/bean/DocumentDetailsBean.java +++ b/source/java/org/alfresco/web/bean/DocumentDetailsBean.java @@ -24,7 +24,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; import javax.transaction.UserTransaction; @@ -37,10 +36,7 @@ import org.alfresco.service.cmr.lock.LockService; import org.alfresco.service.cmr.repository.ContentData; import org.alfresco.service.cmr.repository.CopyService; import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.TemplateImageResolver; import org.alfresco.service.cmr.repository.TemplateNode; -import org.alfresco.service.cmr.security.OwnableService; import org.alfresco.service.cmr.version.Version; import org.alfresco.service.cmr.version.VersionHistory; import org.alfresco.service.cmr.version.VersionService; @@ -56,7 +52,6 @@ import org.alfresco.web.bean.wizard.NewRuleWizard; import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.Utils.URLMode; import org.alfresco.web.ui.common.component.UIActionLink; -import org.alfresco.web.ui.common.component.UIPanel.ExpandedEvent; import org.apache.log4j.Logger; /** @@ -64,9 +59,10 @@ import org.apache.log4j.Logger; * * @author gavinc */ -public class DocumentDetailsBean +public class DocumentDetailsBean extends BaseDetailsBean { - private static final String MSG_SUCCESS_OWNERSHIP = "success_ownership"; + private static final String OUTCOME_RETURN = "showDocDetails"; + private static final String MSG_HAS_FOLLOWING_CATEGORIES = "has_following_categories"; private static final String MSG_NO_CATEGORIES_APPLIED = "no_categories_applied"; private static final String MSG_ERROR_ASPECT_INLINEEDITABLE = "error_aspect_inlineeditable"; @@ -79,22 +75,19 @@ public class DocumentDetailsBean private static Logger logger = Logger.getLogger(DocumentDetailsBean.class); - protected BrowseBean browseBean; - protected NodeService nodeService; protected LockService lockService; protected CopyService copyService; protected VersionService versionService; - protected OwnableService ownableService; - protected NavigationBean navigator; protected CheckOutCheckInService cociService; - private Map panels = new HashMap(5, 1.0f); - private Map workflowProperties; private NodeRef addedCategory; private List categories; + // ------------------------------------------------------------------------------ + // Construction + /** * Default constructor */ @@ -106,6 +99,10 @@ public class DocumentDetailsBean panels.put("version-history-panel", false); } + + // ------------------------------------------------------------------------------ + // Bean property getters and setters + /** * Resets any state that may be held by this bean */ @@ -119,26 +116,6 @@ public class DocumentDetailsBean this.addedCategory = null; } - /** - * Returns the id of the current document - * - * @return The id - */ - public String getId() - { - return getDocument().getId(); - } - - /** - * Returns the name of the current document - * - * @return Name of the current document - */ - public String getName() - { - return getDocument().getName(); - } - /** * Returns the URL to download content for the current document * @@ -156,7 +133,7 @@ public class DocumentDetailsBean */ public String getBrowserUrl() { - Node doc = getLinkResolvedDocument(); + Node doc = getLinkResolvedNode(); return Utils.generateURL(FacesContext.getCurrentInstance(), doc, URLMode.HTTP_INLINE); } @@ -167,48 +144,16 @@ public class DocumentDetailsBean */ public String getDownloadUrl() { - Node doc = getLinkResolvedDocument(); + Node doc = getLinkResolvedNode(); return Utils.generateURL(FacesContext.getCurrentInstance(), doc, URLMode.HTTP_DOWNLOAD); } - /** - * Returns the WebDAV URL for the current document - * - * @return The WebDAV url - */ - public String getWebdavUrl() - { - Node doc = getLinkResolvedDocument(); - return Utils.generateURL(FacesContext.getCurrentInstance(), doc, URLMode.WEBDAV); - } - - /** - * Returns the CIFS path for the current document - * - * @return The CIFS path - */ - public String getCifsPath() - { - Node doc = getLinkResolvedDocument(); - return Utils.generateURL(FacesContext.getCurrentInstance(), doc, URLMode.CIFS); - } - - /** - * Returns the URL to access the details page for the current document - * - * @return The bookmark URL - */ - public String getBookmarkUrl() - { - return Utils.generateURL(FacesContext.getCurrentInstance(), getDocument(), URLMode.SHOW_DETAILS); - } - /** * Resolve the actual document Node from any Link object that may be proxying it * * @return current document Node or document Node resolved from any Link object */ - private Node getLinkResolvedDocument() + protected Node getLinkResolvedNode() { Node document = getDocument(); if (ContentModel.TYPE_FILELINK.equals(document.getType())) @@ -219,16 +164,6 @@ public class DocumentDetailsBean return document; } - /** - * Return the Alfresco NodeRef URL for the current document - * - * @return the Alfresco NodeRef URL - */ - public String getNodeRefUrl() - { - return getDocument().getNodeRef().toString(); - } - /** * Determines whether the current document is versionable * @@ -307,7 +242,7 @@ public class DocumentDetailsBean { // we know for now that the general classifiable aspect only will be // applied so we can retrive the categories property direclty - Collection categories = (Collection)this.nodeService.getProperty(this.browseBean.getDocument().getNodeRef(), + Collection categories = (Collection)this.nodeService.getProperty(getDocument().getNodeRef(), ContentModel.PROP_CATEGORIES); if (categories == null || categories.size() == 0) @@ -348,7 +283,7 @@ public class DocumentDetailsBean */ public void setupCategoriesForEdit(ActionEvent event) { - this.categories = (List)this.nodeService.getProperty(this.browseBean.getDocument().getNodeRef(), + this.categories = (List)this.nodeService.getProperty(getDocument().getNodeRef(), ContentModel.PROP_CATEGORIES); } @@ -582,8 +517,7 @@ public class DocumentDetailsBean } /** - * - * @return + * Cancel Workflow Edit dialog */ public String cancelWorkflowEdit() { @@ -1006,7 +940,7 @@ public class DocumentDetailsBean } // force recreation of the details view - this means the properties sheet component will reinit - return "showDocDetails"; + return OUTCOME_RETURN; } /** @@ -1091,53 +1025,19 @@ public class DocumentDetailsBean } /** - * Action Handler to take Ownership of the current document + * @see org.alfresco.web.bean.BaseDetailsBean#getPropertiesPanelId() */ - public void takeOwnership(ActionEvent event) + protected String getPropertiesPanelId() { - FacesContext fc = FacesContext.getCurrentInstance(); - - UserTransaction tx = null; - - try - { - tx = Repository.getUserTransaction(fc); - tx.begin(); - - this.ownableService.takeOwnership(getDocument().getNodeRef()); - - String msg = Application.getMessage(fc, MSG_SUCCESS_OWNERSHIP); - FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg); - String formId = Utils.getParentForm(fc, event.getComponent()).getClientId(fc); - fc.addMessage(formId + ":document-props", facesMsg); - - // commit the transaction - tx.commit(); - } - catch (Throwable e) - { - // rollback the transaction - try { if (tx != null) {tx.rollback();} } catch (Exception ex) {} - Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - fc, Repository.ERROR_GENERIC), e.getMessage()), e); - } + return "document-props"; } - + /** - * Save the state of the panel that was expanded/collapsed + * @see org.alfresco.web.bean.BaseDetailsBean#getReturnOutcome() */ - public void expandPanel(ActionEvent event) + protected String getReturnOutcome() { - if (event instanceof ExpandedEvent) - { - String id = event.getComponent().getId(); - // we prefix some panels with "no-" which we remove to give consistent behaviour in the UI - if (id.startsWith("no-") == true) - { - id = id.substring(3); - } - this.panels.put(id, ((ExpandedEvent)event).State); - } + return OUTCOME_RETURN; } /** @@ -1147,7 +1047,7 @@ public class DocumentDetailsBean */ public Map getTemplateModel() { - HashMap model = new HashMap(2, 1.0f); + Map model = new HashMap(2, 1.0f); FacesContext fc = FacesContext.getCurrentInstance(); TemplateNode documentNode = new TemplateNode(getDocument().getNodeRef(), @@ -1160,15 +1060,6 @@ public class DocumentDetailsBean return model; } - /** Template Image resolver helper */ - private TemplateImageResolver imageResolver = new TemplateImageResolver() - { - public String resolveImagePathForName(String filename, boolean small) - { - return Utils.getFileTypeImage(filename, small); - } - }; - /** * Returns whether the current document is locked * @@ -1218,6 +1109,16 @@ public class DocumentDetailsBean return getDocument().isWorkingCopyOwner(); } + /** + * Returns the Node this bean is currently representing + * + * @return The Node + */ + public Node getNode() + { + return this.browseBean.getDocument(); + } + /** * Returns the document this bean is currently representing * @@ -1225,43 +1126,7 @@ public class DocumentDetailsBean */ public Node getDocument() { - return this.browseBean.getDocument(); - } - - /** - * @return Returns the panels expanded state map. - */ - public Map getPanels() - { - return this.panels; - } - - /** - * @param panels The panels expanded state map. - */ - public void setPanels(Map panels) - { - this.panels = panels; - } - - /** - * Sets the BrowseBean instance to use to retrieve the current document - * - * @param browseBean BrowseBean instance - */ - public void setBrowseBean(BrowseBean browseBean) - { - this.browseBean = browseBean; - } - - /** - * Sets the node service instance the bean should use - * - * @param nodeService The NodeService - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; + return this.getNode(); } /** @@ -1294,16 +1159,6 @@ public class DocumentDetailsBean this.copyService = copyService; } - /** - * Sets the ownable service instance the bean should use - * - * @param ownableService The OwnableService - */ - public void setOwnableService(OwnableService ownableService) - { - this.ownableService = ownableService; - } - /** * Sets the checkincheckout service instance the bean should use * @@ -1313,12 +1168,4 @@ public class DocumentDetailsBean { this.cociService = cociService; } - - /** - * @param navigator The NavigationBean to set. - */ - public void setNavigator(NavigationBean navigator) - { - this.navigator = navigator; - } } diff --git a/source/java/org/alfresco/web/bean/SpaceDetailsBean.java b/source/java/org/alfresco/web/bean/SpaceDetailsBean.java index ef4fc05219..93e668ff61 100644 --- a/source/java/org/alfresco/web/bean/SpaceDetailsBean.java +++ b/source/java/org/alfresco/web/bean/SpaceDetailsBean.java @@ -43,36 +43,17 @@ import org.alfresco.web.ui.common.component.UIActionLink; import org.alfresco.web.ui.common.component.UIPanel.ExpandedEvent; /** - * Back bean provided access to the details of a Space + * Backing bean provided access to the details of a Space * * @author Kevin Roast */ -public class SpaceDetailsBean +public class SpaceDetailsBean extends BaseDetailsBean { - private static final String MSG_SUCCESS_OWNERSHIP = "success_ownership"; - private static final String OUTCOME_RETURN = "showSpaceDetails"; - /** BrowseBean instance */ - protected BrowseBean browseBean; - - /** The NavigationBean bean reference */ - protected NavigationBean navigator; - /** PermissionService bean reference */ protected PermissionService permissionService; - /** OwnableService bean reference */ - protected OwnableService ownableService; - - /** NodeServuce bean reference */ - protected NodeService nodeService; - - /** Selected template Id */ - private String template; - - private Map panels = new HashMap(4, 1.0f); - // ------------------------------------------------------------------------------ // Construction @@ -90,32 +71,6 @@ public class SpaceDetailsBean // ------------------------------------------------------------------------------ // Bean property getters and setters - /** - * Sets the BrowseBean instance to use to retrieve the current Space - * - * @param browseBean BrowseBean instance - */ - public void setBrowseBean(BrowseBean browseBean) - { - this.browseBean = browseBean; - } - - /** - * @param navigator The NavigationBean to set. - */ - public void setNavigator(NavigationBean navigator) - { - this.navigator = navigator; - } - - /** - * @param nodeService The NodeService to set - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - /** * @param permissionService The PermissionService to set. */ @@ -125,29 +80,13 @@ public class SpaceDetailsBean } /** - * Sets the ownable service instance the bean should use + * Returns the Node this bean is currently representing * - * @param ownableService The OwnableService + * @return The Node */ - public void setOwnableService(OwnableService ownableService) + public Node getNode() { - this.ownableService = ownableService; - } - - /** - * @return Returns the panels expanded state map. - */ - public Map getPanels() - { - return this.panels; - } - - /** - * @param panels The panels expanded state map. - */ - public void setPanels(Map panels) - { - this.panels = panels; + return this.browseBean.getActionSpace(); } /** @@ -157,67 +96,15 @@ public class SpaceDetailsBean */ public Node getSpace() { - return this.browseBean.getActionSpace(); + return getNode(); } /** - * Returns the id of the current space + * Resolve the actual document Node from any Link object that may be proxying it * - * @return The id + * @return current document Node or document Node resolved from any Link object */ - public String getId() - { - return getSpace().getId(); - } - - /** - * Returns the name of the current space - * - * @return Name of the current space - */ - public String getName() - { - return getSpace().getName(); - } - - /** - * Returns the WebDAV URL for the current space - * - * @return The WebDAV url - */ - public String getWebdavUrl() - { - Node space = getLinkResolvedSpace(); - return Utils.generateURL(FacesContext.getCurrentInstance(), space, URLMode.WEBDAV); - } - - /** - * Returns the CIFS path for the current space - * - * @return The CIFS path - */ - public String getCifsPath() - { - Node space = getLinkResolvedSpace(); - return Utils.generateURL(FacesContext.getCurrentInstance(), space, URLMode.CIFS); - } - - /** - * Returns the URL to access the details page for the current space - * - * @return The bookmark URL - */ - public String getBookmarkUrl() - { - return Utils.generateURL(FacesContext.getCurrentInstance(), getSpace(), URLMode.SHOW_DETAILS); - } - - /** - * Resolve the actual space Node from any Link object that may be proxying it - * - * @return current space Node or space Node resolved from any Link object - */ - private Node getLinkResolvedSpace() + protected Node getLinkResolvedNode() { Node space = getSpace(); if (ContentModel.TYPE_FOLDERLINK.equals(space.getType())) @@ -228,54 +115,6 @@ public class SpaceDetailsBean return space; } - /** - * Return the Alfresco NodeRef URL for the current space - * - * @return the Alfresco NodeRef URL - */ - public String getNodeRefUrl() - { - return getSpace().getNodeRef().toString(); - } - - /** - * @return Returns the template Id. - */ - public String getTemplate() - { - // return current template if it exists - NodeRef ref = (NodeRef)getSpace().getProperties().get(ContentModel.PROP_TEMPLATE); - return ref != null ? ref.getId() : this.template; - } - - /** - * @param template The template Id to set. - */ - public void setTemplate(String template) - { - this.template = template; - } - - /** - * @return true if the current document has the 'templatable' aspect applied and - * references a template that currently exists in the system. - */ - public boolean isTemplatable() - { - NodeRef templateRef = (NodeRef)getSpace().getProperties().get(ContentModel.PROP_TEMPLATE); - return (getSpace().hasAspect(ContentModel.ASPECT_TEMPLATABLE) && - templateRef != null && nodeService.exists(templateRef)); - } - - /** - * @return String of the NodeRef for the dashboard template used by the space if any - */ - public String getTemplateRef() - { - NodeRef ref = (NodeRef)getSpace().getProperties().get(ContentModel.PROP_TEMPLATE); - return ref != null ? ref.toString() : null; - } - /** * Returns a model for use by a template on the Space Details page. * @@ -287,121 +126,33 @@ public class SpaceDetailsBean HashMap model = new HashMap(1, 1.0f); FacesContext fc = FacesContext.getCurrentInstance(); - TemplateNode spaceNode = new TemplateNode(getSpace().getNodeRef(), Repository.getServiceRegistry(fc), - new TemplateImageResolver() { - public String resolveImagePathForName(String filename, boolean small) { - return Utils.getFileTypeImage(filename, small); - } - }); + TemplateNode spaceNode = new TemplateNode(getSpace().getNodeRef(), + Repository.getServiceRegistry(fc), imageResolver); model.put("space", spaceNode); return model; } + /** + * @see org.alfresco.web.bean.BaseDetailsBean#getPropertiesPanelId() + */ + protected String getPropertiesPanelId() + { + return "space-props"; + } + + /** + * @see org.alfresco.web.bean.BaseDetailsBean#getReturnOutcome() + */ + protected String getReturnOutcome() + { + return OUTCOME_RETURN; + } + // ------------------------------------------------------------------------------ // Action event handlers - /** - * Action handler to apply the selected Template and Templatable aspect to the current Space - */ - public String applyTemplate() - { - if (this.template != null && this.template.equals(TemplateSupportBean.NO_SELECTION) == false) - { - try - { - // apply the templatable aspect if required - if (getSpace().hasAspect(ContentModel.ASPECT_TEMPLATABLE) == false) - { - this.nodeService.addAspect(getSpace().getNodeRef(), ContentModel.ASPECT_TEMPLATABLE, null); - } - - // get the selected template from the Template Picker - NodeRef templateRef = new NodeRef(Repository.getStoreRef(), this.template); - - // set the template NodeRef into the templatable aspect property - this.nodeService.setProperty(getSpace().getNodeRef(), ContentModel.PROP_TEMPLATE, templateRef); - - // reset space details for next refresh of details page - getSpace().reset(); - } - catch (Exception e) - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), e.getMessage()), e); - } - } - return OUTCOME_RETURN; - } - - /** - * Action handler to remove a dashboard template from the current Space - */ - public String removeTemplate() - { - try - { - // clear template property - this.nodeService.setProperty(getSpace().getNodeRef(), ContentModel.PROP_TEMPLATE, null); - this.nodeService.removeAspect(getSpace().getNodeRef(), ContentModel.ASPECT_TEMPLATABLE); - - // reset space details for next refresh of details page - getSpace().reset(); - } - catch (Exception e) - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), e.getMessage()), e); - } - return OUTCOME_RETURN; - } - - /** - * Action Handler to take Ownership of the current Space - */ - public void takeOwnership(ActionEvent event) - { - FacesContext fc = FacesContext.getCurrentInstance(); - - UserTransaction tx = null; - - try - { - tx = Repository.getUserTransaction(fc); - tx.begin(); - - this.ownableService.takeOwnership(getSpace().getNodeRef()); - - String msg = Application.getMessage(fc, MSG_SUCCESS_OWNERSHIP); - FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg); - String formId = Utils.getParentForm(fc, event.getComponent()).getClientId(fc); - fc.addMessage(formId + ":space-props", facesMsg); - - // commit the transaction - tx.commit(); - } - catch (Throwable e) - { - // rollback the transaction - try { if (tx != null) {tx.rollback();} } catch (Exception ex) {} - Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - fc, Repository.ERROR_GENERIC), e.getMessage()), e); - } - } - - /** - * Save the state of the panel that was expanded/collapsed - */ - public void expandPanel(ActionEvent event) - { - if (event instanceof ExpandedEvent) - { - String id = event.getComponent().getId(); - this.panels.put(id, ((ExpandedEvent)event).State); - } - } - /** * Navigates to next item in the list of Spaces */ diff --git a/source/web/WEB-INF/faces-config-navigation.xml b/source/web/WEB-INF/faces-config-navigation.xml index 9853afe0b8..46f3657ede 100644 --- a/source/web/WEB-INF/faces-config-navigation.xml +++ b/source/web/WEB-INF/faces-config-navigation.xml @@ -273,7 +273,7 @@ applyTemplate - /jsp/dialog/apply-template.jsp + /jsp/dialog/apply-space-template.jsp previewSpace @@ -359,6 +359,10 @@ manageContentUsers /jsp/roles/manage-content-users.jsp + + applyTemplate + /jsp/dialog/apply-doc-template.jsp + diff --git a/source/web/jsp/dialog/apply-doc-template.jsp b/source/web/jsp/dialog/apply-doc-template.jsp new file mode 100644 index 0000000000..89c6ccd763 --- /dev/null +++ b/source/web/jsp/dialog/apply-doc-template.jsp @@ -0,0 +1,149 @@ +<%-- + 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="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> +<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> + +<%@ page buffer="64kb" contentType="text/html;charset=UTF-8" %> +<%@ page isELIgnored="false" %> +<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %> + + + + + + <%-- load a bundle of properties with I18N strings --%> + + + + + <%-- Main outer table --%> +
${child.properties.name}
+ + <%-- Title bar --%> + + + + + <%-- Main area --%> + + <%-- Shelf --%> + + + <%-- Work Area --%> + + +
+ <%@ include file="../parts/titlebar.jsp" %> +
+ <%@ include file="../parts/shelf.jsp" %> + + + <%-- Breadcrumb --%> + <%@ include file="../parts/breadcrumb.jsp" %> + + <%-- Status and Actions --%> + + + + + + + <%-- separator row with gradient shadow --%> + + + + + + + <%-- Details --%> + + + + + + + <%-- separator row with bottom panel graphics --%> + + + + + + +
+ + <%-- Status and Actions inner contents table --%> + <%-- Generally this consists of an icon, textual summary and actions for the current object --%> + + + + + +
+ + +
''
+
+
+ +
+ + + + + + +
+ <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %> + + + + + +
: + <%-- Templates drop-down selector --%> + + + +
+ <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %> +
+ <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %> + + + + + + + +
+ +
+ +
+ <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %> +
+
+
+ + + + + + \ No newline at end of file diff --git a/source/web/jsp/dialog/apply-template.jsp b/source/web/jsp/dialog/apply-space-template.jsp similarity index 96% rename from source/web/jsp/dialog/apply-template.jsp rename to source/web/jsp/dialog/apply-space-template.jsp index 62332cce64..c2b79cc254 100644 --- a/source/web/jsp/dialog/apply-template.jsp +++ b/source/web/jsp/dialog/apply-space-template.jsp @@ -1,149 +1,149 @@ -<%-- - 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="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - -<%@ page buffer="64kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> -<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %> - - - - - - <%-- load a bundle of properties with I18N strings --%> - - - - - <%-- Main outer table --%> - - - <%-- Title bar --%> - - - - - <%-- Main area --%> - - <%-- Shelf --%> - - - <%-- Work Area --%> - - -
- <%@ include file="../parts/titlebar.jsp" %> -
- <%@ include file="../parts/shelf.jsp" %> - - - <%-- Breadcrumb --%> - <%@ include file="../parts/breadcrumb.jsp" %> - - <%-- Status and Actions --%> - - - - - - - <%-- separator row with gradient shadow --%> - - - - - - - <%-- Details --%> - - - - - - - <%-- separator row with bottom panel graphics --%> - - - - - - -
- - <%-- Status and Actions inner contents table --%> - <%-- Generally this consists of an icon, textual summary and actions for the current object --%> - - - - - -
- - -
''
-
-
- -
- - - - - - -
- <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %> - - - - - -
: - <%-- Templates drop-down selector --%> - - - -
- <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %> -
- <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %> - - - - - - - -
- -
- -
- <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %> -
-
-
- -
- -
- +<%-- + 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="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> +<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> + +<%@ page buffer="64kb" contentType="text/html;charset=UTF-8" %> +<%@ page isELIgnored="false" %> +<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %> + + + + + + <%-- load a bundle of properties with I18N strings --%> + + + + + <%-- Main outer table --%> + + + <%-- Title bar --%> + + + + + <%-- Main area --%> + + <%-- Shelf --%> + + + <%-- Work Area --%> + + +
+ <%@ include file="../parts/titlebar.jsp" %> +
+ <%@ include file="../parts/shelf.jsp" %> + + + <%-- Breadcrumb --%> + <%@ include file="../parts/breadcrumb.jsp" %> + + <%-- Status and Actions --%> + + + + + + + <%-- separator row with gradient shadow --%> + + + + + + + <%-- Details --%> + + + + + + + <%-- separator row with bottom panel graphics --%> + + + + + + +
+ + <%-- Status and Actions inner contents table --%> + <%-- Generally this consists of an icon, textual summary and actions for the current object --%> + + + + + +
+ + +
''
+
+
+ +
+ + + + + + +
+ <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %> + + + + + +
: + <%-- Templates drop-down selector --%> + + + +
+ <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %> +
+ <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %> + + + + + + + +
+ +
+ +
+ <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %> +
+
+
+ +
+ +
+
\ No newline at end of file diff --git a/source/web/jsp/dialog/document-details.jsp b/source/web/jsp/dialog/document-details.jsp index fca1c0ca21..ad95225eaf 100644 --- a/source/web/jsp/dialog/document-details.jsp +++ b/source/web/jsp/dialog/document-details.jsp @@ -116,6 +116,37 @@
+ <%-- wrapper comment used by the panel to add additional component facets --%> + + + + + + + + + + + + + +
+ + + + +
+ +
+
+
+
+ +
+ diff --git a/source/web/jsp/dialog/preview-file.jsp b/source/web/jsp/dialog/preview-file.jsp index 442b321eb3..b9d6db2854 100644 --- a/source/web/jsp/dialog/preview-file.jsp +++ b/source/web/jsp/dialog/preview-file.jsp @@ -128,7 +128,7 @@
- +
diff --git a/source/web/jsp/dialog/preview-space.jsp b/source/web/jsp/dialog/preview-space.jsp index 805549bea3..e02870f638 100644 --- a/source/web/jsp/dialog/preview-space.jsp +++ b/source/web/jsp/dialog/preview-space.jsp @@ -128,7 +128,7 @@
- +