mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
. Delete Website implemented
- removes staging store, preview stores and associated user stores before removing the website node itself . Content Reviewer permissions definition fix . Useful summary page info added to Create Website wizard git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4019 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -803,6 +803,12 @@ website_notify=Email Users
|
||||
create_website_step3_title=Step Three - Notify Users
|
||||
create_website_step3_desc=Notify the invited users.
|
||||
create_website_finish_instruction=To close this wizard and create your website space click Finish. To review or change your selections click Back.
|
||||
create_website_summary_users=Users and Roles
|
||||
|
||||
# Delete Website Dialog messages
|
||||
delete_website=Delete Website
|
||||
delete_website_info=To remove this website and all associated user sandboxes, click OK.
|
||||
delete_website_confirm=Are you sure you want to delete the website \"{0}\" and all associated user sandboxes?
|
||||
|
||||
# Browse Website and Sandboxes messages
|
||||
title_browse_website=Browse Website
|
||||
|
@@ -179,4 +179,12 @@
|
||||
description-id="delete_post_info" />
|
||||
</dialogs>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="app:webfolder">
|
||||
<dialogs>
|
||||
<dialog name="deleteSpace" page="/jsp/dialog/delete.jsp" managed-bean="DeleteWebsiteDialog"
|
||||
icon="/images/icons/delete_website_large.gif" title-id="delete_website"
|
||||
description-id="delete_website_info" />
|
||||
</dialogs>
|
||||
</config>
|
||||
</alfresco-config>
|
||||
|
@@ -33,6 +33,7 @@ import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.model.FileInfo;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.GUID;
|
||||
@@ -51,6 +52,10 @@ import org.apache.commons.logging.LogFactory;
|
||||
*/
|
||||
public class CreateWebsiteWizard extends BaseWizardBean
|
||||
{
|
||||
private static final String MSG_DESCRIPTION = "description";
|
||||
private static final String MSG_NAME = "name";
|
||||
private static final String MSG_USERROLES = "create_website_summary_users";
|
||||
|
||||
private static final String ROLE_CONTENT_MANAGER = "ContentManager";
|
||||
|
||||
private static Log logger = LogFactory.getLog(CreateWebsiteWizard.class);
|
||||
@@ -79,8 +84,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
this.description = null;
|
||||
|
||||
// init the dependant bean we are using for the invite users pages
|
||||
InviteWebsiteUsersWizard wiz = (InviteWebsiteUsersWizard)FacesHelper.getManagedBean(
|
||||
FacesContext.getCurrentInstance(), "InviteWebsiteUsersWizard");
|
||||
InviteWebsiteUsersWizard wiz = getInviteUsersWizard();
|
||||
wiz.init();
|
||||
}
|
||||
|
||||
@@ -108,9 +112,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
uiFacetsProps.put(ContentModel.PROP_DESCRIPTION, this.description);
|
||||
this.nodeService.addAspect(nodeRef, ContentModel.ASPECT_UIFACETS, uiFacetsProps);
|
||||
|
||||
// invite users with appropriate permissions into this folder
|
||||
InviteWebsiteUsersWizard wiz = (InviteWebsiteUsersWizard)FacesHelper.getManagedBean(
|
||||
FacesContext.getCurrentInstance(), "InviteWebsiteUsersWizard");
|
||||
InviteWebsiteUsersWizard wiz = getInviteUsersWizard();
|
||||
wiz.setNode(new Node(nodeRef));
|
||||
outcome = wiz.finish();
|
||||
if (outcome != null)
|
||||
@@ -222,14 +224,45 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
*/
|
||||
public String getSummary()
|
||||
{
|
||||
ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance());
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
ResourceBundle bundle = Application.getBundle(fc);
|
||||
|
||||
return buildSummary(
|
||||
new String[] {bundle.getString("name"),
|
||||
bundle.getString("description")},
|
||||
new String[] {this.name, this.description});
|
||||
// build a summary section to list the invited users and there roles
|
||||
StringBuilder buf = new StringBuilder(128);
|
||||
List<UserGroupRole> invitedUserRoles =
|
||||
(List<UserGroupRole>)getInviteUsersWizard().getUserRolesDataModel().getWrappedData();
|
||||
String currentUser = Application.getCurrentUser(fc).getUserName();
|
||||
boolean foundCurrentUser = false;
|
||||
for (UserGroupRole userRole : invitedUserRoles)
|
||||
{
|
||||
if (currentUser.equals(userRole.getAuthority()))
|
||||
{
|
||||
foundCurrentUser = true;
|
||||
}
|
||||
buf.append(userRole.getLabel());
|
||||
buf.append("<br>");
|
||||
}
|
||||
if (foundCurrentUser == false)
|
||||
{
|
||||
buf.append(getInviteUsersWizard().buildLabelForUserAuthorityRole(currentUser, ROLE_CONTENT_MANAGER));
|
||||
}
|
||||
|
||||
return buildSummary(
|
||||
new String[] {bundle.getString(MSG_NAME),
|
||||
bundle.getString(MSG_DESCRIPTION),
|
||||
bundle.getString(MSG_USERROLES)},
|
||||
new String[] {this.name, this.description, buf.toString()});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the InviteWebsiteUsersWizard delegate bean
|
||||
*/
|
||||
private InviteWebsiteUsersWizard getInviteUsersWizard()
|
||||
{
|
||||
return (InviteWebsiteUsersWizard)FacesHelper.getManagedBean(
|
||||
FacesContext.getCurrentInstance(), "InviteWebsiteUsersWizard");
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to get the ID of the 'Websites' system folder
|
||||
@@ -286,11 +319,11 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
|
||||
// create the system directories 'appBase' and 'avm_webapps'
|
||||
String path = stagingStore + ":/";
|
||||
//this.avmService.createDirectory(path, AVMConstants.DIR_APPBASE);
|
||||
this.fileFolderService.create(AVMNodeConverter.ToNodeRef(-1, path), AVMConstants.DIR_APPBASE, ContentModel.TYPE_AVM_PLAIN_FOLDER);
|
||||
this.avmService.createDirectory(path, AVMConstants.DIR_APPBASE);
|
||||
//this.fileFolderService.create(AVMNodeConverter.ToNodeRef(-1, path), AVMConstants.DIR_APPBASE, ContentModel.TYPE_AVM_PLAIN_FOLDER);
|
||||
path += AVMConstants.DIR_APPBASE;
|
||||
//this.avmService.createDirectory(path, AVMConstants.DIR_WEBAPPS);
|
||||
this.fileFolderService.create(AVMNodeConverter.ToNodeRef(-1, path), AVMConstants.DIR_WEBAPPS, ContentModel.TYPE_AVM_PLAIN_FOLDER);
|
||||
this.avmService.createDirectory(path, AVMConstants.DIR_WEBAPPS);
|
||||
//this.fileFolderService.create(AVMNodeConverter.ToNodeRef(-1, path), AVMConstants.DIR_WEBAPPS, ContentModel.TYPE_AVM_PLAIN_FOLDER);
|
||||
|
||||
// tag the store with the store type
|
||||
this.avmService.setStoreProperty(stagingStore,
|
||||
|
@@ -63,7 +63,7 @@ public abstract class BaseWizardBean extends BaseDialogBean implements IWizardBe
|
||||
String msg = Application.getMessage(FacesContext.getCurrentInstance(), MSG_NOT_SET);
|
||||
String notSetMsg = "<" + msg + ">";
|
||||
|
||||
StringBuilder buf = new StringBuilder(256);
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
|
||||
buf.append("<table cellspacing='4' cellpadding='2' border='0' class='summary'>");
|
||||
for (int i=0; i<labels.length; i++)
|
||||
|
@@ -405,25 +405,13 @@ public abstract class InviteUsersWizard extends AbstractWizardBean
|
||||
if (authType == AuthorityType.GUEST || this.personService.personExists(authority) == true)
|
||||
{
|
||||
// found a User authority
|
||||
NodeRef ref = this.personService.getPerson(authority);
|
||||
String firstName = (String)this.nodeService.getProperty(ref, ContentModel.PROP_FIRSTNAME);
|
||||
String lastName = (String)this.nodeService.getProperty(ref, ContentModel.PROP_LASTNAME);
|
||||
|
||||
label.append(firstName)
|
||||
.append(" ")
|
||||
.append(lastName != null ? lastName : "")
|
||||
.append(" (")
|
||||
.append(Application.getMessage(FacesContext.getCurrentInstance(), role))
|
||||
.append(")");
|
||||
label.append(buildLabelForUserAuthorityRole(authority, role));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// found a group authority
|
||||
label.append(authority.substring(PermissionService.GROUP_PREFIX.length()))
|
||||
.append(" (")
|
||||
.append(Application.getMessage(FacesContext.getCurrentInstance(), role))
|
||||
.append(")");
|
||||
label.append(buildLabelForGroupAuthorityRole(authority, role));
|
||||
}
|
||||
|
||||
this.userGroupRoles.add(new UserGroupRole(authority, role, label.toString()));
|
||||
@@ -660,6 +648,44 @@ public abstract class InviteUsersWizard extends AbstractWizardBean
|
||||
return this.mailHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to build a label of the form:
|
||||
* Firstname Lastname (Role)
|
||||
*/
|
||||
public String buildLabelForUserAuthorityRole(String authority, String role)
|
||||
{
|
||||
// found a User authority
|
||||
NodeRef ref = this.personService.getPerson(authority);
|
||||
String firstName = (String)this.nodeService.getProperty(ref, ContentModel.PROP_FIRSTNAME);
|
||||
String lastName = (String)this.nodeService.getProperty(ref, ContentModel.PROP_LASTNAME);
|
||||
|
||||
StringBuilder buf = new StringBuilder(100);
|
||||
buf.append(firstName)
|
||||
.append(" ")
|
||||
.append(lastName != null ? lastName : "")
|
||||
.append(" (")
|
||||
.append(Application.getMessage(FacesContext.getCurrentInstance(), role))
|
||||
.append(")");
|
||||
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to build a label for a Group authority of the form:
|
||||
* Groupname (role)
|
||||
*/
|
||||
public String buildLabelForGroupAuthorityRole(String authority, String role)
|
||||
{
|
||||
StringBuilder buf = new StringBuilder(100);
|
||||
buf.append(authority.substring(PermissionService.GROUP_PREFIX.length()))
|
||||
.append(" (")
|
||||
.append(Application.getMessage(FacesContext.getCurrentInstance(), role))
|
||||
.append(")");
|
||||
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Simple wrapper class to represent a user/group and a role combination
|
||||
*/
|
||||
|
@@ -2514,6 +2514,35 @@
|
||||
</managed-property>
|
||||
</managed-bean>
|
||||
|
||||
<managed-bean>
|
||||
<description>
|
||||
The bean that backs up the Delete Website Space Dialog
|
||||
</description>
|
||||
<managed-bean-name>DeleteWebsiteDialog</managed-bean-name>
|
||||
<managed-bean-class>org.alfresco.web.bean.wcm.DeleteWebsiteDialog</managed-bean-class>
|
||||
<managed-bean-scope>session</managed-bean-scope>
|
||||
<managed-property>
|
||||
<property-name>avmService</property-name>
|
||||
<value>#{AVMService}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>navigator</property-name>
|
||||
<value>#{NavigationBean}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>nodeService</property-name>
|
||||
<value>#{NodeService}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>browseBean</property-name>
|
||||
<value>#{BrowseBean}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>dictionaryService</property-name>
|
||||
<value>#{DictionaryService}</value>
|
||||
</managed-property>
|
||||
</managed-bean>
|
||||
|
||||
<!-- ==================== COMPONENT GENERATOR BEANS ==================== -->
|
||||
<managed-bean>
|
||||
<description>
|
||||
|
Reference in New Issue
Block a user