mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
. More progress on Define Web Content Forms dialog
- ad-hoc workflow selection screen (as per new wireframes) - fixed selection bug on Form Details screen (and in UISelectList component) . Invite Users step of Create Web Project wizard now has email notification as optional . Fixed issue to restrict the selection of the same authority only allowed once in the Invite Users step git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4296 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -64,6 +64,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
public class CreateWebsiteWizard extends BaseWizardBean
|
||||
{
|
||||
private static final String COMPONENT_FORMLIST = "form-list";
|
||||
private static final String COMPONENT_WORKFLOWLIST = "workflow-list";
|
||||
private static final String MSG_DESCRIPTION = "description";
|
||||
private static final String MSG_NAME = "name";
|
||||
private static final String MSG_USERROLES = "create_website_summary_users";
|
||||
@@ -90,12 +91,21 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
/** transient list of form UIListItem objects */
|
||||
private List<UIListItem> formsList = null;
|
||||
|
||||
/** list of forms wrapper objects */
|
||||
/** list of form wrapper objects */
|
||||
private List<FormWrapper> forms = null;
|
||||
|
||||
/** Current form action dialog context */
|
||||
private FormWrapper actionForm = null;
|
||||
|
||||
/** datamodel for table of selected workflows */
|
||||
private DataModel workflowsDataModel = null;
|
||||
|
||||
/** transient list of workflow UIListItem objects */
|
||||
private List<UIListItem> workflowsList = null;
|
||||
|
||||
/** list of workflow wrapper objects */
|
||||
private List<WorkflowWrapper> workflows = null;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Wizard implementation
|
||||
@@ -113,6 +123,8 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
this.description = null;
|
||||
this.formsDataModel = null;
|
||||
this.forms = new ArrayList<FormWrapper>(8);
|
||||
this.workflowsDataModel = null;
|
||||
this.workflows = new ArrayList<WorkflowWrapper>(4);
|
||||
|
||||
// init the dependant bean we are using for the invite users pages
|
||||
InviteWebsiteUsersWizard wiz = getInviteUsersWizard();
|
||||
@@ -208,6 +220,10 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
return outcome;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Service setters
|
||||
|
||||
/**
|
||||
* @param avmService The AVMService to set.
|
||||
*/
|
||||
@@ -224,6 +240,10 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
this.permissionService = permissionService;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Bean getters and setters
|
||||
|
||||
/**
|
||||
* @return Returns the name.
|
||||
*/
|
||||
@@ -239,26 +259,9 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public DataModel getFormsDataModel()
|
||||
{
|
||||
if (this.formsDataModel == null)
|
||||
{
|
||||
this.formsDataModel = new ListDataModel();
|
||||
}
|
||||
|
||||
this.formsDataModel.setWrappedData(this.forms);
|
||||
|
||||
return this.formsDataModel;
|
||||
}
|
||||
|
||||
public void setFormsDataModel(DataModel formsDataModel)
|
||||
{
|
||||
this.formsDataModel = formsDataModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @return DNS name
|
||||
*/
|
||||
public String getDnsName()
|
||||
{
|
||||
@@ -266,7 +269,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dnsName
|
||||
* @param DNS name
|
||||
*/
|
||||
public void setDnsName(String dnsName)
|
||||
{
|
||||
@@ -340,8 +343,35 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
new String[] {this.name, this.description, buf.toString()});
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Define Web Content Workflows page
|
||||
|
||||
/**
|
||||
* @return List of UI items to represent the available Forms for all websites
|
||||
* @return JSF data model for the Form templates
|
||||
*/
|
||||
public DataModel getFormsDataModel()
|
||||
{
|
||||
if (this.formsDataModel == null)
|
||||
{
|
||||
this.formsDataModel = new ListDataModel();
|
||||
}
|
||||
|
||||
this.formsDataModel.setWrappedData(this.forms);
|
||||
|
||||
return this.formsDataModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param formsDataModel JSF data model for the Form templates
|
||||
*/
|
||||
public void setFormsDataModel(DataModel formsDataModel)
|
||||
{
|
||||
this.formsDataModel = formsDataModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return List of UI items to represent the available Workflows for all websites
|
||||
*/
|
||||
public List<UIListItem> getFormsList()
|
||||
{
|
||||
@@ -410,7 +440,83 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
{
|
||||
this.actionForm = actionForm;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Specify Settings (ah-hoc Workflows) page
|
||||
|
||||
/**
|
||||
* @return JSF data model for the Workflow templates
|
||||
*/
|
||||
public DataModel getWorkflowsDataModel()
|
||||
{
|
||||
if (this.workflowsDataModel == null)
|
||||
{
|
||||
this.workflowsDataModel = new ListDataModel();
|
||||
}
|
||||
|
||||
this.workflowsDataModel.setWrappedData(this.workflows);
|
||||
|
||||
return this.workflowsDataModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param workflowsDataModel JSF data model for the Workflow templates
|
||||
*/
|
||||
public void setWorkflowsDataModel(DataModel workflowsDataModel)
|
||||
{
|
||||
this.workflowsDataModel = workflowsDataModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return List of UI items to represent the available Workflows for all websites
|
||||
*/
|
||||
public List<UIListItem> getWorkflowsList()
|
||||
{
|
||||
List<UIListItem> items = new ArrayList<UIListItem>();
|
||||
|
||||
// TODO: add list of workflows from config
|
||||
UIListItem item = new UIListItem();
|
||||
item.setValue("default");
|
||||
item.setLabel("Default");
|
||||
item.setDescription("Default adhoc workflow");
|
||||
item.setImage(WebResources.IMAGE_WORKFLOW_32);
|
||||
items.add(item);
|
||||
|
||||
this.workflowsList = items;
|
||||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Action handler called when the Add to List button is pressed for a workflow
|
||||
*/
|
||||
public void addWorkflow(ActionEvent event)
|
||||
{
|
||||
UISelectList selectList = (UISelectList)event.getComponent().findComponent(COMPONENT_WORKFLOWLIST);
|
||||
int index = selectList.getRowIndex();
|
||||
if (index != -1)
|
||||
{
|
||||
String workflow = (String)this.workflowsList.get(index).getValue();
|
||||
this.workflows.add(new WorkflowWrapper(workflow, null));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a workflow from the selected list
|
||||
*/
|
||||
public void removeWorkflow(ActionEvent event)
|
||||
{
|
||||
WorkflowWrapper wrapper = (WorkflowWrapper)this.workflowsDataModel.getRowData();
|
||||
if (wrapper != null)
|
||||
{
|
||||
this.workflows.remove(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Invite users page
|
||||
|
||||
/**
|
||||
* @return the InviteWebsiteUsersWizard delegate bean
|
||||
*/
|
||||
@@ -420,6 +526,10 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
FacesContext.getCurrentInstance(), "InviteWebsiteUsersWizard");
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Helper methods
|
||||
|
||||
/**
|
||||
* Helper to get the ID of the 'Websites' system folder
|
||||
*
|
||||
@@ -670,8 +780,11 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Inner classes
|
||||
|
||||
/**
|
||||
* Wrapper class for a configurable template Form instance in the UI
|
||||
* Wrapper class for a configurable template Form instance
|
||||
*/
|
||||
public static class FormWrapper
|
||||
{
|
||||
@@ -779,6 +892,9 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class to represent a single configured Presentation Template instance
|
||||
*/
|
||||
public static class PresentationTemplate
|
||||
{
|
||||
private RenderingEngine engine;
|
||||
@@ -835,4 +951,43 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
this.filenamePattern = filenamePattern;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class to represent a single configured Workflow instance
|
||||
*/
|
||||
public static class WorkflowWrapper
|
||||
{
|
||||
private String name;
|
||||
private String filenamePattern;
|
||||
|
||||
public WorkflowWrapper(String name, String filenamePattern)
|
||||
{
|
||||
this.name = name;
|
||||
this.filenamePattern = filenamePattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the name of the workflow.
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the filename pattern.
|
||||
*/
|
||||
public String getFilenamePattern()
|
||||
{
|
||||
return this.filenamePattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param filenamePattern The filename pattern to set.
|
||||
*/
|
||||
public void setFilenamePattern(String filenamePattern)
|
||||
{
|
||||
this.filenamePattern = filenamePattern;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -21,13 +21,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.event.ActionEvent;
|
||||
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.web.bean.TemplateSupportBean;
|
||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.bean.wcm.CreateWebsiteWizard.FormWrapper;
|
||||
import org.alfresco.web.ui.common.component.UIListItem;
|
||||
import org.alfresco.web.ui.wcm.WebResources;
|
||||
@@ -35,6 +31,9 @@ import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Backing bean for the Website Project Form Details dialog.
|
||||
* Launched from the Form Details button on the Define Web Content Forms page.
|
||||
*
|
||||
* @author Kevin Roast
|
||||
*/
|
||||
public class FormDetailsDialog extends BaseDialogBean
|
||||
@@ -47,7 +46,7 @@ public class FormDetailsDialog extends BaseDialogBean
|
||||
private String title;
|
||||
private String description;
|
||||
private String filenamePattern;
|
||||
private String[] workflowSelectedValue = {"default"};
|
||||
private String[] workflowSelectedValue;
|
||||
|
||||
|
||||
/**
|
||||
@@ -59,6 +58,8 @@ public class FormDetailsDialog extends BaseDialogBean
|
||||
super.init(parameters);
|
||||
this.title = null;
|
||||
this.description = null;
|
||||
this.filenamePattern = null;
|
||||
this.workflowSelectedValue = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,6 +151,14 @@ public class FormDetailsDialog extends BaseDialogBean
|
||||
*/
|
||||
public String[] getWorkflowSelectedValue()
|
||||
{
|
||||
if (this.workflowSelectedValue == null)
|
||||
{
|
||||
String workflow = getActionForm().getWorkflow();
|
||||
if (workflow != null)
|
||||
{
|
||||
this.workflowSelectedValue = new String[] {workflow};
|
||||
}
|
||||
}
|
||||
return this.workflowSelectedValue;
|
||||
}
|
||||
|
||||
@@ -168,6 +177,7 @@ public class FormDetailsDialog extends BaseDialogBean
|
||||
{
|
||||
List<UIListItem> items = new ArrayList<UIListItem>();
|
||||
|
||||
// TODO: add list of workflows from config
|
||||
UIListItem item = new UIListItem();
|
||||
item.setValue("default");
|
||||
item.setLabel("Default");
|
||||
|
@@ -29,15 +29,18 @@ import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
import org.alfresco.web.bean.wcm.CreateWebsiteWizard.FormWrapper;
|
||||
import org.alfresco.web.bean.wcm.CreateWebsiteWizard.PresentationTemplate;
|
||||
import org.alfresco.web.forms.Form;
|
||||
import org.alfresco.web.forms.RenderingEngine;
|
||||
import org.alfresco.web.ui.common.component.UIListItem;
|
||||
import org.alfresco.web.ui.common.component.UISelectList;
|
||||
import org.alfresco.web.ui.wcm.WebResources;
|
||||
import org.alfresco.web.forms.Form;
|
||||
import org.alfresco.web.forms.RenderingEngine;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Backing bean for the Website Project Form Templates dialog.
|
||||
* Launched from the Select Templates button on the Define Web Content Forms page.
|
||||
*
|
||||
* @author Kevin Roast
|
||||
*/
|
||||
public class FormTemplatesDialog extends BaseDialogBean
|
||||
@@ -94,6 +97,9 @@ public class FormTemplatesDialog extends BaseDialogBean
|
||||
return this.websiteWizard.getActionForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JSF data model wrapping the templates selected by the user
|
||||
*/
|
||||
public DataModel getTemplatesDataModel()
|
||||
{
|
||||
if (this.templatesDataModel == null)
|
||||
@@ -106,6 +112,9 @@ public class FormTemplatesDialog extends BaseDialogBean
|
||||
return this.templatesDataModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param templatesDataModel JSF data model wrapping the templates
|
||||
*/
|
||||
public void setTemplatesDataModel(DataModel templatesDataModel)
|
||||
{
|
||||
this.templatesDataModel = templatesDataModel;
|
||||
|
@@ -25,6 +25,18 @@ public class InviteWebsiteUsersWizard extends InviteUsersWizard
|
||||
|
||||
private Node website;
|
||||
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.bean.wizard.InviteUsersWizard#init()
|
||||
*/
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
super.init();
|
||||
// only allow one selection per authority
|
||||
allowDuplicateAuthorities = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#getWizardDescription()
|
||||
*/
|
||||
|
@@ -94,6 +94,9 @@ public abstract class InviteUsersWizard extends AbstractWizardBean
|
||||
/** list of user/group role wrapper objects */
|
||||
private List<UserGroupRole> userGroupRoles = null;
|
||||
|
||||
/** True to allow duplicate authorities (with a different role) */
|
||||
protected boolean allowDuplicateAuthorities = true;
|
||||
|
||||
/** dialog state */
|
||||
private String notify = NOTIFY_YES;
|
||||
|
||||
@@ -387,7 +390,7 @@ public abstract class InviteUsersWizard extends AbstractWizardBean
|
||||
{
|
||||
UserGroupRole wrapper = this.userGroupRoles.get(n);
|
||||
if (authority.equals(wrapper.getAuthority()) &&
|
||||
role.equals(wrapper.getRole()))
|
||||
(!this.allowDuplicateAuthorities || role.equals(wrapper.getRole())))
|
||||
{
|
||||
foundExisting = true;
|
||||
break;
|
||||
|
@@ -441,17 +441,20 @@ public class UISelectList extends UIInput implements NamingContainer
|
||||
*/
|
||||
public void setRowIndex(int rowIndex)
|
||||
{
|
||||
this.rowIndex = rowIndex;
|
||||
for (Iterator itr=getChildren().iterator(); itr.hasNext(); /**/)
|
||||
if (isActiveSelect())
|
||||
{
|
||||
UIComponent child = (UIComponent)itr.next();
|
||||
if (child instanceof UIListItem == false && child instanceof UIListItems == false)
|
||||
this.rowIndex = rowIndex;
|
||||
for (Iterator itr=getChildren().iterator(); itr.hasNext(); /**/)
|
||||
{
|
||||
// forces a reset of the clientId for the component
|
||||
// This is then regenerated - relative to this naming container which itself uses the
|
||||
// current row index as part of the Id. This is what facilities the correct component
|
||||
// rendering submit script and then identified during the decode() phase.
|
||||
child.setId(child.getId());
|
||||
UIComponent child = (UIComponent)itr.next();
|
||||
if (child instanceof UIListItem == false && child instanceof UIListItems == false)
|
||||
{
|
||||
// forces a reset of the clientId for the component
|
||||
// This is then regenerated - relative to this naming container which itself uses the
|
||||
// current row index as part of the Id. This is what facilities the correct component
|
||||
// rendering submit script and then identified during the decode() phase.
|
||||
child.setId(child.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user