Merged V1.4 to HEAD

svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@3925 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@3965 .


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3966 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2006-09-29 07:45:33 +00:00
parent d4c5c3562a
commit cba5171884
23 changed files with 386 additions and 197 deletions

View File

@@ -963,6 +963,7 @@ select_reject_step=Do you want to provide a reject step?
choose_copy_move_location=Choose whether you want to move or copy the content and also the location.
start_workflow=Start Advanced Workflow
start_workflow_wizard=Start Advanced Workflow Wizard
start_named_workflow_wizard=Start {0} Workflow Wizard
start_workflow_desc=This wizard helps you start an advanced workflow for an item in the repository.
available_workflows=Available workflows
step_choose_workflow=Choose Workflow
@@ -1207,6 +1208,7 @@ status_space_updated=Successfully updated space ''{0}''.
# Validation Messages
validation_mandatory={0} is a mandatory field.
validation_string_length={0} must be between {1} and {2} characters in length.
validation_is_number={0} must contain a number.
validation_regex={0} is invalid.
validation_regex_not_match={0} is invalid.
validation_numeric_range={0} must be between {1} and {2}.

View File

@@ -184,8 +184,7 @@
<!-- Definition of the Start Workflow wizard -->
<wizard name="startWorkflow" managed-bean="StartWorkflowWizard"
title-id="start_workflow_wizard" description-id="start_workflow_desc"
icon="/images/icons/new_workflow_large.gif">
description-id="start_workflow_desc" icon="/images/icons/new_workflow_large.gif">
<step name="choose-workflow" title-id="step_choose_workflow"
description-id="start_workflow_choose_desc">
<page path="/jsp/workflow/start-workflow-wizard/choose-workflow.jsp"

View File

@@ -535,6 +535,9 @@ public class BrowseBean implements IContextListener
// push the view mode into the lists
setBrowseViewMode(viewMode);
// setup dispatch context for custom views
this.navigator.setupDispatchContext(this.navigator.getCurrentNode());
navigateBrowseScreen();
}
else
@@ -666,7 +669,7 @@ public class BrowseBean implements IContextListener
catch (InvalidNodeRefException refErr)
{
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {refErr.getNodeRef()}) );
FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {refErr.getNodeRef()}), refErr );
this.containerNodes = Collections.<Node>emptyList();
this.contentNodes = Collections.<Node>emptyList();
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
@@ -840,7 +843,7 @@ public class BrowseBean implements IContextListener
catch (InvalidNodeRefException refErr)
{
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {refErr.getNodeRef()}) );
FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {refErr.getNodeRef()}), refErr );
this.containerNodes = Collections.<Node>emptyList();
this.contentNodes = Collections.<Node>emptyList();
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}

View File

