Fix so that Project Space policy code is moved to emailserver:aliasable onAddAspect - fixes 2 bugs and allows creation of project from any Project template

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7876 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2008-01-08 19:16:24 +00:00
parent 9bd769e023
commit 99544b86fa
5 changed files with 34 additions and 15 deletions

View File

@@ -1836,4 +1836,5 @@ create_project_title=Create Project Collaboration Space
create_project_desc=This wizard helps you create a new space for Project Collaboration create_project_desc=This wizard helps you create a new space for Project Collaboration
create_project=Create Project create_project=Create Project
title_calendar=Project Calendar title_calendar=Project Calendar
calendar_info=This view allows you to view and edit Calendar entries. calendar_info=This view allows you to view and edit Calendar entries.
select_project_template=Select Project Template

View File

@@ -50,6 +50,7 @@ public class CreateProjectDialog extends CreateSpaceWizard
public void init(Map<String, String> parameters) public void init(Map<String, String> parameters)
{ {
super.init(parameters); super.init(parameters);
this.createFrom = CREATEFROM_TEMPLATE;
setSpaceType(ApplicationModel.TYPE_PROJECTSPACE.toString()); setSpaceType(ApplicationModel.TYPE_PROJECTSPACE.toString());
setIcon("project"); setIcon("project");
} }

View File

