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

@@ -1837,3 +1837,4 @@ create_project_desc=This wizard helps you create a new space for Project Collabo
create_project=Create Project
title_calendar=Project Calendar
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)
{
super.init(parameters);
this.createFrom = CREATEFROM_TEMPLATE;
setSpaceType(ApplicationModel.TYPE_PROJECTSPACE.toString());
setIcon("project");
}

View File

@@ -71,6 +71,10 @@ public class CreateSpaceWizard extends BaseWizardBean
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;
protected String createFrom;
@@ -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,11 +496,12 @@ 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()));
}

View File

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

View File

@@ -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 @@
<f:verbatim/>
<h:outputText value="#{msg.description}:"/>
<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>