mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
. WCM UI
- You can now invite and notify multiple users when creating a new website - Each user has a sandbox area to play in - Each sandbox is layered over the staging area sandbox git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3876 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -790,6 +790,12 @@ create_website_desc=This wizard helps you create a new website space.
|
||||
website_details=Website Details
|
||||
create_website_step1_title=Step One - Website Details
|
||||
create_website_step1_desc=Enter the information about the website.
|
||||
website_invite=Invite Users
|
||||
create_website_step2_title=Step Two - Invite Users
|
||||
create_website_step2_desc=Select users and their roles.
|
||||
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.
|
||||
|
||||
# Browse Website and Sandboxes messages
|
||||
|
@@ -15,6 +15,18 @@
|
||||
description-id="create_website_step1_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="invite" title-id="website_invite" description-id="create_website_step2_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/invite.jsp"
|
||||
title-id="create_website_step2_title"
|
||||
description-id="create_website_step2_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="notify" title-id="website_notify" description-id="create_website_step3_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/notify.jsp"
|
||||
title-id="create_website_step3_title"
|
||||
description-id="create_website_step3_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="summary" title-id="summary" description-id="summary_step_description">
|
||||
<page path="/jsp/wizard/summary.jsp"
|
||||
title-id="summary"
|
||||
|
@@ -37,6 +37,7 @@ import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.app.context.IContextListener;
|
||||
import org.alfresco.web.app.context.UIContextService;
|
||||
@@ -212,8 +213,8 @@ public class AVMBrowseBean implements IContextListener
|
||||
AVMStoreDescriptor store = this.avmService.getAVMStore(stagingStore);
|
||||
if (store != null)
|
||||
{
|
||||
// TODO: count user stores!
|
||||
int users = 1;
|
||||
// TODO: count user stores with correct query
|
||||
int users = avmService.queryStoresPropertyKeys(QName.createQName(null, storeRoot + "-%" + AVMConstants.STORE_MAIN)).size();
|
||||
summary.append(msg.getString(MSG_CREATED_ON)).append(": ")
|
||||
.append(Utils.getDateFormat(fc).format(new Date(store.getCreateDate())))
|
||||
.append("<p>");
|
||||
|
@@ -49,7 +49,7 @@ public class AVMNode implements Map<String, Object>
|
||||
public AVMNode(AVMNodeDescriptor avmRef)
|
||||
{
|
||||
this.avmRef = avmRef;
|
||||
this.version = -1; // TODO: always 1 for now...
|
||||
this.version = -1; // TODO: always -1 for now...
|
||||
this.path = avmRef.getPath();
|
||||
|
||||
getProperties();
|
||||
|
@@ -36,9 +36,13 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.GUID;
|
||||
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.bean.wizard.BaseWizardBean;
|
||||
import org.alfresco.web.bean.wizard.InviteUsersWizard.UserGroupRole;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
@@ -71,6 +75,11 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
this.name = null;
|
||||
this.title = null;
|
||||
this.description = null;
|
||||
|
||||
// init the dependant bean we are using for the invite users pages
|
||||
InviteWebsiteUsersWizard wiz = (InviteWebsiteUsersWizard)FacesHelper.getManagedBean(
|
||||
FacesContext.getCurrentInstance(), "InviteWebsiteUsersWizard");
|
||||
wiz.init();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,14 +106,24 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
uiFacetsProps.put(ContentModel.PROP_DESCRIPTION, this.description);
|
||||
this.nodeService.addAspect(nodeRef, ContentModel.ASPECT_UIFACETS, uiFacetsProps);
|
||||
|
||||
// TODO: invite users with appropriate permissions into this folder
|
||||
|
||||
// invite users with appropriate permissions into this folder
|
||||
InviteWebsiteUsersWizard wiz = (InviteWebsiteUsersWizard)FacesHelper.getManagedBean(
|
||||
FacesContext.getCurrentInstance(), "InviteWebsiteUsersWizard");
|
||||
wiz.setNode(new Node(nodeRef));
|
||||
outcome = wiz.finish();
|
||||
if (outcome != null)
|
||||
{
|
||||
// create the AVM stores (layers) to represent the newly created location website
|
||||
createStagingSandbox(this.name);
|
||||
|
||||
// create a sandbox for each user - TODO: based on role?
|
||||
List<String> invitedUsers = getInvitedUsernames();
|
||||
// create a sandbox for each user
|
||||
// TODO: create sandbox appropriately based on role
|
||||
List<String> invitedUsers = getInvitedUsernames(wiz);
|
||||
String currentUser = Application.getCurrentUser(context).getUserName();
|
||||
if (invitedUsers.contains(currentUser) == false)
|
||||
{
|
||||
invitedUsers.add(Application.getCurrentUser(context).getUserName());
|
||||
}
|
||||
for (String username : invitedUsers)
|
||||
{
|
||||
createUserSandbox(this.name, username);
|
||||
@@ -119,7 +138,9 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
// navigate to the Websites folder so we can see the newly created folder
|
||||
this.navigator.setCurrentNodeId(websiteParentId);
|
||||
|
||||
return "browse";
|
||||
outcome = AlfrescoNavigationHandler.CLOSE_WIZARD_OUTCOME;
|
||||
}
|
||||
return outcome;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -303,6 +324,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
* Identifier for store-types: .sandbox.author.main and .sandbox.author.preview
|
||||
* Store-id: .sandbox-id.<guid> (unique across all stores in the sandbox)
|
||||
* DNS: .dns.<store> = <path-to-webapps-root>
|
||||
* Website Name: .website.name = website name
|
||||
*
|
||||
* @param name The store name to create the sandbox for
|
||||
* @param username Username of the user to create the sandbox for
|
||||
@@ -381,9 +403,15 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
/**
|
||||
* @return The list of invited usernames
|
||||
*/
|
||||
private List<String> getInvitedUsernames()
|
||||
private List<String> getInvitedUsernames(InviteWebsiteUsersWizard wizard)
|
||||
{
|
||||
// TODO: add the list of invited users here
|
||||
return new ArrayList<String>(1);
|
||||
// add the list of invited users here
|
||||
List<UserGroupRole> users = (List<UserGroupRole>)wizard.getUserRolesDataModel().getWrappedData();
|
||||
List<String> invited = new ArrayList<String>(users.size());
|
||||
for (UserGroupRole u : users)
|
||||
{
|
||||
invited.add(u.getAuthority());
|
||||
}
|
||||
return invited;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,72 @@
|
||||
package org.alfresco.web.bean.wcm;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.wizard.InviteUsersWizard;
|
||||
|
||||
/**
|
||||
* Concrete implementation providing the ability to invite users to a space.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class InviteWebsiteUsersWizard extends InviteUsersWizard
|
||||
{
|
||||
private static final String WIZARD_TITLE_ID = "invite_title";
|
||||
private static final String WIZARD_DESC_ID = "invite_desc";
|
||||
private static final String STEP1_DESCRIPTION_ID = "invite_step1_desc";
|
||||
|
||||
/** Cache of available folder permissions */
|
||||
Set<String> folderPermissions = null;
|
||||
|
||||
private Node website;
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#getWizardDescription()
|
||||
*/
|
||||
public String getWizardDescription()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), WIZARD_DESC_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#getWizardTitle()
|
||||
*/
|
||||
public String getWizardTitle()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), WIZARD_TITLE_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getStep1DescriptionText()
|
||||
{
|
||||
return STEP1_DESCRIPTION_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<String> getPermissionsForType()
|
||||
{
|
||||
if (this.folderPermissions == null)
|
||||
{
|
||||
// TODO: get permissions for a website folder type
|
||||
this.folderPermissions = this.permissionService.getSettablePermissions(ContentModel.TYPE_FOLDER);
|
||||
}
|
||||
|
||||
return this.folderPermissions;
|
||||
}
|
||||
|
||||
protected void setNode(Node node)
|
||||
{
|
||||
this.website = node;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Node getNode()
|
||||
{
|
||||
return this.website;
|
||||
}
|
||||
}
|
@@ -303,6 +303,7 @@ public class UIUserSandboxes extends SelfRenderingComponent
|
||||
String stagingStore = AVMConstants.buildAVMStagingStoreName(storeRoot) + ":/";
|
||||
|
||||
// get the UIActions component responsible for rendering context related user actions
|
||||
// TODO: we may need a component per user instance
|
||||
UIActions uiFileActions = aquireUIActions(ACTIONS_FILE);
|
||||
UIActions uiFolderActions = aquireUIActions(ACTIONS_FOLDER);
|
||||
|
||||
@@ -504,7 +505,7 @@ public class UIUserSandboxes extends SelfRenderingComponent
|
||||
private UIActionLink aquireAction(FacesContext fc, String store, String username,
|
||||
String name, String icon, String actionListener, String outcome)
|
||||
{
|
||||
UIActionLink action = findAction(name);
|
||||
UIActionLink action = findAction(name, username);
|
||||
if (action == null)
|
||||
{
|
||||
action = createAction(fc, store, username, name, icon, actionListener, outcome);
|
||||
@@ -516,13 +517,14 @@ public class UIUserSandboxes extends SelfRenderingComponent
|
||||
* Locate a child UIActionLink component by name.
|
||||
*
|
||||
* @param name Of the action component to find
|
||||
* @param username Username of the user owner of the action
|
||||
*
|
||||
* @return UIActionLink component if found, else null if not created yet
|
||||
*/
|
||||
private UIActionLink findAction(String name)
|
||||
private UIActionLink findAction(String name, String username)
|
||||
{
|
||||
UIActionLink action = null;
|
||||
String actionId = getId() + name;
|
||||
String actionId = getId() + name + username;
|
||||
for (UIComponent component : (List<UIComponent>)getChildren())
|
||||
{
|
||||
if (actionId.equals(component.getId()))
|
||||
@@ -554,7 +556,7 @@ public class UIUserSandboxes extends SelfRenderingComponent
|
||||
UIActionLink control = (UIActionLink)facesApp.createComponent(UIActions.COMPONENT_ACTIONLINK);
|
||||
|
||||
control.setRendererType(UIActions.RENDERER_ACTIONLINK);
|
||||
control.setId(getId() + name);
|
||||
control.setId(getId() + name + username);
|
||||
control.setValue(Application.getMessage(fc, name));
|
||||
control.setShowLink(false);
|
||||
control.setImage(icon);
|
||||
|
@@ -633,6 +633,51 @@
|
||||
</managed-property>
|
||||
</managed-bean>
|
||||
|
||||
<managed-bean>
|
||||
<description>
|
||||
The bean that backs up the Invite Users Wizard a website
|
||||
</description>
|
||||
<managed-bean-name>InviteWebsiteUsersWizard</managed-bean-name>
|
||||
<managed-bean-class>org.alfresco.web.bean.wcm.InviteWebsiteUsersWizard</managed-bean-class>
|
||||
<managed-bean-scope>session</managed-bean-scope>
|
||||
<managed-property>
|
||||
<property-name>nodeService</property-name>
|
||||
<value>#{NodeService}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>searchService</property-name>
|
||||
<value>#{SearchService}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>namespaceService</property-name>
|
||||
<value>#{NamespaceService}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>permissionService</property-name>
|
||||
<value>#{PermissionService}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>personService</property-name>
|
||||
<value>#{PersonService}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>navigator</property-name>
|
||||
<value>#{NavigationBean}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>browseBean</property-name>
|
||||
<value>#{BrowseBean}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>mailSender</property-name>
|
||||
<value>#{mailService}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>authorityService</property-name>
|
||||
<value>#{AuthorityService}</value>
|
||||
</managed-property>
|
||||
</managed-bean>
|
||||
|
||||
<managed-bean>
|
||||
<description>
|
||||
The bean that backs up the website file/folder browsing screens
|
||||
|
62
source/web/jsp/wcm/create-website-wizard/invite.jsp
Normal file
62
source/web/jsp/wcm/create-website-wizard/invite.jsp
Normal file
@@ -0,0 +1,62 @@
|
||||
<%--
|
||||
Copyright (C) 2006 Alfresco, Inc.
|
||||
|
||||
Licensed under the Mozilla Public License version 1.1
|
||||
with a permitted attribution clause. You may obtain a
|
||||
copy of the License at
|
||||
|
||||
http://www.alfresco.org/legal/license.txt
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
either express or implied. See the License for the specific
|
||||
language governing permissions and limitations under the
|
||||
License.
|
||||
--%>
|
||||
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
|
||||
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
|
||||
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
|
||||
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
|
||||
|
||||
<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %>
|
||||
<%@ page isELIgnored="false" %>
|
||||
|
||||
<h:panelGrid columns="1" cellpadding="2" style="padding-top:2px; padding-bottom:2px;" width="100%">
|
||||
<h:outputText styleClass="mainSubText" value="#{msg.specify_usersgroups}" />
|
||||
<h:outputText styleClass="mainSubText" value="1. #{msg.select_usersgroups}" />
|
||||
<a:genericPicker id="picker" showAddButton="false" filters="#{InviteWebsiteUsersWizard.filters}" queryCallback="#{InviteWebsiteUsersWizard.pickerCallback}" />
|
||||
<h:outputText value="#{msg.role}" />
|
||||
<h:selectOneListbox id="roles" style="width:250px" size="5">
|
||||
<f:selectItems value="#{InviteWebsiteUsersWizard.roles}" />
|
||||
</h:selectOneListbox>
|
||||
<h:panelGroup styleClass="mainSubText">
|
||||
<h:outputText value="2." /> <h:commandButton value="#{msg.add_to_list_button}" actionListener="#{InviteWebsiteUsersWizard.addSelection}" styleClass="wizardButton" />
|
||||
</h:panelGroup>
|
||||
<h:outputText styleClass="mainSubText" value="#{msg.selected_usersgroups}" />
|
||||
<h:panelGroup>
|
||||
<h:dataTable value="#{InviteWebsiteUsersWizard.userRolesDataModel}" var="row"
|
||||
rowClasses="selectedItemsRow,selectedItemsRowAlt"
|
||||
styleClass="selectedItems" headerClass="selectedItemsHeader"
|
||||
cellspacing="0" cellpadding="4"
|
||||
rendered="#{InviteWebsiteUsersWizard.userRolesDataModel.rowCount != 0}">
|
||||
<h:column>
|
||||
<f:facet name="header">
|
||||
<h:outputText value="#{msg.name}" />
|
||||
</f:facet>
|
||||
<h:outputText value="#{row.label}" />
|
||||
</h:column>
|
||||
<h:column>
|
||||
<a:actionLink actionListener="#{InviteWebsiteUsersWizard.removeSelection}" image="/images/icons/delete.gif"
|
||||
value="#{msg.remove}" showLink="false" style="padding-left:6px" />
|
||||
</h:column>
|
||||
</h:dataTable>
|
||||
|
||||
<a:panel id="no-items" rendered="#{InviteWebsiteUsersWizard.userRolesDataModel.rowCount == 0}">
|
||||
<h:panelGrid columns="1" cellpadding="2" styleClass="selectedItems" rowClasses="selectedItemsHeader,selectedItemsRow">
|
||||
<h:outputText styleClass="selectedItemsHeader" id="no-items-name" value="#{msg.name}" />
|
||||
<h:outputText styleClass="selectedItemsRow" id="no-items-msg" value="#{msg.no_selected_items}" />
|
||||
</h:panelGrid>
|
||||
</a:panel>
|
||||
</h:panelGroup>
|
||||
</h:panelGrid>
|
75
source/web/jsp/wcm/create-website-wizard/notify.jsp
Normal file
75
source/web/jsp/wcm/create-website-wizard/notify.jsp
Normal file
@@ -0,0 +1,75 @@
|
||||
<%--
|
||||
Copyright (C) 2005 Alfresco, Inc.
|
||||
|
||||
Licensed under the Mozilla Public License version 1.1
|
||||
with a permitted attribution clause. You may obtain a
|
||||
copy of the License at
|
||||
|
||||
http://www.alfresco.org/legal/license.txt
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
either express or implied. See the License for the specific
|
||||
language governing permissions and limitations under the
|
||||
License.
|
||||
--%>
|
||||
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
|
||||
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
|
||||
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
|
||||
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
|
||||
|
||||
<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %>
|
||||
<%@ page isELIgnored="false" %>
|
||||
|
||||
<f:verbatim>
|
||||
<script type="text/javascript">
|
||||
|
||||
window.onload = pageLoaded;
|
||||
var okEnabled;
|
||||
|
||||
function pageLoaded()
|
||||
{
|
||||
document.getElementById("dialog:dialog-body:subject").focus();
|
||||
okEnabled = !document.getElementById("dialog:finish-button").disabled;
|
||||
checkButtonState();
|
||||
}
|
||||
|
||||
function checkButtonState()
|
||||
{
|
||||
if (okEnabled)
|
||||
{
|
||||
if (document.getElementById("dialog:dialog-body:subject").value.length == 0)
|
||||
{
|
||||
document.getElementById("dialog:finish-button").disabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
document.getElementById("dialog:finish-button").disabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</f:verbatim>
|
||||
|
||||
<h:outputText styleClass="mainSubTitle" value="#{msg.email_message}" />
|
||||
<h:panelGrid columns="2" cellpadding="2" cellspacing="2" border="0" width="100%">
|
||||
<h:outputText value="#{msg.subject}:" />
|
||||
<h:panelGroup>
|
||||
<h:inputText id="subject" value="#{InviteWebsiteUsersWizard.mailHelper.subject}" size="75" maxlength="1024" onkeyup="javascript:checkButtonState();" />
|
||||
<f:verbatim> *</f:verbatim>
|
||||
</h:panelGroup>
|
||||
|
||||
<f:verbatim></f:verbatim>
|
||||
<h:panelGrid columns="4" cellspacing="1" cellpadding="1" border="0">
|
||||
<h:outputText value="#{msg.action_mail_template}:" />
|
||||
<h:selectOneMenu value="#{InviteWebsiteUsersWizard.mailHelper.template}">
|
||||
<f:selectItems value="#{TemplateSupportBean.emailTemplates}" />
|
||||
</h:selectOneMenu>
|
||||
<h:commandButton value="#{msg.insert_template}" actionListener="#{InviteWebsiteUsersWizard.mailHelper.insertTemplate}" styleClass="wizardButton" />
|
||||
<h:commandButton value="#{msg.discard_template}" actionListener="#{InviteWebsiteUsersWizard.mailHelper.discardTemplate}" styleClass="wizardButton" disabled="#{InviteWebsiteUsersWizard.mailHelper.usingTemplate == null}" />
|
||||
</h:panelGrid>
|
||||
|
||||
<h:outputText value="#{msg.message}:"/>
|
||||
<h:inputTextarea value="#{InviteWebsiteUsersWizard.mailHelper.body}" rows="4" cols="75" disabled="#{InviteWebsiteUsersWizard.mailHelper.usingTemplate != null}" />
|
||||
</h:panelGrid>
|
Reference in New Issue
Block a user