. Added RSS Feed panel to Space Details page

- Selectable template for RSS feed for a folder
  - RSS feed link for drag/drop into RSS reader
. Added new folder "RSS Templates" in Data Dictionary in bootstrap
. Example RSS Template for new folder (docs in last 7 days)
. Created patch to add above folder+example to current schema
. Added 'app:feedsource' aspect to application data model
. Cleaned up some obsolete code in Apply/Remove Template actions
. Simplified Apply/Remove Template dialog navigation to use dialog framework

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3527 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-08-16 15:41:49 +00:00
parent edc31cf75c
commit ebd29c8548
14 changed files with 377 additions and 39 deletions

View File

@@ -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);
}
}
}