. Split the notion of a website project 'name' and the 'dns name'

- Website now support name, title, description like other nodes and an additional field for DNS name.
 - The DNS name has basic client-side validation (JavaScript regex) and server-side name mangling to ensure validity

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4266 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-10-31 15:23:33 +00:00
parent 1d3fc456e9
commit 70f0311af8
4 changed files with 52 additions and 5 deletions

View File

@@ -804,6 +804,8 @@ create_website_desc=This wizard helps you create a new web project space.
website_details=Web Project Details
create_website_step1_title=Step One - Web Project Details
create_website_step1_desc=Enter the information about the web project.
website_dnsname=DNS name
validation_invalid_dns_name=Invalid website DNS name, only alpha-numeric characters are accepted.
website_forms=Form Templates
create_website_step2_title=Step Two - Form Templates
create_website_step2_desc=Setup the forms you want to use in this project.

View File

@@ -64,6 +64,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
private static Log logger = LogFactory.getLog(CreateWebsiteWizard.class);
protected String dnsName;
protected String title;
protected String name;
protected String description;
@@ -85,6 +86,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
super.init(parameters);
this.name = null;
this.dnsName = null;
this.title = null;
this.description = null;
@@ -110,6 +112,8 @@ public class CreateWebsiteWizard extends BaseWizardBean
if (logger.isDebugEnabled())
logger.debug("Created website folder node with name: " + this.name);
String avmStore = DNSNameMangler.MakeDNSName(this.dnsName);
// apply the uifacets aspect - icon, title and description props
Map<QName, Serializable> uiFacetsProps = new HashMap<QName, Serializable>(4);
uiFacetsProps.put(ContentModel.PROP_ICON, AVMConstants.SPACE_ICON_WEBSITE);
@@ -149,11 +153,11 @@ public class CreateWebsiteWizard extends BaseWizardBean
// build the sandboxes now we have the manager list and complete user list
for (UserGroupRole userRole : invitedUserRoles)
{
createUserSandbox(this.name, managers, userRole.getAuthority(), userRole.getRole());
createUserSandbox(avmStore, managers, userRole.getAuthority(), userRole.getRole());
}
// create the AVM stores to represent the newly created location website
createStagingSandbox(this.name, managers);
createStagingSandbox(avmStore, managers);
// save the list of invited users against the store
for (UserGroupRole userRole : invitedUserRoles)
@@ -170,7 +174,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
}
// set the property on the node to reference the AVM store
this.nodeService.setProperty(nodeRef, ContentModel.PROP_AVMSTORE, DNSNameMangler.MakeDNSName(this.name));
this.nodeService.setProperty(nodeRef, ContentModel.PROP_AVMSTORE, avmStore);
// navigate to the Websites folder so we can see the newly created folder
this.navigator.setCurrentNodeId(websiteParentId);
@@ -212,6 +216,22 @@ public class CreateWebsiteWizard extends BaseWizardBean
this.name = name;
}
/**
* @return
*/
public String getDnsName()
{
return this.dnsName;
}
/**
* @param dnsName
*/
public void setDnsName(String dnsName)
{
this.dnsName = dnsName;
}
/**
* @return Returns the title.
*/

View File

@@ -907,7 +907,7 @@ public final class Utils
if (disabled == false)
{
Object readOnlyAttr = component.getAttributes().get("disabled");
Object readOnlyAttr = component.getAttributes().get("readonly");
if (readOnlyAttr != null)
{
readOnly = readOnlyAttr.equals(Boolean.TRUE);

View File

@@ -57,9 +57,16 @@
if (finishButtonPressed)
{
finishButtonPressed = false;
return validateName(document.getElementById("wizard:wizard-body:name"),
var valid = validateName(document.getElementById("wizard:wizard-body:name"),
'</f:verbatim><a:outputText value="#{msg.validation_invalid_character}" /><f:verbatim>',
true);
if (valid == true)
{
valid = validateRegex(document.getElementById("wizard:wizard-body:dnsname"),
"^[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$", true, null,
'</f:verbatim><a:outputText value="#{msg.validation_invalid_dns_name}" /><f:verbatim>', true);
}
return valid;
}
else
{
@@ -94,6 +101,24 @@
<f:verbatim>
</td>
</tr>
<tr>
<td align="middle">
</f:verbatim>
<h:graphicImage value="/images/icons/required_field.gif" alt="Required Field" />
<f:verbatim>
</td>
<td>
</f:verbatim>
<h:outputText value="#{msg.website_dnsname}:"/>
<f:verbatim>
</td>
<td width="85%">
</f:verbatim>
<h:inputText id="dnsname" value="#{WizardManager.bean.dnsName}" size="35" maxlength="64"
onkeyup="javascript:checkButtonState();" />
<f:verbatim>
</td>
</tr>
<tr>
<td></td>
<td>