Merged up to HEAD.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3129 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-06-16 19:18:30 +00:00
parent 77df6eb45d
commit d2f8666983
39 changed files with 2129 additions and 1142 deletions

View File

@@ -176,6 +176,7 @@ link_to=Link to
icon=Icon icon=Icon
lock=Lock lock=Lock
unlock=Unlock unlock=Unlock
items_per_page=Items Per Page
# Properties # Properties
username=User Name username=User Name
@@ -196,7 +197,6 @@ title=Title
author=Author author=Author
date=Date date=Date
mimetype=Format mimetype=Format
content_format=Content Format
# Repo permission display labels # Repo permission display labels
# Note - these come from the server, the english translation is generally the same # Note - these come from the server, the english translation is generally the same
@@ -414,6 +414,7 @@ add_user_group_description=Add an existing User to a Group
select_users=Select Users to add to this Group select_users=Select Users to add to this Group
selected_users=Selected Users selected_users=Selected Users
groups_err_group_name=Group ID cannot contain the characters: {0} groups_err_group_name=Group ID cannot contain the characters: {0}
groups_err_exists=A group ID with the same name already exists, group identifiers must be unique.
# Invite Users Wizard messages # Invite Users Wizard messages
invite_title=Invite Users Wizard invite_title=Invite Users Wizard

View File

@@ -224,6 +224,33 @@
<transformer name="image/jpeg"/> <transformer name="image/jpeg"/>
<transformer name="image/png"/> <transformer name="image/png"/>
</image-transformers> </image-transformers>
<!-- The classes used to handle actions -->
<action-handlers>
<handler name="add-features" class="org.alfresco.web.bean.actions.handlers.AddFeaturesHandler" />
<handler name="check-in" class="org.alfresco.web.bean.actions.handlers.CheckInHandler" />
<handler name="check-out" class="org.alfresco.web.bean.actions.handlers.CheckOutHandler" />
<handler name="copy" class="org.alfresco.web.bean.actions.handlers.CopyHandler" />
<handler name="import" class="org.alfresco.web.bean.actions.handlers.ImportHandler" />
<handler name="link-category" class="org.alfresco.web.bean.actions.handlers.LinkCategoryHandler" />
<handler name="mail" class="org.alfresco.web.bean.actions.handlers.MailHandler" />
<handler name="move" class="org.alfresco.web.bean.actions.handlers.MoveHandler" />
<handler name="remove-features" class="org.alfresco.web.bean.actions.handlers.RemoveFeaturesHandler" />
<handler name="script" class="org.alfresco.web.bean.actions.handlers.ScriptHandler" />
<handler name="simple-workflow" class="org.alfresco.web.bean.actions.handlers.SimpleWorkflowHandler" />
<handler name="specialise-type" class="org.alfresco.web.bean.actions.handlers.SpecialiseTypeHandler" />
<handler name="transform" class="org.alfresco.web.bean.actions.handlers.TransformHandler" />
<handler name="transform-image" class="org.alfresco.web.bean.actions.handlers.TransformImageHandler" />
</action-handlers>
<!-- The classes used to handle conditions -->
<condition-handlers>
<handler name="compare-mime-type" class="org.alfresco.web.bean.rules.handlers.CompareMimeTypeHandler" />
<handler name="compare-property-value" class="org.alfresco.web.bean.rules.handlers.PropertyValueHandler" />
<handler name="has-aspect" class="org.alfresco.web.bean.rules.handlers.HasAspectHandler" />
<handler name="in-category" class="org.alfresco.web.bean.rules.handlers.InCategoryHandler" />
<handler name="is-subtype" class="org.alfresco.web.bean.rules.handlers.IsSubTypeHandler" />
</condition-handlers>
</config> </config>
<!-- This config sections below hold all the icons choices --> <!-- This config sections below hold all the icons choices -->

View File

@@ -19,13 +19,11 @@ package org.alfresco.web.app.servlet;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.SocketException; import java.net.SocketException;
import java.net.URLDecoder;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@@ -173,8 +171,7 @@ public class DownloadContentServlet extends BaseServlet
{ {
// set header based on filename - will force a Save As from the browse if it doesn't recognise it // set header based on filename - will force a Save As from the browse if it doesn't recognise it
// this is better than the default response of the browser trying to display the contents // this is better than the default response of the browser trying to display the contents
String encname = filename.replace('%', '='); res.setHeader("Content-Disposition", "attachment");
res.setHeader("Content-Disposition", "attachment;filename=\"=?ISO-8859-1?Q?" + encname + "?=\"");
} }
// get the content reader // get the content reader

View File

@@ -186,26 +186,48 @@ public class BrowseBean implements IContextListener
FacesContext fc = FacesContext.getCurrentInstance(); FacesContext fc = FacesContext.getCurrentInstance();
fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "dashboard"); fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "dashboard");
} }
else
{
navigateBrowseScreen();
}
} }
/** public int getPageSizeContent()
* @return Returns the browsePageSize.
*/
public int getBrowsePageSize()
{ {
return this.browsePageSize; return this.pageSizeContent;
} }
/** public void setPageSizeContent(int pageSizeContent)
* @param browsePageSize The browsePageSize to set.
*/
public void setBrowsePageSize(int browsePageSize)
{ {
this.browsePageSize = browsePageSize; this.pageSizeContent = pageSizeContent;
this.pageSizeContentStr = Integer.toString(pageSizeContent);
}
public int getPageSizeSpaces()
{
return this.pageSizeSpaces;
}
public void setPageSizeSpaces(int pageSizeSpaces)
{
this.pageSizeSpaces = pageSizeSpaces;
this.pageSizeSpacesStr = Integer.toString(pageSizeSpaces);
}
public String getPageSizeContentStr()
{
return this.pageSizeContentStr;
}
public void setPageSizeContentStr(String pageSizeContentStr)
{
this.pageSizeContentStr = pageSizeContentStr;
}
public String getPageSizeSpacesStr()
{
return this.pageSizeSpacesStr;
}
public void setPageSizeSpacesStr(String pageSizeSpacesStr)
{
this.pageSizeSpacesStr = pageSizeSpacesStr;
} }
/** /**
@@ -483,20 +505,19 @@ public class BrowseBean implements IContextListener
if (VIEWMODE_DASHBOARD.equals(viewMode) == false) if (VIEWMODE_DASHBOARD.equals(viewMode) == false)
{ {
// set the page size based on the style of display // set the page size based on the style of display
setBrowsePageSize(this.viewsConfig.getDefaultPageSize(PAGE_NAME_BROWSE, int pageSize = this.viewsConfig.getDefaultPageSize(PAGE_NAME_BROWSE, viewMode);
viewMode)); setPageSizeContent(pageSize);
setPageSizeSpaces(pageSize);
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("Browse view page size set to: " + getBrowsePageSize()); logger.debug("Browse view page size set to: " + pageSize);
// in case we left for dashboard
if (isDashboardView() == true)
{
setDashboardView(false); setDashboardView(false);
}
// push the view mode into the lists // push the view mode into the lists
setBrowseViewMode(viewMode); setBrowseViewMode(viewMode);
navigateBrowseScreen();
} }
else else
{ {
@@ -565,7 +586,7 @@ public class BrowseBean implements IContextListener
this.dictionaryService.isSubClass(type, ContentModel.TYPE_SYSTEM_FOLDER) == false) this.dictionaryService.isSubClass(type, ContentModel.TYPE_SYSTEM_FOLDER) == false)
{ {
// create our Node representation // create our Node representation
node = new MapNode(nodeRef, this.nodeService, false); node = new MapNode(nodeRef, this.nodeService, true);
node.addPropertyResolver("icon", this.resolverSpaceIcon); node.addPropertyResolver("icon", this.resolverSpaceIcon);
node.addPropertyResolver("smallIcon", this.resolverSmallIcon); node.addPropertyResolver("smallIcon", this.resolverSmallIcon);
@@ -575,7 +596,7 @@ public class BrowseBean implements IContextListener
else if (this.dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT)) else if (this.dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT))
{ {
// create our Node representation // create our Node representation
node = new MapNode(nodeRef, this.nodeService, false); node = new MapNode(nodeRef, this.nodeService, true);
setupCommonBindingProperties(node); setupCommonBindingProperties(node);
this.contentNodes.add(node); this.contentNodes.add(node);
@@ -584,7 +605,7 @@ public class BrowseBean implements IContextListener
else if (ContentModel.TYPE_FILELINK.equals(type)) else if (ContentModel.TYPE_FILELINK.equals(type))
{ {
// create our File Link Node representation // create our File Link Node representation
node = new MapNode(nodeRef, this.nodeService, false); node = new MapNode(nodeRef, this.nodeService, true);
node.addPropertyResolver("url", this.resolverLinkUrl); node.addPropertyResolver("url", this.resolverLinkUrl);
node.addPropertyResolver("webdavUrl", this.resolverLinkWebdavUrl); node.addPropertyResolver("webdavUrl", this.resolverLinkWebdavUrl);
node.addPropertyResolver("cifsPath", this.resolverLinkCifsPath); node.addPropertyResolver("cifsPath", this.resolverLinkCifsPath);
@@ -597,7 +618,7 @@ public class BrowseBean implements IContextListener
else if (ContentModel.TYPE_FOLDERLINK.equals(type)) else if (ContentModel.TYPE_FOLDERLINK.equals(type))
{ {
// create our Folder Link Node representation // create our Folder Link Node representation
node = new MapNode(nodeRef, this.nodeService, false); node = new MapNode(nodeRef, this.nodeService, true);
node.addPropertyResolver("icon", this.resolverSpaceIcon); node.addPropertyResolver("icon", this.resolverSpaceIcon);
node.addPropertyResolver("smallIcon", this.resolverSmallIcon); node.addPropertyResolver("smallIcon", this.resolverSmallIcon);
@@ -1001,6 +1022,56 @@ public class BrowseBean implements IContextListener
this.navigator.setCurrentNodeId( this.navigator.getCurrentNodeId() ); this.navigator.setCurrentNodeId( this.navigator.getCurrentNodeId() );
} }
/**
* Update page size based on user selection
*/
public void updateSpacesPageSize(ActionEvent event)
{
try
{
int size = Integer.parseInt(this.pageSizeSpacesStr);
if (size >= 0)
{
this.pageSizeSpaces = size;
}
else
{
// reset to known value if this occurs
this.pageSizeSpacesStr = Integer.toString(this.pageSizeSpaces);
}
}
catch (NumberFormatException err)
{
// reset to known value if this occurs
this.pageSizeSpacesStr = Integer.toString(this.pageSizeSpaces);
}
}
/**
* Update page size based on user selection
*/
public void updateContentPageSize(ActionEvent event)
{
try
{
int size = Integer.parseInt(this.pageSizeContentStr);
if (size >= 0)
{
this.pageSizeContent = size;
}
else
{
// reset to known value if this occurs
this.pageSizeContentStr = Integer.toString(this.pageSizeContent);
}
}
catch (NumberFormatException err)
{
// reset to known value if this occurs
this.pageSizeContentStr = Integer.toString(this.pageSizeContent);
}
}
/** /**
* Action called when a folder space is clicked. * Action called when a folder space is clicked.
* Navigate into the space. * Navigate into the space.
@@ -1417,8 +1488,9 @@ public class BrowseBean implements IContextListener
getConfigElement(ViewsConfigElement.CONFIG_ELEMENT_ID); getConfigElement(ViewsConfigElement.CONFIG_ELEMENT_ID);
this.browseViewMode = this.viewsConfig.getDefaultView(PAGE_NAME_BROWSE); this.browseViewMode = this.viewsConfig.getDefaultView(PAGE_NAME_BROWSE);
this.browsePageSize = this.viewsConfig.getDefaultPageSize(PAGE_NAME_BROWSE, int pageSize = this.viewsConfig.getDefaultPageSize(PAGE_NAME_BROWSE, this.browseViewMode);
this.browseViewMode); setPageSizeContent(pageSize);
setPageSizeSpaces(pageSize);
} }
/** /**
@@ -1704,8 +1776,11 @@ public class BrowseBean implements IContextListener
/** The current browse view mode - set to a well known IRichListRenderer identifier */ /** The current browse view mode - set to a well known IRichListRenderer identifier */
private String browseViewMode; private String browseViewMode;
/** The current browse view page size */ /** The current browse view page sizes */
private int browsePageSize; private int pageSizeSpaces;
private int pageSizeContent;
private String pageSizeSpacesStr;
private String pageSizeContentStr;
/** True if current space has a dashboard (template) view available */ /** True if current space has a dashboard (template) view available */
private boolean dashboardView; private boolean dashboardView;

View File