@@ -157,6 +157,8 @@ public class TrashcanBean implements IContextListener
/** User filter search box text */
private String userSearchText = null;
private boolean inProgress = false;
// ------------------------------------------------------------------------------
// Bean property getters and setters
@@ -784,43 +786,54 @@ public class TrashcanBean implements IContextListener
*/
public String recoverListedItemsOK()
{
FacesContext fc = FacesContext.getCurrentInstance();
if (inProgress == true) return null;
// restore the nodes - the user may have requested a restore to a different parent
List<NodeRef> nodeRefs = new ArrayList<NodeRef>(this.listedItems.size());
for (Node node : this.listedItems)
{
nodeRefs.add(node.getNodeRef());
}
List<RestoreNodeReport> reports;
if (this.destination == null)
{
reports = this.nodeArchiveService.restoreArchivedNodes(nodeRefs);
}
else
{
reports = this.nodeArchiveService.restoreArchivedNodes(nodeRefs, this.destination, null, null);
}
inProgress = true;
UserTransaction tx = null;
try
{
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true);
tx.begin();
FacesContext fc = FacesContext.getCurrentInstance();
saveReportDetail(reports);
// restore the nodes - the user may have requested a restore to a different parent
List<NodeRef> nodeRefs = new ArrayList<NodeRef>(this.listedItems.size());
for (Node node : this.listedItems)
{
nodeRefs.add(node.getNodeRef());
}
List<RestoreNodeReport> reports;
if (this.destination == null)
{
reports = this.nodeArchiveService.restoreArchivedNodes(nodeRefs);
}
else
{
reports = this.nodeArchiveService.restoreArchivedNodes(nodeRefs, this.destination, null, null);
}
tx.commit();
UserTransaction tx = null;
try
{
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true);
tx.begin();
saveReportDetail(reports);
tx.commit();
}
catch (Throwable err)
{
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
// most exceptions will be caught and returned as RestoreNodeReport objects by the service
String reason = err.getMessage();
String msg = MessageFormat.format(
Application.getMessage(fc, Repository.ERROR_GENERIC), reason);
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
fc.addMessage(null, facesMsg);
}
}
catch (Throwable err)
finally
{
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
// most exceptions will be caught and returned as RestoreNodeReport objects by the service
String reason = err.getMessage();
String msg = MessageFormat.format(
Application.getMessage(fc, Repository.ERROR_GENERIC), reason);
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
fc.addMessage(null, facesMsg);
inProgress = false;
}
return OUTCOME_RECOVERY_REPORT;
@@ -831,38 +844,49 @@ public class TrashcanBean implements IContextListener
*/
public String recoverAllItemsOK()
{
FacesContext fc = FacesContext.getCurrentInstance();
if (inProgress == true) return null;
// restore all nodes - the user may have requested a restore to a different parent
List<RestoreNodeReport> reports;
if (this.destination == null)
{
reports = this.nodeArchiveService.restoreAllArchivedNodes(Repository.getStoreRef());
}
else
{
reports = this.nodeArchiveService.restoreAllArchivedNodes(Repository.getStoreRef(), this.destination, null, null);
}
inProgress = true;
UserTransaction tx = null;
try
{
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true);
tx.begin();
FacesContext fc = FacesContext.getCurrentInstance();
saveReportDetail(reports);
// restore all nodes - the user may have requested a restore to a different parent
List<RestoreNodeReport> reports;
if (this.destination == null)
{
reports = this.nodeArchiveService.restoreAllArchivedNodes(Repository.getStoreRef());
}
else
{
reports = this.nodeArchiveService.restoreAllArchivedNodes(Repository.getStoreRef(), this.destination, null, null);
}
tx.commit();
UserTransaction tx = null;
try
{
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true);
tx.begin();
saveReportDetail(reports);
tx.commit();
}
catch (Throwable err)
{
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
// most exceptions will be caught and returned as RestoreNodeReport objects by the service
String reason = err.getMessage();
String msg = MessageFormat.format(
Application.getMessage(fc, Repository.ERROR_GENERIC), reason);
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
fc.addMessage(null, facesMsg);
}
}
catch (Throwable err)
finally
{
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
// most exceptions will be caught and returned as RestoreNodeReport objects by the service
String reason = err.getMessage();
String msg = MessageFormat.format(
Application.getMessage(fc, Repository.ERROR_GENERIC), reason);
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
fc.addMessage(null, facesMsg);
inProgress = false;
}
return OUTCOME_RECOVERY_REPORT;
@@ -883,6 +907,10 @@ public class TrashcanBean implements IContextListener
*/
public String deleteListedItemsOK()
{
if (inProgress == true) return null;
inProgress = true;
try
{
List<NodeRef> nodeRefs = new ArrayList<NodeRef>(this.listedItems.size());
@@ -897,6 +925,10 @@ public class TrashcanBean implements IContextListener
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
}
finally
{
inProgress = false;
}
return OUTCOME_DIALOGCLOSE;
}
@@ -906,6 +938,10 @@ public class TrashcanBean implements IContextListener
*/
public String deleteAllItemsOK()
{
if (inProgress == true) return null;
inProgress = true;
try
{
this.nodeArchiveService.purgeAllArchivedNodes(Repository.getStoreRef());
@@ -915,6 +951,10 @@ public class TrashcanBean implements IContextListener
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
}
finally
{
inProgress = false;
}
return OUTCOME_DIALOGCLOSE;
}

View File

@@ -48,13 +48,27 @@ public final class DialogManager
*/
public void setCurrentDialog(DialogConfig config)
{
// make sure the managed bean is present
String beanName = config.getManagedBean();
IDialogBean dialog = (IDialogBean)FacesHelper.getManagedBean(
FacesContext.getCurrentInstance(), beanName);
if (dialog == null)
Object bean = FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), beanName);
if (bean == null)
{
throw new AlfrescoRuntimeException("Failed to find managed bean '" + beanName + "'");
throw new AlfrescoRuntimeException("Failed to start dialog as managed bean '" + beanName +
"' has not been defined");
}
// make sure the bean implements the IDialogBean interface
IDialogBean dialog = null;
if (bean instanceof IDialogBean)
{
dialog = (IDialogBean)bean;
}
else
{
throw new AlfrescoRuntimeException("Failed to start dialog as managed bean '" + beanName +
"' does not implement the required IDialogBean interface");
}
// initialise the managed bean

View File

