mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.0 to HEAD
11481: ETHREEOH-499 - Full colour icons for unavailable buttons in wiki page component. ETHREEOH-506 - Incorrect delete wiki page icon 11482: Re-added repo blog-action to allow external blog publishing from Share client 11485: ETHREEOH-155 Incorrect display of "Calendar" page 11488: Fixed: ETHREEOH-553 Members list is not sorted alphabetically git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12443 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* 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.bean.actions.blogIntegration;
|
||||||
|
|
||||||
|
import org.alfresco.model.BlogIntegrationModel;
|
||||||
|
import org.alfresco.web.action.evaluator.BaseActionEvaluator;
|
||||||
|
import org.alfresco.web.bean.repository.Node;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add blog details evaluator
|
||||||
|
*
|
||||||
|
* @author Roy Wetherall
|
||||||
|
*/
|
||||||
|
public class AddBlogDetailsEvaluator extends BaseActionEvaluator implements BlogIntegrationModel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
|
||||||
|
*/
|
||||||
|
public boolean evaluate(Node node)
|
||||||
|
{
|
||||||
|
boolean result = false;
|
||||||
|
if (node.hasAspect(ASPECT_BLOG_DETAILS) == false)
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,140 @@
|
|||||||
|
/*
|
||||||
|
* 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.bean.actions.blogIntegration;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.faces.component.UIComponent;
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.faces.event.ActionEvent;
|
||||||
|
|
||||||
|
import org.alfresco.model.BlogIntegrationModel;
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.repo.blogIntegration.BlogDetails;
|
||||||
|
import org.alfresco.repo.blogIntegration.BlogIntegrationRuntimeException;
|
||||||
|
import org.alfresco.repo.blogIntegration.BlogIntegrationService;
|
||||||
|
import org.alfresco.service.ServiceRegistry;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.alfresco.web.app.servlet.FacesHelper;
|
||||||
|
import org.alfresco.web.bean.BrowseBean;
|
||||||
|
import org.alfresco.web.bean.repository.Repository;
|
||||||
|
import org.alfresco.web.ui.common.component.UIActionLink;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blog details action listener
|
||||||
|
*
|
||||||
|
* @author Roy Wetherall
|
||||||
|
*/
|
||||||
|
public class BlogActionListener implements BlogIntegrationModel
|
||||||
|
{
|
||||||
|
/** The service registry */
|
||||||
|
private ServiceRegistry services;
|
||||||
|
|
||||||
|
/** The blog service */
|
||||||
|
private BlogIntegrationService blogIntegrationService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the service registry
|
||||||
|
*
|
||||||
|
* @param services the service registry
|
||||||
|
*/
|
||||||
|
public void setServiceRegistry(ServiceRegistry services)
|
||||||
|
{
|
||||||
|
this.services = services;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the blog integration service
|
||||||
|
*
|
||||||
|
* @param blogIntegrationService the blog integration service
|
||||||
|
*/
|
||||||
|
public void setBlogIntegrationService(BlogIntegrationService blogIntegrationService)
|
||||||
|
{
|
||||||
|
this.blogIntegrationService = blogIntegrationService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listener's execute method
|
||||||
|
*/
|
||||||
|
public void executeScript(ActionEvent event)
|
||||||
|
{
|
||||||
|
// Get the script to be executed
|
||||||
|
UIActionLink link = (UIActionLink)event.getComponent();
|
||||||
|
Map<String, String> params = link.getParameterMap();
|
||||||
|
|
||||||
|
// Get the action
|
||||||
|
String action = params.get("action");
|
||||||
|
|
||||||
|
String id = params.get("id");
|
||||||
|
NodeRef documentNodeRef = new NodeRef(Repository.getStoreRef(), id);
|
||||||
|
if ("post".equals(action) == true)
|
||||||
|
{
|
||||||
|
QName type = this.services.getNodeService().getType(documentNodeRef);
|
||||||
|
if (this.services.getDictionaryService().isSubClass(type, ContentModel.TYPE_CONTENT) == true)
|
||||||
|
{
|
||||||
|
List<BlogDetails> list = this.blogIntegrationService.getBlogDetails(documentNodeRef);
|
||||||
|
if (list.size() != 0)
|
||||||
|
{
|
||||||
|
// Take the 'nearest' blog details
|
||||||
|
BlogDetails blogDetails = list.get(0);
|
||||||
|
this.blogIntegrationService.newPost(blogDetails, documentNodeRef, ContentModel.PROP_CONTENT, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ("update".equals(action) == true)
|
||||||
|
{
|
||||||
|
QName type = this.services.getNodeService().getType(documentNodeRef);
|
||||||
|
if (this.services.getNodeService().hasAspect(documentNodeRef, ASPECT_BLOG_POST) == true &&
|
||||||
|
this.services.getDictionaryService().isSubClass(type, ContentModel.TYPE_CONTENT) == true)
|
||||||
|
{
|
||||||
|
this.blogIntegrationService.updatePost(documentNodeRef, ContentModel.PROP_CONTENT, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ("remove".equals(action) == true)
|
||||||
|
{
|
||||||
|
QName type = this.services.getNodeService().getType(documentNodeRef);
|
||||||
|
if (this.services.getNodeService().hasAspect(documentNodeRef, ASPECT_BLOG_POST) == true &&
|
||||||
|
this.services.getDictionaryService().isSubClass(type, ContentModel.TYPE_CONTENT) == true)
|
||||||
|
{
|
||||||
|
this.blogIntegrationService.deletePost(documentNodeRef);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new BlogIntegrationRuntimeException("Invalid action has been specified '" + action + "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Refresh the document details
|
||||||
|
FacesContext context = FacesContext.getCurrentInstance();
|
||||||
|
BrowseBean browseBean = (BrowseBean)FacesHelper.getManagedBean(context, "BrowseBean");
|
||||||
|
browseBean.getDocument().reset();
|
||||||
|
UIComponent comp = context.getViewRoot().findComponent("dialog:dialog-body:document-props");
|
||||||
|
comp.getChildren().clear();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,95 @@
|
|||||||
|
/*
|
||||||
|
* 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.bean.actions.blogIntegration;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.faces.component.UIComponent;
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.faces.event.ActionEvent;
|
||||||
|
|
||||||
|
import org.alfresco.model.BlogIntegrationModel;
|
||||||
|
import org.alfresco.repo.blogIntegration.BlogIntegrationRuntimeException;
|
||||||
|
import org.alfresco.service.ServiceRegistry;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.web.app.servlet.FacesHelper;
|
||||||
|
import org.alfresco.web.bean.BrowseBean;
|
||||||
|
import org.alfresco.web.bean.repository.Repository;
|
||||||
|
import org.alfresco.web.ui.common.component.UIActionLink;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blog details action listener
|
||||||
|
*
|
||||||
|
* @author Roy Wetherall
|
||||||
|
*/
|
||||||
|
public class BlogDetailsActionListener implements BlogIntegrationModel
|
||||||
|
{
|
||||||
|
/** The service registry */
|
||||||
|
private ServiceRegistry services;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the service registry
|
||||||
|
*
|
||||||
|
* @param services the service registry
|
||||||
|
*/
|
||||||
|
public void setServiceRegistry(ServiceRegistry services)
|
||||||
|
{
|
||||||
|
this.services = services;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listener's execute method
|
||||||
|
*/
|
||||||
|
public void executeScript(ActionEvent event)
|
||||||
|
{
|
||||||
|
// Get the script to be executed
|
||||||
|
UIActionLink link = (UIActionLink)event.getComponent();
|
||||||
|
Map<String, String> params = link.getParameterMap();
|
||||||
|
|
||||||
|
String action = params.get("action");
|
||||||
|
|
||||||
|
String id = params.get("id");
|
||||||
|
NodeRef documentNodeRef = new NodeRef(Repository.getStoreRef(), id);
|
||||||
|
if ("add".equals(action) == true)
|
||||||
|
{
|
||||||
|
this.services.getNodeService().addAspect(documentNodeRef, ASPECT_BLOG_DETAILS, null);
|
||||||
|
}
|
||||||
|
else if ("remove".equals(action) == true)
|
||||||
|
{
|
||||||
|
this.services.getNodeService().removeAspect(documentNodeRef, ASPECT_BLOG_DETAILS);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new BlogIntegrationRuntimeException("Invalid action has been specified '" + action + "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
FacesContext context = FacesContext.getCurrentInstance();
|
||||||
|
BrowseBean browseBean = (BrowseBean)FacesHelper.getManagedBean(context, "BrowseBean");
|
||||||
|
browseBean.getActionSpace().reset();
|
||||||
|
UIComponent comp = context.getViewRoot().findComponent("dialog:dialog-body:document-props");
|
||||||
|
comp.getChildren().clear();
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,115 @@
|
|||||||
|
/*
|
||||||
|
* 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.bean.actions.blogIntegration;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.faces.component.UIComponent;
|
||||||
|
import javax.faces.component.UISelectItems;
|
||||||
|
import javax.faces.component.UISelectOne;
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.faces.model.SelectItem;
|
||||||
|
|
||||||
|
import org.alfresco.repo.blogIntegration.BlogIntegrationImplementation;
|
||||||
|
import org.alfresco.repo.blogIntegration.BlogIntegrationService;
|
||||||
|
import org.alfresco.web.app.servlet.FacesHelper;
|
||||||
|
import org.alfresco.web.bean.generator.BaseComponentGenerator;
|
||||||
|
import org.alfresco.web.bean.repository.Node;
|
||||||
|
import org.alfresco.web.ui.repo.component.property.PropertySheetItem;
|
||||||
|
import org.alfresco.web.ui.repo.component.property.UIPropertySheet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blog selector generator.
|
||||||
|
*
|
||||||
|
* @author Roy Wetherall
|
||||||
|
*/
|
||||||
|
public class BlogSelectorGenerator extends BaseComponentGenerator
|
||||||
|
{
|
||||||
|
/** Node */
|
||||||
|
protected Node node;
|
||||||
|
|
||||||
|
/** Blog integration service */
|
||||||
|
BlogIntegrationService blogIntegrationService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the blog integration service
|
||||||
|
*
|
||||||
|
* @param blogIntegrationService the blog integration service
|
||||||
|
*/
|
||||||
|
public void setBlogIntegrationService(BlogIntegrationService blogIntegrationService)
|
||||||
|
{
|
||||||
|
this.blogIntegrationService = blogIntegrationService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.web.bean.generator.IComponentGenerator#generate(javax.faces.context.FacesContext, java.lang.String)
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public UIComponent generate(FacesContext context, String id)
|
||||||
|
{
|
||||||
|
UIComponent component = context.getApplication().createComponent(UISelectOne.COMPONENT_TYPE);
|
||||||
|
FacesHelper.setupComponentId(context, component, id);
|
||||||
|
|
||||||
|
// create the list of choices
|
||||||
|
UISelectItems itemsComponent = (UISelectItems)context.getApplication().createComponent("javax.faces.SelectItems");
|
||||||
|
|
||||||
|
itemsComponent.setValue(getBlogItems());
|
||||||
|
|
||||||
|
// add the items as a child component
|
||||||
|
component.getChildren().add(itemsComponent);
|
||||||
|
|
||||||
|
return component;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the items to put in the drop down control using the blog integration service.
|
||||||
|
*
|
||||||
|
* @return SelectItem[] array of select items
|
||||||
|
*/
|
||||||
|
protected SelectItem[] getBlogItems()
|
||||||
|
{
|
||||||
|
List<BlogIntegrationImplementation> blogs = this.blogIntegrationService.getBlogIntegrationImplementations();
|
||||||
|
SelectItem[] items = new SelectItem[blogs.size()];
|
||||||
|
int index = 0;
|
||||||
|
for (BlogIntegrationImplementation blog : blogs)
|
||||||
|
{
|
||||||
|
items[index] = new SelectItem(blog.getName(), blog.getDisplayName());
|
||||||
|
index ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.web.bean.generator.BaseComponentGenerator#createComponent(javax.faces.context.FacesContext, org.alfresco.web.ui.repo.component.property.UIPropertySheet, org.alfresco.web.ui.repo.component.property.PropertySheetItem)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected UIComponent createComponent(FacesContext context, UIPropertySheet propertySheet, PropertySheetItem item) {
|
||||||
|
|
||||||
|
this.node = propertySheet.getNode();
|
||||||
|
|
||||||
|
return super.createComponent(context, propertySheet, item);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* 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.bean.actions.blogIntegration;
|
||||||
|
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
|
||||||
|
import org.alfresco.model.BlogIntegrationModel;
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.repo.blogIntegration.BlogIntegrationService;
|
||||||
|
import org.alfresco.repo.blogIntegration.BlogIntegrationServiceImpl;
|
||||||
|
import org.alfresco.service.cmr.repository.ContentReader;
|
||||||
|
import org.alfresco.service.cmr.repository.ContentService;
|
||||||
|
import org.alfresco.web.action.evaluator.BaseActionEvaluator;
|
||||||
|
import org.alfresco.web.bean.repository.Node;
|
||||||
|
import org.springframework.web.context.WebApplicationContext;
|
||||||
|
import org.springframework.web.jsf.FacesContextUtils;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Post blog evaluator
|
||||||
|
*
|
||||||
|
* @author Roy Wetherall
|
||||||
|
*/
|
||||||
|
public class PostBlogEvaluator extends BaseActionEvaluator implements BlogIntegrationModel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
|
||||||
|
*/
|
||||||
|
public boolean evaluate(Node node)
|
||||||
|
{
|
||||||
|
boolean result = false;
|
||||||
|
|
||||||
|
// Get the conten service and the blog integration service
|
||||||
|
WebApplicationContext applicationContext = FacesContextUtils.getRequiredWebApplicationContext(FacesContext.getCurrentInstance());
|
||||||
|
ContentService contentService = (ContentService)applicationContext.getBean("ContentService");
|
||||||
|
BlogIntegrationService blogIntegrationService = (BlogIntegrationService)applicationContext.getBean("BlogIntegrationService");
|
||||||
|
|
||||||
|
// Check the mimetype of the content
|
||||||
|
ContentReader contentReader = contentService.getReader(node.getNodeRef(), ContentModel.PROP_CONTENT);
|
||||||
|
if (contentReader != null)
|
||||||
|
{
|
||||||
|
String mimetype = contentReader.getMimetype();
|
||||||
|
if (node.hasAspect(ASPECT_BLOG_POST) == false &&
|
||||||
|
BlogIntegrationServiceImpl.supportedMimetypes.contains(mimetype) == true &&
|
||||||
|
blogIntegrationService.getBlogDetails(node.getNodeRef()).size() != 0)
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* 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.bean.actions.blogIntegration;
|
||||||
|
|
||||||
|
import org.alfresco.model.BlogIntegrationModel;
|
||||||
|
import org.alfresco.web.action.evaluator.BaseActionEvaluator;
|
||||||
|
import org.alfresco.web.bean.repository.Node;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove blog details evaluator
|
||||||
|
*
|
||||||
|
* @author Roy Wetherall
|
||||||
|
*/
|
||||||
|
public class RemoveBlogDetailsEvaluator extends BaseActionEvaluator implements BlogIntegrationModel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
|
||||||
|
*/
|
||||||
|
public boolean evaluate(Node node)
|
||||||
|
{
|
||||||
|
boolean result = false;
|
||||||
|
if (node.hasAspect(ASPECT_BLOG_DETAILS) == true)
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* 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.bean.actions.blogIntegration;
|
||||||
|
|
||||||
|
import org.alfresco.model.BlogIntegrationModel;
|
||||||
|
import org.alfresco.web.action.evaluator.BaseActionEvaluator;
|
||||||
|
import org.alfresco.web.bean.repository.Node;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update blog evaluator
|
||||||
|
*
|
||||||
|
* @author Roy Wetherall
|
||||||
|
*/
|
||||||
|
public class UpdateBlogEvaluator extends BaseActionEvaluator implements BlogIntegrationModel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
|
||||||
|
*/
|
||||||
|
public boolean evaluate(Node node)
|
||||||
|
{
|
||||||
|
boolean result = false;
|
||||||
|
if (node.hasAspect(ASPECT_BLOG_POST) == true)
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user