@@ -45,14 +45,13 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application; import org.alfresco.web.app.Application;
import org.alfresco.web.app.context.UIContextService; import org.alfresco.web.app.context.UIContextService;
import org.alfresco.web.app.servlet.DownloadContentServlet; import org.alfresco.web.app.servlet.DownloadContentServlet;
import org.alfresco.web.bean.actions.BaseActionWizard; import org.alfresco.web.bean.actions.handlers.SimpleWorkflowHandler;
import org.alfresco.web.bean.repository.MapNode; import org.alfresco.web.bean.repository.MapNode;
import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.Utils.URLMode; import org.alfresco.web.ui.common.Utils.URLMode;
import org.alfresco.web.ui.common.component.UIActionLink; import org.alfresco.web.ui.common.component.UIActionLink;
import org.apache.log4j.Logger;
/** /**
* Backing bean providing access to the details of a document * Backing bean providing access to the details of a document
@@ -74,8 +73,6 @@ public class DocumentDetailsBean extends BaseDetailsBean
private static final String MSG_ERROR_UPDATE_SIMPLEWORKFLOW = "error_update_simpleworkflow"; private static final String MSG_ERROR_UPDATE_SIMPLEWORKFLOW = "error_update_simpleworkflow";
private static final String MSG_ERROR_UPDATE_CATEGORY = "error_update_category"; private static final String MSG_ERROR_UPDATE_CATEGORY = "error_update_category";
private static Logger logger = Logger.getLogger(DocumentDetailsBean.class);
protected LockService lockService; protected LockService lockService;
protected CopyService copyService; protected CopyService copyService;
protected VersionService versionService; protected VersionService versionService;
@@ -344,7 +341,6 @@ public class DocumentDetailsBean extends BaseDetailsBean
try try
{ {
FacesContext context = FacesContext.getCurrentInstance();
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance()); tx = Repository.getUserTransaction(FacesContext.getCurrentInstance());
tx.begin(); tx.begin();
@@ -494,25 +490,25 @@ public class DocumentDetailsBean extends BaseDetailsBean
// put the workflow properties in a separate map for use by the JSP // put the workflow properties in a separate map for use by the JSP
this.workflowProperties = new HashMap<String, Serializable>(7); this.workflowProperties = new HashMap<String, Serializable>(7);
this.workflowProperties.put(BaseActionWizard.PROP_APPROVE_STEP_NAME, this.workflowProperties.put(SimpleWorkflowHandler.PROP_APPROVE_STEP_NAME,
approveStepName); approveStepName);
this.workflowProperties.put(BaseActionWizard.PROP_APPROVE_ACTION, this.workflowProperties.put(SimpleWorkflowHandler.PROP_APPROVE_ACTION,
approveMove ? "move" : "copy"); approveMove ? "move" : "copy");
this.workflowProperties.put(BaseActionWizard.PROP_APPROVE_FOLDER, approveFolder); this.workflowProperties.put(SimpleWorkflowHandler.PROP_APPROVE_FOLDER, approveFolder);
if (rejectStepName == null || rejectMove == null || rejectFolder == null) if (rejectStepName == null || rejectMove == null || rejectFolder == null)
{ {
this.workflowProperties.put(BaseActionWizard.PROP_REJECT_STEP_PRESENT, "no"); this.workflowProperties.put(SimpleWorkflowHandler.PROP_REJECT_STEP_PRESENT, "no");
} }
else else
{ {
this.workflowProperties.put(BaseActionWizard.PROP_REJECT_STEP_PRESENT, this.workflowProperties.put(SimpleWorkflowHandler.PROP_REJECT_STEP_PRESENT,
"yes"); "yes");
this.workflowProperties.put(BaseActionWizard.PROP_REJECT_STEP_NAME, this.workflowProperties.put(SimpleWorkflowHandler.PROP_REJECT_STEP_NAME,
rejectStepName); rejectStepName);
this.workflowProperties.put(BaseActionWizard.PROP_REJECT_ACTION, this.workflowProperties.put(SimpleWorkflowHandler.PROP_REJECT_ACTION,
rejectMove ? "move" : "copy"); rejectMove ? "move" : "copy");
this.workflowProperties.put(BaseActionWizard.PROP_REJECT_FOLDER, this.workflowProperties.put(SimpleWorkflowHandler.PROP_REJECT_FOLDER,
rejectFolder); rejectFolder);
} }
} }
@@ -546,7 +542,6 @@ public class DocumentDetailsBean extends BaseDetailsBean
try try
{ {
FacesContext context = FacesContext.getCurrentInstance();
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance()); tx = Repository.getUserTransaction(FacesContext.getCurrentInstance());
tx.begin(); tx.begin();
@@ -558,11 +553,11 @@ public class DocumentDetailsBean extends BaseDetailsBean
// set the approve step name // set the approve step name
updateProps.put(ContentModel.PROP_APPROVE_STEP, updateProps.put(ContentModel.PROP_APPROVE_STEP,
this.workflowProperties.get(BaseActionWizard.PROP_APPROVE_STEP_NAME)); this.workflowProperties.get(SimpleWorkflowHandler.PROP_APPROVE_STEP_NAME));
// specify whether the approve step will copy or move the content // specify whether the approve step will copy or move the content
boolean approveMove = true; boolean approveMove = true;
String approveAction = (String)this.workflowProperties.get(BaseActionWizard.PROP_APPROVE_ACTION); String approveAction = (String)this.workflowProperties.get(SimpleWorkflowHandler.PROP_APPROVE_ACTION);
if (approveAction != null && approveAction.equals("copy")) if (approveAction != null && approveAction.equals("copy"))
{ {
approveMove = false; approveMove = false;
@@ -571,12 +566,12 @@ public class DocumentDetailsBean extends BaseDetailsBean
// create node ref representation of the destination folder // create node ref representation of the destination folder
updateProps.put(ContentModel.PROP_APPROVE_FOLDER, updateProps.put(ContentModel.PROP_APPROVE_FOLDER,
this.workflowProperties.get(BaseActionWizard.PROP_APPROVE_FOLDER)); this.workflowProperties.get(SimpleWorkflowHandler.PROP_APPROVE_FOLDER));
// determine whether there should be a reject step // determine whether there should be a reject step
boolean requireReject = true; boolean requireReject = true;
String rejectStepPresent = (String)this.workflowProperties.get( String rejectStepPresent = (String)this.workflowProperties.get(
BaseActionWizard.PROP_REJECT_STEP_PRESENT); SimpleWorkflowHandler.PROP_REJECT_STEP_PRESENT);
if (rejectStepPresent != null && rejectStepPresent.equals("no")) if (rejectStepPresent != null && rejectStepPresent.equals("no"))
{ {
requireReject = false; requireReject = false;
@@ -586,12 +581,12 @@ public class DocumentDetailsBean extends BaseDetailsBean
{ {
// set the reject step name // set the reject step name
updateProps.put(ContentModel.PROP_REJECT_STEP, updateProps.put(ContentModel.PROP_REJECT_STEP,
this.workflowProperties.get(BaseActionWizard.PROP_REJECT_STEP_NAME)); this.workflowProperties.get(SimpleWorkflowHandler.PROP_REJECT_STEP_NAME));
// specify whether the reject step will copy or move the content // specify whether the reject step will copy or move the content
boolean rejectMove = true; boolean rejectMove = true;
String rejectAction = (String)this.workflowProperties.get( String rejectAction = (String)this.workflowProperties.get(
BaseActionWizard.PROP_REJECT_ACTION); SimpleWorkflowHandler.PROP_REJECT_ACTION);
if (rejectAction != null && rejectAction.equals("copy")) if (rejectAction != null && rejectAction.equals("copy"))
{ {
rejectMove = false; rejectMove = false;
@@ -600,7 +595,7 @@ public class DocumentDetailsBean extends BaseDetailsBean
// create node ref representation of the destination folder // create node ref representation of the destination folder
updateProps.put(ContentModel.PROP_REJECT_FOLDER, updateProps.put(ContentModel.PROP_REJECT_FOLDER,
this.workflowProperties.get(BaseActionWizard.PROP_REJECT_FOLDER)); this.workflowProperties.get(SimpleWorkflowHandler.PROP_REJECT_FOLDER));
} }
else else
{ {

View File

@@ -68,6 +68,7 @@ public class GroupsBean implements IContextListener
private static final String DEFAULT_OUTCOME = "finish"; private static final String DEFAULT_OUTCOME = "finish";
private static final String MSG_ERR_EXISTS = "groups_err_exists";
private static final String MSG_GROUPS = "root_groups"; private static final String MSG_GROUPS = "root_groups";
private static Logger logger = Logger.getLogger(GroupsBean.class); private static Logger logger = Logger.getLogger(GroupsBean.class);
@@ -648,15 +649,24 @@ public class GroupsBean implements IContextListener
{ {
String outcome = DEFAULT_OUTCOME; String outcome = DEFAULT_OUTCOME;
FacesContext context = FacesContext.getCurrentInstance();
UserTransaction tx = null; UserTransaction tx = null;
try try
{ {
FacesContext context = FacesContext.getCurrentInstance();
tx = Repository.getUserTransaction(context); tx = Repository.getUserTransaction(context);
tx.begin(); tx.begin();
// create new Group using Authentication Service // create new Group using Authentication Service
String groupName = this.authService.getName(AuthorityType.GROUP, this.name);
if (this.authService.authorityExists(groupName) == false)
{
this.authService.createAuthority(AuthorityType.GROUP, getActionGroup(), this.name); this.authService.createAuthority(AuthorityType.GROUP, getActionGroup(), this.name);
}
else
{
Utils.addErrorMessage(Application.getMessage(context, MSG_ERR_EXISTS));
outcome = null;
}
// commit the transaction // commit the transaction
tx.commit(); tx.commit();
@@ -666,7 +676,7 @@ public class GroupsBean implements IContextListener
// rollback the transaction // rollback the transaction
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
Utils.addErrorMessage(MessageFormat.format(Application.getMessage( Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err); context, Repository.ERROR_GENERIC), err.getMessage()), err);
outcome = null; outcome = null;
} }

View File

@@ -18,21 +18,8 @@ import javax.faces.model.SelectItem;
import org.alfresco.config.Config; import org.alfresco.config.Config;
import org.alfresco.config.ConfigElement; import org.alfresco.config.ConfigElement;
import org.alfresco.config.ConfigService; import org.alfresco.config.ConfigService;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.action.executer.AddFeaturesActionExecuter;
import org.alfresco.repo.action.executer.CheckInActionExecuter;
import org.alfresco.repo.action.executer.CheckOutActionExecuter;
import org.alfresco.repo.action.executer.CopyActionExecuter;
import org.alfresco.repo.action.executer.ImageTransformActionExecuter;
import org.alfresco.repo.action.executer.ImporterActionExecuter;
import org.alfresco.repo.action.executer.LinkCategoryActionExecuter;
import org.alfresco.repo.action.executer.MailActionExecuter;
import org.alfresco.repo.action.executer.MoveActionExecuter;
import org.alfresco.repo.action.executer.RemoveFeaturesActionExecuter;
import org.alfresco.repo.action.executer.ScriptActionExecutor;
import org.alfresco.repo.action.executer.SimpleWorkflowActionExecuter;
import org.alfresco.repo.action.executer.SpecialiseTypeActionExecuter;
import org.alfresco.repo.action.executer.TransformActionExecuter;
import org.alfresco.service.cmr.action.ActionDefinition; import org.alfresco.service.cmr.action.ActionDefinition;
import org.alfresco.service.cmr.action.ActionService; import org.alfresco.service.cmr.action.ActionService;
import org.alfresco.service.cmr.dictionary.AspectDefinition; import org.alfresco.service.cmr.dictionary.AspectDefinition;
@@ -43,10 +30,10 @@ import org.alfresco.service.cmr.repository.MimetypeService;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.security.AuthorityService; import org.alfresco.service.cmr.security.AuthorityService;
import org.alfresco.service.cmr.security.PersonService; import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application; import org.alfresco.web.app.Application;
import org.alfresco.web.bean.TemplateSupportBean; import org.alfresco.web.bean.TemplateSupportBean;
import org.alfresco.web.bean.actions.handlers.MailHandler;
import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wizard.BaseWizardBean; import org.alfresco.web.bean.wizard.BaseWizardBean;
@@ -64,37 +51,9 @@ import org.apache.commons.logging.LogFactory;
*/ */
public abstract class BaseActionWizard extends BaseWizardBean public abstract class BaseActionWizard extends BaseWizardBean
{ {
public static final String PROP_ACTION_NAME = "actionName"; protected static final String PROP_ACTION_NAME = "actionName";
public static final String PROP_ACTION_SUMMARY = "actionSummary"; protected static final String PROP_ACTION_SUMMARY = "actionSummary";
public static final String PROP_CATEGORY = "category"; protected static final String NO_PARAMS_MARKER = "noParamsMarker";
public static final String PROP_ASPECT = "aspect";
public static final String PROP_DESTINATION = "destinationLocation";
public static final String PROP_APPROVE_STEP_NAME = "approveStepName";
public static final String PROP_APPROVE_ACTION = "approveAction";
public static final String PROP_APPROVE_FOLDER = "approveFolder";
public static final String PROP_REJECT_STEP_PRESENT = "rejectStepPresent";
public static final String PROP_REJECT_STEP_NAME = "rejectStepName";
public static final String PROP_REJECT_ACTION = "rejectAction";
public static final String PROP_REJECT_FOLDER = "rejectFolder";
public static final String PROP_CHECKIN_DESC = "checkinDescription";
public static final String PROP_CHECKIN_MINOR = "checkinMinorChange";
public static final String PROP_TRANSFORMER = "transformer";
public static final String PROP_IMAGE_TRANSFORMER = "imageTransformer";
public static final String PROP_TRANSFORM_OPTIONS = "transformOptions";
public static final String PROP_ENCODING = "encoding";
public static final String PROP_MESSAGE = "message";
public static final String PROP_SUBJECT = "subject";
public static final String PROP_TO = "to";
public static final String PROP_FROM = "from";
public static final String PROP_TEMPLATE = "template";
public static final String PROP_OBJECT_TYPE = "objecttype";
public static final String PROP_PROPERTY = "property";
public static final String PROP_CONTAINS_TEXT = "containstext";
public static final String PROP_MODEL_TYPE = "modeltype";
public static final String PROP_MIMETYPE = "mimetype";
public static final String PROP_MODEL_ASPECT = "modelaspect";
public static final String PROP_TYPE_OR_ASPECT = "typeoraspect";
public static final String PROP_SCRIPT = "script";
protected ActionService actionService; protected ActionService actionService;
protected MimetypeService mimetypeService; protected MimetypeService mimetypeService;
@@ -121,11 +80,9 @@ public abstract class BaseActionWizard extends BaseWizardBean
protected Map<String, Serializable> currentActionProperties; protected Map<String, Serializable> currentActionProperties;
protected List<Map<String, Serializable>> allActionsProperties; protected List<Map<String, Serializable>> allActionsProperties;
protected static final String ACTION_PAGES_LOCATION = "/jsp/actions/"; protected Map<String, IHandler> actionHandlers;
private static final Log logger = LogFactory.getLog(BaseActionWizard.class); private static final Log logger = LogFactory.getLog(BaseActionWizard.class);
private static final String IMPORT_ENCODING = "UTF-8";
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Wizard implementation // Wizard implementation
@@ -139,22 +96,15 @@ public abstract class BaseActionWizard extends BaseWizardBean
this.users = null; this.users = null;
this.actions = null; this.actions = null;
this.emailRecipientsDataModel = null; this.emailRecipientsDataModel = null;
this.emailRecipients = new ArrayList<RecipientWrapper>(4);
this.usingTemplate = null; this.usingTemplate = null;
this.emailRecipients = new ArrayList<RecipientWrapper>(4);
this.allActionsProperties = new ArrayList<Map<String, Serializable>>(); this.allActionsProperties = new ArrayList<Map<String, Serializable>>();
this.currentActionProperties = new HashMap<String, Serializable>(3); this.currentActionProperties = new HashMap<String, Serializable>(3);
// default the approve and reject actions initialiseActionHandlers();
this.currentActionProperties.put(PROP_APPROVE_ACTION, "move");
this.currentActionProperties.put(PROP_REJECT_STEP_PRESENT, "yes");
this.currentActionProperties.put(PROP_REJECT_ACTION, "move");
// default the checkin minor change
this.currentActionProperties.put(PROP_CHECKIN_MINOR, new Boolean(true));
} }
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Bean Getters and Setters // Bean Getters and Setters
@@ -528,6 +478,15 @@ public abstract class BaseActionWizard extends BaseWizardBean
return this.imageTransformers; return this.imageTransformers;
} }
/**
* Returns the current list of email recipients
*
* @return List of email recipients
*/
public List<RecipientWrapper> getEmailRecipients()
{
return this.emailRecipients;
}
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Action event handlers // Action event handlers
@@ -542,27 +501,29 @@ public abstract class BaseActionWizard extends BaseWizardBean
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
this.returnViewId = context.getViewRoot().getViewId(); this.returnViewId = context.getViewRoot().getViewId();
String viewId = calculateActionViewId(this.action); String viewId = null;
HashMap<String, Serializable> actionProps = new HashMap<String, Serializable>(3); HashMap<String, Serializable> actionProps = new HashMap<String, Serializable>(3);
actionProps.put(PROP_ACTION_NAME, this.action); actionProps.put(PROP_ACTION_NAME, this.action);
this.currentActionProperties = actionProps; this.currentActionProperties = actionProps;
// determine whether the action being added has any parameters // get the handler for the action, if there isn't one we presume it
ActionDefinition actionDef = this.actionService.getActionDefinition(this.action); // is a no-parameter action
if (actionDef.hasParameterDefinitions()) IHandler handler = this.actionHandlers.get(this.action);
if (handler != null)
{ {
// setup any defaults for the UI and override the viewId if necessary // setup any UI defaults the action may have and get the location of
String overridenViewId = setupUIDefaultsForAction(actionProps); // the JSP used to collect the parameters
if (overridenViewId != null) handler.setupUIDefaults(actionProps);
{ viewId = handler.getJSPPath();
viewId = overridenViewId;
}
} }
else else
{ {
// just add the action to the list and use the title as the summary // just add the action to the list and use the title as the summary
ActionDefinition actionDef = this.actionService.getActionDefinition(this.action);
actionProps.put(PROP_ACTION_SUMMARY, actionDef.getTitle()); actionProps.put(PROP_ACTION_SUMMARY, actionDef.getTitle());
// add the no params marker so we can disable the edit action
actionProps.put(NO_PARAMS_MARKER, "no-params");
this.allActionsProperties.add(actionProps); this.allActionsProperties.add(actionProps);
// come back to the same page we're on now as there are no params to collect // come back to the same page we're on now as there are no params to collect
@@ -595,8 +556,9 @@ public abstract class BaseActionWizard extends BaseWizardBean
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
this.returnViewId = context.getViewRoot().getViewId(); this.returnViewId = context.getViewRoot().getViewId();
// refresh the wizard // go to the action page (as there is an edit option visible,
goToPage(context, calculateActionViewId(this.action)); // there must be a handler for the action so we don't check)
goToPage(context, this.actionHandlers.get(this.action).getJSPPath());
} }
/** /**
@@ -605,7 +567,11 @@ public abstract class BaseActionWizard extends BaseWizardBean
public void addAction() public void addAction()
{ {
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
String summary = buildActionSummary();
// this is called from the actions page so there must be a handler
// present so there's no need to check for null
String summary = this.actionHandlers.get(this.action).generateSummary(
context, this, this.currentActionProperties);
if (summary != null) if (summary != null)
{ {
@@ -709,18 +675,20 @@ public abstract class BaseActionWizard extends BaseWizardBean
*/ */
public void insertTemplate(ActionEvent event) public void insertTemplate(ActionEvent event)
{ {
String template = (String)this.currentActionProperties.get(PROP_TEMPLATE); String template = (String)this.currentActionProperties.get(MailHandler.PROP_TEMPLATE);
if (template != null && template.equals(TemplateSupportBean.NO_SELECTION) == false) if (template != null && template.equals(TemplateSupportBean.NO_SELECTION) == false)
{ {
// get the content of the template so the user can get a basic preview of it // get the content of the template so the user can get a basic preview of it
try try
{ {
NodeRef templateRef = new NodeRef(Repository.getStoreRef(), template); NodeRef templateRef = new NodeRef(Repository.getStoreRef(), template);
ContentService cs = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getContentService(); ContentService cs = Repository.getServiceRegistry(
FacesContext.getCurrentInstance()).getContentService();
ContentReader reader = cs.getReader(templateRef, ContentModel.PROP_CONTENT); ContentReader reader = cs.getReader(templateRef, ContentModel.PROP_CONTENT);
if (reader != null && reader.exists()) if (reader != null && reader.exists())
{ {
this.currentActionProperties.put(PROP_MESSAGE, reader.getContentString()); this.currentActionProperties.put(MailHandler.PROP_MESSAGE,
reader.getContentString());
usingTemplate = template; usingTemplate = template;
} }
@@ -738,7 +706,7 @@ public abstract class BaseActionWizard extends BaseWizardBean
*/ */
public void discardTemplate(ActionEvent event) public void discardTemplate(ActionEvent event)
{ {
this.currentActionProperties.put(PROP_MESSAGE, ""); this.currentActionProperties.put(MailHandler.PROP_MESSAGE, "");
usingTemplate = null; usingTemplate = null;
} }
@@ -786,7 +754,7 @@ public abstract class BaseActionWizard extends BaseWizardBean
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Helper methods // Helper methods
protected String displayLabelForAuthority(String authority) public String displayLabelForAuthority(String authority)
{ {
String label = authority; String label = authority;
@@ -804,515 +772,6 @@ public abstract class BaseActionWizard extends BaseWizardBean
return label; return label;
} }
/**
* Sets up any default state required by the UI for collecting the
* action settings. The view id to use for the action UI can also
* be overridden by returing the path to the relevant JSP.
*
* @props The map of properties being used for the current action
* @return An optional overridden JSP to use for action settings collection
*/
protected String setupUIDefaultsForAction(HashMap<String, Serializable> props)
{
String overridenViewId = null;
if (SimpleWorkflowActionExecuter.NAME.equals(this.action))
{
this.currentActionProperties.put("approveAction", "move");
this.currentActionProperties.put("rejectStepPresent", "yes");
this.currentActionProperties.put("rejectAction", "move");
}
else if (CheckInActionExecuter.NAME.equals(this.action))
{
this.currentActionProperties.put(PROP_CHECKIN_MINOR, new Boolean(true));
}
return overridenViewId;
}
/**
* Build the param map for the current Action instance.
* <p>
* Based on the params set by the UI, build the params needed to create the action.
*
* @return param map
*/
protected Map<String, Serializable> buildActionParams()
{
// set up parameters maps for the action
Map<String, Serializable> repoParams = new HashMap<String, Serializable>();
if (AddFeaturesActionExecuter.NAME.equals(this.action))
{
QName aspect = Repository.resolveToQName((String)this.currentActionProperties.get(PROP_ASPECT));
repoParams.put(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, aspect);
}
else if (RemoveFeaturesActionExecuter.NAME.equals(this.action))
{
QName aspect = Repository.resolveToQName((String)this.currentActionProperties.get(PROP_ASPECT));
repoParams.put(RemoveFeaturesActionExecuter.PARAM_ASPECT_NAME, aspect);
}
else if (CopyActionExecuter.NAME.equals(this.action))
{
// add the destination space id to the action properties
NodeRef destNodeRef = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
repoParams.put(CopyActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
// add the type and name of the association to create when the copy
// is performed
repoParams.put(CopyActionExecuter.PARAM_ASSOC_TYPE_QNAME,
ContentModel.ASSOC_CONTAINS);
repoParams.put(CopyActionExecuter.PARAM_ASSOC_QNAME,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "copy"));
}
else if (MoveActionExecuter.NAME.equals(this.action))
{
// add the destination space id to the action properties
NodeRef destNodeRef = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
repoParams.put(MoveActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
// add the type and name of the association to create when the move
// is performed
repoParams.put(MoveActionExecuter.PARAM_ASSOC_TYPE_QNAME,
ContentModel.ASSOC_CONTAINS);
repoParams.put(MoveActionExecuter.PARAM_ASSOC_QNAME,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "move"));
}
else if (SimpleWorkflowActionExecuter.NAME.equals(this.action))
{
// add the approve step name
repoParams.put(SimpleWorkflowActionExecuter.PARAM_APPROVE_STEP,
(String)this.currentActionProperties.get(PROP_APPROVE_STEP_NAME));
// add whether the approve step will copy or move the content
boolean approveMove = true;
String approveAction = (String)this.currentActionProperties.get(PROP_APPROVE_ACTION);
if (approveAction != null && approveAction.equals("copy"))
{
approveMove = false;
}
repoParams.put(SimpleWorkflowActionExecuter.PARAM_APPROVE_MOVE, Boolean.valueOf(approveMove));
// add the destination folder of the content
NodeRef approveDestNodeRef = null;
Object approveDestNode = this.currentActionProperties.get(PROP_APPROVE_FOLDER);
if (approveDestNode instanceof NodeRef)
{
approveDestNodeRef = (NodeRef)approveDestNode;
}
else if (approveDestNode instanceof String)
{
approveDestNodeRef = new NodeRef((String)approveDestNode);
}
repoParams.put(SimpleWorkflowActionExecuter.PARAM_APPROVE_FOLDER, approveDestNodeRef);
// determine whether we have a reject step or not
boolean requireReject = true;
String rejectStepPresent = (String)this.currentActionProperties.get(PROP_REJECT_STEP_PRESENT);
if (rejectStepPresent != null && rejectStepPresent.equals("no"))
{
requireReject = false;
}
if (requireReject)
{
// add the reject step name
repoParams.put(SimpleWorkflowActionExecuter.PARAM_REJECT_STEP,
(String)this.currentActionProperties.get(PROP_REJECT_STEP_NAME));
// add whether the reject step will copy or move the content
boolean rejectMove = true;
String rejectAction = (String)this.currentActionProperties.get(PROP_REJECT_ACTION);
if (rejectAction != null && rejectAction.equals("copy"))
{
rejectMove = false;
}
repoParams.put(SimpleWorkflowActionExecuter.PARAM_REJECT_MOVE, Boolean.valueOf(rejectMove));
// add the destination folder of the content
NodeRef rejectDestNodeRef = null;
Object rejectDestNode = this.currentActionProperties.get(PROP_REJECT_FOLDER);
if (rejectDestNode instanceof NodeRef)
{
rejectDestNodeRef = (NodeRef)rejectDestNode;
}
else if (rejectDestNode instanceof String)
{
rejectDestNodeRef = new NodeRef((String)rejectDestNode);
}
repoParams.put(SimpleWorkflowActionExecuter.PARAM_REJECT_FOLDER, rejectDestNodeRef);
}
}
else if (LinkCategoryActionExecuter.NAME.equals(this.action))
{
// add the classifiable aspect
repoParams.put(LinkCategoryActionExecuter.PARAM_CATEGORY_ASPECT,
ContentModel.ASPECT_GEN_CLASSIFIABLE);
// put the selected category in the action params
NodeRef catNodeRef = (NodeRef)this.currentActionProperties.get(PROP_CATEGORY);
repoParams.put(LinkCategoryActionExecuter.PARAM_CATEGORY_VALUE,
catNodeRef);
}
else if (CheckOutActionExecuter.NAME.equals(this.action))
{
// specify the location the checked out working copy should go
// add the destination space id to the action properties
NodeRef destNodeRef = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
repoParams.put(CheckOutActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
// add the type and name of the association to create when the
// check out is performed
repoParams.put(CheckOutActionExecuter.PARAM_ASSOC_TYPE_QNAME,
ContentModel.ASSOC_CONTAINS);
repoParams.put(CheckOutActionExecuter.PARAM_ASSOC_QNAME,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "checkout"));
}
else if (CheckInActionExecuter.NAME.equals(this.action))
{
// add the description for the checkin to the action params
repoParams.put(CheckInActionExecuter.PARAM_DESCRIPTION,
this.currentActionProperties.get(PROP_CHECKIN_DESC));
// add the minor change flag
repoParams.put(CheckInActionExecuter.PARAM_MINOR_CHANGE,
this.currentActionProperties.get(PROP_CHECKIN_MINOR));
}
else if (TransformActionExecuter.NAME.equals(this.action))
{
// add the transformer to use
repoParams.put(TransformActionExecuter.PARAM_MIME_TYPE,
this.currentActionProperties.get(PROP_TRANSFORMER));
// add the destination space id to the action properties
NodeRef destNodeRef = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
repoParams.put(TransformActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
// add the type and name of the association to create when the copy
// is performed
repoParams.put(TransformActionExecuter.PARAM_ASSOC_TYPE_QNAME,
ContentModel.ASSOC_CONTAINS);
repoParams.put(TransformActionExecuter.PARAM_ASSOC_QNAME,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "copy"));
}
else if (ImageTransformActionExecuter.NAME.equals(this.action))
{
// add the transformer to use
repoParams.put(ImageTransformActionExecuter.PARAM_MIME_TYPE,
this.currentActionProperties.get(PROP_IMAGE_TRANSFORMER));
// add the options
repoParams.put(ImageTransformActionExecuter.PARAM_CONVERT_COMMAND,
this.currentActionProperties.get(PROP_TRANSFORM_OPTIONS));
// add the destination space id to the action properties
NodeRef destNodeRef = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
repoParams.put(TransformActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
// add the type and name of the association to create when the copy
// is performed
repoParams.put(TransformActionExecuter.PARAM_ASSOC_TYPE_QNAME,
ContentModel.ASSOC_CONTAINS);
repoParams.put(TransformActionExecuter.PARAM_ASSOC_QNAME,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "copy"));
}
else if (MailActionExecuter.NAME.equals(this.action))
{
// add the person(s) it's going to as a list of authorities
List<String> recipients = new ArrayList<String>(emailRecipients.size());
for (int i=0; i<emailRecipients.size(); i++)
{
RecipientWrapper wrapper = emailRecipients.get(i);
recipients.add(wrapper.authority);
}
repoParams.put(MailActionExecuter.PARAM_TO_MANY, (Serializable)recipients);
// add the actual email text to send
repoParams.put(MailActionExecuter.PARAM_TEXT,
this.currentActionProperties.get(PROP_MESSAGE));
// add the subject for the email
repoParams.put(MailActionExecuter.PARAM_SUBJECT,
this.currentActionProperties.get(PROP_SUBJECT));
// add the from address
String from = Application.getClientConfig(FacesContext.getCurrentInstance()).getFromEmailAddress();
repoParams.put(MailActionExecuter.PARAM_FROM, from);
// add the template if one was selected by the user
if (this.usingTemplate != null)
{
repoParams.put(MailActionExecuter.PARAM_TEMPLATE, new NodeRef(Repository.getStoreRef(), this.usingTemplate));
}
}
else if (ImporterActionExecuter.NAME.equals(this.action))
{
// add the encoding
repoParams.put(ImporterActionExecuter.PARAM_ENCODING, IMPORT_ENCODING);
// add the destination for the import
NodeRef destNodeRef = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
repoParams.put(ImporterActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
}
else if (SpecialiseTypeActionExecuter.NAME.equals(this.action))
{
// add the specialisation type
String objectType = (String)this.currentActionProperties.get(PROP_OBJECT_TYPE);
repoParams.put(SpecialiseTypeActionExecuter.PARAM_TYPE_NAME, QName.createQName(objectType));
}
else if (ScriptActionExecutor.NAME.equals(this.action))
{
// add the selected script noderef to the action properties
String id = (String)this.currentActionProperties.get(PROP_SCRIPT);
NodeRef scriptRef = new NodeRef(Repository.getStoreRef(), id);
repoParams.put(ScriptActionExecutor.PARAM_SCRIPTREF, scriptRef);
repoParams.put(ScriptActionExecutor.PARAM_SPACEREF, this.navigator.getCurrentNode().getNodeRef());
}
return repoParams;
}
/**
* Returns a summary string for the current action
*
* @return The summary or null if a summary could not be built
*/
protected String buildActionSummary()
{
String summary = null;
FacesContext context = FacesContext.getCurrentInstance();
if (AddFeaturesActionExecuter.NAME.equals(this.action))
{
String label = null;
String aspect = (String)this.currentActionProperties.get(PROP_ASPECT);
// find the label used by looking through the SelectItem list
for (SelectItem item : this.getAspects())
{
if (item.getValue().equals(aspect))
{
label = item.getLabel();
break;
}
}
summary = MessageFormat.format(Application.getMessage(context, "action_add_features"),
new Object[] {label});
}
else if (RemoveFeaturesActionExecuter.NAME.equals(this.action))
{
String label = null;
String aspect = (String)this.currentActionProperties.get(PROP_ASPECT);
// find the label used by looking through the SelectItem list
for (SelectItem item : this.getAspects())
{
if (item.getValue().equals(aspect))
{
label = item.getLabel();
break;
}
}
summary = MessageFormat.format(Application.getMessage(context, "action_remove_features"),
new Object[] {label});
}
else if (CopyActionExecuter.NAME.equals(this.action))
{
NodeRef space = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
String spaceName = Repository.getNameForNode(this.nodeService, space);
summary = MessageFormat.format(Application.getMessage(context, "action_copy"),
new Object[] {spaceName});
}
else if (MoveActionExecuter.NAME.equals(this.action))
{
NodeRef space = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
String spaceName = Repository.getNameForNode(this.nodeService, space);
summary = MessageFormat.format(Application.getMessage(context, "action_move"),
new Object[] {spaceName});
}
else if (SimpleWorkflowActionExecuter.NAME.equals(this.action))
{
String approveStepName = (String)this.currentActionProperties.get(PROP_APPROVE_STEP_NAME);
String approveAction = (String)this.currentActionProperties.get(PROP_APPROVE_ACTION);
NodeRef approveFolder = (NodeRef)this.currentActionProperties.get(PROP_APPROVE_FOLDER);
String approveFolderName = Repository.getNameForNode(this.nodeService, approveFolder);
String approveMsg = MessageFormat.format(Application.getMessage(context, "action_simple_workflow"),
new Object[] {Application.getMessage(context, approveAction),
approveFolderName, approveStepName});
String rejectMsg = null;
String rejectStep = (String)this.currentActionProperties.get(PROP_REJECT_STEP_PRESENT);
if (rejectStep != null && "yes".equals(rejectStep))
{
String rejectStepName = (String)this.currentActionProperties.get(PROP_REJECT_STEP_NAME);
String rejectAction = (String)this.currentActionProperties.get(PROP_REJECT_ACTION);
NodeRef rejectFolder = (NodeRef)this.currentActionProperties.get(PROP_REJECT_FOLDER);
String rejectFolderName = Repository.getNameForNode(this.nodeService, rejectFolder);
rejectMsg = MessageFormat.format(Application.getMessage(context, "action_simple_workflow"),
new Object[] {Application.getMessage(context, rejectAction),
rejectFolderName, rejectStepName});
}
StringBuilder builder = new StringBuilder(approveMsg);
if (rejectMsg != null)
{
builder.append(" ");
builder.append(rejectMsg);
}
summary = builder.toString();
}
else if (LinkCategoryActionExecuter.NAME.equals(this.action))
{
NodeRef cat = (NodeRef)this.currentActionProperties.get(PROP_CATEGORY);
String name = Repository.getNameForNode(this.nodeService, cat);
summary = MessageFormat.format(Application.getMessage(context, "action_link_category"),
new Object[] {name});
}
else if (CheckOutActionExecuter.NAME.equals(this.action))
{
NodeRef space = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
String spaceName = Repository.getNameForNode(this.nodeService, space);
summary = MessageFormat.format(Application.getMessage(context, "action_check_out"),
new Object[] {spaceName});
}
else if (CheckInActionExecuter.NAME.equals(this.action))
{
String comment = (String)this.currentActionProperties.get(PROP_CHECKIN_DESC);
Boolean minorChange = (Boolean)this.currentActionProperties.get(PROP_CHECKIN_MINOR);
String change = null;
if (minorChange != null && minorChange.booleanValue())
{
change = Application.getMessage(context, "minor_change");
}
else
{
change = Application.getMessage(context, "major_change");
}
summary = MessageFormat.format(Application.getMessage(context, "action_check_in"),
new Object[] {change, comment});
}
else if (TransformActionExecuter.NAME.equals(this.action))
{
String label = null;
NodeRef space = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
String name = Repository.getNameForNode(this.nodeService, space);
String transformer = (String)this.currentActionProperties.get(PROP_TRANSFORMER);
// find the label used by looking through the SelectItem list
for (SelectItem item : this.getTransformers())
{
if (item.getValue().equals(transformer))
{
label = item.getLabel();
break;
}
}
summary = MessageFormat.format(Application.getMessage(context, "action_transform"),
new Object[] {name, label});
}
else if (ImageTransformActionExecuter.NAME.equals(this.action))
{
String label = null;
NodeRef space = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
String name = Repository.getNameForNode(this.nodeService, space);
String transformer = (String)this.currentActionProperties.get(PROP_IMAGE_TRANSFORMER);
String option = (String)this.currentActionProperties.get(PROP_TRANSFORM_OPTIONS);
// find the label used by looking through the SelectItem list
for (SelectItem item : this.getImageTransformers())
{
if (item.getValue().equals(transformer))
{
label = item.getLabel();
break;
}
}
summary = MessageFormat.format(Application.getMessage(context, "action_transform_image"),
new Object[] {name, label, option});
}
else if (MailActionExecuter.NAME.equals(this.action))
{
String addresses = (String)this.currentActionProperties.get(PROP_TO);
if (addresses == null || addresses.length() == 0)
{
if (this.emailRecipients.size() != 0)
{
StringBuilder builder = new StringBuilder();
for (int i=0; i<this.emailRecipients.size(); i++)
{
RecipientWrapper wrapper = this.emailRecipients.get(i);
if (i != 0)
{
builder.append(", ");
}
builder.append(wrapper.getName());
}
addresses = builder.toString();
}
}
summary = MessageFormat.format(Application.getMessage(context, "action_mail"),
new Object[] {addresses});
}
else if (ImporterActionExecuter.NAME.equals(this.action))
{
NodeRef space = (NodeRef)this.currentActionProperties.get(PROP_DESTINATION);
String spaceName = Repository.getNameForNode(this.nodeService, space);
summary = MessageFormat.format(Application.getMessage(context, "action_import"),
new Object[] {spaceName});
}
else if (SpecialiseTypeActionExecuter.NAME.equals(this.action))
{
String label = null;
String objectType = (String)this.currentActionProperties.get(PROP_OBJECT_TYPE);
for (SelectItem item : getObjectTypes())
{
if (item.getValue().equals(objectType) == true)
{
label = item.getLabel();
break;
}
}
summary = MessageFormat.format(Application.getMessage(context, "action_specialise_type"),
new Object[] {label});
}
else if (ScriptActionExecutor.NAME.equals(this.action))
{
String id = (String)this.currentActionProperties.get(PROP_SCRIPT);
NodeRef scriptRef = new NodeRef(Repository.getStoreRef(), id);
String scriptName = Repository.getNameForNode(this.nodeService, scriptRef);
summary = MessageFormat.format(Application.getMessage(context, "action_script"),
new Object[] {scriptName});
}
else
{
// as the default case (i.e. for actions with no parameters) use the title
ActionDefinition actionDef = this.actionService.getActionDefinition(this.action);
summary = actionDef.getTitle();
}
return summary;
}
/** /**
* Navigates to the given page, used to go back and forth between the * Navigates to the given page, used to go back and forth between the
* wizard and the actions settings pages * wizard and the actions settings pages
@@ -1330,16 +789,55 @@ public abstract class BaseActionWizard extends BaseWizardBean
} }
/** /**
* Calculates the viewId for the given action id * Initialises the action handlers from the current configuration.
*
* @param actionId The id of the action to generate the view id for
* @return The view id
*/ */
protected String calculateActionViewId(String actionId) protected void initialiseActionHandlers()
{ {
return ACTION_PAGES_LOCATION + actionId + ".jsp"; if (this.actionHandlers == null)
} {
ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
Config wizardCfg = svc.getConfig("Action Wizards");
if (wizardCfg != null)
{
ConfigElement actionHandlerCfg = wizardCfg.getConfigElement("action-handlers");
if (actionHandlerCfg != null)
{
this.actionHandlers = new HashMap<String, IHandler>(20);
// instantiate each handler and store in the map
for (ConfigElement child : actionHandlerCfg.getChildren())
{
String actionName = child.getAttribute("name");
String handlerClass = child.getAttribute("class");
if (actionName != null && actionName.length() > 0 &&
handlerClass != null && handlerClass.length() > 0)
{
try
{
Class klass = Class.forName(handlerClass);
IHandler handler = (IHandler)klass.newInstance();
this.actionHandlers.put(actionName, handler);
}
catch (Exception e)
{
throw new AlfrescoRuntimeException("Failed to setup action handler for '" +
actionName + "'", e);
}
}
}
}
else
{
logger.warn("Could not find 'action-handlers' configuration element");
}
}
else
{
logger.warn("Could not find 'Action Wizards' configuration section");
}
}
}
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Inner classes // Inner classes

View File

@@ -0,0 +1,70 @@
package org.alfresco.web.bean.actions;
import java.io.Serializable;
import java.util.Map;
import javax.faces.context.FacesContext;
import org.alfresco.web.bean.wizard.IWizardBean;
/**
* Interface definition for a handler, classes that are responsible
* for marshalling data between the repository and the action based
* wizards.
*
* @author gavinc
*/
public interface IHandler
{
/**
* Adds any properties to the given map that need default values
* before the UI is displayed to the user.
*
* @param props The current properties map
*/
public void setupUIDefaults(Map<String, Serializable> props);
/**
* By default, a JSP with the same name as the handler will
* be loaded from a default location. If the handler has stored
* it's UI somewhere else the view id can be returned from this method.
*
* @return The path to the JSP for the handler
*/
public String getJSPPath();
/**
* Called at the end of the wizard. The properties relevant to
* this handler have to be placed in the repository properties
* map in the correct form for sending to the node service.
*
* @param props The current properties map
* @param repoProps The repository properties map to prepare
*/
public void prepareForSave(Map<String, Serializable> props,
Map<String, Serializable> repoProps);
/**
* Called at the start of the edit wizard. The repository properties
* map holds the current state of this rule. Any properties relevant
* to this handler should be retrieved and setup in the current
* properties map.
*
* @param props The current properties map
* @param repoParams The properties currently in the repository
*/
public void prepareForEdit(Map<String, Serializable> props,
Map<String, Serializable> repoProps);
/**
* Generates a summary string for this handler. The current state of
* the wizard is passed as well as the current properties map.
*
* @param context Faces context
* @param wizard The current wizard
* @param props The properties map
* @return The summary string
*/
public String generateSummary(FacesContext context, IWizardBean wizard,
Map<String, Serializable> props);
}

View File

@@ -2,6 +2,7 @@ package org.alfresco.web.bean.actions;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.ResourceBundle; import java.util.ResourceBundle;
@@ -37,8 +38,14 @@ public class RunActionWizard extends BaseActionWizard
// to setup the currentActionProperties and action variables // to setup the currentActionProperties and action variables
String actionName = (String)actionParams.get(PROP_ACTION_NAME); String actionName = (String)actionParams.get(PROP_ACTION_NAME);
this.action = actionName; this.action = actionName;
this.currentActionProperties = actionParams;
Map<String, Serializable> repoActionParams = buildActionParams(); // get the action handler to prepare for the save
Map<String, Serializable> repoActionParams = new HashMap<String, Serializable>();
IHandler handler = this.actionHandlers.get(this.action);
if (handler != null)
{
handler.prepareForSave(actionParams, repoActionParams);
}
// add the action to the rule // add the action to the rule
Action action = this.actionService.createAction(actionName); Action action = this.actionService.createAction(actionName);

View File

@@ -0,0 +1,64 @@
package org.alfresco.web.bean.actions.handlers;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.alfresco.repo.action.executer.AddFeaturesActionExecuter;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.actions.BaseActionWizard;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wizard.IWizardBean;
/**
* Action handler implementation for the "add-features" action.
*
* @author gavinc
*/
public class AddFeaturesHandler extends BaseActionHandler
{
protected static final String PROP_ASPECT = "aspect";
public String getJSPPath()
{
return getJSPPath(AddFeaturesActionExecuter.NAME);
}
public void prepareForSave(Map<String, Serializable> actionProps,
Map<String, Serializable> repoParams)
{
QName aspect = Repository.resolveToQName((String)actionProps.get(PROP_ASPECT));
repoParams.put(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, aspect);
}
public void prepareForEdit(Map<String, Serializable> actionProps,
Map<String, Serializable> repoParams)
{
QName aspect = (QName)repoParams.get(AddFeaturesActionExecuter.PARAM_ASPECT_NAME);
actionProps.put(PROP_ASPECT, aspect.toString());
}
public String generateSummary(FacesContext context, IWizardBean wizard,
Map<String, Serializable> actionProps)
{
String label = null;
String aspect = (String)actionProps.get(PROP_ASPECT);
// find the label used by looking through the SelectItem list
for (SelectItem item : ((BaseActionWizard)wizard).getAspects())
{
if (item.getValue().equals(aspect))
{
label = item.getLabel();
break;
}
}
return MessageFormat.format(Application.getMessage(context, "action_add_features"),
new Object[] {label});
}
}

View File

@@ -0,0 +1,34 @@
package org.alfresco.web.bean.actions.handlers;
import java.io.Serializable;
import java.util.Map;
import org.alfresco.web.bean.actions.IHandler;
/**
* Base class for all action handler implementations.
*
* @author gavinc
*/
public abstract class BaseActionHandler implements IHandler
{
protected static final String ACTION_PAGES_LOCATION = "/jsp/actions/";
protected static final String PROP_DESTINATION = "destinationLocation";
public void setupUIDefaults(Map<String, Serializable> actionProps)
{
// do nothing by default, only those action handlers that need
// to setup defaults need override this method
}
/**
* Given the action name, generates the default path for the JSP
*
* @param actionName The name of the action
* @return The path to the JSP used for the action
*/
protected String getJSPPath(String actionName)
{
return ACTION_PAGES_LOCATION + actionName + ".jsp";
}
}

View File

@@ -0,0 +1,72 @@
package org.alfresco.web.bean.actions.handlers;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Map;
import javax.faces.context.FacesContext;
import org.alfresco.repo.action.executer.CheckInActionExecuter;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.wizard.IWizardBean;
/**
* Action handler implementation for the "check-in" action.
*
* @author gavinc
*/
public class CheckInHandler extends BaseActionHandler
{
protected static final String PROP_CHECKIN_DESC = "checkinDescription";
protected static final String PROP_CHECKIN_MINOR = "checkinMinorChange";
@Override
public void setupUIDefaults(Map<String, Serializable> actionProps)
{
actionProps.put(PROP_CHECKIN_MINOR, new Boolean(true));
}
public String getJSPPath()
{
return getJSPPath(CheckInActionExecuter.NAME);
}
public void prepareForSave(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
repoProps.put(CheckInActionExecuter.PARAM_DESCRIPTION,
actionProps.get(PROP_CHECKIN_DESC));
repoProps.put(CheckInActionExecuter.PARAM_MINOR_CHANGE,
actionProps.get(PROP_CHECKIN_MINOR));
}
public void prepareForEdit(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
String checkDesc = (String)repoProps.get(CheckInActionExecuter.PARAM_DESCRIPTION);
actionProps.put(PROP_CHECKIN_DESC, checkDesc);
Boolean minorChange = (Boolean)repoProps.get(CheckInActionExecuter.PARAM_MINOR_CHANGE);
actionProps.put(PROP_CHECKIN_MINOR, minorChange);
}
public String generateSummary(FacesContext context, IWizardBean wizard,
Map<String, Serializable> actionProps)
{
String comment = (String)actionProps.get(PROP_CHECKIN_DESC);
Boolean minorChange = (Boolean)actionProps.get(PROP_CHECKIN_MINOR);
String change = null;
if (minorChange != null && minorChange.booleanValue())
{
change = Application.getMessage(context, "minor_change");
}
else
{
change = Application.getMessage(context, "major_change");
}
return MessageFormat.format(Application.getMessage(context, "action_check_in"),
new Object[] {change, comment});
}
}

View File

@@ -0,0 +1,63 @@
package org.alfresco.web.bean.actions.handlers;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Map;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.action.executer.CheckOutActionExecuter;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wizard.IWizardBean;
/**
* Action handler implementation for the "check-out" action.
*
* @author gavinc
*/
public class CheckOutHandler extends BaseActionHandler
{
public String getJSPPath()
{
return getJSPPath(CheckOutActionExecuter.NAME);
}
public void prepareForSave(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
// specify the location the checked out working copy should go
// add the destination space id to the action properties
NodeRef destNodeRef = (NodeRef)actionProps.get(PROP_DESTINATION);
repoProps.put(CheckOutActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
// add the type and name of the association to create when the
// check out is performed
repoProps.put(CheckOutActionExecuter.PARAM_ASSOC_TYPE_QNAME,
ContentModel.ASSOC_CONTAINS);
repoProps.put(CheckOutActionExecuter.PARAM_ASSOC_QNAME,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "checkout"));
}
public void prepareForEdit(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
NodeRef destNodeRef = (NodeRef)repoProps.get(CheckOutActionExecuter.PARAM_DESTINATION_FOLDER);
actionProps.put(PROP_DESTINATION, destNodeRef);
}
public String generateSummary(FacesContext context, IWizardBean wizard,
Map<String, Serializable> actionProps)
{
NodeRef space = (NodeRef)actionProps.get(PROP_DESTINATION);
String spaceName = Repository.getNameForNode(
Repository.getServiceRegistry(context).getNodeService(), space);
return MessageFormat.format(Application.getMessage(context, "action_check_out"),
new Object[] {spaceName});
}
}

View File

@@ -0,0 +1,63 @@
package org.alfresco.web.bean.actions.handlers;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Map;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.action.executer.CopyActionExecuter;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wizard.IWizardBean;
/**
* Action handler implementation for the "copy" action.
*
* @author gavinc
*/
public class CopyHandler extends BaseActionHandler
{
public String getJSPPath()
{
return getJSPPath(CopyActionExecuter.NAME);
}
public void prepareForSave(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
// add the destination space id to the action properties
NodeRef destNodeRef = (NodeRef)actionProps.get(PROP_DESTINATION);
repoProps.put(CopyActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
// add the type and name of the association to create when the copy
// is performed
repoProps.put(CopyActionExecuter.PARAM_ASSOC_TYPE_QNAME,
ContentModel.ASSOC_CONTAINS);
repoProps.put(CopyActionExecuter.PARAM_ASSOC_QNAME,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "copy"));
}
public void prepareForEdit(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
NodeRef destNodeRef = (NodeRef)repoProps.get(CopyActionExecuter.PARAM_DESTINATION_FOLDER);
actionProps.put(PROP_DESTINATION, destNodeRef);
}
public String generateSummary(FacesContext context, IWizardBean wizard,
Map<String, Serializable> actionProps)
{
NodeRef space = (NodeRef)actionProps.get(PROP_DESTINATION);
String spaceName = Repository.getNameForNode(
Repository.getServiceRegistry(context).getNodeService(), space);
return MessageFormat.format(Application.getMessage(context, "action_copy"),
new Object[] {spaceName});
}
}

View File

@@ -0,0 +1,58 @@
package org.alfresco.web.bean.actions.handlers;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Map;
import javax.faces.context.FacesContext;
import org.alfresco.repo.action.executer.ImporterActionExecuter;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wizard.IWizardBean;
/**
* Action handler implementation for the "import" action.
*
* @author gavinc
*/
public class ImportHandler extends BaseActionHandler
{
protected static final String IMPORT_ENCODING = "UTF-8";
public String getJSPPath()
{
return getJSPPath(ImporterActionExecuter.NAME);
}
public void prepareForSave(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
// add the encoding
repoProps.put(ImporterActionExecuter.PARAM_ENCODING, IMPORT_ENCODING);
// add the destination for the import
NodeRef destNodeRef = (NodeRef)actionProps.get(PROP_DESTINATION);
repoProps.put(ImporterActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
}
public void prepareForEdit(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
NodeRef destNodeRef = (NodeRef)repoProps.get(
ImporterActionExecuter.PARAM_DESTINATION_FOLDER);
actionProps.put(PROP_DESTINATION, destNodeRef);
}
public String generateSummary(FacesContext context, IWizardBean wizard,
Map<String, Serializable> actionProps)
{
NodeRef space = (NodeRef)actionProps.get(PROP_DESTINATION);
String spaceName = Repository.getNameForNode(
Repository.getServiceRegistry(context).getNodeService(), space);
return MessageFormat.format(Application.getMessage(context, "action_import"),
new Object[] {spaceName});
}
}

View File

@@ -0,0 +1,60 @@
package org.alfresco.web.bean.actions.handlers;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Map;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.action.executer.LinkCategoryActionExecuter;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wizard.IWizardBean;
/**
* Action handler implementation for the "link-category" action.
*
* @author gavinc
*/
public class LinkCategoryHandler extends BaseActionHandler
{
protected static final String PROP_CATEGORY = "category";
public String getJSPPath()
{
return getJSPPath(LinkCategoryActionExecuter.NAME);
}
public void prepareForSave(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
// add the classifiable aspect
repoProps.put(LinkCategoryActionExecuter.PARAM_CATEGORY_ASPECT,
ContentModel.ASPECT_GEN_CLASSIFIABLE);
// put the selected category in the action params
NodeRef catNodeRef = (NodeRef)actionProps.get(PROP_CATEGORY);
repoProps.put(LinkCategoryActionExecuter.PARAM_CATEGORY_VALUE,
catNodeRef);
}
public void prepareForEdit(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
NodeRef catNodeRef = (NodeRef)repoProps.get(LinkCategoryActionExecuter.PARAM_CATEGORY_VALUE);
actionProps.put(PROP_CATEGORY, catNodeRef);
}
public String generateSummary(FacesContext context, IWizardBean wizard,
Map<String, Serializable> actionProps)
{
NodeRef cat = (NodeRef)actionProps.get(PROP_CATEGORY);
String name = Repository.getNameForNode(
Repository.getServiceRegistry(context).getNodeService(), cat);
return MessageFormat.format(Application.getMessage(context, "action_link_category"),
new Object[] {name});
}
}

View File

@@ -0,0 +1,144 @@
package org.alfresco.web.bean.actions.handlers;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.faces.context.FacesContext;
import org.alfresco.repo.action.executer.MailActionExecuter;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.actions.BaseActionWizard;
import org.alfresco.web.bean.actions.BaseActionWizard.RecipientWrapper;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wizard.IWizardBean;
/**
* Action handler implementation for the "mail" action.
*
* @author gavinc
*/
public class MailHandler extends BaseActionHandler
{
public static final String PROP_TO = "to";
public static final String PROP_FROM = "from";
public static final String PROP_MESSAGE = "message";
public static final String PROP_SUBJECT = "subject";
public static final String PROP_TEMPLATE = "template";
public String getJSPPath()
{
return getJSPPath(MailActionExecuter.NAME);
}
public void prepareForSave(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
// get hold of the current wizard so we can extract some data from it
BaseActionWizard wizard = (BaseActionWizard)Application.
getWizardManager().getBean();
// add the person(s) it's going to as a list of authorities
List<String> recipients = new ArrayList<String>(wizard.getEmailRecipients().size());
for (int i=0; i < wizard.getEmailRecipients().size(); i++)
{
RecipientWrapper wrapper = wizard.getEmailRecipients().get(i);
recipients.add(wrapper.getAuthority());
}
repoProps.put(MailActionExecuter.PARAM_TO_MANY, (Serializable)recipients);
// add the actual email text to send
repoProps.put(MailActionExecuter.PARAM_TEXT, actionProps.get(PROP_MESSAGE));
// add the subject for the email
repoProps.put(MailActionExecuter.PARAM_SUBJECT, actionProps.get(PROP_SUBJECT));
// add the from address
String from = Application.getClientConfig(FacesContext.getCurrentInstance()).getFromEmailAddress();
repoProps.put(MailActionExecuter.PARAM_FROM, from);
// add the template if one was selected by the user
if (wizard.getUsingTemplate() != null)
{
repoProps.put(MailActionExecuter.PARAM_TEMPLATE, new NodeRef(Repository.getStoreRef(),
wizard.getUsingTemplate()));
}
}
public void prepareForEdit(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
// get hold of the current wizard so we can extract some data from it
BaseActionWizard wizard = (BaseActionWizard)Application.
getWizardManager().getBean();
String subject = (String)repoProps.get(MailActionExecuter.PARAM_SUBJECT);
actionProps.put(PROP_SUBJECT, subject);
String message = (String)repoProps.get(MailActionExecuter.PARAM_TEXT);
actionProps.put(PROP_MESSAGE, message);
// handle single email or multiple authority recipients
String to = (String)repoProps.get(MailActionExecuter.PARAM_TO);
if (to != null)
{
actionProps.put(PROP_TO, to);
}
else
{
List<String> recipients = (List<String>)repoProps.get(MailActionExecuter.PARAM_TO_MANY);
if (recipients != null && recipients.size() != 0)
{
// rebuild the list of RecipientWrapper objects from the stored action
for (String authority : recipients)
{
wizard.getEmailRecipients().add(
new RecipientWrapper(wizard.displayLabelForAuthority(authority),
authority));
}
}
}
NodeRef templateRef = (NodeRef)repoProps.get(MailActionExecuter.PARAM_TEMPLATE);
if (templateRef != null)
{
actionProps.put(PROP_TEMPLATE, templateRef.getId());
wizard.setUsingTemplate(templateRef.getId());
}
}
public String generateSummary(FacesContext context, IWizardBean wizard,
Map<String, Serializable> actionProps)
{
BaseActionWizard actionWizard = (BaseActionWizard)wizard;
String addresses = (String)actionProps.get(PROP_TO);
if (addresses == null || addresses.length() == 0)
{
if (actionWizard.getEmailRecipients().size() != 0)
{
StringBuilder builder = new StringBuilder();
for (int i=0; i < actionWizard.getEmailRecipients().size(); i++)
{
RecipientWrapper wrapper = actionWizard.getEmailRecipients().get(i);
if (i != 0)
{
builder.append(", ");
}
builder.append(wrapper.getName());
}
addresses = builder.toString();
}
}
return MessageFormat.format(Application.getMessage(context, "action_mail"),
new Object[] {addresses});
}
}

View File

@@ -0,0 +1,62 @@
package org.alfresco.web.bean.actions.handlers;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Map;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.action.executer.MoveActionExecuter;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wizard.IWizardBean;
/**
* Action handler for the "move" action.
*
* @author gavinc
*/
public class MoveHandler extends BaseActionHandler
{
public String getJSPPath()
{
return getJSPPath(MoveActionExecuter.NAME);
}
public void prepareForSave(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
// add the destination space id to the action properties
NodeRef destNodeRef = (NodeRef)actionProps.get(PROP_DESTINATION);
repoProps.put(MoveActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
// add the type and name of the association to create when the move
// is performed
repoProps.put(MoveActionExecuter.PARAM_ASSOC_TYPE_QNAME,
ContentModel.ASSOC_CONTAINS);
repoProps.put(MoveActionExecuter.PARAM_ASSOC_QNAME,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "move"));
}
public void prepareForEdit(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
NodeRef destNodeRef = (NodeRef)repoProps.get(MoveActionExecuter.PARAM_DESTINATION_FOLDER);
actionProps.put(PROP_DESTINATION, destNodeRef);
}
public String generateSummary(FacesContext context, IWizardBean wizard,
Map<String, Serializable> actionProps)
{
NodeRef space = (NodeRef)actionProps.get(PROP_DESTINATION);
String spaceName = Repository.getNameForNode(
Repository.getServiceRegistry(context).getNodeService(), space);
return MessageFormat.format(Application.getMessage(context, "action_move"),
new Object[] {spaceName});
}
}

View File

@@ -0,0 +1,65 @@
package org.alfresco.web.bean.actions.handlers;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.alfresco.repo.action.executer.RemoveFeaturesActionExecuter;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.actions.BaseActionWizard;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wizard.IWizardBean;
/**
* Action handler for the "remove-features" action.
*
* @author gavinc
*/
public class RemoveFeaturesHandler extends BaseActionHandler
{
protected static final String PROP_ASPECT = "aspect";
public String getJSPPath()
{
return getJSPPath(RemoveFeaturesActionExecuter.NAME);
}
public void prepareForSave(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
QName aspect = Repository.resolveToQName((String)actionProps.get(PROP_ASPECT));
repoProps.put(RemoveFeaturesActionExecuter.PARAM_ASPECT_NAME, aspect);
}
public void prepareForEdit(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
QName aspect = (QName)repoProps.get(RemoveFeaturesActionExecuter.PARAM_ASPECT_NAME);
actionProps.put(PROP_ASPECT, aspect.toString());
}
public String generateSummary(FacesContext context, IWizardBean wizard,
Map<String, Serializable> actionProps)
{
String label = null;
String aspect = (String)actionProps.get(PROP_ASPECT);
// find the label used by looking through the SelectItem list
for (SelectItem item : ((BaseActionWizard)wizard).getAspects())
{
if (item.getValue().equals(aspect))
{
label = item.getLabel();
break;
}
}
return MessageFormat.format(Application.getMessage(context, "action_remove_features"),
new Object[] {label});
}
}

View File

@@ -0,0 +1,63 @@
package org.alfresco.web.bean.actions.handlers;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Map;
import javax.faces.context.FacesContext;
import org.alfresco.repo.action.executer.ScriptActionExecutor;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.bean.NavigationBean;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wizard.IWizardBean;
/**
* Action handler for the "script" action.
*
* @author gavinc
*/
public class ScriptHandler extends BaseActionHandler
{
protected static final String PROP_SCRIPT = "script";
public String getJSPPath()
{
return getJSPPath(ScriptActionExecutor.NAME);
}
public void prepareForSave(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
// add the selected script noderef to the action properties
String id = (String)actionProps.get(PROP_SCRIPT);
NodeRef scriptRef = new NodeRef(Repository.getStoreRef(), id);
repoProps.put(ScriptActionExecutor.PARAM_SCRIPTREF, scriptRef);
NavigationBean navBean = (NavigationBean)FacesHelper.getManagedBean(
FacesContext.getCurrentInstance(), "NavigationBean");
repoProps.put(ScriptActionExecutor.PARAM_SPACEREF,
navBean.getCurrentNode().getNodeRef());
}
public void prepareForEdit(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
NodeRef scriptRef = (NodeRef)repoProps.get(ScriptActionExecutor.PARAM_SCRIPTREF);
actionProps.put(PROP_SCRIPT, scriptRef.getId());
}
public String generateSummary(FacesContext context, IWizardBean wizard,
Map<String, Serializable> actionProps)
{
String id = (String)actionProps.get(PROP_SCRIPT);
NodeRef scriptRef = new NodeRef(Repository.getStoreRef(), id);
String scriptName = Repository.getNameForNode(
Repository.getServiceRegistry(context).getNodeService(), scriptRef);
return MessageFormat.format(Application.getMessage(context, "action_script"),
new Object[] {scriptName});
}
}

View File

@@ -0,0 +1,181 @@
package org.alfresco.web.bean.actions.handlers;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Map;
import javax.faces.context.FacesContext;
import org.alfresco.repo.action.executer.SimpleWorkflowActionExecuter;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wizard.IWizardBean;
/**
* Action handler for the "simple-workflow" action.
*
* @author gavinc
*/
public class SimpleWorkflowHandler extends BaseActionHandler
{
public static final String PROP_APPROVE_STEP_NAME = "approveStepName";
public static final String PROP_APPROVE_ACTION = "approveAction";
public static final String PROP_APPROVE_FOLDER = "approveFolder";
public static final String PROP_REJECT_STEP_PRESENT = "rejectStepPresent";
public static final String PROP_REJECT_STEP_NAME = "rejectStepName";
public static final String PROP_REJECT_ACTION = "rejectAction";
public static final String PROP_REJECT_FOLDER = "rejectFolder";
@Override
public void setupUIDefaults(Map<String, Serializable> actionProps)
{
actionProps.put(PROP_APPROVE_ACTION, "move");
actionProps.put(PROP_REJECT_STEP_PRESENT, "yes");
actionProps.put(PROP_REJECT_ACTION, "move");
}
public String getJSPPath()
{
return getJSPPath(SimpleWorkflowActionExecuter.NAME);
}
public void prepareForSave(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
// add the approve step name
repoProps.put(SimpleWorkflowActionExecuter.PARAM_APPROVE_STEP,
(String)actionProps.get(PROP_APPROVE_STEP_NAME));
// add whether the approve step will copy or move the content
boolean approveMove = true;
String approveAction = (String)actionProps.get(PROP_APPROVE_ACTION);
if (approveAction != null && approveAction.equals("copy"))
{
approveMove = false;
}
repoProps.put(SimpleWorkflowActionExecuter.PARAM_APPROVE_MOVE, Boolean.valueOf(approveMove));
// add the destination folder of the content
NodeRef approveDestNodeRef = null;
Object approveDestNode = actionProps.get(PROP_APPROVE_FOLDER);
if (approveDestNode instanceof NodeRef)
{
approveDestNodeRef = (NodeRef)approveDestNode;
}
else if (approveDestNode instanceof String)
{
approveDestNodeRef = new NodeRef((String)approveDestNode);
}
repoProps.put(SimpleWorkflowActionExecuter.PARAM_APPROVE_FOLDER, approveDestNodeRef);
// determine whether we have a reject step or not
boolean requireReject = true;
String rejectStepPresent = (String)actionProps.get(PROP_REJECT_STEP_PRESENT);
if (rejectStepPresent != null && rejectStepPresent.equals("no"))
{
requireReject = false;
}
if (requireReject)
{
// add the reject step name
repoProps.put(SimpleWorkflowActionExecuter.PARAM_REJECT_STEP,
(String)actionProps.get(PROP_REJECT_STEP_NAME));
// add whether the reject step will copy or move the content
boolean rejectMove = true;
String rejectAction = (String)actionProps.get(PROP_REJECT_ACTION);
if (rejectAction != null && rejectAction.equals("copy"))
{
rejectMove = false;
}
repoProps.put(SimpleWorkflowActionExecuter.PARAM_REJECT_MOVE, Boolean.valueOf(rejectMove));
// add the destination folder of the content
NodeRef rejectDestNodeRef = null;
Object rejectDestNode = actionProps.get(PROP_REJECT_FOLDER);
if (rejectDestNode instanceof NodeRef)
{
rejectDestNodeRef = (NodeRef)rejectDestNode;
}
else if (rejectDestNode instanceof String)
{
rejectDestNodeRef = new NodeRef((String)rejectDestNode);
}
repoProps.put(SimpleWorkflowActionExecuter.PARAM_REJECT_FOLDER, rejectDestNodeRef);
}
}
public void prepareForEdit(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
String approveStep = (String)repoProps.get(SimpleWorkflowActionExecuter.PARAM_APPROVE_STEP);
Boolean approveMove = (Boolean)repoProps.get(SimpleWorkflowActionExecuter.PARAM_APPROVE_MOVE);
NodeRef approveFolderNode = (NodeRef)repoProps.get(
SimpleWorkflowActionExecuter.PARAM_APPROVE_FOLDER);
String rejectStep = (String)repoProps.get(SimpleWorkflowActionExecuter.PARAM_REJECT_STEP);
Boolean rejectMove = (Boolean)repoProps.get(SimpleWorkflowActionExecuter.PARAM_REJECT_MOVE);
NodeRef rejectFolderNode = (NodeRef)repoProps.get(
SimpleWorkflowActionExecuter.PARAM_REJECT_FOLDER);
actionProps.put(PROP_APPROVE_STEP_NAME, approveStep);
actionProps.put(PROP_APPROVE_ACTION, approveMove ? "move" : "copy");
actionProps.put(PROP_APPROVE_FOLDER, approveFolderNode);
if (rejectStep == null && rejectMove == null && rejectFolderNode == null)
{
actionProps.put(PROP_REJECT_STEP_PRESENT, "no");
actionProps.put(PROP_REJECT_ACTION, "move");
}
else
{
actionProps.put(PROP_REJECT_STEP_PRESENT, "yes");
actionProps.put(PROP_REJECT_STEP_NAME, rejectStep);
actionProps.put(PROP_REJECT_ACTION, rejectMove ? "move" : "copy");
actionProps.put(PROP_REJECT_FOLDER, rejectFolderNode);
}
}
public String generateSummary(FacesContext context, IWizardBean wizard,
Map<String, Serializable> actionProps)
{
NodeService nodeService = Repository.getServiceRegistry(context).getNodeService();
String approveStepName = (String)actionProps.get(PROP_APPROVE_STEP_NAME);
String approveAction = (String)actionProps.get(PROP_APPROVE_ACTION);
NodeRef approveFolder = (NodeRef)actionProps.get(PROP_APPROVE_FOLDER);
String approveFolderName = Repository.getNameForNode(nodeService, approveFolder);
String approveMsg = MessageFormat.format(
Application.getMessage(context, "action_simple_workflow"),
new Object[] {Application.getMessage(context, approveAction),
approveFolderName, approveStepName});
String rejectMsg = null;
String rejectStep = (String)actionProps.get(PROP_REJECT_STEP_PRESENT);
if (rejectStep != null && "yes".equals(rejectStep))
{
String rejectStepName = (String)actionProps.get(PROP_REJECT_STEP_NAME);
String rejectAction = (String)actionProps.get(PROP_REJECT_ACTION);
NodeRef rejectFolder = (NodeRef)actionProps.get(PROP_REJECT_FOLDER);
String rejectFolderName = Repository.getNameForNode(nodeService, rejectFolder);
rejectMsg = MessageFormat.format(
Application.getMessage(context, "action_simple_workflow"),
new Object[] {Application.getMessage(context, rejectAction),
rejectFolderName, rejectStepName});
}
StringBuilder builder = new StringBuilder(approveMsg);
if (rejectMsg != null)
{
builder.append(" ");
builder.append(rejectMsg);
}
return builder.toString();
}
}

View File

@@ -0,0 +1,63 @@
package org.alfresco.web.bean.actions.handlers;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.alfresco.repo.action.executer.SpecialiseTypeActionExecuter;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.actions.BaseActionWizard;
import org.alfresco.web.bean.wizard.IWizardBean;
/**
* Action handler for the "specialise-type" action.
*
* @author gavinc
*/
public class SpecialiseTypeHandler extends BaseActionHandler
{
public static final String PROP_OBJECT_TYPE = "objecttype";
public String getJSPPath()
{
return getJSPPath(SpecialiseTypeActionExecuter.NAME);
}
public void prepareForSave(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
String objectType = (String)actionProps.get(PROP_OBJECT_TYPE);
repoProps.put(SpecialiseTypeActionExecuter.PARAM_TYPE_NAME,
QName.createQName(objectType));
}
public void prepareForEdit(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
QName specialiseType = (QName)repoProps.get(SpecialiseTypeActionExecuter.PARAM_TYPE_NAME);
actionProps.put(PROP_OBJECT_TYPE, specialiseType.toString());
}
public String generateSummary(FacesContext context, IWizardBean wizard,
Map<String, Serializable> actionProps)
{
String label = null;
String objectType = (String)actionProps.get(PROP_OBJECT_TYPE);
for (SelectItem item : ((BaseActionWizard)wizard).getObjectTypes())
{
if (item.getValue().equals(objectType) == true)
{
label = item.getLabel();
break;
}
}
return MessageFormat.format(Application.getMessage(context, "action_specialise_type"),
new Object[] {label});
}
}

View File

@@ -0,0 +1,85 @@
package org.alfresco.web.bean.actions.handlers;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.action.executer.TransformActionExecuter;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.actions.BaseActionWizard;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wizard.IWizardBean;
/**
* Action handler for the "transform" action.
*
* @author gavinc
*/
public class TransformHandler extends BaseActionHandler
{
protected static final String PROP_TRANSFORMER = "transformer";
public String getJSPPath()
{
return getJSPPath(TransformActionExecuter.NAME);
}
public void prepareForSave(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
// add the transformer to use
repoProps.put(TransformActionExecuter.PARAM_MIME_TYPE,
actionProps.get(PROP_TRANSFORMER));
// add the destination space id to the action properties
NodeRef destNodeRef = (NodeRef)actionProps.get(PROP_DESTINATION);
repoProps.put(TransformActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
// add the type and name of the association to create when the copy
// is performed
repoProps.put(TransformActionExecuter.PARAM_ASSOC_TYPE_QNAME,
ContentModel.ASSOC_CONTAINS);
repoProps.put(TransformActionExecuter.PARAM_ASSOC_QNAME,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "copy"));
}
public void prepareForEdit(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
String transformer = (String)repoProps.get(TransformActionExecuter.PARAM_MIME_TYPE);
actionProps.put(PROP_TRANSFORMER, transformer);
NodeRef destNodeRef = (NodeRef)repoProps.get(TransformActionExecuter.PARAM_DESTINATION_FOLDER);
actionProps.put(PROP_DESTINATION, destNodeRef);
}
public String generateSummary(FacesContext context, IWizardBean wizard,
Map<String, Serializable> actionProps)
{
String label = null;
NodeRef space = (NodeRef)actionProps.get(PROP_DESTINATION);
String name = Repository.getNameForNode(
Repository.getServiceRegistry(context).getNodeService(), space);
String transformer = (String)actionProps.get(PROP_TRANSFORMER);
// find the label used by looking through the SelectItem list
for (SelectItem item : ((BaseActionWizard)wizard).getTransformers())
{
if (item.getValue().equals(transformer))
{
label = item.getLabel();
break;
}
}
return MessageFormat.format(Application.getMessage(context, "action_transform"),
new Object[] {name, label});
}
}

View File

@@ -0,0 +1,95 @@
package org.alfresco.web.bean.actions.handlers;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.action.executer.ImageTransformActionExecuter;
import org.alfresco.repo.action.executer.TransformActionExecuter;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.actions.BaseActionWizard;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wizard.IWizardBean;
/**
* Action handler for the "transform-image" action.
*
* @author gavinc
*/
public class TransformImageHandler extends BaseActionHandler
{
protected static final String PROP_IMAGE_TRANSFORMER = "imageTransformer";
protected static final String PROP_TRANSFORM_OPTIONS = "transformOptions";
public String getJSPPath()
{
return getJSPPath(ImageTransformActionExecuter.NAME);
}
public void prepareForSave(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
// add the transformer to use
repoProps.put(ImageTransformActionExecuter.PARAM_MIME_TYPE,
actionProps.get(PROP_IMAGE_TRANSFORMER));
// add the options
repoProps.put(ImageTransformActionExecuter.PARAM_CONVERT_COMMAND,
actionProps.get(PROP_TRANSFORM_OPTIONS));
// add the destination space id to the action properties
NodeRef destNodeRef = (NodeRef)actionProps.get(PROP_DESTINATION);
repoProps.put(ImageTransformActionExecuter.PARAM_DESTINATION_FOLDER, destNodeRef);
// add the type and name of the association to create when the copy
// is performed
repoProps.put(TransformActionExecuter.PARAM_ASSOC_TYPE_QNAME,
ContentModel.ASSOC_CONTAINS);
repoProps.put(TransformActionExecuter.PARAM_ASSOC_QNAME,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "copy"));
}
public void prepareForEdit(Map<String, Serializable> actionProps,
Map<String, Serializable> repoProps)
{
String transformer = (String)repoProps.get(TransformActionExecuter.PARAM_MIME_TYPE);
actionProps.put(PROP_IMAGE_TRANSFORMER, transformer);
String options = (String)repoProps.get(ImageTransformActionExecuter.PARAM_CONVERT_COMMAND);
actionProps.put(PROP_TRANSFORM_OPTIONS, options != null ? options : "");
NodeRef destNodeRef = (NodeRef)repoProps.get(ImageTransformActionExecuter.PARAM_DESTINATION_FOLDER);
actionProps.put(PROP_DESTINATION, destNodeRef);
}
public String generateSummary(FacesContext context, IWizardBean wizard,
Map<String, Serializable> actionProps)
{
String label = null;
NodeRef space = (NodeRef)actionProps.get(PROP_DESTINATION);
String name = Repository.getNameForNode(
Repository.getServiceRegistry(context).getNodeService(), space);
String transformer = (String)actionProps.get(PROP_IMAGE_TRANSFORMER);
String option = (String)actionProps.get(PROP_TRANSFORM_OPTIONS);
// find the label used by looking through the SelectItem list
for (SelectItem item : ((BaseActionWizard)wizard).getImageTransformers())
{
if (item.getValue().equals(transformer))
{
label = item.getLabel();
break;
}
}
return MessageFormat.format(Application.getMessage(context, "action_transform_image"),
new Object[] {name, label, option});
}
}

View File

@@ -1,7 +1,6 @@
package org.alfresco.web.bean.rules; package org.alfresco.web.bean.rules;
import java.io.Serializable; import java.io.Serializable;
import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -16,25 +15,21 @@ import javax.faces.model.SelectItem;
import org.alfresco.config.Config; import org.alfresco.config.Config;
import org.alfresco.config.ConfigElement; import org.alfresco.config.ConfigElement;
import org.alfresco.config.ConfigService; import org.alfresco.config.ConfigService;
import org.alfresco.model.ContentModel; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.action.evaluator.CompareMimeTypeEvaluator;
import org.alfresco.repo.action.evaluator.ComparePropertyValueEvaluator;
import org.alfresco.repo.action.evaluator.HasAspectEvaluator;
import org.alfresco.repo.action.evaluator.InCategoryEvaluator;
import org.alfresco.repo.action.evaluator.IsSubTypeEvaluator;
import org.alfresco.service.cmr.action.Action; import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ActionCondition; import org.alfresco.service.cmr.action.ActionCondition;
import org.alfresco.service.cmr.action.ActionConditionDefinition; import org.alfresco.service.cmr.action.ActionConditionDefinition;
import org.alfresco.service.cmr.dictionary.TypeDefinition; import org.alfresco.service.cmr.dictionary.TypeDefinition;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.rule.Rule; import org.alfresco.service.cmr.rule.Rule;
import org.alfresco.service.cmr.rule.RuleService; import org.alfresco.service.cmr.rule.RuleService;
import org.alfresco.service.cmr.rule.RuleType; import org.alfresco.service.cmr.rule.RuleType;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application; import org.alfresco.web.app.Application;
import org.alfresco.web.bean.actions.BaseActionWizard; import org.alfresco.web.bean.actions.BaseActionWizard;
import org.alfresco.web.bean.actions.IHandler;
import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.rules.handlers.BaseConditionHandler;
import org.alfresco.web.data.IDataContainer; import org.alfresco.web.data.IDataContainer;
import org.alfresco.web.data.QuickSort; import org.alfresco.web.data.QuickSort;
import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.Utils;
@@ -48,9 +43,8 @@ import org.apache.commons.logging.LogFactory;
*/ */
public class CreateRuleWizard extends BaseActionWizard public class CreateRuleWizard extends BaseActionWizard
{ {
public static final String PROP_CONDITION_NAME = "conditionName"; protected static final String PROP_CONDITION_NAME = "conditionName";
public static final String PROP_CONDITION_SUMMARY = "conditionSummary"; protected static final String PROP_CONDITION_SUMMARY = "conditionSummary";
public static final String PROP_CONDITION_NOT = "notcondition";
protected RuleService ruleService; protected RuleService ruleService;
protected RulesBean rulesBean; protected RulesBean rulesBean;
@@ -60,6 +54,7 @@ public class CreateRuleWizard extends BaseActionWizard
private List<SelectItem> types; private List<SelectItem> types;
private List<SelectItem> conditions; private List<SelectItem> conditions;
protected Map<String, IHandler> conditionHandlers;
protected Map<String, Serializable> currentConditionProperties; protected Map<String, Serializable> currentConditionProperties;
protected List<Map<String, Serializable>> allConditionsProperties; protected List<Map<String, Serializable>> allConditionsProperties;
@@ -73,8 +68,6 @@ public class CreateRuleWizard extends BaseActionWizard
protected boolean applyToSubSpaces; protected boolean applyToSubSpaces;
protected boolean editingCondition; protected boolean editingCondition;
protected static final String CONDITION_PAGES_LOCATION = "/jsp/rules/";
private static final Log logger = LogFactory.getLog(CreateRuleWizard.class); private static final Log logger = LogFactory.getLog(CreateRuleWizard.class);
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
@@ -94,6 +87,8 @@ public class CreateRuleWizard extends BaseActionWizard
this.conditions = null; this.conditions = null;
this.allConditionsProperties = new ArrayList<Map<String, Serializable>>(); this.allConditionsProperties = new ArrayList<Map<String, Serializable>>();
initialiseConditionHandlers();
} }
@Override @Override
@@ -488,29 +483,31 @@ public class CreateRuleWizard extends BaseActionWizard
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
this.returnViewId = context.getViewRoot().getViewId(); this.returnViewId = context.getViewRoot().getViewId();
String viewId = calculateConditionViewId(this.condition); String viewId = null;
HashMap<String, Serializable> condProps = new HashMap<String, Serializable>(3); HashMap<String, Serializable> condProps = new HashMap<String, Serializable>(3);
condProps.put(PROP_CONDITION_NAME, this.condition); condProps.put(PROP_CONDITION_NAME, this.condition);
this.currentConditionProperties = condProps; this.currentConditionProperties = condProps;
// determine whether the condition being added has any parameters // get the handler for the condition, if there isn't one we presume it
ActionConditionDefinition conditionDef = this.actionService. // is a no-parameter condition
getActionConditionDefinition(this.condition); IHandler handler = this.conditionHandlers.get(this.condition);
if (conditionDef.hasParameterDefinitions()) if (handler != null)
{ {
// setup any defaults for the UI and override the viewId if necessary // setup any UI defaults the condition may have and get the location of
String overridenViewId = setupUIDefaultsForCondition(condProps); // the JSP used to collect the parameters
if (overridenViewId != null) handler.setupUIDefaults(condProps);
{ viewId = handler.getJSPPath();
viewId = overridenViewId;
}
} }
else else
{ {
// just add the condition to the list and use the title as the summary // just add the action to the list and use the title as the summary
ActionConditionDefinition conditionDef = this.actionService.
getActionConditionDefinition(this.condition);
condProps.put(PROP_CONDITION_SUMMARY, conditionDef.getTitle()); condProps.put(PROP_CONDITION_SUMMARY, conditionDef.getTitle());
condProps.put(PROP_CONDITION_NOT, Boolean.FALSE); condProps.put(BaseConditionHandler.PROP_CONDITION_NOT, Boolean.FALSE);
// add the no params marker so we can disable the edit action
condProps.put(NO_PARAMS_MARKER, "no-params");
this.allConditionsProperties.add(condProps); this.allConditionsProperties.add(condProps);
// come back to the same page we're on now as there are no params to collect // come back to the same page we're on now as there are no params to collect
@@ -543,8 +540,9 @@ public class CreateRuleWizard extends BaseActionWizard
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
this.returnViewId = context.getViewRoot().getViewId(); this.returnViewId = context.getViewRoot().getViewId();
// refresh the wizard // go to the condition page (as there is an edit option visible,
goToPage(context, calculateConditionViewId(this.condition)); // there must be a handler for the condition so we don't check)
goToPage(context, this.conditionHandlers.get(this.condition).getJSPPath());
} }
/** /**
@@ -553,7 +551,11 @@ public class CreateRuleWizard extends BaseActionWizard
public void addCondition() public void addCondition()
{ {
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
String summary = buildConditionSummary();
// this is called from the actions page so there must be a handler
// present so there's no need to check for null
String summary = this.conditionHandlers.get(this.condition).generateSummary(
context, this, this.currentConditionProperties);
if (summary != null) if (summary != null)
{ {
@@ -654,8 +656,14 @@ public class CreateRuleWizard extends BaseActionWizard
{ {
String conditionName = (String)condParams.get(PROP_CONDITION_NAME); String conditionName = (String)condParams.get(PROP_CONDITION_NAME);
this.condition = conditionName; this.condition = conditionName;
this.currentConditionProperties = condParams;
Map<String, Serializable> repoCondParams = buildConditionParams(); // get the condition handler to prepare for the save
Map<String, Serializable> repoCondParams = new HashMap<String, Serializable>();
IHandler handler = this.conditionHandlers.get(this.condition);
if (handler != null)
{
handler.prepareForSave(condParams, repoCondParams);
}
// add the condition to the rule // add the condition to the rule
ActionCondition condition = this.actionService. ActionCondition condition = this.actionService.
@@ -663,7 +671,7 @@ public class CreateRuleWizard extends BaseActionWizard
condition.setParameterValues(repoCondParams); condition.setParameterValues(repoCondParams);
// specify whether the condition result should be inverted // specify whether the condition result should be inverted
Boolean not = (Boolean)condParams.get(PROP_CONDITION_NOT); Boolean not = (Boolean)condParams.get(BaseConditionHandler.PROP_CONDITION_NOT);
condition.setInvertCondition(((Boolean)not).booleanValue()); condition.setInvertCondition(((Boolean)not).booleanValue());
rule.addActionCondition(condition); rule.addActionCondition(condition);
@@ -676,8 +684,14 @@ public class CreateRuleWizard extends BaseActionWizard
// to setup the currentActionProperties and action variables // to setup the currentActionProperties and action variables
String actionName = (String)actionParams.get(PROP_ACTION_NAME); String actionName = (String)actionParams.get(PROP_ACTION_NAME);
this.action = actionName; this.action = actionName;
this.currentActionProperties = actionParams;
Map<String, Serializable> repoActionParams = buildActionParams(); // get the action handler to prepare for the save
Map<String, Serializable> repoActionParams = new HashMap<String, Serializable>();
IHandler handler = this.actionHandlers.get(this.action);
if (handler != null)
{
handler.prepareForSave(actionParams, repoActionParams);
}
// add the action to the rule // add the action to the rule
Action action = this.actionService.createAction(actionName); Action action = this.actionService.createAction(actionName);
@@ -689,170 +703,53 @@ public class CreateRuleWizard extends BaseActionWizard
} }
/** /**
* Sets up any default state required by the UI for collecting the * Initialises the condition handlers from the current configuration.
* condition settings. The view id to use for the condition UI can also
* be overridden by returing the path to the relevant JSP.
*
* @props The map of properties being used for the current condition
* @return An optional overridden JSP to use for condition settings collection
*/ */
protected String setupUIDefaultsForCondition(HashMap<String, Serializable> props) protected void initialiseConditionHandlers()
{ {
// NOTE: none of the built in conditions have any defaults to setup if (this.conditionHandlers == null)
{
ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
Config wizardCfg = svc.getConfig("Action Wizards");
if (wizardCfg != null)
{
ConfigElement conditionHandlerCfg = wizardCfg.getConfigElement("condition-handlers");
if (conditionHandlerCfg != null)
{
this.conditionHandlers = new HashMap<String, IHandler>(20);
return null; // instantiate each handler and store in the map
for (ConfigElement child : conditionHandlerCfg.getChildren())
{
String conditionName = child.getAttribute("name");
String handlerClass = child.getAttribute("class");
if (conditionName != null && conditionName.length() > 0 &&
handlerClass != null && handlerClass.length() > 0)
{
try
{
Class klass = Class.forName(handlerClass);
IHandler handler = (IHandler)klass.newInstance();
this.conditionHandlers.put(conditionName, handler);
} }
catch (Exception e)
/**
* Builds the Map of properties for the given condition in the format the repo is expecting
*
* @return The Map the repo is expecting
*/
protected Map<String, Serializable> buildConditionParams()
{ {
Map<String, Serializable> repoParams = new HashMap<String, Serializable>(); throw new AlfrescoRuntimeException("Failed to setup condition handler for '" +
conditionName + "'", e);
if (ComparePropertyValueEvaluator.NAME.equals(this.condition))
{
// add the text to compare
String text = (String)this.currentConditionProperties.get(PROP_CONTAINS_TEXT);
repoParams.put(ComparePropertyValueEvaluator.PARAM_VALUE, text);
}
else if (InCategoryEvaluator.NAME.equals(this.condition))
{
// put the selected category in the condition params
NodeRef nodeRef = (NodeRef)this.currentConditionProperties.get(PROP_CATEGORY);
repoParams.put(InCategoryEvaluator.PARAM_CATEGORY_VALUE, nodeRef);
// add the classifiable aspect
repoParams.put(InCategoryEvaluator.PARAM_CATEGORY_ASPECT, ContentModel.ASPECT_GEN_CLASSIFIABLE);
}
else if (IsSubTypeEvaluator.NAME.equals(this.condition))
{
// add the model type
QName type = QName.createQName((String)this.currentConditionProperties.get(PROP_MODEL_TYPE));
repoParams.put(IsSubTypeEvaluator.PARAM_TYPE, type);
}
else if (HasAspectEvaluator.NAME.equals(this.condition))
{
// add the aspect
QName aspect = QName.createQName((String)this.currentConditionProperties.get(PROP_ASPECT));
repoParams.put(HasAspectEvaluator.PARAM_ASPECT, aspect);
}
else if (CompareMimeTypeEvaluator.NAME.equals(this.condition))
{
// add the mimetype
String mimeType = (String)this.currentConditionProperties.get(PROP_MIMETYPE);
repoParams.put(CompareMimeTypeEvaluator.PARAM_VALUE, mimeType);
}
return repoParams;
}
/**
* Returns a summary string for the current condition
*
* @return The summary or null if a summary could not be built
*/
protected String buildConditionSummary()
{
String summary = null;
FacesContext context = FacesContext.getCurrentInstance();
Boolean not = (Boolean)this.currentConditionProperties.get(PROP_CONDITION_NOT);
if (ComparePropertyValueEvaluator.NAME.equals(this.condition))
{
String msgId = not.booleanValue() ?
"condition_compare_property_value_not" : "condition_compare_property_value";
String text = (String)this.currentConditionProperties.get(PROP_CONTAINS_TEXT);
summary = MessageFormat.format(Application.getMessage(context, msgId),
new Object[] {text});
}
else if (InCategoryEvaluator.NAME.equals(this.condition))
{
String msgId = not.booleanValue() ? "condition_in_category_not" : "condition_in_category";
String name = Repository.getNameForNode(this.nodeService,
(NodeRef)this.currentConditionProperties.get(PROP_CATEGORY));
summary = MessageFormat.format(Application.getMessage(context, msgId),
new Object[] {name});
}
else if (IsSubTypeEvaluator.NAME.equals(this.condition))
{
String msgId = not.booleanValue() ? "condition_is_subtype_not" : "condition_is_subtype";
String label = null;
String typeName = (String)this.currentConditionProperties.get(PROP_MODEL_TYPE);
for (SelectItem item : this.getModelTypes())
{
if (item.getValue().equals(typeName))
{
label = item.getLabel();
break;
} }
} }
summary = MessageFormat.format(Application.getMessage(context, msgId),
new Object[] {label});
} }
else if (HasAspectEvaluator.NAME.equals(this.condition))
{
String msgId = not.booleanValue() ? "condition_has_aspect_not" : "condition_has_aspect";
String label = null;
String aspectName = (String)this.currentConditionProperties.get(PROP_ASPECT);
for (SelectItem item : this.getAspects())
{
if (item.getValue().equals(aspectName))
{
label = item.getLabel();
break;
}
}
summary = MessageFormat.format(Application.getMessage(context, msgId),
new Object[] {label});
}
else if (CompareMimeTypeEvaluator.NAME.equals(this.condition))
{
String msgId = not.booleanValue() ? "condition_compare_mime_type_not" : "condition_compare_mime_type";
String label = null;
String mimetype = (String)this.currentConditionProperties.get(PROP_MIMETYPE);
for (SelectItem item : this.getMimeTypes())
{
if (item.getValue().equals(mimetype))
{
label = item.getLabel();
break;
}
}
summary = MessageFormat.format(Application.getMessage(context, msgId),
new Object[] {label});
} }
else else
{ {
// as the default case (i.e. for conditions with no parameters) use the title logger.warn("Could not find 'condition-handlers' configuration element");
ActionConditionDefinition conditionDef = this.actionService.
getActionConditionDefinition(this.condition);
summary = conditionDef.getTitle();
} }
return summary;
} }
else
/**
* Calculates the viewId for the given condition id
*
* @param conditionId The id of the condition to generate the view id for
* @return The view id
*/
protected String calculateConditionViewId(String conditionId)
{ {
return CONDITION_PAGES_LOCATION + conditionId + ".jsp"; logger.warn("Could not find 'Action Wizards' configuration section");
}
}
} }
} }

View File

@@ -8,31 +8,14 @@ import java.util.Map;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.action.evaluator.CompareMimeTypeEvaluator;
import org.alfresco.repo.action.evaluator.ComparePropertyValueEvaluator;
import org.alfresco.repo.action.evaluator.HasAspectEvaluator;
import org.alfresco.repo.action.evaluator.InCategoryEvaluator;
import org.alfresco.repo.action.evaluator.IsSubTypeEvaluator;
import org.alfresco.repo.action.executer.AddFeaturesActionExecuter;
import org.alfresco.repo.action.executer.CheckInActionExecuter;
import org.alfresco.repo.action.executer.CheckOutActionExecuter;
import org.alfresco.repo.action.executer.CopyActionExecuter;
import org.alfresco.repo.action.executer.ImageTransformActionExecuter;
import org.alfresco.repo.action.executer.ImporterActionExecuter;
import org.alfresco.repo.action.executer.LinkCategoryActionExecuter;
import org.alfresco.repo.action.executer.MailActionExecuter;
import org.alfresco.repo.action.executer.MoveActionExecuter;
import org.alfresco.repo.action.executer.RemoveFeaturesActionExecuter;
import org.alfresco.repo.action.executer.ScriptActionExecutor;
import org.alfresco.repo.action.executer.SimpleWorkflowActionExecuter;
import org.alfresco.repo.action.executer.SpecialiseTypeActionExecuter;
import org.alfresco.repo.action.executer.TransformActionExecuter;
import org.alfresco.service.cmr.action.Action; import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ActionCondition; import org.alfresco.service.cmr.action.ActionCondition;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.action.ActionConditionDefinition;
import org.alfresco.service.cmr.action.ActionDefinition;
import org.alfresco.service.cmr.rule.Rule; import org.alfresco.service.cmr.rule.Rule;
import org.alfresco.service.namespace.QName; import org.alfresco.web.bean.actions.IHandler;
import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.rules.handlers.BaseConditionHandler;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@@ -69,19 +52,38 @@ public class EditRuleWizard extends CreateRuleWizard
this.applyToSubSpaces = rule.isAppliedToChildren(); this.applyToSubSpaces = rule.isAppliedToChildren();
this.runInBackground = rule.getExecuteAsychronously(); this.runInBackground = rule.getExecuteAsychronously();
FacesContext context = FacesContext.getCurrentInstance();
// populate the conditions list with maps of properties representing each condition // populate the conditions list with maps of properties representing each condition
List<ActionCondition> conditions = rule.getActionConditions(); List<ActionCondition> conditions = rule.getActionConditions();
for (ActionCondition condition : conditions) for (ActionCondition condition : conditions)
{ {
this.currentConditionProperties = new HashMap<String, Serializable>(3); this.currentConditionProperties = new HashMap<String, Serializable>(3);
this.condition = condition.getActionConditionDefinitionName(); this.condition = condition.getActionConditionDefinitionName();
populateCondition(condition.getParameterValues());
// add the name, summary and not condition flag
this.currentConditionProperties.put(PROP_CONDITION_NAME, this.condition); this.currentConditionProperties.put(PROP_CONDITION_NAME, this.condition);
this.currentConditionProperties.put(PROP_CONDITION_NOT, this.currentConditionProperties.put(BaseConditionHandler.PROP_CONDITION_NOT,
Boolean.valueOf(condition.getInvertCondition())); Boolean.valueOf(condition.getInvertCondition()));
this.currentConditionProperties.put(PROP_CONDITION_SUMMARY, buildConditionSummary());
IHandler handler = this.conditionHandlers.get(this.condition);
if (handler != null)
{
// use the handler to populate the properties and summary
handler.prepareForEdit(this.currentConditionProperties,
condition.getParameterValues());
this.currentConditionProperties.put(PROP_CONDITION_SUMMARY,
handler.generateSummary(context, this, this.currentConditionProperties));
}
else
{
// there's no handler, so we presume it is a no-paramter
// condition, use the condition title as the summary
ActionConditionDefinition conditionDef = this.actionService.
getActionConditionDefinition(this.condition);
this.currentConditionProperties.put(PROP_CONDITION_SUMMARY,
conditionDef.getTitle());
// add the no params marker so we can disable the edit action
this.currentConditionProperties.put(NO_PARAMS_MARKER, "no-params");
}
// add the populated currentConditionProperties to the list // add the populated currentConditionProperties to the list
this.allConditionsProperties.add(this.currentConditionProperties); this.allConditionsProperties.add(this.currentConditionProperties);
@@ -93,11 +95,25 @@ public class EditRuleWizard extends CreateRuleWizard
{ {
this.currentActionProperties = new HashMap<String, Serializable>(3); this.currentActionProperties = new HashMap<String, Serializable>(3);
this.action = action.getActionDefinitionName(); this.action = action.getActionDefinitionName();
populateAction(action.getParameterValues());
// also add the name and summary
this.currentActionProperties.put(PROP_ACTION_NAME, this.action); this.currentActionProperties.put(PROP_ACTION_NAME, this.action);
this.currentActionProperties.put(PROP_ACTION_SUMMARY, buildActionSummary());
IHandler handler = this.actionHandlers.get(this.action);
if (handler != null)
{
// use the handler to populate the properties and summary
handler.prepareForEdit(this.currentActionProperties, action.getParameterValues());
this.currentActionProperties.put(PROP_ACTION_SUMMARY,
handler.generateSummary(context, this, this.currentActionProperties));
}
else
{
// there's no handler, so we presume it is a no-paramter
// action, use the action title as the summary
ActionDefinition actionDef = this.actionService.getActionDefinition(this.action);
this.currentActionProperties.put(PROP_ACTION_SUMMARY, actionDef.getTitle());
// add the no params marker so we can disable the edit action
this.currentActionProperties.put(NO_PARAMS_MARKER, "no-params");
}
// add the populated currentActionProperties to the list // add the populated currentActionProperties to the list
this.allActionsProperties.add(this.currentActionProperties); this.allActionsProperties.add(this.currentActionProperties);
@@ -152,182 +168,4 @@ public class EditRuleWizard extends CreateRuleWizard
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Helper methods // Helper methods
/**
* Populates a Map of properties the wizard is expecting for the given condition
*
* @param condition The condition to build the map for
*/
protected void populateCondition(Map<String, Serializable> conditionProps)
{
if (ComparePropertyValueEvaluator.NAME.equals(this.condition))
{
String propValue = (String)conditionProps.get(ComparePropertyValueEvaluator.PARAM_VALUE);
this.currentConditionProperties.put(PROP_CONTAINS_TEXT, propValue);
}
else if (InCategoryEvaluator.NAME.equals(this.condition))
{
NodeRef catNodeRef = (NodeRef)conditionProps.get(InCategoryEvaluator.PARAM_CATEGORY_VALUE);
this.currentConditionProperties.put(PROP_CATEGORY, catNodeRef);
}
else if (IsSubTypeEvaluator.NAME.equals(this.condition))
{
QName type = (QName)conditionProps.get(IsSubTypeEvaluator.PARAM_TYPE);
this.currentConditionProperties.put(PROP_MODEL_TYPE, type.toString());
}
else if (HasAspectEvaluator.NAME.equals(this.condition))
{
QName aspect = (QName)conditionProps.get(HasAspectEvaluator.PARAM_ASPECT);
this.currentConditionProperties.put(PROP_ASPECT, aspect.toString());
}
else if (CompareMimeTypeEvaluator.NAME.equals(this.condition))
{
String mimeType = (String)conditionProps.get(CompareMimeTypeEvaluator.PARAM_VALUE);
this.currentConditionProperties.put(PROP_MIMETYPE, mimeType);
}
}
/**
* Populate the actionProperties member variable with correct props for the current action
* using the supplied property map.
*
* @param actionProps Map to retrieve props appropriate to the current action from
*/
protected void populateAction(Map<String, Serializable> actionProps)
{
if (AddFeaturesActionExecuter.NAME.equals(this.action))
{
QName aspect = (QName)actionProps.get(AddFeaturesActionExecuter.PARAM_ASPECT_NAME);
this.currentActionProperties.put(PROP_ASPECT, aspect.toString());
}
else if (RemoveFeaturesActionExecuter.NAME.equals(this.action))
{
QName aspect = (QName)actionProps.get(RemoveFeaturesActionExecuter.PARAM_ASPECT_NAME);
this.currentActionProperties.put(PROP_ASPECT, aspect.toString());
}
else if (CopyActionExecuter.NAME.equals(this.action))
{
NodeRef destNodeRef = (NodeRef)actionProps.get(CopyActionExecuter.PARAM_DESTINATION_FOLDER);
this.currentActionProperties.put(PROP_DESTINATION, destNodeRef);
}
else if (MoveActionExecuter.NAME.equals(this.action))
{
NodeRef destNodeRef = (NodeRef)actionProps.get(MoveActionExecuter.PARAM_DESTINATION_FOLDER);
this.currentActionProperties.put(PROP_DESTINATION, destNodeRef);
}
else if (SimpleWorkflowActionExecuter.NAME.equals(this.action))
{
String approveStep = (String)actionProps.get(SimpleWorkflowActionExecuter.PARAM_APPROVE_STEP);
Boolean approveMove = (Boolean)actionProps.get(SimpleWorkflowActionExecuter.PARAM_APPROVE_MOVE);
NodeRef approveFolderNode = (NodeRef)actionProps.get(
SimpleWorkflowActionExecuter.PARAM_APPROVE_FOLDER);
String rejectStep = (String)actionProps.get(SimpleWorkflowActionExecuter.PARAM_REJECT_STEP);
Boolean rejectMove = (Boolean)actionProps.get(SimpleWorkflowActionExecuter.PARAM_REJECT_MOVE);
NodeRef rejectFolderNode = (NodeRef)actionProps.get(
SimpleWorkflowActionExecuter.PARAM_REJECT_FOLDER);
this.currentActionProperties.put(PROP_APPROVE_STEP_NAME, approveStep);
this.currentActionProperties.put(PROP_APPROVE_ACTION, approveMove ? "move" : "copy");
this.currentActionProperties.put(PROP_APPROVE_FOLDER, approveFolderNode);
if (rejectStep == null && rejectMove == null && rejectFolderNode == null)
{
this.currentActionProperties.put(PROP_REJECT_STEP_PRESENT, "no");
}
else
{
this.currentActionProperties.put(PROP_REJECT_STEP_PRESENT, "yes");
this.currentActionProperties.put(PROP_REJECT_STEP_NAME, rejectStep);
this.currentActionProperties.put(PROP_REJECT_ACTION, rejectMove ? "move" : "copy");
this.currentActionProperties.put(PROP_REJECT_FOLDER, rejectFolderNode);
}
}
else if (LinkCategoryActionExecuter.NAME.equals(this.action))
{
NodeRef catNodeRef = (NodeRef)actionProps.get(LinkCategoryActionExecuter.PARAM_CATEGORY_VALUE);
this.currentActionProperties.put(PROP_CATEGORY, catNodeRef);
}
else if (CheckOutActionExecuter.NAME.equals(this.action))
{
NodeRef destNodeRef = (NodeRef)actionProps.get(CheckOutActionExecuter.PARAM_DESTINATION_FOLDER);
this.currentActionProperties.put(PROP_DESTINATION, destNodeRef);
}
else if (CheckInActionExecuter.NAME.equals(this.action))
{
String checkDesc = (String)actionProps.get(CheckInActionExecuter.PARAM_DESCRIPTION);
this.currentActionProperties.put(PROP_CHECKIN_DESC, checkDesc);
Boolean minorChange = (Boolean)actionProps.get(CheckInActionExecuter.PARAM_MINOR_CHANGE);
this.currentActionProperties.put(PROP_CHECKIN_MINOR, minorChange);
}
else if (TransformActionExecuter.NAME.equals(this.action))
{
String transformer = (String)actionProps.get(TransformActionExecuter.PARAM_MIME_TYPE);
this.currentActionProperties.put(PROP_TRANSFORMER, transformer);
NodeRef destNodeRef = (NodeRef)actionProps.get(CopyActionExecuter.PARAM_DESTINATION_FOLDER);
this.currentActionProperties.put(PROP_DESTINATION, destNodeRef);
}
else if (ImageTransformActionExecuter.NAME.equals(this.action))
{
String transformer = (String)actionProps.get(TransformActionExecuter.PARAM_MIME_TYPE);
this.currentActionProperties.put(PROP_IMAGE_TRANSFORMER, transformer);
String options = (String)actionProps.get(ImageTransformActionExecuter.PARAM_CONVERT_COMMAND);
this.currentActionProperties.put(PROP_TRANSFORM_OPTIONS, options != null ? options : "");
NodeRef destNodeRef = (NodeRef)actionProps.get(CopyActionExecuter.PARAM_DESTINATION_FOLDER);
this.currentActionProperties.put(PROP_DESTINATION, destNodeRef);
}
else if (MailActionExecuter.NAME.equals(this.action))
{
String subject = (String)actionProps.get(MailActionExecuter.PARAM_SUBJECT);
this.currentActionProperties.put(PROP_SUBJECT, subject);
String message = (String)actionProps.get(MailActionExecuter.PARAM_TEXT);
this.currentActionProperties.put(PROP_MESSAGE, message);
// handle single email or multiple authority recipients
String to = (String)actionProps.get(MailActionExecuter.PARAM_TO);
if (to != null)
{
this.currentActionProperties.put(PROP_TO, to);
}
else
{
List<String> recipients = (List<String>)actionProps.get(MailActionExecuter.PARAM_TO_MANY);
if (recipients != null && recipients.size() != 0)
{
// rebuild the list of RecipientWrapper objects from the stored action
for (String authority : recipients)
{
this.emailRecipients.add(
new RecipientWrapper(displayLabelForAuthority(authority), authority));
}
}
}
NodeRef templateRef = (NodeRef)actionProps.get(MailActionExecuter.PARAM_TEMPLATE);
if (templateRef != null)
{
this.currentActionProperties.put(PROP_TEMPLATE, templateRef.getId());
this.usingTemplate = templateRef.getId();
}
}
else if (ImporterActionExecuter.NAME.equals(this.action))
{
NodeRef destNodeRef = (NodeRef)actionProps.get(ImporterActionExecuter.PARAM_DESTINATION_FOLDER);
this.currentActionProperties.put(PROP_DESTINATION, destNodeRef);
}
else if (SpecialiseTypeActionExecuter.NAME.equals(this.action))
{
QName specialiseType = (QName)actionProps.get(SpecialiseTypeActionExecuter.PARAM_TYPE_NAME);
this.currentActionProperties.put(PROP_OBJECT_TYPE, specialiseType.toString());
}
else if (ScriptActionExecutor.NAME.equals(this.action))
{
NodeRef scriptRef = (NodeRef)actionProps.get(ScriptActionExecutor.PARAM_SCRIPTREF);
this.currentActionProperties.put(PROP_SCRIPT, scriptRef.getId());
}
}
} }

View File

@@ -0,0 +1,34 @@
package org.alfresco.web.bean.rules.handlers;
import java.io.Serializable;
import java.util.Map;
import org.alfresco.web.bean.actions.IHandler;
/**
* Base class for all condition handler implementations.
*
* @author gavinc
*/
public abstract class BaseConditionHandler implements IHandler
{
protected static final String CONDITION_PAGES_LOCATION = "/jsp/rules/";
public static final String PROP_CONDITION_NOT = "notcondition";
public void setupUIDefaults(Map<String, Serializable> conditionProps)
{
// do nothing by default, only those condition handlers that need
// to setup defaults need override this method
}
/**
* Given the condition name, generates the default path for the JSP
*
* @param conditionName The name of the condition
* @return The path to the JSP used for the condition
*/
protected String getJSPPath(String conditionName)
{
return CONDITION_PAGES_LOCATION + conditionName + ".jsp";
}
}

View File

@@ -0,0 +1,63 @@
package org.alfresco.web.bean.rules.handlers;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.alfresco.repo.action.evaluator.CompareMimeTypeEvaluator;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.rules.CreateRuleWizard;
import org.alfresco.web.bean.wizard.IWizardBean;
/**
* Condition handler for the "compare-mime-type" condition
*
* @author gavinc
*/
public class CompareMimeTypeHandler extends BaseConditionHandler
{
protected static final String PROP_MIMETYPE = "mimetype";
public String getJSPPath()
{
return getJSPPath(CompareMimeTypeEvaluator.NAME);
}
public void prepareForSave(Map<String, Serializable> conditionProps,
Map<String, Serializable> repoProps)
{
String mimeType = (String)conditionProps.get(PROP_MIMETYPE);
repoProps.put(CompareMimeTypeEvaluator.PARAM_VALUE, mimeType);
}
public void prepareForEdit(Map<String, Serializable> conditionProps,
Map<String, Serializable> repoProps)
{
String mimeType = (String)repoProps.get(CompareMimeTypeEvaluator.PARAM_VALUE);
conditionProps.put(PROP_MIMETYPE, mimeType);
}
public String generateSummary(FacesContext context, IWizardBean wizard,
Map<String, Serializable> conditionProps)
{
Boolean not = (Boolean)conditionProps.get(PROP_CONDITION_NOT);
String msgId = not.booleanValue() ? "condition_compare_mime_type_not" : "condition_compare_mime_type";
String label = null;
String mimetype = (String)conditionProps.get(PROP_MIMETYPE);
for (SelectItem item : ((CreateRuleWizard)wizard).getMimeTypes())
{
if (item.getValue().equals(mimetype))
{
label = item.getLabel();
break;
}
}
return MessageFormat.format(Application.getMessage(context, msgId),
new Object[] {label});
}
}

View File

@@ -0,0 +1,64 @@
package org.alfresco.web.bean.rules.handlers;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.alfresco.repo.action.evaluator.HasAspectEvaluator;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.rules.CreateRuleWizard;
import org.alfresco.web.bean.wizard.IWizardBean;
/**
* Condition handler for the "has-aspect" condition.
*
* @author gavinc
*/
public class HasAspectHandler extends BaseConditionHandler
{
protected static final String PROP_ASPECT = "aspect";
public String getJSPPath()
{
return getJSPPath(HasAspectEvaluator.NAME);
}
public void prepareForSave(Map<String, Serializable> conditionProps,
Map<String, Serializable> repoProps)
{
QName aspect = QName.createQName((String)conditionProps.get(PROP_ASPECT));
repoProps.put(HasAspectEvaluator.PARAM_ASPECT, aspect);
}
public void prepareForEdit(Map<String, Serializable> conditionProps,
Map<String, Serializable> repoProps)
{
QName aspect = (QName)repoProps.get(HasAspectEvaluator.PARAM_ASPECT);
conditionProps.put(PROP_ASPECT, aspect.toString());
}
public String generateSummary(FacesContext context, IWizardBean wizard,
Map<String, Serializable> conditionProps)
{
Boolean not = (Boolean)conditionProps.get(PROP_CONDITION_NOT);
String msgId = not.booleanValue() ? "condition_has_aspect_not" : "condition_has_aspect";
String label = null;
String aspectName = (String)conditionProps.get(PROP_ASPECT);
for (SelectItem item : ((CreateRuleWizard)wizard).getAspects())
{
if (item.getValue().equals(aspectName))
{
label = item.getLabel();
break;
}
}
return MessageFormat.format(Application.getMessage(context, msgId),
new Object[] {label});
}
}

View File

@@ -0,0 +1,61 @@
package org.alfresco.web.bean.rules.handlers;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Map;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.action.evaluator.InCategoryEvaluator;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wizard.IWizardBean;
/**
* Condition handler for the "in-category" condition.
*
* @author gavinc
*/
public class InCategoryHandler extends BaseConditionHandler
{
protected static final String PROP_CATEGORY = "category";
public String getJSPPath()
{
return getJSPPath(InCategoryEvaluator.NAME);
}
public void prepareForSave(Map<String, Serializable> conditionProps,
Map<String, Serializable> repoProps)
{
// put the selected category in the condition params
NodeRef nodeRef = (NodeRef)conditionProps.get(PROP_CATEGORY);
repoProps.put(InCategoryEvaluator.PARAM_CATEGORY_VALUE, nodeRef);
// add the classifiable aspect
repoProps.put(InCategoryEvaluator.PARAM_CATEGORY_ASPECT,
ContentModel.ASPECT_GEN_CLASSIFIABLE);
}
public void prepareForEdit(Map<String, Serializable> conditionProps,
Map<String, Serializable> repoProps)
{
NodeRef catNodeRef = (NodeRef)repoProps.get(InCategoryEvaluator.PARAM_CATEGORY_VALUE);
conditionProps.put(PROP_CATEGORY, catNodeRef);
}
public String generateSummary(FacesContext context, IWizardBean wizard,
Map<String, Serializable> conditionProps)
{
Boolean not = (Boolean)conditionProps.get(PROP_CONDITION_NOT);
String msgId = not.booleanValue() ? "condition_in_category_not" : "condition_in_category";
String name = Repository.getNameForNode(Repository.getServiceRegistry(context).
getNodeService(), (NodeRef)conditionProps.get(PROP_CATEGORY));
return MessageFormat.format(Application.getMessage(context, msgId),
new Object[] {name});
}
}

View File

@@ -0,0 +1,64 @@
package org.alfresco.web.bean.rules.handlers;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.alfresco.repo.action.evaluator.IsSubTypeEvaluator;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.rules.CreateRuleWizard;
import org.alfresco.web.bean.wizard.IWizardBean;
/**
* Condition handler to the "is-subtype" condition.
*
* @author gavinc
*/
public class IsSubTypeHandler extends BaseConditionHandler
{
protected static final String PROP_MODEL_TYPE = "modeltype";
public String getJSPPath()
{
return getJSPPath(IsSubTypeEvaluator.NAME);
}
public void prepareForSave(Map<String, Serializable> conditionProps,
Map<String, Serializable> repoProps)
{
QName type = QName.createQName((String)conditionProps.get(PROP_MODEL_TYPE));
repoProps.put(IsSubTypeEvaluator.PARAM_TYPE, type);
}
public void prepareForEdit(Map<String, Serializable> conditionProps,
Map<String, Serializable> repoProps)
{
QName type = (QName)repoProps.get(IsSubTypeEvaluator.PARAM_TYPE);
conditionProps.put(PROP_MODEL_TYPE, type.toString());
}
public String generateSummary(FacesContext context, IWizardBean wizard,
Map<String, Serializable> conditionProps)
{
Boolean not = (Boolean)conditionProps.get(PROP_CONDITION_NOT);
String msgId = not.booleanValue() ? "condition_is_subtype_not" : "condition_is_subtype";
String label = null;
String typeName = (String)conditionProps.get(PROP_MODEL_TYPE);
for (SelectItem item : ((CreateRuleWizard)wizard).getModelTypes())
{
if (item.getValue().equals(typeName))
{
label = item.getLabel();
break;
}
}
return MessageFormat.format(Application.getMessage(context, msgId),
new Object[] {label});
}
}

View File

@@ -0,0 +1,53 @@
package org.alfresco.web.bean.rules.handlers;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Map;
import javax.faces.context.FacesContext;
import org.alfresco.repo.action.evaluator.ComparePropertyValueEvaluator;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.wizard.IWizardBean;
/**
* Condition handler for the "compare-property-value" condition.
*
* @author gavinc
*/
public class PropertyValueHandler extends BaseConditionHandler
{
public static final String PROP_CONTAINS_TEXT = "containstext";
public String getJSPPath()
{
return getJSPPath(ComparePropertyValueEvaluator.NAME);
}
public void prepareForSave(Map<String, Serializable> conditionProps,
Map<String, Serializable> repoProps)
{
String text = (String)conditionProps.get(PROP_CONTAINS_TEXT);
repoProps.put(ComparePropertyValueEvaluator.PARAM_VALUE, text);
}
public void prepareForEdit(Map<String, Serializable> conditionProps,
Map<String, Serializable> repoProps)
{
String propValue = (String)repoProps.get(ComparePropertyValueEvaluator.PARAM_VALUE);
conditionProps.put(PROP_CONTAINS_TEXT, propValue);
}
public String generateSummary(FacesContext context, IWizardBean wizard,
Map<String, Serializable> conditionProps)
{
Boolean not = (Boolean)conditionProps.get(PROP_CONDITION_NOT);
String msgId = not.booleanValue() ?
"condition_compare_property_value_not" : "condition_compare_property_value";
String text = (String)conditionProps.get(PROP_CONTAINS_TEXT);
return MessageFormat.format(Application.getMessage(context, msgId),
new Object[] {text});
}
}

View File

@@ -34,6 +34,7 @@ import javax.faces.model.ListDataModel;
import javax.transaction.UserTransaction; import javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
import org.alfresco.service.cmr.repository.InvalidNodeRefException; import org.alfresco.service.cmr.repository.InvalidNodeRefException;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
@@ -589,6 +590,7 @@ public abstract class UserMembersBean implements IContextListener
// and add each of the new permissions in turn // and add each of the new permissions in turn
NodeRef nodeRef = getNode().getNodeRef(); NodeRef nodeRef = getNode().getNodeRef();
this.permissionService.clearPermission(nodeRef, getPersonAuthority()); this.permissionService.clearPermission(nodeRef, getPersonAuthority());
AlfrescoTransactionSupport.flush();
for (PermissionWrapper wrapper : personRoles) for (PermissionWrapper wrapper : personRoles)
{ {
this.permissionService.setPermission( this.permissionService.setPermission(

View File

@@ -30,6 +30,8 @@ import javax.faces.event.ActionEvent;
import javax.faces.model.DataModel; import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel; import javax.faces.model.ListDataModel;
import javax.faces.model.SelectItem; import javax.faces.model.SelectItem;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import javax.transaction.UserTransaction; import javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
@@ -57,6 +59,8 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.mail.SimpleMailMessage; import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.mail.javamail.MimeMessagePreparator;
/** /**
* @author Kevin Roast * @author Kevin Roast
@@ -105,6 +109,7 @@ public abstract class InviteUsersWizard extends AbstractWizardBean
private String automaticText = null; private String automaticText = null;
private String template = null; private String template = null;
private String usingTemplate = null; private String usingTemplate = null;
private String finalBody;
/** /**
* @return a cached list of available permissions for the type being dealt with * @return a cached list of available permissions for the type being dealt with
@@ -277,9 +282,9 @@ public abstract class InviteUsersWizard extends AbstractWizardBean
* @param from From text message * @param from From text message
* @param roleText The role display label for the user invite notification * @param roleText The role display label for the user invite notification
*/ */
private void notifyUser(NodeRef person, NodeRef node, String from, String roleText) private void notifyUser(NodeRef person, NodeRef node, final String from, String roleText)
{ {
String to = (String)this.nodeService.getProperty(person, ContentModel.PROP_EMAIL); final String to = (String)this.nodeService.getProperty(person, ContentModel.PROP_EMAIL);
if (to != null && to.length() != 0) if (to != null && to.length() != 0)
{ {
@@ -289,21 +294,28 @@ public abstract class InviteUsersWizard extends AbstractWizardBean
FacesContext fc = FacesContext.getCurrentInstance(); FacesContext fc = FacesContext.getCurrentInstance();
// use template service to format the email // use template service to format the email
NodeRef templateRef = new NodeRef(Repository.getStoreRef(), this.usingTemplate);
ServiceRegistry services = Repository.getServiceRegistry(fc); ServiceRegistry services = Repository.getServiceRegistry(fc);
Map<String, Object> model = DefaultModelHelper.buildDefaultModel( Map<String, Object> model = DefaultModelHelper.buildDefaultModel(
services, Application.getCurrentUser(fc)); services, Application.getCurrentUser(fc));
model.put("role", roleText); model.put("role", roleText);
model.put("space", new TemplateNode(node, Repository.getServiceRegistry(fc), null)); model.put("space", new TemplateNode(node, Repository.getServiceRegistry(fc), null));
NodeRef templateRef = new NodeRef(Repository.getStoreRef(), this.usingTemplate);
body = services.getTemplateService().processTemplate("freemarker", templateRef.toString(), model); body = services.getTemplateService().processTemplate("freemarker", templateRef.toString(), model);
} }
this.finalBody = body;
SimpleMailMessage simpleMailMessage = new SimpleMailMessage(); MimeMessagePreparator mailPreparer = new MimeMessagePreparator()
simpleMailMessage.setTo(to); {
simpleMailMessage.setSubject(this.subject); public void prepare(MimeMessage mimeMessage) throws MessagingException
simpleMailMessage.setText(body); {
simpleMailMessage.setFrom(from); MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
message.setTo(to);
message.setSubject(subject);
message.setText(finalBody);
message.setFrom(from);
}
};
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("Sending notification email to: " + to + "\n...with subject:\n" + subject + "\n...with body:\n" + body); logger.debug("Sending notification email to: " + to + "\n...with subject:\n" + subject + "\n...with body:\n" + body);
@@ -311,7 +323,7 @@ public abstract class InviteUsersWizard extends AbstractWizardBean
try try
{ {
// Send the message // Send the message
this.mailSender.send(simpleMailMessage); this.mailSender.send(mailPreparer);
} }
catch (Throwable e) catch (Throwable e)
{ {

View File

@@ -409,7 +409,7 @@ public class UIRichList extends UIComponentBase implements IDataContainer
int rowCount = getDataModel().size(); int rowCount = getDataModel().size();
// if a page size is specified, then we use that // if a page size is specified, then we use that
int pageSize = getPageSize(); int pageSize = getPageSize();
if (pageSize != -1) if (pageSize != -1 && pageSize != 0)
{ {
// calc start row index based on current page index // calc start row index based on current page index
this.rowIndex = (this.currentPage * pageSize) - 1; this.rowIndex = (this.currentPage * pageSize) - 1;

View File

@@ -219,6 +219,7 @@ public class NodePathLinkRenderer extends BaseRenderer
NodeRef lastElementRef = null; NodeRef lastElementRef = null;
int size = (showLeaf ? path.size() : path.size() - 1); int size = (showLeaf ? path.size() : path.size() - 1);
int lastElementPos = (showLeaf ? path.size() - 1 : path.size() - 2);
for (int i=0; i<size; i++) for (int i=0; i<size; i++)
{ {
Path.Element element = path.get(i); Path.Element element = path.get(i);
@@ -230,7 +231,7 @@ public class NodePathLinkRenderer extends BaseRenderer
{ {
elementString = Repository.getNameForNode(getNodeService(context), elementRef.getChildRef()); elementString = Repository.getNameForNode(getNodeService(context), elementRef.getChildRef());
} }
if (i == path.size() - 2) if (i == lastElementPos)
{ {
lastElementRef = elementRef.getChildRef(); lastElementRef = elementRef.getChildRef();
} }

View File

@@ -111,14 +111,14 @@
<f:facet name="header"> <f:facet name="header">
<h:outputText value="#{msg.summary}" /> <h:outputText value="#{msg.summary}" />
</f:facet> </f:facet>
<h:outputText value="#{row.actionSummary}"/> <h:outputText value="#{row.actionSummary}" />
<h:outputText value="&nbsp;&nbsp;" escape="false"/> <h:outputText value="&nbsp;&nbsp;" escape="false"/>
</h:column> </h:column>
<h:column> <h:column>
<a:actionLink action="#{WizardManager.bean.removeAction}" image="/images/icons/delete.gif" <a:actionLink action="#{WizardManager.bean.removeAction}" image="/images/icons/delete.gif"
value="#{msg.remove}" showLink="false" style="padding-left:6px;padding-right:2px" /> value="#{msg.remove}" showLink="false" style="padding-left:6px;padding-right:2px" />
<a:actionLink action="#{WizardManager.bean.editAction}" image="/images/icons/edit_icon.gif" <a:actionLink action="#{WizardManager.bean.editAction}" image="/images/icons/edit_icon.gif"
value="#{msg.change}" showLink="false" /> value="#{msg.change}" showLink="false" rendered='#{row.noParamsMarker == null}' />
</h:column> </h:column>
</h:dataTable> </h:dataTable>
<a:panel id="no-items" rendered="#{WizardManager.bean.allActionsDataModel.rowCount == 0}"> <a:panel id="no-items" rendered="#{WizardManager.bean.allActionsDataModel.rowCount == 0}">

View File

@@ -29,6 +29,32 @@
<r:page titleId="title_browse"> <r:page titleId="title_browse">
<script language="JavaScript1.2">
function applySizeSpaces(e)
{
return applySize(e, 'spaces-apply');
}
function applySizeContent(e)
{
return applySize(e, 'content-apply');
}
function applySize(e, field)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
if (keycode == 13)
{
document.forms['browse']['browse:act'].value='browse:' + field;
document.forms['browse'].submit();
return false;
}
return true;
}
</script>
<f:view> <f:view>
<% <%
FacesContext fc = FacesContext.getCurrentInstance(); FacesContext fc = FacesContext.getCurrentInstance();
@@ -182,117 +208,128 @@
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_4.gif)" width=4></td> <td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_4.gif)" width=4></td>
<td style="padding:4px"> <td style="padding:4px">
<a:panel id="spaces-panel" border="white" bgcolor="white" titleBorder="blue" titleBgcolor="#D3E6FE" styleClass="mainSubTitle" label="#{msg.browse_spaces}"> <%-- wrapper comment used by the panel to add additional component facets --%>
<h:panelGroup id="spaces-panel-facets">
<f:facet name="title">
<a:panel id="page-controls1" style="font-size:9px">
<h:outputText value="#{msg.items_per_page}" id="items-txt1"/>
<h:inputText id="spaces-pages" value="#{BrowseBean.pageSizeSpacesStr}" style="width:24px;margin-left:4px" maxlength="3" onkeyup="return applySizeSpaces(event);" />
<div style="display:none"><a:actionLink id="spaces-apply" value="" actionListener="#{BrowseBean.updateSpacesPageSize}" /></div>
</a:panel>
</f:facet>
</h:panelGroup>
<a:panel id="spaces-panel" border="white" bgcolor="white" titleBorder="blue" titleBgcolor="#D3E6FE" styleClass="mainSubTitle"
label="#{msg.browse_spaces}" progressive="true" facetsId="spaces-panel-facets">
<%-- Spaces List --%> <%-- Spaces List --%>
<a:richList id="spacesList" binding="#{BrowseBean.spacesRichList}" viewMode="#{BrowseBean.browseViewMode}" pageSize="#{BrowseBean.browsePageSize}" <a:richList id="spacesList" binding="#{BrowseBean.spacesRichList}" viewMode="#{BrowseBean.browseViewMode}" pageSize="#{BrowseBean.pageSizeSpaces}"
styleClass="recordSet" headerStyleClass="recordSetHeader" rowStyleClass="recordSetRow" altRowStyleClass="recordSetRowAlt" width="100%" styleClass="recordSet" headerStyleClass="recordSetHeader" rowStyleClass="recordSetRow" altRowStyleClass="recordSetRowAlt" width="100%"
value="#{BrowseBean.nodes}" var="r"> value="#{BrowseBean.nodes}" var="r">
<%-- component to display if the list is empty --%> <%-- component to display if the list is empty --%>
<f:facet name="empty"> <f:facet name="empty">
<%-- TODO: either build complete message in BrowseBean or have no icon... --%> <%-- TODO: either build complete message in BrowseBean or have no icon... --%>
<h:outputFormat value="#{msg.no_space_items}" escape="false" rendered="#{NavigationBean.searchContext == null}"> <h:outputFormat id="no-space-items" value="#{msg.no_space_items}" escape="false" rendered="#{NavigationBean.searchContext == null}">
<f:param value="#{msg.create_space}" /> <f:param value="#{msg.create_space}" />
</h:outputFormat> </h:outputFormat>
</f:facet> </f:facet>
<%-- Primary column for details view mode --%> <%-- Primary column for details view mode --%>
<a:column primary="true" width="200" style="padding:2px;text-align:left" rendered="#{BrowseBean.browseViewMode == 'details'}"> <a:column id="col1" primary="true" width="200" style="padding:2px;text-align:left" rendered="#{BrowseBean.browseViewMode == 'details'}">
<f:facet name="header"> <f:facet name="header">
<a:sortLink label="#{msg.name}" value="name" mode="case-insensitive" styleClass="header"/> <a:sortLink id="col1-sort" label="#{msg.name}" value="name" mode="case-insensitive" styleClass="header"/>
</f:facet> </f:facet>
<f:facet name="small-icon"> <f:facet name="small-icon">
<a:actionLink value="#{r.name}" image="/images/icons/#{r.smallIcon}.gif" actionListener="#{BrowseBean.clickSpace}" showLink="false"> <a:actionLink id="col1-act1" value="#{r.name}" image="/images/icons/#{r.smallIcon}.gif" actionListener="#{BrowseBean.clickSpace}" showLink="false">
<f:param name="id" value="#{r.id}" /> <f:param name="id" value="#{r.id}" />
</a:actionLink> </a:actionLink>
</f:facet> </f:facet>
<a:actionLink value="#{r.name}" actionListener="#{BrowseBean.clickSpace}"> <a:actionLink id="col1-act2" value="#{r.name}" actionListener="#{BrowseBean.clickSpace}">
<f:param name="id" value="#{r.id}" /> <f:param name="id" value="#{r.id}" />
</a:actionLink> </a:actionLink>
</a:column> </a:column>
<%-- Primary column for icons view mode --%> <%-- Primary column for icons view mode --%>
<a:column primary="true" style="padding:2px;text-align:left;vertical-align:top;" rendered="#{BrowseBean.browseViewMode == 'icons'}"> <a:column id="col2" primary="true" style="padding:2px;text-align:left;vertical-align:top;" rendered="#{BrowseBean.browseViewMode == 'icons'}">
<f:facet name="large-icon"> <f:facet name="large-icon">
<a:actionLink value="#{r.name}" image="/images/icons/#{r.icon}.gif" actionListener="#{BrowseBean.clickSpace}" showLink="false"> <a:actionLink id="col2-act1" value="#{r.name}" image="/images/icons/#{r.icon}.gif" actionListener="#{BrowseBean.clickSpace}" showLink="false">
<f:param name="id" value="#{r.id}" /> <f:param name="id" value="#{r.id}" />
</a:actionLink> </a:actionLink>
</f:facet> </f:facet>
<a:actionLink value="#{r.name}" actionListener="#{BrowseBean.clickSpace}" styleClass="header"> <a:actionLink id="col2-act2" value="#{r.name}" actionListener="#{BrowseBean.clickSpace}" styleClass="header">
<f:param name="id" value="#{r.id}" /> <f:param name="id" value="#{r.id}" />
</a:actionLink> </a:actionLink>
</a:column> </a:column>
<%-- Primary column for list view mode --%> <%-- Primary column for list view mode --%>
<a:column primary="true" style="padding:2px;text-align:left" rendered="#{BrowseBean.browseViewMode == 'list'}"> <a:column id="col3" primary="true" style="padding:2px;text-align:left" rendered="#{BrowseBean.browseViewMode == 'list'}">
<f:facet name="large-icon"> <f:facet name="large-icon">
<a:actionLink value="#{r.name}" image="/images/icons/#{r.icon}.gif" actionListener="#{BrowseBean.clickSpace}" showLink="false"> <a:actionLink id="col3-act1" value="#{r.name}" image="/images/icons/#{r.icon}.gif" actionListener="#{BrowseBean.clickSpace}" showLink="false">
<f:param name="id" value="#{r.id}" /> <f:param name="id" value="#{r.id}" />
</a:actionLink> </a:actionLink>
</f:facet> </f:facet>
<a:actionLink value="#{r.name}" actionListener="#{BrowseBean.clickSpace}" styleClass="title"> <a:actionLink id="col3-act2" value="#{r.name}" actionListener="#{BrowseBean.clickSpace}" styleClass="title">
<f:param name="id" value="#{r.id}" /> <f:param name="id" value="#{r.id}" />
</a:actionLink> </a:actionLink>
</a:column> </a:column>
<%-- Description column for all view modes --%> <%-- Description column for all view modes --%>
<a:column style="text-align:left"> <a:column id="col4" style="text-align:left">
<f:facet name="header"> <f:facet name="header">
<a:sortLink label="#{msg.description}" value="description" styleClass="header"/> <a:sortLink id="col4-sort" label="#{msg.description}" value="description" styleClass="header"/>
</f:facet> </f:facet>
<h:outputText value="#{r.description}" /> <h:outputText id="col4-txt" value="#{r.description}" />
</a:column> </a:column>
<%-- Path column for search mode in details view mode --%> <%-- Path column for search mode in details view mode --%>
<a:column style="text-align:left" rendered="#{NavigationBean.searchContext != null && BrowseBean.browseViewMode == 'details'}"> <a:column id="col5" style="text-align:left" rendered="#{NavigationBean.searchContext != null && BrowseBean.browseViewMode == 'details'}">
<f:facet name="header"> <f:facet name="header">
<a:sortLink label="#{msg.path}" value="displayPath" styleClass="header"/> <a:sortLink id="col5-sort" label="#{msg.path}" value="displayPath" styleClass="header"/>
</f:facet> </f:facet>
<r:nodePath value="#{r.path}" actionListener="#{BrowseBean.clickSpacePath}" /> <r:nodePath id="col5-path" value="#{r.path}" actionListener="#{BrowseBean.clickSpacePath}" />
</a:column> </a:column>
<%-- Created Date column for details view mode --%> <%-- Created Date column for details view mode --%>
<a:column style="text-align:left" rendered="#{BrowseBean.browseViewMode == 'details'}"> <a:column id="col6" style="text-align:left" rendered="#{BrowseBean.browseViewMode == 'details'}">
<f:facet name="header"> <f:facet name="header">
<a:sortLink label="#{msg.created}" value="created" styleClass="header"/> <a:sortLink id="col6-sort" label="#{msg.created}" value="created" styleClass="header"/>
</f:facet> </f:facet>
<h:outputText value="#{r.created}"> <h:outputText id="col6-txt" value="#{r.created}">
<a:convertXMLDate type="both" pattern="#{msg.date_time_pattern}" /> <a:convertXMLDate type="both" pattern="#{msg.date_time_pattern}" />
</h:outputText> </h:outputText>
</a:column> </a:column>
<%-- Modified Date column for details/icons view modes --%> <%-- Modified Date column for details/icons view modes --%>
<a:column style="text-align:left" rendered="#{BrowseBean.browseViewMode == 'details' || BrowseBean.browseViewMode == 'icons'}"> <a:column id="col7" style="text-align:left" rendered="#{BrowseBean.browseViewMode == 'details' || BrowseBean.browseViewMode == 'icons'}">
<f:facet name="header"> <f:facet name="header">
<a:sortLink label="#{msg.modified}" value="modified" styleClass="header"/> <a:sortLink id="col7-sort" label="#{msg.modified}" value="modified" styleClass="header"/>
</f:facet> </f:facet>
<h:outputText value="#{r.modified}"> <h:outputText id="col7-txt" value="#{r.modified}">
<a:convertXMLDate type="both" pattern="#{msg.date_time_pattern}" /> <a:convertXMLDate type="both" pattern="#{msg.date_time_pattern}" />
</h:outputText> </h:outputText>
</a:column> </a:column>
<%-- Node Descendants links for list view mode --%> <%-- Node Descendants links for list view mode --%>
<a:column style="text-align:left" rendered="#{BrowseBean.browseViewMode == 'list'}"> <a:column id="col8" style="text-align:left" rendered="#{BrowseBean.browseViewMode == 'list'}">
<r:nodeDescendants value="#{r.nodeRef}" styleClass="header" actionListener="#{BrowseBean.clickDescendantSpace}" /> <r:nodeDescendants id="col8-kids" value="#{r.nodeRef}" styleClass="header" actionListener="#{BrowseBean.clickDescendantSpace}" />
</a:column> </a:column>
<%-- Space Actions column --%> <%-- Space Actions column --%>
<a:column id="space-actions" actions="true" style="text-align:left"> <a:column id="col9" actions="true" style="text-align:left">
<f:facet name="header"> <f:facet name="header">
<h:outputText value="#{msg.actions}"/> <h:outputText id="col9-txt" value="#{msg.actions}"/>
</f:facet> </f:facet>
<%-- actions are configured in web-client-config-actions.xml --%> <%-- actions are configured in web-client-config-actions.xml --%>
<r:actions id="acts1" value="space_browse" context="#{r}" showLink="false" styleClass="inlineAction" /> <r:actions id="col9-acts1" value="space_browse" context="#{r}" showLink="false" styleClass="inlineAction" />
<%-- More actions menu --%> <%-- More actions menu --%>
<a:menu id="spaces-more-menu" itemSpacing="4" image="/images/icons/more.gif" tooltip="#{msg.more_actions}" menuStyleClass="moreActionsMenu"> <a:menu id="spaces-more-menu" itemSpacing="4" image="/images/icons/more.gif" tooltip="#{msg.more_actions}" menuStyleClass="moreActionsMenu">
<r:actions id="acts2" value="space_browse_menu" context="#{r}" /> <r:actions id="col9-acts2" value="space_browse_menu" context="#{r}" />
</a:menu> </a:menu>
</a:column> </a:column>
<a:dataPager styleClass="pager" /> <a:dataPager id="pager1" styleClass="pager" />
</a:richList> </a:richList>
</a:panel> </a:panel>
@@ -306,114 +343,124 @@
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_4.gif)" width=4></td> <td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_4.gif)" width=4></td>
<td style="padding:4px"> <td style="padding:4px">
<a:panel id="content-panel" border="white" bgcolor="white" titleBorder="blue" titleBgcolor="#D3E6FE" styleClass="mainSubTitle" label="#{msg.browse_content}"> <h:panelGroup id="content-panel-facets">
<f:facet name="title">
<a:panel id="page-controls2" style="font-size:9px">
<h:outputText value="#{msg.items_per_page}" id="items-txt2"/>
<h:inputText id="content-pages" value="#{BrowseBean.pageSizeContentStr}" style="width:24px;margin-left:4px" maxlength="3" onkeyup="return applySizeContent(event);" />
<div style="display:none"><a:actionLink id="content-apply" value="" actionListener="#{BrowseBean.updateContentPageSize}" /></div>
</a:panel>
</f:facet>
</h:panelGroup>
<a:panel id="content-panel" border="white" bgcolor="white" titleBorder="blue" titleBgcolor="#D3E6FE" styleClass="mainSubTitle"
label="#{msg.browse_content}" progressive="true" facetsId="content-panel-facets">
<%-- Content list --%> <%-- Content list --%>
<a:richList id="contentRichList" binding="#{BrowseBean.contentRichList}" viewMode="#{BrowseBean.browseViewMode}" pageSize="#{BrowseBean.browsePageSize}" <a:richList id="contentRichList" binding="#{BrowseBean.contentRichList}" viewMode="#{BrowseBean.browseViewMode}" pageSize="#{BrowseBean.pageSizeContent}"
styleClass="recordSet" headerStyleClass="recordSetHeader" rowStyleClass="recordSetRow" altRowStyleClass="recordSetRowAlt" width="100%" styleClass="recordSet" headerStyleClass="recordSetHeader" rowStyleClass="recordSetRow" altRowStyleClass="recordSetRowAlt" width="100%"
value="#{BrowseBean.content}" var="r"> value="#{BrowseBean.content}" var="r">
<%-- component to display if the list is empty --%> <%-- component to display if the list is empty --%>
<f:facet name="empty"> <f:facet name="empty">
<%-- TODO: either build complete message in BrowseBean or have no icon... --%> <%-- TODO: either build complete message in BrowseBean or have no icon... --%>
<h:outputFormat value="#{msg.no_content_items}" escape="false" rendered="#{NavigationBean.searchContext == null}"> <h:outputFormat id="no-content-items" value="#{msg.no_content_items}" escape="false" rendered="#{NavigationBean.searchContext == null}">
<f:param value="#{msg.add_content}" /> <f:param value="#{msg.add_content}" />
<f:param value="#{msg.create_content}" /> <f:param value="#{msg.create_content}" />
</h:outputFormat> </h:outputFormat>
</f:facet> </f:facet>
<%-- Primary column for details view mode --%> <%-- Primary column for details view mode --%>
<a:column primary="true" width="200" style="padding:2px;text-align:left" rendered="#{BrowseBean.browseViewMode == 'details'}"> <a:column id="col10" primary="true" width="200" style="padding:2px;text-align:left" rendered="#{BrowseBean.browseViewMode == 'details'}">
<f:facet name="header"> <f:facet name="header">
<a:sortLink label="#{msg.name}" value="name" mode="case-insensitive" styleClass="header"/> <a:sortLink id="col10-sort" label="#{msg.name}" value="name" mode="case-insensitive" styleClass="header"/>
</f:facet> </f:facet>
<f:facet name="small-icon"> <f:facet name="small-icon">
<a:actionLink value="#{r.name}" href="#{r.url}" target="new" image="#{r.fileType16}" showLink="false" styleClass="inlineAction" /> <a:actionLink id="col10-act1" value="#{r.name}" href="#{r.url}" target="new" image="#{r.fileType16}" showLink="false" styleClass="inlineAction" />
</f:facet> </f:facet>
<a:actionLink value="#{r.name}" href="#{r.url}" target="new" /> <a:actionLink id="col10-act2" value="#{r.name}" href="#{r.url}" target="new" />
<r:lockIcon value="#{r.nodeRef}" align="absmiddle" /> <r:lockIcon id="col10-lock" value="#{r.nodeRef}" align="absmiddle" />
</a:column> </a:column>
<%-- Primary column for icons view mode --%> <%-- Primary column for icons view mode --%>
<a:column primary="true" style="padding:2px;text-align:left;vertical-align:top;" rendered="#{BrowseBean.browseViewMode == 'icons'}"> <a:column id="col11" primary="true" style="padding:2px;text-align:left;vertical-align:top;" rendered="#{BrowseBean.browseViewMode == 'icons'}">
<f:facet name="large-icon"> <f:facet name="large-icon">
<a:actionLink value="#{r.name}" href="#{r.url}" target="new" image="#{r.fileType32}" showLink="false" styleClass="inlineAction" /> <a:actionLink id="col11-act1" value="#{r.name}" href="#{r.url}" target="new" image="#{r.fileType32}" showLink="false" styleClass="inlineAction" />
</f:facet> </f:facet>
<a:actionLink value="#{r.name}" href="#{r.url}" target="new" styleClass="header" /> <a:actionLink id="col11-act2" value="#{r.name}" href="#{r.url}" target="new" styleClass="header" />
<r:lockIcon value="#{r.nodeRef}" align="absmiddle" /> <r:lockIcon id="col11-lock" value="#{r.nodeRef}" align="absmiddle" />
</a:column> </a:column>
<%-- Primary column for list view mode --%> <%-- Primary column for list view mode --%>
<a:column primary="true" style="padding:2px;text-align:left" rendered="#{BrowseBean.browseViewMode == 'list'}"> <a:column id="col12" primary="true" style="padding:2px;text-align:left" rendered="#{BrowseBean.browseViewMode == 'list'}">
<f:facet name="large-icon"> <f:facet name="large-icon">
<a:actionLink value="#{r.name}" href="#{r.url}" target="new" image="#{r.fileType32}" showLink="false" styleClass="inlineAction" /> <a:actionLink id="col12-act1" value="#{r.name}" href="#{r.url}" target="new" image="#{r.fileType32}" showLink="false" styleClass="inlineAction" />
</f:facet> </f:facet>
<a:actionLink value="#{r.name}" href="#{r.url}" target="new" styleClass="title" /> <a:actionLink id="col12-act2" value="#{r.name}" href="#{r.url}" target="new" styleClass="title" />
<r:lockIcon value="#{r.nodeRef}" align="absmiddle" /> <r:lockIcon id="col12-lock" value="#{r.nodeRef}" align="absmiddle" />
</a:column> </a:column>
<%-- Description column for all view modes --%> <%-- Description column for all view modes --%>
<a:column style="text-align:left"> <a:column id="col13" style="text-align:left">
<f:facet name="header"> <f:facet name="header">
<a:sortLink label="#{msg.description}" value="description" styleClass="header"/> <a:sortLink id="col13-sort" label="#{msg.description}" value="description" styleClass="header"/>
</f:facet> </f:facet>
<h:outputText value="#{r.description}" /> <h:outputText id="col13-txt" value="#{r.description}" />
</a:column> </a:column>
<%-- Path column for search mode in details view mode --%> <%-- Path column for search mode in details view mode --%>
<a:column style="text-align:left" rendered="#{NavigationBean.searchContext != null && BrowseBean.browseViewMode == 'details'}"> <a:column id="col14" style="text-align:left" rendered="#{NavigationBean.searchContext != null && BrowseBean.browseViewMode == 'details'}">
<f:facet name="header"> <f:facet name="header">
<a:sortLink label="#{msg.path}" value="displayPath" styleClass="header"/> <a:sortLink id="col14-sort" label="#{msg.path}" value="displayPath" styleClass="header"/>
</f:facet> </f:facet>
<r:nodePath value="#{r.path}" actionListener="#{BrowseBean.clickSpacePath}" /> <r:nodePath id="col14-path" value="#{r.path}" actionListener="#{BrowseBean.clickSpacePath}" />
</a:column> </a:column>
<%-- Size for details/icons view modes --%> <%-- Size for details/icons view modes --%>
<a:column style="text-align:left" rendered="#{BrowseBean.browseViewMode == 'details' || BrowseBean.browseViewMode == 'icons'}"> <a:column id="col15" style="text-align:left" rendered="#{BrowseBean.browseViewMode == 'details' || BrowseBean.browseViewMode == 'icons'}">
<f:facet name="header"> <f:facet name="header">
<a:sortLink label="#{msg.size}" value="size" styleClass="header"/> <a:sortLink id="col15-sort" label="#{msg.size}" value="size" styleClass="header"/>
</f:facet> </f:facet>
<h:outputText value="#{r.size}"> <h:outputText id="col15-txt" value="#{r.size}">
<a:convertSize /> <a:convertSize />
</h:outputText> </h:outputText>
</a:column> </a:column>
<%-- Created Date column for details view mode --%> <%-- Created Date column for details view mode --%>
<a:column style="text-align:left" rendered="#{BrowseBean.browseViewMode == 'details'}"> <a:column id="col16" style="text-align:left" rendered="#{BrowseBean.browseViewMode == 'details'}">
<f:facet name="header"> <f:facet name="header">
<a:sortLink label="#{msg.created}" value="created" styleClass="header"/> <a:sortLink id="col16-sort" label="#{msg.created}" value="created" styleClass="header"/>
</f:facet> </f:facet>
<h:outputText value="#{r.created}"> <h:outputText id="col16-txt" value="#{r.created}">
<a:convertXMLDate type="both" pattern="#{msg.date_time_pattern}" /> <a:convertXMLDate type="both" pattern="#{msg.date_time_pattern}" />
</h:outputText> </h:outputText>
</a:column> </a:column>
<%-- Modified Date column for details/icons view modes --%> <%-- Modified Date column for details/icons view modes --%>
<a:column style="text-align:left" rendered="#{BrowseBean.browseViewMode == 'details' || BrowseBean.browseViewMode == 'icons'}"> <a:column id="col17" style="text-align:left" rendered="#{BrowseBean.browseViewMode == 'details' || BrowseBean.browseViewMode == 'icons'}">
<f:facet name="header"> <f:facet name="header">
<a:sortLink label="#{msg.modified}" value="modified" styleClass="header"/> <a:sortLink id="col17-sort" label="#{msg.modified}" value="modified" styleClass="header"/>
</f:facet> </f:facet>
<h:outputText value="#{r.modified}"> <h:outputText id="col17-txt" value="#{r.modified}">
<a:convertXMLDate type="both" pattern="#{msg.date_time_pattern}" /> <a:convertXMLDate type="both" pattern="#{msg.date_time_pattern}" />
</h:outputText> </h:outputText>
</a:column> </a:column>
<%-- Content Actions column --%> <%-- Content Actions column --%>
<a:column id="content-actions" actions="true" style="text-align:left"> <a:column id="col18" actions="true" style="text-align:left">
<f:facet name="header"> <f:facet name="header">
<h:outputText value="#{msg.actions}"/> <h:outputText id="col18-txt" value="#{msg.actions}"/>
</f:facet> </f:facet>
<%-- actions are configured in web-client-config-actions.xml --%> <%-- actions are configured in web-client-config-actions.xml --%>
<r:actions id="acts3" value="document_browse" context="#{r}" showLink="false" styleClass="inlineAction" /> <r:actions id="col18-acts1" value="document_browse" context="#{r}" showLink="false" styleClass="inlineAction" />
<%-- More actions menu --%> <%-- More actions menu --%>
<a:menu id="content-more-menu" itemSpacing="4" image="/images/icons/more.gif" tooltip="#{msg.more_actions}" menuStyleClass="moreActionsMenu"> <a:menu id="content-more-menu" itemSpacing="4" image="/images/icons/more.gif" tooltip="#{msg.more_actions}" menuStyleClass="moreActionsMenu">
<r:actions id="acts4" value="document_browse_menu" context="#{r}" /> <r:actions id="col18-acts2" value="document_browse_menu" context="#{r}" />
</a:menu> </a:menu>
</a:column> </a:column>
<a:dataPager styleClass="pager" /> <a:dataPager id="pager2" styleClass="pager" />
</a:richList> </a:richList>
</a:panel> </a:panel>

View File

@@ -111,14 +111,13 @@
<f:facet name="header"> <f:facet name="header">
<h:outputText value="#{msg.summary}" /> <h:outputText value="#{msg.summary}" />
</f:facet> </f:facet>
<h:outputText value="#{row.conditionSummary}"/> <h:outputText value="#{row.conditionSummary}" />
</h:column> </h:column>
<h:column> <h:column>
<a:actionLink action="#{WizardManager.bean.removeCondition}" image="/images/icons/delete.gif" <a:actionLink action="#{WizardManager.bean.removeCondition}" image="/images/icons/delete.gif"
value="#{msg.remove}" showLink="false" style="padding-left:6px;padding-right:2px" /> value="#{msg.remove}" showLink="false" style="padding-left:6px;padding-right:2px" />
<a:actionLink action="#{WizardManager.bean.editCondition}" image="/images/icons/edit_icon.gif" <a:actionLink action="#{WizardManager.bean.editCondition}" image="/images/icons/edit_icon.gif"
value="#{msg.change}" showLink="false" value="#{msg.change}" showLink="false" rendered='#{row.noParamsMarker == null}' />
rendered='#{row.conditionName != "no-condition"}'/>
</h:column> </h:column>
</h:dataTable> </h:dataTable>
<a:panel id="no-items" rendered="#{WizardManager.bean.allConditionsDataModel.rowCount == 0}"> <a:panel id="no-items" rendered="#{WizardManager.bean.allConditionsDataModel.rowCount == 0}">