@@ -5,6 +5,7 @@ import javax.faces.context.FacesContext;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.ui.repo.RepoConstants;
import org.alfresco.web.ui.repo.component.UIMultiValueEditor;
import org.alfresco.web.ui.repo.component.property.PropertySheetItem;
import org.alfresco.web.ui.repo.component.property.UIPropertySheet;
@@ -37,14 +38,29 @@ public class CategorySelectorGenerator extends BaseComponentGenerator
protected void setupMandatoryValidation(FacesContext context, UIPropertySheet propertySheet,
PropertySheetItem item, UIComponent component, boolean realTimeChecking, String idSuffix)
{
// Override the setup of the mandatory validation
// so we can send the _selected id suffix.
// We also enable real time so the page load check disabled
// the ok button if necessary, as the control is used the
// page will be refreshed and therefore re-check the status.
super.setupMandatoryValidation(context, propertySheet, item,
component, true, "_selected");
if (component instanceof UIMultiValueEditor)
{
// Override the setup of the mandatory validation
// so we can send the _current_value id suffix.
// We also enable real time so the page load
// check disables the ok button if necessary, as the user
// adds or removes items from the multi value list the
// page will be refreshed and therefore re-check the status.
super.setupMandatoryValidation(context, propertySheet, item,
component, true, "_current_value");
}
else
{
// Override the setup of the mandatory validation
// so we can send the _selected id suffix.
// We also enable real time so the page load check disabled
// the ok button if necessary, as the control is used the
// page will be refreshed and therefore re-check the status.
super.setupMandatoryValidation(context, propertySheet, item,
component, true, "_selected");
}
}
@Override

View File

@@ -1,5 +1,6 @@
package org.alfresco.web.bean.generator;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
@@ -12,12 +13,15 @@ import javax.faces.model.SelectItem;
import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint;
import org.alfresco.service.cmr.dictionary.Constraint;
import org.alfresco.service.cmr.dictionary.ConstraintDefinition;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.ui.common.ComponentConstants;
import org.alfresco.web.ui.repo.component.UIMultiValueEditor;
import org.alfresco.web.ui.repo.component.property.PropertySheetItem;
import org.alfresco.web.ui.repo.component.property.UIPropertySheet;
import org.alfresco.web.ui.repo.component.property.UIPropertySheet.ClientValidation;
/**
* Generates a text field component.
@@ -166,6 +170,47 @@ public class TextFieldGenerator extends BaseComponentGenerator
}
}
@Override
@SuppressWarnings("unchecked")
protected void setupConstraints(FacesContext context,
UIPropertySheet propertySheet, PropertySheetItem property,
PropertyDefinition propertyDef, UIComponent component)
{
// do the default processing first
super.setupConstraints(context, propertySheet, property,
propertyDef, component);
// if the property type is a number based type and the property
// sheet is in edit mode and validation is turned, on add the
// validateIsNumber validation function
if (propertySheet.inEditMode() && propertySheet.isValidationEnabled() &&
propertyDef != null)
{
// check the type of the property is a number
if (propertyDef.getDataType().getName().equals(DataTypeDefinition.DOUBLE) ||
propertyDef.getDataType().getName().equals(DataTypeDefinition.FLOAT) ||
propertyDef.getDataType().getName().equals(DataTypeDefinition.INT) ||
propertyDef.getDataType().getName().equals(DataTypeDefinition.LONG))
{
List<String> params = new ArrayList<String>(3);
// add the value parameter
String value = "document.getElementById('" +
component.getClientId(context) + "')";
params.add(value);
// add the validation failed message to show
String msg = Application.getMessage(context, "validation_is_number");
addStringConstraintParam(params,
MessageFormat.format(msg, new Object[] {property.getResolvedDisplayLabel()}));
// add the validation case to the property sheet
propertySheet.addClientValidation(new ClientValidation("validateIsNumber",
params, false));
}
}
}
/**
* Retrieves the list of values constraint for the item, if it has one
*
@@ -174,8 +219,8 @@ public class TextFieldGenerator extends BaseComponentGenerator
* @param item The item being generated
* @return The constraint if the item has one, null otherwise
*/
protected ListOfValuesConstraint getListOfValuesConstraint(FacesContext context, UIPropertySheet propertySheet,
PropertySheetItem item)
protected ListOfValuesConstraint getListOfValuesConstraint(FacesContext context,
UIPropertySheet propertySheet, PropertySheetItem item)
{
ListOfValuesConstraint lovConstraint = null;

View File

@@ -16,7 +16,9 @@
*/
package org.alfresco.web.bean.repository;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import javax.faces.context.FacesContext;
@@ -213,4 +215,21 @@ public final class User
return prefRef;
}
/**
* Returns the full name of the user represented by the given NodeRef
*
* @param nodeService The node service instance
* @param user The user to get the full name for
* @return The full name
*/
public static String getFullName(NodeService nodeService, NodeRef user)
{
Map<QName, Serializable> props = nodeService.getProperties(user);
String firstName = (String)props.get(ContentModel.PROP_FIRSTNAME);
String lastName = (String)props.get(ContentModel.PROP_LASTNAME);
String fullName = firstName + " " + (lastName != null ? lastName : "");
return fullName;
}
}

View File

