mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
. WCM UI
- Fix to ui issue with generated components IDs when viewing multiple websites (JSF hell!) - Added Preview Website action to the website browse page git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3921 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -226,13 +226,6 @@ public class AVMBrowseBean implements IContextListener
|
||||
this.actionService = actionService;
|
||||
}
|
||||
|
||||
public String getStagingStore()
|
||||
{
|
||||
Node websiteNode = this.navigator.getCurrentNode();
|
||||
String storeRoot = (String)websiteNode.getProperties().get(ContentModel.PROP_AVMSTORE);
|
||||
return AVMConstants.buildAVMStagingStoreName(storeRoot);
|
||||
}
|
||||
|
||||
/**
|
||||
* Summary text for the staging store:
|
||||
* Created On: xx/yy/zz
|
||||
@@ -268,11 +261,32 @@ public class AVMBrowseBean implements IContextListener
|
||||
return summary.toString();
|
||||
}
|
||||
|
||||
public String getPreviewUrl()
|
||||
/**
|
||||
* @return the current staging store name
|
||||
*/
|
||||
public String getStagingStore()
|
||||
{
|
||||
Node websiteNode = this.navigator.getCurrentNode();
|
||||
String storeRoot = (String)websiteNode.getProperties().get(ContentModel.PROP_AVMSTORE);
|
||||
return AVMConstants.buildAVMStagingStoreName(storeRoot);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Preview URL for the current Staging store
|
||||
*/
|
||||
public String getStagingPreviewUrl()
|
||||
{
|
||||
return AVMConstants.buildAVMStoreUrl(getStagingStore());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Preview URL for the current User Sandbox store
|
||||
*/
|
||||
public String getSandboxPreviewUrl()
|
||||
{
|
||||
return AVMConstants.buildAVMStoreUrl(getSandbox());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param foldersRichList The foldersRichList to set.
|
||||
*/
|
||||
|
@@ -55,6 +55,8 @@ import org.alfresco.web.ui.common.component.UIActionLink;
|
||||
import org.alfresco.web.ui.common.converter.ByteSizeConverter;
|
||||
import org.alfresco.web.ui.repo.component.UIActions;
|
||||
import org.alfresco.web.ui.wcm.WebResources;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.web.jsf.FacesContextUtils;
|
||||
|
||||
/**
|
||||
@@ -62,6 +64,8 @@ import org.springframework.web.jsf.FacesContextUtils;
|
||||
*/
|
||||
public class UIUserSandboxes extends SelfRenderingComponent
|
||||
{
|
||||
private static Log logger = LogFactory.getLog(UIUserSandboxes.class);
|
||||
|
||||
private static final String ACTIONS_FILE = "avm_file_modified";
|
||||
private static final String ACTIONS_FOLDER = "avm_folder_modified";
|
||||
private static final String ACTIONS_DELETED = "avm_deleted_modified";
|
||||
@@ -201,6 +205,9 @@ public class UIUserSandboxes extends SelfRenderingComponent
|
||||
// check it exists before we render the view
|
||||
if (avmService.getAVMStore(mainStore) != null)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Building sandbox view for user store: " + mainStore);
|
||||
|
||||
// for each user sandbox, generate an outer panel table
|
||||
PanelGenerator.generatePanelStart(out,
|
||||
context.getExternalContext().getRequestContextPath(),
|
||||
@@ -306,14 +313,15 @@ public class UIUserSandboxes extends SelfRenderingComponent
|
||||
ResourceBundle bundle = Application.getBundle(fc);
|
||||
|
||||
// build the paths to the stores to compare
|
||||
String userStore = AVMConstants.buildAVMUserMainStoreName(storeRoot, username) + ":/";
|
||||
String userStorePrefix = AVMConstants.buildAVMUserMainStoreName(storeRoot, username);
|
||||
String userStore = userStorePrefix + ":/";
|
||||
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? (or use evaluators for roles...)
|
||||
UIActions uiFileActions = aquireUIActions(ACTIONS_FILE);
|
||||
UIActions uiFolderActions = aquireUIActions(ACTIONS_FOLDER);
|
||||
UIActions uiDeletedActions = aquireUIActions(ACTIONS_DELETED);
|
||||
UIActions uiFileActions = aquireUIActions(ACTIONS_FILE, userStorePrefix);
|
||||
UIActions uiFolderActions = aquireUIActions(ACTIONS_FOLDER, userStorePrefix);
|
||||
UIActions uiDeletedActions = aquireUIActions(ACTIONS_DELETED, userStorePrefix);
|
||||
|
||||
// use the sync service to get the list of diffs between the stores
|
||||
List<AVMDifference> diffs = avmSyncService.compare(-1, userStore, -1, stagingStore);
|
||||
@@ -473,24 +481,31 @@ public class UIUserSandboxes extends SelfRenderingComponent
|
||||
*
|
||||
* @return UIActions component
|
||||
*/
|
||||
private UIActions aquireUIActions(String id)
|
||||
private UIActions aquireUIActions(String id, String store)
|
||||
{
|
||||
UIActions uiActions = null;
|
||||
String componentId = id + '_' + store;
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Find UIActions component id: " + componentId);
|
||||
for (UIComponent component : (List<UIComponent>)getChildren())
|
||||
{
|
||||
if (id.equals(component.getId()))
|
||||
if (componentId.equals(component.getId()))
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("...found UIActions component id: " + componentId);
|
||||
uiActions = (UIActions)component;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (uiActions == null)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("...creating UIActions component id: " + componentId);
|
||||
javax.faces.application.Application facesApp = FacesContext.getCurrentInstance().getApplication();
|
||||
uiActions = (UIActions)facesApp.createComponent(COMPONENT_ACTIONS);
|
||||
uiActions.setShowLink(false);
|
||||
uiActions.getAttributes().put("styleClass", "inlineAction");
|
||||
uiActions.setId(id);
|
||||
uiActions.setId(componentId);
|
||||
uiActions.setParent(this);
|
||||
uiActions.setValue(id);
|
||||
|
||||
@@ -516,7 +531,7 @@ public class UIUserSandboxes extends SelfRenderingComponent
|
||||
private UIActionLink aquireAction(FacesContext fc, String store, String username,
|
||||
String name, String icon, String actionListener, String outcome, String url)
|
||||
{
|
||||
UIActionLink action = findAction(name, username);
|
||||
UIActionLink action = findAction(name, store, username);
|
||||
if (action == null)
|
||||
{
|
||||
action = createAction(fc, store, username, name, icon, actionListener, outcome, url);
|
||||
@@ -528,19 +543,24 @@ public class UIUserSandboxes extends SelfRenderingComponent
|
||||
* Locate a child UIActionLink component by name.
|
||||
*
|
||||
* @param name Of the action component to find
|
||||
* @param store Store the action component is tied to
|
||||
* @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, String username)
|
||||
private UIActionLink findAction(String name, String store, String username)
|
||||
{
|
||||
UIActionLink action = null;
|
||||
String actionId = getId() + name + username;
|
||||
String actionId = name + '_' + store;
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Finding action Id: " + actionId);
|
||||
for (UIComponent component : (List<UIComponent>)getChildren())
|
||||
{
|
||||
if (actionId.equals(component.getId()))
|
||||
{
|
||||
action = (UIActionLink)component;
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("...found action Id: " + actionId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -567,8 +587,11 @@ public class UIUserSandboxes extends SelfRenderingComponent
|
||||
javax.faces.application.Application facesApp = fc.getApplication();
|
||||
UIActionLink control = (UIActionLink)facesApp.createComponent(UIActions.COMPONENT_ACTIONLINK);
|
||||
|
||||
String id = name + '_' + store;
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("...creating action Id: " + id);
|
||||
control.setRendererType(UIActions.RENDERER_ACTIONLINK);
|
||||
control.setId(getId() + name + username);
|
||||
control.setId(id);
|
||||
control.setValue(Application.getMessage(fc, name));
|
||||
control.setShowLink(false);
|
||||
control.setImage(icon);
|
||||
@@ -579,10 +602,12 @@ public class UIUserSandboxes extends SelfRenderingComponent
|
||||
actionListener, UIActions.ACTION_CLASS_ARGS));
|
||||
|
||||
UIParameter param = (UIParameter)facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER);
|
||||
param.setId(id + "_1");
|
||||
param.setName("store");
|
||||
param.setValue(store);
|
||||
control.getChildren().add(param);
|
||||
param = (UIParameter)facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER);
|
||||
param.setId(id + "_2");
|
||||
param.setName("username");
|
||||
param.setValue(username);
|
||||
control.getChildren().add(param);
|
||||
|
@@ -75,6 +75,8 @@
|
||||
<div class="mainSubText"><h:outputText value="#{NavigationBean.nodeProperties.description}" id="msg4" /></div>
|
||||
</td>
|
||||
<td align=right>
|
||||
<a:actionLink value="#{msg.sandbox_preview}" image="/images/icons/preview_website.gif" href="#{AVMBrowseBean.sandboxPreviewUrl}" target="new" />
|
||||
|
||||
<a:actionLink value="#{msg.sandbox_create}" image="/images/icons/new_content.gif" action="wizard:createWebContent" />
|
||||
</td>
|
||||
</tr>
|
||||
|
@@ -105,9 +105,9 @@
|
||||
<td align=left width=32><a:actionLink image="/images/icons/sandbox_large.gif" showLink="false" value="#{msg.staging_sandbox}" actionListener="#{AVMBrowseBean.setupSandboxAction}" action="browseSandbox" /></td>
|
||||
<td align=left><h:outputText value="#{msg.staging_sandbox}" styleClass="mainSubTitle" /></td>
|
||||
<td align=right>
|
||||
<a:actionLink value="#{msg.sandbox_preview}" image="/images/icons/preview_website.gif" showLink="false" actionListener="#{AVMBrowseBean.setupSandboxAction}" href="#{AVMBrowseBean.previewUrl}" target="new" />
|
||||
<a:actionLink value="#{msg.sandbox_create}" image="/images/icons/new_content.gif" showLink="false" actionListener="#{AVMBrowseBean.setupSandboxAction}" action="wizard:createWebContent" />
|
||||
<a:actionLink value="#{msg.sandbox_browse}" image="/images/icons/space_small.gif" showLink="false" actionListener="#{AVMBrowseBean.setupSandboxAction}" action="browseSandbox" />
|
||||
<a:actionLink id="actPreview" value="#{msg.sandbox_preview}" image="/images/icons/preview_website.gif" showLink="false" href="#{AVMBrowseBean.stagingPreviewUrl}" target="new" />
|
||||
<a:actionLink id="actCreate" value="#{msg.sandbox_create}" image="/images/icons/new_content.gif" showLink="false" actionListener="#{AVMBrowseBean.setupSandboxAction}" action="wizard:createWebContent" />
|
||||
<a:actionLink id="actBrowse" value="#{msg.sandbox_browse}" image="/images/icons/space_small.gif" showLink="false" actionListener="#{AVMBrowseBean.setupSandboxAction}" action="browseSandbox" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -133,7 +133,7 @@
|
||||
<a:panel id="sandboxes-panel" border="white" bgcolor="white" titleBorder="blue" titleBgcolor="#D3E6FE" styleClass="mainSubTitle" label="#{msg.user_sandboxes}">
|
||||
|
||||
<%-- User Sandboxes List --%>
|
||||
<w:userSandboxes binding="#{AVMBrowseBean.userSandboxes}" value="#{NavigationBean.currentNode.nodeRef}" />
|
||||
<w:userSandboxes id="sandboxes" binding="#{AVMBrowseBean.userSandboxes}" value="#{NavigationBean.currentNode.nodeRef}" />
|
||||
|
||||
</a:panel>
|
||||
|
||||
|
Reference in New Issue
Block a user