- Preview Staging area action added
 - Preview User Sandbox action added
   - Generates the virtualisation server URLs to an AVM sandboxes for the - possible to preview the entire website with transparent overlays for each user.
 - Fix to generation of mangled DNS name for a user store to remove the "main" part (implicit)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3918 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-09-25 12:57:19 +00:00
parent c10643a388
commit c9f6f17756
5 changed files with 66 additions and 13 deletions

View File

@@ -225,6 +225,13 @@ public class AVMBrowseBean implements IContextListener
{ {
this.actionService = actionService; 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: * Summary text for the staging store:
@@ -242,7 +249,7 @@ public class AVMBrowseBean implements IContextListener
ResourceBundle msg = Application.getBundle(fc); ResourceBundle msg = Application.getBundle(fc);
Node websiteNode = this.navigator.getCurrentNode(); Node websiteNode = this.navigator.getCurrentNode();
String storeRoot = (String)websiteNode.getProperties().get(ContentModel.PROP_AVMSTORE); String storeRoot = (String)websiteNode.getProperties().get(ContentModel.PROP_AVMSTORE);
String stagingStore = AVMConstants.buildAVMStagingStoreName(storeRoot); String stagingStore = getStagingStore();
AVMStoreDescriptor store = this.avmService.getAVMStore(stagingStore); AVMStoreDescriptor store = this.avmService.getAVMStore(stagingStore);
if (store != null) if (store != null)
{ {
@@ -261,6 +268,11 @@ public class AVMBrowseBean implements IContextListener
return summary.toString(); return summary.toString();
} }
public String getPreviewUrl()
{
return AVMConstants.buildAVMStoreUrl(getStagingStore());
}
/** /**
* @param foldersRichList The foldersRichList to set. * @param foldersRichList The foldersRichList to set.
*/ */

View File

@@ -16,6 +16,18 @@
*/ */
package org.alfresco.web.bean.wcm; package org.alfresco.web.bean.wcm;
import java.text.MessageFormat;
import java.util.Map;
import javax.faces.context.FacesContext;
import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.config.ClientConfigElement;
/** /**
* @author Kevin Roast * @author Kevin Roast
*/ */
@@ -53,6 +65,23 @@ public final class AVMConstants
return store + ":/" + DIR_APPBASE + '/' + DIR_WEBAPPS; return store + ":/" + DIR_APPBASE + '/' + DIR_WEBAPPS;
} }
public static String buildAVMStoreUrl(String store)
{
String url = null;;
FacesContext fc = FacesContext.getCurrentInstance();
AVMService avmService = Repository.getServiceRegistry(fc).getAVMService();
ClientConfigElement config = Application.getClientConfig(fc);
Map<QName, PropertyValue> props = avmService.queryStorePropertyKey(store, QName.createQName(null, PROP_DNS + '%'));
if (props.size() == 1)
{
String dns = props.entrySet().iterator().next().getKey().getLocalName().substring(PROP_DNS.length());
url = MessageFormat.format(PREVIEW_SANDBOX_URL, dns, config.getWCMDomain(), config.getWCMPort());
}
return url;
}
// names of the stores representing the layers for an AVM website // names of the stores representing the layers for an AVM website
public final static String STORE_STAGING = "-staging"; public final static String STORE_STAGING = "-staging";
public final static String STORE_MAIN = "-main"; public final static String STORE_MAIN = "-main";
@@ -72,4 +101,8 @@ public final class AVMConstants
public final static String PROP_WEBSITE_NAME = ".website.name"; public final static String PROP_WEBSITE_NAME = ".website.name";
public final static String PROP_SANDBOX_STORE_PREFIX = ".sandbox.store."; public final static String PROP_SANDBOX_STORE_PREFIX = ".sandbox.store.";
public final static String SPACE_ICON_WEBSITE = "space-icon-website"; public final static String SPACE_ICON_WEBSITE = "space-icon-website";
// URLs for preview of sandboxes and assets
public final static String PREVIEW_SANDBOX_URL = "http://www-{0}.avm.{1}:{2}";
public final static String PREVIEW_ASSET_URL = "http://www-{0}.avm.{1}:{2}/{3}";
} }

View File

@@ -359,7 +359,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
new PropertyValue(DataTypeDefinition.TEXT, null)); new PropertyValue(DataTypeDefinition.TEXT, null));
// tag the store with the DNS name property // tag the store with the DNS name property
tagStoreDNSPath(userStore, name, username, "main"); tagStoreDNSPath(userStore, name, username);
// create the user 'preview' store // create the user 'preview' store

View File

