diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index f2fffa3db6..b778cd4641 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -158,6 +158,7 @@ system_error=System Error login=Login templates=Templates template=Template +rss_template=RSS Template select_button=Select... select_items=Select items select_an_item=Select an item @@ -545,6 +546,12 @@ success_not_inherit_permissions=Successfully changed Inherit Parent Permissions 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. +apply_rss_feed=Apply RSS Feed Template +apply_rss_feed_info=Select a template to be applied to the Space as an RSS feed. +apply_rss_feed_warning1=This Space must be visible to the Guest user for the RSS feed to be publically viewable, you can Invite the Guest user using the +apply_rss_feed_warning2=view. +rss_feed=RSS Feed +rss_feed_link=RSS Feed Link # Export messages export_info=Exports metadata and content from this or all Spaces. diff --git a/source/java/org/alfresco/web/app/Application.java b/source/java/org/alfresco/web/app/Application.java index 8e00ddb3f4..fb5c0b87c3 100644 --- a/source/java/org/alfresco/web/app/Application.java +++ b/source/java/org/alfresco/web/app/Application.java @@ -71,6 +71,7 @@ public class Application private static String spaceTemplatesFolderName; private static String contentTemplatesFolderName; private static String emailTemplatesFolderName; + private static String rssTemplatesFolderName; private static String savedSearchesFolderName; private static String scriptsFolderName; private static String guestHomeFolderName; @@ -376,6 +377,22 @@ public class Application return getEmailTemplatesFolderName(FacesContextUtils.getRequiredWebApplicationContext(context)); } + /** + * @return Returns the RSS templates folder name + */ + public static String getRSSTemplatesFolderName(ServletContext context) + { + return getRSSTemplatesFolderName(WebApplicationContextUtils.getRequiredWebApplicationContext(context)); + } + + /** + * @return Returns the RSS templates folder name + */ + public static String getRSSTemplatesFolderName(FacesContext context) + { + return getRSSTemplatesFolderName(FacesContextUtils.getRequiredWebApplicationContext(context)); + } + /** * @return Return the Saved Searches folder name */ @@ -750,6 +767,24 @@ public class Application return emailTemplatesFolderName; } + /** + * Returns the RSS Templates folder name + * + * @param context The spring context + * @return The RSS folder name + */ + private static String getRSSTemplatesFolderName(WebApplicationContext context) + { + if (rssTemplatesFolderName == null) + { + ImporterBootstrap bootstrap = (ImporterBootstrap)context.getBean(BEAN_IMPORTER_BOOTSTRAP); + Properties configuration = bootstrap.getConfiguration(); + rssTemplatesFolderName = configuration.getProperty("spaces.templates.rss.childname"); + } + + return rssTemplatesFolderName; + } + /** * Returns the Saved Searches folder name * diff --git a/source/java/org/alfresco/web/bean/BaseDetailsBean.java b/source/java/org/alfresco/web/bean/BaseDetailsBean.java index 65795a5cce..763b1915a3 100644 --- a/source/java/org/alfresco/web/bean/BaseDetailsBean.java +++ b/source/java/org/alfresco/web/bean/BaseDetailsBean.java @@ -256,7 +256,7 @@ public abstract class BaseDetailsBean /** * Action handler to apply the selected Template and Templatable aspect to the current Space */ - public String applyTemplate() + public void applyTemplate(ActionEvent event) { if (this.template != null && this.template.equals(TemplateSupportBean.NO_SELECTION) == false) { @@ -283,13 +283,12 @@ public abstract class BaseDetailsBean FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), e.getMessage()), e); } } - return getReturnOutcome(); } /** * Action handler to remove a dashboard template from the current Space */ - public String removeTemplate() + public void removeTemplate(ActionEvent event) { try { @@ -305,14 +304,8 @@ public abstract class BaseDetailsBean 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 */ diff --git a/source/java/org/alfresco/web/bean/DocumentDetailsBean.java b/source/java/org/alfresco/web/bean/DocumentDetailsBean.java index 9730b412f2..6d8c5eba3a 100644 --- a/source/java/org/alfresco/web/bean/DocumentDetailsBean.java +++ b/source/java/org/alfresco/web/bean/DocumentDetailsBean.java @@ -989,14 +989,6 @@ public class DocumentDetailsBean extends BaseDetailsBean { return "document-props"; } - - /** - * @see org.alfresco.web.bean.BaseDetailsBean#getReturnOutcome() - */ - protected String getReturnOutcome() - { - return OUTCOME_RETURN; - } /** * Returns a model for use by a template on the Document Details page. diff --git a/source/java/org/alfresco/web/bean/SpaceDetailsBean.java b/source/java/org/alfresco/web/bean/SpaceDetailsBean.java index ca29ce9b16..745301a528 100644 --- a/source/java/org/alfresco/web/bean/SpaceDetailsBean.java +++ b/source/java/org/alfresco/web/bean/SpaceDetailsBean.java @@ -34,6 +34,7 @@ import org.alfresco.service.cmr.security.PermissionService; import org.alfresco.service.namespace.QName; import org.alfresco.web.app.AlfrescoNavigationHandler; import org.alfresco.web.app.Application; +import org.alfresco.web.app.servlet.TemplateContentServlet; import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.ui.common.Utils; @@ -46,8 +47,6 @@ import org.alfresco.web.ui.common.component.UIActionLink; */ public class SpaceDetailsBean extends BaseDetailsBean { - private static final String OUTCOME_RETURN = "showSpaceDetails"; - private static final String MSG_HAS_FOLLOWING_CATEGORIES = "has_following_categories_space"; private static final String MSG_NO_CATEGORIES_APPLIED = "no_categories_applied_space"; private static final String MSG_ERROR_UPDATE_CATEGORY = "error_update_category"; @@ -60,6 +59,9 @@ public class SpaceDetailsBean extends BaseDetailsBean private NodeRef addedCategory; private List categories; + /** RSS Template ID */ + private String rssTemplate; + // ------------------------------------------------------------------------------ // Construction @@ -149,14 +151,6 @@ public class SpaceDetailsBean extends BaseDetailsBean { return "space-props"; } - - /** - * @see org.alfresco.web.bean.BaseDetailsBean#getReturnOutcome() - */ - protected String getReturnOutcome() - { - return OUTCOME_RETURN; - } // ------------------------------------------------------------------------------ @@ -471,4 +465,94 @@ public class SpaceDetailsBean extends BaseDetailsBean { return getSpace().isLocked(); } + + /** + * @return true if the current space has an RSS feed applied + */ + public boolean isRSSFeed() + { + return (getSpace().hasAspect(ContentModel.ASPECT_FEEDSOURCE) && + getSpace().getProperties().get(ContentModel.PROP_FEEDTEMPLATE) != null); + } + + public String getRSSFeedURL() + { + // build RSS feed template URL from selected template and current space NodeRef and + // add the guest=true URL parameter - this is required for no login access and + // add the mimetype=text/xml URL parameter - required to return correct stream type + return TemplateContentServlet.generateURL(getSpace().getNodeRef(), + (NodeRef)getSpace().getProperties().get(ContentModel.PROP_FEEDTEMPLATE)) + + "?guest=true" + "&mimetype=text%2Fxml"; + } + + /** + * @return Returns the current RSS Template ID. + */ + public String getRSSTemplate() + { + // return current template if it exists + NodeRef ref = (NodeRef)getNode().getProperties().get(ContentModel.PROP_FEEDTEMPLATE); + return ref != null ? ref.getId() : this.rssTemplate; + } + + /** + * @param rssTemplate The RSS Template Id to set. + */ + public void setRSSTemplate(String rssTemplate) + { + this.rssTemplate = rssTemplate; + } + + /** + * Action handler to apply the selected RSS Template and FeedSource aspect to the current Space + */ + public void applyRSSTemplate(ActionEvent event) + { + if (this.rssTemplate != null && this.rssTemplate.equals(TemplateSupportBean.NO_SELECTION) == false) + { + try + { + // apply the feedsource aspect if required + if (getNode().hasAspect(ContentModel.ASPECT_FEEDSOURCE) == false) + { + this.nodeService.addAspect(getNode().getNodeRef(), ContentModel.ASPECT_FEEDSOURCE, null); + } + + // get the selected template Id from the Template Picker + NodeRef templateRef = new NodeRef(Repository.getStoreRef(), this.rssTemplate); + + // set the template NodeRef into the templatable aspect property + this.nodeService.setProperty(getNode().getNodeRef(), ContentModel.PROP_FEEDTEMPLATE, 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); + } + } + } + + /** + * Action handler to remove a RSS template from the current Space + */ + public void removeRSSTemplate(ActionEvent event) + { + try + { + // clear template property + this.nodeService.setProperty(getNode().getNodeRef(), ContentModel.PROP_FEEDTEMPLATE, null); + this.nodeService.removeAspect(getNode().getNodeRef(), ContentModel.ASPECT_FEEDSOURCE); + + // 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); + } + } } diff --git a/source/java/org/alfresco/web/bean/TemplateSupportBean.java b/source/java/org/alfresco/web/bean/TemplateSupportBean.java index 01f5e59519..29aed02a2a 100644 --- a/source/java/org/alfresco/web/bean/TemplateSupportBean.java +++ b/source/java/org/alfresco/web/bean/TemplateSupportBean.java @@ -64,6 +64,9 @@ public class TemplateSupportBean /** cache of email templates that lasts 30 seconds - enough for a few page refreshes */ private ExpiringValueCache> emailTemplates = new ExpiringValueCache>(1000*30); + /** cache of RSS templates that lasts 30 seconds - enough for a few page refreshes */ + private ExpiringValueCache> rssTemplates = new ExpiringValueCache>(1000*30); + /** cache of JavaScript files that lasts 30 seconds - enough for a few page refreshes */ private ExpiringValueCache> scriptFiles = new ExpiringValueCache>(1000*30); @@ -128,6 +131,28 @@ public class TemplateSupportBean return templates; } + /** + * @return the list of available RSS Templates. + */ + public List getRSSTemplates() + { + List templates = rssTemplates.get(); + if (templates == null) + { + // get the template from the special Email Templates folder + FacesContext fc = FacesContext.getCurrentInstance(); + String xpath = Application.getRootPath(fc) + "/" + + Application.getGlossaryFolderName(fc) + "/" + + Application.getRSSTemplatesFolderName(fc) + "//*"; + + templates = selectDictionaryNodes(fc, xpath, MSG_SELECT_TEMPLATE); + + rssTemplates.put(templates); + } + + return templates; + } + /** * @return the list of available JavaScript files that can be applied to the current document. */ diff --git a/source/web/WEB-INF/faces-config-navigation.xml b/source/web/WEB-INF/faces-config-navigation.xml index 14e5b68b48..669286e050 100644 --- a/source/web/WEB-INF/faces-config-navigation.xml +++ b/source/web/WEB-INF/faces-config-navigation.xml @@ -271,6 +271,10 @@ applyTemplate /jsp/dialog/apply-space-template.jsp + + applyRSSTemplate + /jsp/dialog/apply-rss-template.jsp + previewSpace /jsp/dialog/preview-space.jsp @@ -285,6 +289,14 @@ + + /jsp/dialog/apply-rss-template.jsp + + manageInvitedUsers + /jsp/roles/manage-invited-users.jsp + + + /jsp/dialog/document-details.jsp diff --git a/source/web/images/icons/rss.gif b/source/web/images/icons/rss.gif new file mode 100644 index 0000000000..0e9be56673 Binary files /dev/null and b/source/web/images/icons/rss.gif differ diff --git a/source/web/images/icons/rss_large.gif b/source/web/images/icons/rss_large.gif new file mode 100644 index 0000000000..5b3e2273d7 Binary files /dev/null and b/source/web/images/icons/rss_large.gif differ diff --git a/source/web/jsp/dialog/apply-doc-template.jsp b/source/web/jsp/dialog/apply-doc-template.jsp index 89c6ccd763..bf5596d8fa 100644 --- a/source/web/jsp/dialog/apply-doc-template.jsp +++ b/source/web/jsp/dialog/apply-doc-template.jsp @@ -113,12 +113,12 @@
- +
- +
diff --git a/source/web/jsp/dialog/apply-rss-template.jsp b/source/web/jsp/dialog/apply-rss-template.jsp new file mode 100644 index 0000000000..1de5e2b9cc --- /dev/null +++ b/source/web/jsp/dialog/apply-rss-template.jsp @@ -0,0 +1,167 @@ +<%-- + 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 --%> + + + + + +
+ + +
''
+
+
+ +
+ + + <%-- TODO: check for Guest user access and hide panel? --%> + + + + +
+ <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "yellowInner", "#ffffcc"); %> + + + + + +
+ + + + + +
+ <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "yellowInner"); %> + +
+ + <% 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-space-template.jsp b/source/web/jsp/dialog/apply-space-template.jsp index c2b79cc254..9b3eaeef89 100644 --- a/source/web/jsp/dialog/apply-space-template.jsp +++ b/source/web/jsp/dialog/apply-space-template.jsp @@ -113,12 +113,12 @@
- +
- +
diff --git a/source/web/jsp/dialog/document-details.jsp b/source/web/jsp/dialog/document-details.jsp index 4436c21d32..6dae40f147 100644 --- a/source/web/jsp/dialog/document-details.jsp +++ b/source/web/jsp/dialog/document-details.jsp @@ -120,8 +120,8 @@ - - + + @@ -132,8 +132,7 @@ - +
diff --git a/source/web/jsp/dialog/space-details.jsp b/source/web/jsp/dialog/space-details.jsp index 3efc490c35..f1d2f8670e 100644 --- a/source/web/jsp/dialog/space-details.jsp +++ b/source/web/jsp/dialog/space-details.jsp @@ -108,8 +108,8 @@ - - + + @@ -120,8 +120,7 @@ - +
@@ -296,6 +295,31 @@ +
+ + + + + + + + + + + + + + +
+ + + + +
+
+ <%-- TODO: implement this - but READONLY details only! Manage Space Users for edits... need support for panel with facets - so can hide edit link unless edit permissions also need to wrap this panel with an permissions check: ReadPermissions