@@ -70,6 +70,10 @@ public class CreateSpaceWizard extends BaseWizardBean
public static final String DEFAULT_SPACE_TYPE_ICON_PATH = "/images/icons/space.gif"; public static final String DEFAULT_SPACE_TYPE_ICON_PATH = "/images/icons/space.gif";
private static Log logger = LogFactory.getLog(CreateSpaceWizard.class); private static Log logger = LogFactory.getLog(CreateSpaceWizard.class);
protected static final String CREATEFROM_TEMPLATE = "template";
protected static final String CREATEFROM_EXISTING = "existing";
protected static final String CREATEFROM_SCRATCH = "scratch";
protected String spaceType; protected String spaceType;
protected String icon; protected String icon;
@@ -107,7 +111,7 @@ public class CreateSpaceWizard extends BaseWizardBean
} }
// reset all variables // reset all variables
this.createFrom = "scratch"; this.createFrom = CREATEFROM_SCRATCH;
this.spaceType = ContentModel.TYPE_FOLDER.toString(); this.spaceType = ContentModel.TYPE_FOLDER.toString();
this.icon = null; this.icon = null;
this.copyPolicy = "contents"; this.copyPolicy = "contents";
@@ -125,11 +129,11 @@ public class CreateSpaceWizard extends BaseWizardBean
// if the user has chosen to create the space from an existing // if the user has chosen to create the space from an existing
// space or from a template we need to find it's type to show // space or from a template we need to find it's type to show
// the current set of icons. // the current set of icons.
if (this.createFrom.equals("existing") && this.existingSpaceId != null) if (this.createFrom.equals(CREATEFROM_EXISTING) && this.existingSpaceId != null)
{ {
this.spaceType = this.nodeService.getType(this.existingSpaceId).toString(); this.spaceType = this.nodeService.getType(this.existingSpaceId).toString();
} }
else if (this.createFrom.equals("template") && this.templateSpaceId != null) else if (this.createFrom.equals(CREATEFROM_TEMPLATE) && this.templateSpaceId != null)
{ {
NodeRef templateNode = new NodeRef(Repository.getStoreRef(), this.templateSpaceId); NodeRef templateNode = new NodeRef(Repository.getStoreRef(), this.templateSpaceId);
this.spaceType = this.nodeService.getType(templateNode).toString(); this.spaceType = this.nodeService.getType(templateNode).toString();
@@ -143,7 +147,7 @@ public class CreateSpaceWizard extends BaseWizardBean
{ {
String newSpaceId = null; String newSpaceId = null;
if (this.createFrom.equals("scratch")) if (this.createFrom.equals(CREATEFROM_SCRATCH))
{ {
// create the space (just create a folder for now) // create the space (just create a folder for now)
NodeRef parentNodeRef; NodeRef parentNodeRef;
@@ -180,7 +184,7 @@ public class CreateSpaceWizard extends BaseWizardBean
// remember the created node // remember the created node
this.createdNode = nodeRef; this.createdNode = nodeRef;
} }
else if (this.createFrom.equals("existing")) else if (this.createFrom.equals(CREATEFROM_EXISTING))
{ {
// copy the selected space and update the name, description and icon // copy the selected space and update the name, description and icon
NodeRef sourceNode = this.existingSpaceId; NodeRef sourceNode = this.existingSpaceId;
@@ -202,7 +206,7 @@ public class CreateSpaceWizard extends BaseWizardBean
// remember the created node // remember the created node
this.createdNode = copiedNode; this.createdNode = copiedNode;
} }
else if (this.createFrom.equals("template")) else if (this.createFrom.equals(CREATEFROM_TEMPLATE))
{ {
// copy the selected space and update the name, description and icon // copy the selected space and update the name, description and icon
NodeRef sourceNode = new NodeRef(Repository.getStoreRef(), this.templateSpaceId); NodeRef sourceNode = new NodeRef(Repository.getStoreRef(), this.templateSpaceId);
@@ -442,15 +446,15 @@ public class CreateSpaceWizard extends BaseWizardBean
String summaryCreateType = null; String summaryCreateType = null;
ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance()); ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance());
if (this.createFrom.equals("scratch")) if (this.createFrom.equals(CREATEFROM_SCRATCH))
{ {
summaryCreateType = bundle.getString("scratch"); summaryCreateType = bundle.getString(CREATEFROM_SCRATCH);
} }
else if (this.createFrom.equals("existing")) else if (this.createFrom.equals(CREATEFROM_EXISTING))
{ {
summaryCreateType = bundle.getString("an_existing_space"); summaryCreateType = bundle.getString("an_existing_space");
} }
else if (this.createFrom.equals("template")) else if (this.createFrom.equals(CREATEFROM_TEMPLATE))
{ {
summaryCreateType = bundle.getString("a_template"); summaryCreateType = bundle.getString("a_template");
} }
@@ -492,16 +496,17 @@ public class CreateSpaceWizard extends BaseWizardBean
if (results.size() != 0) if (results.size() != 0)
{ {
// show templates of the type relating to the space we are creating
QName spaceType = QName.createQName(this.spaceType);
for (NodeRef assocRef : results) for (NodeRef assocRef : results)
{ {
Node childNode = new Node(assocRef); Node childNode = new Node(assocRef);
if (this.dictionaryService.isSubClass(childNode.getType(), ContentModel.TYPE_FOLDER) && if (this.dictionaryService.isSubClass(childNode.getType(), spaceType))
!this.dictionaryService.isSubClass(childNode.getType(), ApplicationModel.TYPE_PROJECTSPACE))
{ {
this.templates.add(new SelectItem(childNode.getId(), childNode.getName())); this.templates.add(new SelectItem(childNode.getId(), childNode.getName()));
} }
} }
// make sure the list is sorted by the label // make sure the list is sorted by the label
QuickSort sorter = new QuickSort(this.templates, "label", true, IDataContainer.SORT_CASEINSENSITIVE); QuickSort sorter = new QuickSort(this.templates, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
sorter.sort(); sorter.sort();

View File

@@ -5247,6 +5247,10 @@
<property-name>namespaceService</property-name> <property-name>namespaceService</property-name>
<value>#{NamespaceService}</value> <value>#{NamespaceService}</value>
</managed-property> </managed-property>
<managed-property>
<property-name>dictionaryService</property-name>
<value>#{DictionaryService}</value>
</managed-property>
</managed-bean> </managed-bean>
<managed-bean> <managed-bean>

View File

@@ -48,7 +48,8 @@
function checkButtonState() function checkButtonState()
{ {
if (document.getElementById("dialog:dialog-body:name").value.length == 0) if (document.getElementById("dialog:dialog-body:name").value.length == 0 ||
document.getElementById("dialog:dialog-body:template-space-id").selectedIndex == 0)
{ {
document.getElementById("dialog:finish-button").disabled = true; document.getElementById("dialog:finish-button").disabled = true;
} }
@@ -92,4 +93,11 @@
<f:verbatim/> <f:verbatim/>
<h:outputText value="#{msg.description}:"/> <h:outputText value="#{msg.description}:"/>
<h:inputText id="description" value="#{DialogManager.bean.description}" size="35" maxlength="1024" /> <h:inputText id="description" value="#{DialogManager.bean.description}" size="35" maxlength="1024" />
<h:graphicImage value="/images/icons/required_field.gif" alt="#{msg.required_field}" />
<h:outputText value="#{msg.select_project_template}:"/>
<h:selectOneMenu id="template-space-id" value="#{DialogManager.bean.templateSpaceId}"
onchange="javascript:checkButtonState();">
<f:selectItems value="#{DialogManager.bean.templateSpaces}" />
</h:selectOneMenu>
</h:panelGrid> </h:panelGrid>