@@ -213,7 +213,7 @@ public class UIUserSandboxes extends SelfRenderingComponent
// this is currently identical to the sandbox_browse action as below // this is currently identical to the sandbox_browse action as below
Utils.encodeRecursive(context, aquireAction( Utils.encodeRecursive(context, aquireAction(
context, mainStore, username, "sandbox_icon", WebResources.IMAGE_USERSANDBOX_32, context, mainStore, username, "sandbox_icon", WebResources.IMAGE_USERSANDBOX_32,
"#{AVMBrowseBean.setupSandboxAction}", "browseSandbox")); "#{AVMBrowseBean.setupSandboxAction}", "browseSandbox", null));
out.write("</td><td width=100%>"); out.write("</td><td width=100%>");
out.write("<b>"); out.write("<b>");
out.write(bundle.getString(MSG_USERNAME)); out.write(bundle.getString(MSG_USERNAME));
@@ -222,24 +222,25 @@ public class UIUserSandboxes extends SelfRenderingComponent
out.write("</td><td><nobr>"); out.write("</td><td><nobr>");
// direct actions for a sandbox // direct actions for a sandbox
String sandboxUrl = AVMConstants.buildAVMStoreUrl(mainStore);
Utils.encodeRecursive(context, aquireAction( Utils.encodeRecursive(context, aquireAction(
context, mainStore, username, "sandbox_preview", "/images/icons/preview_website.gif", context, mainStore, username, "sandbox_preview", "/images/icons/preview_website.gif",
null, null)); null, null, sandboxUrl));
out.write("&nbsp;"); out.write("&nbsp;");
Utils.encodeRecursive(context, aquireAction( Utils.encodeRecursive(context, aquireAction(
context, mainStore, username, "sandbox_create", "/images/icons/new_content.gif", context, mainStore, username, "sandbox_create", "/images/icons/new_content.gif",
"#{AVMBrowseBean.setupSandboxAction}", "wizard:createWebContent")); "#{AVMBrowseBean.setupSandboxAction}", "wizard:createWebContent", null));
out.write("&nbsp;"); out.write("&nbsp;");
Utils.encodeRecursive(context, aquireAction( Utils.encodeRecursive(context, aquireAction(
context, mainStore, username, "sandbox_submitall", "/images/icons/submit.gif", context, mainStore, username, "sandbox_submitall", "/images/icons/submit.gif",
"#{AVMBrowseBean.submitAll}", null)); "#{AVMBrowseBean.submitAll}", null, null));
out.write("&nbsp;"); out.write("&nbsp;");
Utils.encodeRecursive(context, aquireAction( Utils.encodeRecursive(context, aquireAction(
context, mainStore, username, "sandbox_browse", "/images/icons/space_small.gif", context, mainStore, username, "sandbox_browse", "/images/icons/space_small.gif",
"#{AVMBrowseBean.setupSandboxAction}", "browseSandbox")); "#{AVMBrowseBean.setupSandboxAction}", "browseSandbox", null));
out.write("</nobr></td></tr>"); out.write("</nobr></td></tr>");
// modified items panel // modified items panel
@@ -505,19 +506,20 @@ public class UIUserSandboxes extends SelfRenderingComponent
* @param store Root store name for the user sandbox * @param store Root store name for the user sandbox
* @param username Username of the user for the action * @param username Username of the user for the action
* @param name Action name - will be used for I18N message lookup * @param name Action name - will be used for I18N message lookup
* @param icon Icon to display for the actio n * @param icon Icon to display for the action
* @param actionListener Actionlistener for the action * @param actionListener Actionlistener for the action
* @param outcome Navigation outcome for the action * @param outcome Navigation outcome for the action
* @param url HREF URL for the action
* *
* @return UIActionLink component * @return UIActionLink component
*/ */
private UIActionLink aquireAction(FacesContext fc, String store, String username, private UIActionLink aquireAction(FacesContext fc, String store, String username,
String name, String icon, String actionListener, String outcome) String name, String icon, String actionListener, String outcome, String url)
{ {
UIActionLink action = findAction(name, username); UIActionLink action = findAction(name, username);
if (action == null) if (action == null)
{ {
action = createAction(fc, store, username, name, icon, actionListener, outcome); action = createAction(fc, store, username, name, icon, actionListener, outcome, url);
} }
return action; return action;
} }
@@ -555,11 +557,12 @@ public class UIUserSandboxes extends SelfRenderingComponent
* @param icon Icon to display for the actio n * @param icon Icon to display for the actio n
* @param actionListener Actionlistener for the action * @param actionListener Actionlistener for the action
* @param outcome Navigation outcome for the action * @param outcome Navigation outcome for the action
* @param url HREF URL for the action
* *
* @return UIActionLink child component * @return UIActionLink child component
*/ */
private UIActionLink createAction(FacesContext fc, String store, String username, private UIActionLink createAction(FacesContext fc, String store, String username,
String name, String icon, String actionListener, String outcome) String name, String icon, String actionListener, String outcome, String url)
{ {
javax.faces.application.Application facesApp = fc.getApplication(); javax.faces.application.Application facesApp = fc.getApplication();
UIActionLink control = (UIActionLink)facesApp.createComponent(UIActions.COMPONENT_ACTIONLINK); UIActionLink control = (UIActionLink)facesApp.createComponent(UIActions.COMPONENT_ACTIONLINK);
@@ -574,7 +577,7 @@ public class UIUserSandboxes extends SelfRenderingComponent
{ {
control.setActionListener(facesApp.createMethodBinding( control.setActionListener(facesApp.createMethodBinding(
actionListener, UIActions.ACTION_CLASS_ARGS)); actionListener, UIActions.ACTION_CLASS_ARGS));
UIParameter param = (UIParameter)facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER); UIParameter param = (UIParameter)facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER);
param.setName("store"); param.setName("store");
param.setValue(store); param.setValue(store);
@@ -588,6 +591,11 @@ public class UIUserSandboxes extends SelfRenderingComponent
{ {
control.setAction(new ConstantMethodBinding(outcome)); control.setAction(new ConstantMethodBinding(outcome));
} }
if (url != null)
{
control.setHref(url);
control.setTarget("new");
}
this.getChildren().add(control); this.getChildren().add(control);

View File

@@ -105,7 +105,7 @@
<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 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=left><h:outputText value="#{msg.staging_sandbox}" styleClass="mainSubTitle" /></td>
<td align=right> <td align=right>
<a:actionLink value="#{msg.sandbox_preview}" image="/images/icons/preview_website.gif" showLink="false" actionListener="#{AVMBrowseBean.setupSandboxAction}" /> <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_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 value="#{msg.sandbox_browse}" image="/images/icons/space_small.gif" showLink="false" actionListener="#{AVMBrowseBean.setupSandboxAction}" action="browseSandbox" />
</td> </td>