diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index fa905d7070..6bd3fa5a7b 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -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=Create Project title_calendar=Project Calendar -calendar_info=This view allows you to view and edit Calendar entries. \ No newline at end of file +calendar_info=This view allows you to view and edit Calendar entries. +select_project_template=Select Project Template \ No newline at end of file diff --git a/source/java/org/alfresco/web/bean/projects/CreateProjectDialog.java b/source/java/org/alfresco/web/bean/projects/CreateProjectDialog.java index 8f233145e5..5562569f15 100644 --- a/source/java/org/alfresco/web/bean/projects/CreateProjectDialog.java +++ b/source/java/org/alfresco/web/bean/projects/CreateProjectDialog.java @@ -50,6 +50,7 @@ public class CreateProjectDialog extends CreateSpaceWizard public void init(Map parameters) { super.init(parameters); + this.createFrom = CREATEFROM_TEMPLATE; setSpaceType(ApplicationModel.TYPE_PROJECTSPACE.toString()); setIcon("project"); } diff --git a/source/java/org/alfresco/web/bean/spaces/CreateSpaceWizard.java b/source/java/org/alfresco/web/bean/spaces/CreateSpaceWizard.java index ea7c73a7ee..1f7c80624b 100644 --- a/source/java/org/alfresco/web/bean/spaces/CreateSpaceWizard.java +++ b/source/java/org/alfresco/web/bean/spaces/CreateSpaceWizard.java @@ -70,6 +70,10 @@ public class CreateSpaceWizard extends BaseWizardBean public static final String DEFAULT_SPACE_TYPE_ICON_PATH = "/images/icons/space.gif"; 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 icon; @@ -107,7 +111,7 @@ public class CreateSpaceWizard extends BaseWizardBean } // reset all variables - this.createFrom = "scratch"; + this.createFrom = CREATEFROM_SCRATCH; this.spaceType = ContentModel.TYPE_FOLDER.toString(); this.icon = null; this.copyPolicy = "contents"; @@ -125,11 +129,11 @@ public class CreateSpaceWizard extends BaseWizardBean // 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 // 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(); } - 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); this.spaceType = this.nodeService.getType(templateNode).toString(); @@ -143,7 +147,7 @@ public class CreateSpaceWizard extends BaseWizardBean { String newSpaceId = null; - if (this.createFrom.equals("scratch")) + if (this.createFrom.equals(CREATEFROM_SCRATCH)) { // create the space (just create a folder for now) NodeRef parentNodeRef; @@ -180,7 +184,7 @@ public class CreateSpaceWizard extends BaseWizardBean // remember the created node 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 NodeRef sourceNode = this.existingSpaceId; @@ -202,7 +206,7 @@ public class CreateSpaceWizard extends BaseWizardBean // remember the created node 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 NodeRef sourceNode = new NodeRef(Repository.getStoreRef(), this.templateSpaceId); @@ -442,15 +446,15 @@ public class CreateSpaceWizard extends BaseWizardBean String summaryCreateType = null; 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"); } - else if (this.createFrom.equals("template")) + else if (this.createFrom.equals(CREATEFROM_TEMPLATE)) { summaryCreateType = bundle.getString("a_template"); } @@ -492,16 +496,17 @@ public class CreateSpaceWizard extends BaseWizardBean 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) { Node childNode = new Node(assocRef); - if (this.dictionaryService.isSubClass(childNode.getType(), ContentModel.TYPE_FOLDER) && - !this.dictionaryService.isSubClass(childNode.getType(), ApplicationModel.TYPE_PROJECTSPACE)) + if (this.dictionaryService.isSubClass(childNode.getType(), spaceType)) { this.templates.add(new SelectItem(childNode.getId(), childNode.getName())); } } - + // make sure the list is sorted by the label QuickSort sorter = new QuickSort(this.templates, "label", true, IDataContainer.SORT_CASEINSENSITIVE); sorter.sort(); diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml index 3c0df3d285..a8682cf592 100644 --- a/source/web/WEB-INF/faces-config-beans.xml +++ b/source/web/WEB-INF/faces-config-beans.xml @@ -5247,6 +5247,10 @@ namespaceService #{NamespaceService} + + dictionaryService + #{DictionaryService} + diff --git a/source/web/jsp/projects/create-project-details.jsp b/source/web/jsp/projects/create-project-details.jsp index af4def1aab..0b932f7b5d 100644 --- a/source/web/jsp/projects/create-project-details.jsp +++ b/source/web/jsp/projects/create-project-details.jsp @@ -48,7 +48,8 @@ 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; } @@ -92,4 +93,11 @@ + + + + + + \ No newline at end of file