@@ -56,13 +56,27 @@ public final class WizardManager
*/
public void setCurrentWizard(WizardConfig config)
{
// make sure the managed bean is present
String beanName = config.getManagedBean();
IWizardBean wizard = (IWizardBean)FacesHelper.getManagedBean(
FacesContext.getCurrentInstance(), beanName);
if (wizard == null)
Object bean = FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), beanName);
if (bean == null)
{
throw new AlfrescoRuntimeException("Failed to find managed bean '" + beanName + "'");
throw new AlfrescoRuntimeException("Failed to start wizard as managed bean '" + beanName +
"' has not been defined");
}
// make sure the bean implements the IWizardBean interface
IWizardBean wizard = null;
if (bean instanceof IWizardBean)
{
wizard = (IWizardBean)bean;
}
else
{
throw new AlfrescoRuntimeException("Failed to start wizard as managed bean '" + beanName +
"' does not implement the required IWizardBean interface");
}
// initialise the managed bean

View File

@@ -5,6 +5,7 @@ import java.util.Map;
import javax.faces.context.FacesContext;
import org.alfresco.service.cmr.workflow.WorkflowInstance;
import org.alfresco.service.cmr.workflow.WorkflowService;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.dialog.BaseDialogBean;
@@ -18,7 +19,7 @@ import org.apache.commons.logging.LogFactory;
*/
public class CancelWorkflowDialog extends BaseDialogBean
{
protected String workflowInstanceId;
protected WorkflowInstance workflowInstance;
protected WorkflowService workflowService;
private static final Log logger = LogFactory.getLog(CancelWorkflowDialog.class);
@@ -32,11 +33,17 @@ public class CancelWorkflowDialog extends BaseDialogBean
super.init(parameters);
// make sure the workflow instance id has been passed
this.workflowInstanceId = this.parameters.get("workflow-instance-id");
if (this.workflowInstanceId == null || this.workflowInstanceId.length() == 0)
String workflowInstanceId = this.parameters.get("workflow-instance-id");
if (workflowInstanceId == null || workflowInstanceId.length() == 0)
{
throw new IllegalArgumentException("Cancel workflow dialog called without workflow instance id");
}
this.workflowInstance = workflowService.getWorkflowById(workflowInstanceId);
if (this.workflowInstance == null)
{
throw new IllegalArgumentException("Failed to find workflow instance for id: " + workflowInstanceId);
}
}
@Override
@@ -44,13 +51,13 @@ public class CancelWorkflowDialog extends BaseDialogBean
throws Exception
{
if (logger.isDebugEnabled())
logger.debug("Cancelling workflow with id: " + this.workflowInstanceId);
logger.debug("Cancelling workflow with id: " + this.workflowInstance.id);
// cancel the workflow
this.workflowService.cancelWorkflow(this.workflowInstanceId);
this.workflowService.cancelWorkflow(this.workflowInstance.id);
if (logger.isDebugEnabled())
logger.debug("Cancelled workflow with id: " + this.workflowInstanceId);
logger.debug("Cancelled workflow with id: " + this.workflowInstance.id);
return outcome;
}
@@ -67,9 +74,21 @@ public class CancelWorkflowDialog extends BaseDialogBean
return false;
}
@Override
public String getCancelButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), "no");
}
@Override
public String getFinishButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), "yes");
}
// ------------------------------------------------------------------------------
// Bean Getters and Setters
/**
* Returns the confirmation to display to the user before deleting the content.
*
@@ -80,8 +99,13 @@ public class CancelWorkflowDialog extends BaseDialogBean
String confirmMsg = Application.getMessage(FacesContext.getCurrentInstance(),
"cancel_workflow_confirm");
return MessageFormat.format(confirmMsg,
new Object[] {this.parameters.get("workflow-instance-name")});
String workflowLabel = this.workflowInstance.definition.title;
if (this.workflowInstance.description != null && this.workflowInstance.description.length() > 0)
{
workflowLabel = workflowLabel + " (" + this.workflowInstance.description + ")";
}
return MessageFormat.format(confirmMsg, new Object[] {workflowLabel});
}
/**

View File

@@ -15,10 +15,6 @@ import javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.SearchParameters;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.service.cmr.workflow.WorkflowService;
import org.alfresco.service.namespace.NamespaceService;

View File

@@ -233,9 +233,31 @@ public class StartWorkflowWizard extends BaseWizardBean
return this.nextButtonDisabled;
}
@Override
public String getContainerTitle()
{
String wizTitle = null;
ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance());
String stepName = Application.getWizardManager().getCurrentStepName();
if ("choose-workflow".equals(stepName) == false && this.selectedWorkflow != null)
{
String titlePattern = bundle.getString("start_named_workflow_wizard");
WorkflowDefinition workflowDef = this.workflows.get(this.selectedWorkflow);
wizTitle = MessageFormat.format(titlePattern, new Object[] {workflowDef.title});
}
else
{
wizTitle = bundle.getString("start_workflow_wizard");
}
return wizTitle;
}
// ------------------------------------------------------------------------------
// Event Handlers
/**
* Prepares the dialog to allow the user to add an item to the workflow package
*

View File

@@ -260,7 +260,6 @@ public class WorkflowBean
// add the workflow instance id and name this taks belongs to
node.getProperties().put("workflowInstanceId", task.path.instance.id);
node.getProperties().put("workflowInstanceName", task.path.instance.definition.title);
}
return node;

View File

@@ -21,6 +21,7 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.repository.User;
import org.alfresco.web.ui.common.component.SelfRenderingComponent;
/**
@@ -305,27 +306,25 @@ public class UINodeWorkflowInfo extends SelfRenderingComponent
{
out.write("<li>");
out.write(wi.definition.title);
if (wi.definition.description != null && wi.definition.description.length() > 0)
if (wi.description != null && wi.description.length() > 0)
{
out.write(" (");
out.write(wi.definition.description);
out.write("&nbsp;(");
out.write(wi.description);
out.write(")");
}
out.write("&nbsp;");
out.write(" ");
if (wi.startDate != null)
{
out.write(bundle.getString("started_on").toLowerCase());
out.write("&nbsp;");
out.write(format.format(wi.startDate));
out.write("&nbsp;");
out.write(" ");
}
if (wi.initiator != null)
{
out.write(bundle.getString("by"));
out.write("&nbsp;");
String userName = (String)nodeService.getProperty(wi.initiator,
ContentModel.PROP_USERNAME);
out.write(userName);
out.write(User.getFullName(nodeService, wi.initiator));
out.write(".");
}
out.write("</li>");

View File

@@ -8,11 +8,10 @@ import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.el.ValueBinding;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.workflow.WorkflowInstance;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.repository.User;
import org.alfresco.web.ui.common.component.SelfRenderingComponent;
/**
@@ -87,20 +86,19 @@ public class UIWorkflowSummary extends SelfRenderingComponent
out.write(bundle.getString("title"));
out.write(":</td><td>");
out.write(wi.definition.title);
out.write("</td></tr><tr><td>");
out.write(bundle.getString("description"));
out.write(":</td><td>");
out.write(wi.definition.description);
if (wi.definition.description != null && wi.definition.description.length() > 0)
{
out.write("&nbsp;(");
out.write(wi.definition.description);
out.write(")");
}
out.write("</td></tr><tr><td>");
out.write(bundle.getString("initiated_by"));
out.write(":</td><td>");
if (wi.initiator != null)
{
NodeService nodeService = Repository.getServiceRegistry(
context).getNodeService();
String userName = (String)nodeService.getProperty(
wi.initiator, ContentModel.PROP_USERNAME);
out.write(userName);
out.write(User.getFullName(Repository.getServiceRegistry(
context).getNodeService(), wi.initiator));
}
out.write("</td></tr><tr><td>");
out.write(bundle.getString("started_on"));

View File

@@ -18,7 +18,6 @@
package org.alfresco.web.ui.repo.component.property;
import java.io.IOException;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
@@ -47,6 +46,7 @@ import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.DataDictionary;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.repository.User;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -704,12 +704,7 @@ public abstract class BaseAssociationEditor extends UIInput
if (ContentModel.TYPE_PERSON.equals(nodeService.getType(targetRef)))
{
//out.write((String)nodeService.getProperty(targetRef, ContentModel.PROP_USERNAME));
Map<QName, Serializable> props = nodeService.getProperties(targetRef);
String firstName = (String)props.get(ContentModel.PROP_FIRSTNAME);
String lastName = (String)props.get(ContentModel.PROP_LASTNAME);
String fullName = firstName + " " + (lastName != null ? lastName : "");
out.write(fullName);
out.write(User.getFullName(nodeService, targetRef));
}
else
{
@@ -832,17 +827,13 @@ public abstract class BaseAssociationEditor extends UIInput
// if the node represents a person, show the username instead of the name
if (ContentModel.TYPE_PERSON.equals(nodeService.getType(item)))
{
Map<QName, Serializable> props = nodeService.getProperties(item);
String userName = (String)props.get(ContentModel.PROP_USERNAME);
String userName = (String)nodeService.getProperty(item, ContentModel.PROP_USERNAME);
if (userName != null && (userName.equals(PermissionService.GUEST_AUTHORITY) == false))
{
out.write("<option value='");
out.write(item.getId());
out.write("'>");
String firstName = (String)props.get(ContentModel.PROP_FIRSTNAME);
String lastName = (String)props.get(ContentModel.PROP_LASTNAME);
String fullName = firstName + " " + (lastName != null ? lastName : "");
out.write(fullName);
out.write(User.getFullName(nodeService, item));
out.write("</option>");
}
}

View File

@@ -33,6 +33,7 @@ import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.repository.User;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -157,7 +158,7 @@ public class UIAssociationEditor extends BaseAssociationEditor
// if the node represents a person, show the username instead of the name
if (ContentModel.TYPE_PERSON.equals(nodeService.getType(targetNode)))
{
out.write((String)nodeService.getProperty(targetNode, ContentModel.PROP_USERNAME));
out.write(User.getFullName(nodeService, targetNode));
}
else
{

View File

@@ -33,6 +33,7 @@ import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.repository.User;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -157,7 +158,7 @@ public class UIChildAssociationEditor extends BaseAssociationEditor
// if the node represents a person, show the username instead of the name
if (ContentModel.TYPE_PERSON.equals(nodeService.getType(targetNode)))
{
out.write((String)nodeService.getProperty(targetNode, ContentModel.PROP_USERNAME));
out.write(User.getFullName(nodeService, targetNode));
}
else
{

View File

@@ -41,7 +41,7 @@
rendered="#{not empty DialogManager.bean.resources}">
<%-- Name column --%>
<a:column id="col1" primary="true" width="200" style="padding:2px; text-align:left">
<a:column id="col1" primary="true" width="200" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col1-sort" label="#{msg.name}" value="name" mode="case-insensitive" styleClass="header"/>
</f:facet>
@@ -54,7 +54,7 @@
</a:column>
<%-- Description column --%>
<a:column id="col2" style="text-align:left">
<a:column id="col2" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col2-sort" label="#{msg.description}" value="description" styleClass="header"/>
</f:facet>
@@ -62,7 +62,7 @@
</a:column>
<%-- Path column --%>
<a:column id="col3" style="text-align:left">
<a:column id="col3" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col3-sort" label="#{msg.path}" value="path" styleClass="header"/>
</f:facet>
@@ -71,7 +71,7 @@
</a:column>
<%-- Created Date column --%>
<a:column id="col4" style="text-align:left">
<a:column id="col4" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col4-sort" label="#{msg.created}" value="created" styleClass="header"/>
</f:facet>
@@ -81,7 +81,7 @@
</a:column>
<%-- Modified Date column --%>
<a:column id="col5" style="text-align:left">
<a:column id="col5" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col5-sort" label="#{msg.modified}" value="modified" styleClass="header"/>
</f:facet>
@@ -91,25 +91,13 @@
</a:column>
<%-- Actions column --%>
<a:column id="col6" actions="true" style="text-align:left">
<a:column id="col6" actions="true" style="padding:2px;text-align:left">
<f:facet name="header">
<h:outputText id="col6-txt" value="#{msg.actions}"/>
</f:facet>
<r:actions id="col6-actions" value="#{DialogManager.bean.packageItemActionGroup}"
context="#{r}" showLink="false" styleClass="inlineAction" />
</a:column>
<%-- Completed column --%>
<%--
<a:column style="text-align:left">
<f:facet name="header">
<h:outputText value="#{msg.completed}" />
</f:facet>
<a:actionLink value="#{r.completed}" actionListener="#{DialogManager.bean.togglePackageItemComplete}">
<f:param name="id" value="#{r.id}" />
</a:actionLink>
</a:column>
--%>
</a:richList>
<h:panelGrid id="package-actions-group" columns="1" styleClass="paddingRow">

View File

@@ -14,7 +14,7 @@
<%-- Primary column for details view mode --%>
<a:column id="col1" primary="true" width="200" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col1-sort" label="#{msg.title}" value="name" mode="case-insensitive" styleClass="header"/>
<a:sortLink id="col1-sort" label="#{msg.description}" value="name" mode="case-insensitive" styleClass="header"/>
</f:facet>
<f:facet name="small-icon">
<a:actionLink id="col1-act1" value="#{r['bpm:description']}" image="/images/icons/completed_workflow_task.gif" showLink="false"
@@ -28,67 +28,67 @@
</a:actionLink>
</a:column>
<%-- Task id column --%>
<%-- Task type --%>
<a:column id="col2" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col2-sort" label="#{msg.id}" value="bpm:taskId" styleClass="header"/>
<a:sortLink id="col2-sort" label="#{msg.type}" value="name" mode="case-insensitive" styleClass="header"/>
</f:facet>
<h:outputText id="col2-txt" value="#{r['bpm:taskId']}" />
<h:outputText id="col2-txt" value="#{r.name}" />
</a:column>
<%-- Task type --%>
<a:column id="col2a" style="padding:2px;text-align:left">
<%-- Task id column --%>
<a:column id="col3" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col2a-sort" label="#{msg.type}" value="name" mode="case-insensitive" styleClass="header"/>
<a:sortLink id="col3-sort" label="#{msg.id}" value="bpm:taskId" styleClass="header"/>
</f:facet>
<h:outputText id="col2a-txt" value="#{r.name}" />
<h:outputText id="col3-txt" value="#{r['bpm:taskId']}" />
</a:column>
<%-- Source column --%>
<a:column id="col3" style="padding:2px;text-align:left">
<a:column id="col4" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col3-sort" label="#{msg.source}" value="sourceSpaceName" styleClass="header"/>
<a:sortLink id="col4-sort" label="#{msg.source}" value="sourceSpaceName" styleClass="header"/>
</f:facet>
<a:actionLink id="col3-act1" value="#{r.sourceSpaceName}"
<a:actionLink id="col4-act1" value="#{r.sourceSpaceName}"
actionListener="#{BrowseBean.clickSpace}" action="browse">
<f:param name="id" value="#{r.sourceSpaceId}" />
</a:actionLink>
</a:column>
<%-- Created Date column --%>
<a:column id="col4" style="padding:2px;text-align:left">
<a:column id="col5" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col4-sort" label="#{msg.created}" value="created" styleClass="header"/>
<a:sortLink id="col5-sort" label="#{msg.created}" value="created" styleClass="header"/>
</f:facet>
<h:outputText id="col4-txt" value="#{r.created}">
<h:outputText id="col5-txt" value="#{r.created}">
<a:convertXMLDate type="both" pattern="#{msg.date_time_pattern}" />
</h:outputText>
</a:column>
<%-- Completed date column --%>
<a:column id="col5" style="padding:2px;text-align:left">
<a:column id="col6" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col5-sort" label="#{msg.completed_on}" value="bpm:completionDate" styleClass="header"/>
<a:sortLink id="col6-sort" label="#{msg.completed_on}" value="bpm:completionDate" styleClass="header"/>
</f:facet>
<h:outputText id="col5-txt" value="#{r['bpm:completionDate']}">
<h:outputText id="col6-txt" value="#{r['bpm:completionDate']}">
<a:convertXMLDate type="both" pattern="#{msg.date_pattern}" />
</h:outputText>
</a:column>
<%-- Outcome column --%>
<a:column id="col6" style="padding:2px;text-align:left">
<a:column id="col7" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col6-sort" label="#{msg.outcome}" value="outcome" styleClass="header"/>
<a:sortLink id="col7-sort" label="#{msg.outcome}" value="outcome" styleClass="header"/>
</f:facet>
<h:outputText id="col6-txt" value="#{r.outcome}" />
<h:outputText id="col7-txt" value="#{r.outcome}" />
</a:column>
<%-- Actions column --%>
<a:column id="col7" actions="true" style="padding:2px;text-align:left">
<a:column id="col8" actions="true" style="padding:2px;text-align:left">
<f:facet name="header">
<h:outputText id="col7-txt" value="#{msg.actions}"/>
<h:outputText id="col8-txt" value="#{msg.actions}"/>
</f:facet>
<r:actions id="col7-actions" value="dashlet_completed_actions" context="#{r}" showLink="false"
<r:actions id="col8-actions" value="dashlet_completed_actions" context="#{r}" showLink="false"
styleClass="inlineAction" />
</a:column>

View File

@@ -14,7 +14,7 @@
<%-- Primary column for details view mode --%>
<a:column id="col1" primary="true" width="200" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col1-sort" label="#{msg.title}" value="name" mode="case-insensitive" styleClass="header"/>
<a:sortLink id="col1-sort" label="#{msg.description}" value="name" mode="case-insensitive" styleClass="header"/>
</f:facet>
<f:facet name="small-icon">
<a:actionLink id="col1-act1" value="#{r['bpm:description']}" image="/images/icons/workflow_task.gif" showLink="false"
@@ -28,75 +28,75 @@
</a:actionLink>
</a:column>
<%-- Task id column --%>
<%-- Task type --%>
<a:column id="col2" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col2-sort" label="#{msg.id}" value="bpm:taskId" styleClass="header"/>
<a:sortLink id="col2-sort" label="#{msg.type}" value="name" mode="case-insensitive" styleClass="header"/>
</f:facet>
<h:outputText id="col2-txt" value="#{r['bpm:taskId']}" />
<h:outputText id="col2-txt" value="#{r.name}" />
</a:column>
<%-- Task type --%>
<a:column id="col2a" style="padding:2px;text-align:left">
<%-- Task id column --%>
<a:column id="col3" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col2a-sort" label="#{msg.type}" value="name" mode="case-insensitive" styleClass="header"/>
<a:sortLink id="col3-sort" label="#{msg.id}" value="bpm:taskId" styleClass="header"/>
</f:facet>
<h:outputText id="col2a-txt" value="#{r.name}" />
<h:outputText id="col3-txt" value="#{r['bpm:taskId']}" />
</a:column>
<%-- Source column --%>
<a:column id="col3" style="padding:2px;text-align:left">
<a:column id="col4" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col3-sort" label="#{msg.source}" value="sourceSpaceName" styleClass="header"/>
<a:sortLink id="col4-sort" label="#{msg.source}" value="sourceSpaceName" styleClass="header"/>
</f:facet>
<a:actionLink id="col3-act1" value="#{r.sourceSpaceName}"
<a:actionLink id="col4-act1" value="#{r.sourceSpaceName}"
actionListener="#{BrowseBean.clickSpace}" action="browse">
<f:param name="id" value="#{r.sourceSpaceId}" />
</a:actionLink>
</a:column>
<%-- Created Date column --%>
<a:column id="col4" style="padding:2px;text-align:left">
<a:column id="col5" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col4-sort" label="#{msg.created}" value="created" styleClass="header"/>
<a:sortLink id="col5-sort" label="#{msg.created}" value="created" styleClass="header"/>
</f:facet>
<h:outputText id="col4-txt" value="#{r.created}">
<h:outputText id="col5-txt" value="#{r.created}">
<a:convertXMLDate type="both" pattern="#{msg.date_time_pattern}" />
</h:outputText>
</a:column>
<%-- Due date column --%>
<a:column id="col5" style="padding:2px;text-align:left">
<a:column id="col6" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col5-sort" label="#{msg.due_date}" value="bpm:dueDate" styleClass="header"/>
<a:sortLink id="col6-sort" label="#{msg.due_date}" value="bpm:dueDate" styleClass="header"/>
</f:facet>
<h:outputText id="col5-txt" value="#{r['bpm:dueDate']}">
<h:outputText id="col6-txt" value="#{r['bpm:dueDate']}">
<a:convertXMLDate type="both" pattern="#{msg.date_pattern}" />
</h:outputText>
</a:column>
<%-- Status column --%>
<a:column id="col6" style="padding:2px;text-align:left">
<a:column id="col7" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col6-sort" label="#{msg.status}" value="bpm:status" styleClass="header"/>
<a:sortLink id="col7-sort" label="#{msg.status}" value="bpm:status" styleClass="header"/>
</f:facet>
<h:outputText id="col6-txt" value="#{r['bpm:status']}" />
<h:outputText id="col7-txt" value="#{r['bpm:status']}" />
</a:column>
<%-- Priority column --%>
<a:column id="col7" style="padding:2px;text-align:left">
<a:column id="col8" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col7-sort" label="#{msg.priority}" value="bpm:priority" styleClass="header"/>
<a:sortLink id="col8-sort" label="#{msg.priority}" value="bpm:priority" styleClass="header"/>
</f:facet>
<h:outputText id="col7-txt" value="#{r['bpm:priority']}" />
<h:outputText id="col8-txt" value="#{r['bpm:priority']}" />
</a:column>
<%-- Actions column --%>
<a:column id="col8" actions="true" style="padding:2px;text-align:left">
<a:column id="col9" actions="true" style="padding:2px;text-align:left">
<f:facet name="header">
<h:outputText id="col8-txt" value="#{msg.actions}"/>
<h:outputText id="col9-txt" value="#{msg.actions}"/>
</f:facet>
<r:actions id="col8-actions" value="dashlet_todo_actions" context="#{r}" showLink="false"
<r:actions id="col9-actions" value="dashlet_todo_actions" context="#{r}" showLink="false"
styleClass="inlineAction" />
</a:column>

View File

@@ -41,7 +41,7 @@
rendered="#{not empty DialogManager.bean.resources}">
<%-- Name column --%>
<a:column id="col1" primary="true" width="200" style="padding:2px; text-align:left">
<a:column id="col1" primary="true" width="200" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col1-sort" label="#{msg.name}" value="name" mode="case-insensitive" styleClass="header"/>
</f:facet>
@@ -54,7 +54,7 @@
</a:column>
<%-- Description column --%>
<a:column id="col2" style="text-align:left">
<a:column id="col2" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col2-sort" label="#{msg.description}" value="description" styleClass="header"/>
</f:facet>
@@ -62,7 +62,7 @@
</a:column>
<%-- Path column --%>
<a:column id="col3" style="text-align:left">
<a:column id="col3" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col3-sort" label="#{msg.path}" value="path" styleClass="header"/>
</f:facet>
@@ -71,7 +71,7 @@
</a:column>
<%-- Created Date column --%>
<a:column id="col4" style="text-align:left">
<a:column id="col4" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col4-sort" label="#{msg.created}" value="created" styleClass="header"/>
</f:facet>
@@ -81,7 +81,7 @@
</a:column>
<%-- Modified Date column --%>
<a:column id="col5" style="text-align:left">
<a:column id="col5" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col5-sort" label="#{msg.modified}" value="modified" styleClass="header"/>
</f:facet>

View File

@@ -52,6 +52,24 @@ function validateNumberRange(control, min, max, message, showMessage)
return result;
}
/**
* Ensures the value of the 'control' is a number.
*
* @return true if the value is a number
*/
function validateIsNumber(control, message, showMessage)
{
var result = true;
if (isNaN(control.value))
{
informUser(control, message, showMessage);
result = false;
}
return result;
}
/**
* Ensures the value of the 'control' has a string length more than 'min' and less than 'max'.
*