mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Webscript URLs now supported in the Custom View panel for the Browse, Space Details and Document Details screens.
Added new aspect definition to support Webscript custom views. Web context path (i.e. /alfresco) is now automatically prefixed onto webscript urls specified in JSF runtimes. Modified the existing webscript dashlet JSPs to remove the hardcoded /alfresco path. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5973 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -43,7 +43,9 @@ import org.alfresco.service.cmr.repository.FileTypeImageSize;
|
|||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.repository.TemplateImageResolver;
|
import org.alfresco.service.cmr.repository.TemplateImageResolver;
|
||||||
|
import org.alfresco.service.cmr.security.AccessStatus;
|
||||||
import org.alfresco.service.cmr.security.OwnableService;
|
import org.alfresco.service.cmr.security.OwnableService;
|
||||||
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.web.app.Application;
|
import org.alfresco.web.app.Application;
|
||||||
import org.alfresco.web.app.context.UIContextService;
|
import org.alfresco.web.app.context.UIContextService;
|
||||||
@@ -80,6 +82,9 @@ public abstract class BaseDetailsBean
|
|||||||
/** CopyService bean reference */
|
/** CopyService bean reference */
|
||||||
protected CopyService copyService;
|
protected CopyService copyService;
|
||||||
|
|
||||||
|
/** The PermissionService reference */
|
||||||
|
protected PermissionService permissionService;
|
||||||
|
|
||||||
/** Selected template Id */
|
/** Selected template Id */
|
||||||
protected String template;
|
protected String template;
|
||||||
|
|
||||||
@@ -103,7 +108,7 @@ public abstract class BaseDetailsBean
|
|||||||
// Bean property getters and setters
|
// Bean property getters and setters
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the BrowseBean instance to use to retrieve the current Space
|
* Sets the BrowseBean instance to use to retrieve the current node
|
||||||
*
|
*
|
||||||
* @param browseBean BrowseBean instance
|
* @param browseBean BrowseBean instance
|
||||||
*/
|
*/
|
||||||
@@ -148,6 +153,14 @@ public abstract class BaseDetailsBean
|
|||||||
this.copyService = copyService;
|
this.copyService = copyService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param permissionService The PermissionService to set.
|
||||||
|
*/
|
||||||
|
public void setPermissionService(PermissionService permissionService)
|
||||||
|
{
|
||||||
|
this.permissionService = permissionService;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the panels expanded state map.
|
* @return Returns the panels expanded state map.
|
||||||
*/
|
*/
|
||||||
@@ -172,7 +185,7 @@ public abstract class BaseDetailsBean
|
|||||||
public abstract Node getNode();
|
public abstract Node getNode();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the id of the current space
|
* Returns the id of the current node
|
||||||
*
|
*
|
||||||
* @return The id
|
* @return The id
|
||||||
*/
|
*/
|
||||||
@@ -182,9 +195,9 @@ public abstract class BaseDetailsBean
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the current space
|
* Returns the name of the current node
|
||||||
*
|
*
|
||||||
* @return Name of the current space
|
* @return Name of the current
|
||||||
*/
|
*/
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
@@ -208,8 +221,8 @@ public abstract class BaseDetailsBean
|
|||||||
*/
|
*/
|
||||||
public String getWebdavUrl()
|
public String getWebdavUrl()
|
||||||
{
|
{
|
||||||
Node space = getLinkResolvedNode();
|
Node node = getLinkResolvedNode();
|
||||||
return Utils.generateURL(FacesContext.getCurrentInstance(), space, URLMode.WEBDAV);
|
return Utils.generateURL(FacesContext.getCurrentInstance(), node, URLMode.WEBDAV);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -219,8 +232,8 @@ public abstract class BaseDetailsBean
|
|||||||
*/
|
*/
|
||||||
public String getCifsPath()
|
public String getCifsPath()
|
||||||
{
|
{
|
||||||
Node space = getLinkResolvedNode();
|
Node node = getLinkResolvedNode();
|
||||||
return Utils.generateURL(FacesContext.getCurrentInstance(), space, URLMode.CIFS);
|
return Utils.generateURL(FacesContext.getCurrentInstance(), node, URLMode.CIFS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -259,18 +272,42 @@ public abstract class BaseDetailsBean
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if the current document has the 'templatable' aspect applied and
|
* @return true if the current node has a custom Template or Webscript view applied and
|
||||||
* references a template that currently exists in the system.
|
* references a template/webscript that currently exists in the system.
|
||||||
*/
|
*/
|
||||||
public boolean isTemplatable()
|
public boolean getHasCustomView()
|
||||||
{
|
{
|
||||||
NodeRef templateRef = (NodeRef)getNode().getProperties().get(ContentModel.PROP_TEMPLATE);
|
return getHasWebscriptView() || getHasTemplateView();
|
||||||
return (getNode().hasAspect(ContentModel.ASPECT_TEMPLATABLE) &&
|
|
||||||
templateRef != null && nodeService.exists(templateRef));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return String of the NodeRef for the dashboard template used by the space if any
|
* @return true if the current node has a Template based custom view available
|
||||||
|
*/
|
||||||
|
public boolean getHasTemplateView()
|
||||||
|
{
|
||||||
|
if (getNode().hasAspect(ContentModel.ASPECT_TEMPLATABLE))
|
||||||
|
{
|
||||||
|
NodeRef templateRef = (NodeRef)getNode().getProperties().get(ContentModel.PROP_TEMPLATE);
|
||||||
|
return (templateRef != null && this.nodeService.exists(templateRef) &&
|
||||||
|
this.permissionService.hasPermission(templateRef, PermissionService.READ) == AccessStatus.ALLOWED);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if the current node has a Webscript based custom view available
|
||||||
|
*/
|
||||||
|
public boolean getHasWebscriptView()
|
||||||
|
{
|
||||||
|
if (getNode().hasAspect(ContentModel.ASPECT_WEBSCRIPTABLE))
|
||||||
|
{
|
||||||
|
return (getNode().getProperties().get(ContentModel.PROP_WEBSCRIPT) != null);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return String of the NodeRef for the custom view for the node
|
||||||
*/
|
*/
|
||||||
public String getTemplateRef()
|
public String getTemplateRef()
|
||||||
{
|
{
|
||||||
@@ -278,6 +315,14 @@ public abstract class BaseDetailsBean
|
|||||||
return ref != null ? ref.toString() : null;
|
return ref != null ? ref.toString() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Webscript URL for the custom view for the node
|
||||||
|
*/
|
||||||
|
public String getWebscriptUrl()
|
||||||
|
{
|
||||||
|
return (String)getNode().getProperties().get(ContentModel.PROP_WEBSCRIPT);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a model for use by a template on the Details page.
|
* Returns a model for use by a template on the Details page.
|
||||||
*
|
*
|
||||||
@@ -304,7 +349,7 @@ public abstract class BaseDetailsBean
|
|||||||
if (this.workflowProperties == null &&
|
if (this.workflowProperties == null &&
|
||||||
getNode().hasAspect(ApplicationModel.ASPECT_SIMPLE_WORKFLOW))
|
getNode().hasAspect(ApplicationModel.ASPECT_SIMPLE_WORKFLOW))
|
||||||
{
|
{
|
||||||
// get the exisiting properties for the document
|
// get the exisiting properties for the node
|
||||||
Map<String, Object> props = getNode().getProperties();
|
Map<String, Object> props = getNode().getProperties();
|
||||||
|
|
||||||
String approveStepName = (String)props.get(
|
String approveStepName = (String)props.get(
|
||||||
@@ -364,7 +409,7 @@ public abstract class BaseDetailsBean
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves the details of the workflow stored in workflowProperties
|
* Saves the details of the workflow stored in workflowProperties
|
||||||
* to the current document
|
* to the current node
|
||||||
*
|
*
|
||||||
* @return The outcome string
|
* @return The outcome string
|
||||||
*/
|
*/
|
||||||
@@ -447,7 +492,7 @@ public abstract class BaseDetailsBean
|
|||||||
};
|
};
|
||||||
txnHelper.doInTransaction(callback);
|
txnHelper.doInTransaction(callback);
|
||||||
|
|
||||||
// reset the state of the current document so it reflects the changes just made
|
// reset the state of the current node so it reflects the changes just made
|
||||||
getNode().reset();
|
getNode().reset();
|
||||||
|
|
||||||
outcome = "finish";
|
outcome = "finish";
|
||||||
@@ -510,7 +555,7 @@ public abstract class BaseDetailsBean
|
|||||||
};
|
};
|
||||||
txnHelper.doInTransaction(callback);
|
txnHelper.doInTransaction(callback);
|
||||||
|
|
||||||
// if this was called via the document details dialog we need to reset the document node
|
// if this was called via the node details dialog we need to reset the node
|
||||||
if (getNode() != null)
|
if (getNode() != null)
|
||||||
{
|
{
|
||||||
getNode().reset();
|
getNode().reset();
|
||||||
@@ -575,7 +620,7 @@ public abstract class BaseDetailsBean
|
|||||||
};
|
};
|
||||||
txnHelper.doInTransaction(callback);
|
txnHelper.doInTransaction(callback);
|
||||||
|
|
||||||
// if this was called via the document details dialog we need to reset the document node
|
// if this was called via the node details dialog we need to reset the node
|
||||||
if (getNode() != null)
|
if (getNode() != null)
|
||||||
{
|
{
|
||||||
getNode().reset();
|
getNode().reset();
|
||||||
@@ -596,7 +641,7 @@ public abstract class BaseDetailsBean
|
|||||||
// Action event handlers
|
// Action event handlers
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action handler to apply the selected Template and Templatable aspect to the current Space
|
* Action handler to apply the selected Template and Templatable aspect to the current node
|
||||||
*/
|
*/
|
||||||
public void applyTemplate(ActionEvent event)
|
public void applyTemplate(ActionEvent event)
|
||||||
{
|
{
|
||||||
@@ -628,7 +673,7 @@ public abstract class BaseDetailsBean
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action handler to remove a dashboard template from the current Space
|
* Action handler to remove a custom view template from the current node
|
||||||
*/
|
*/
|
||||||
public void removeTemplate(ActionEvent event)
|
public void removeTemplate(ActionEvent event)
|
||||||
{
|
{
|
||||||
@@ -649,7 +694,7 @@ public abstract class BaseDetailsBean
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action Handler to take Ownership of the current Space
|
* Action Handler to take Ownership of the current node
|
||||||
*/
|
*/
|
||||||
public void takeOwnership(final ActionEvent event)
|
public void takeOwnership(final ActionEvent event)
|
||||||
{
|
{
|
||||||
|
@@ -49,6 +49,7 @@ import org.alfresco.service.cmr.repository.TemplateImageResolver;
|
|||||||
import org.alfresco.service.cmr.repository.TemplateService;
|
import org.alfresco.service.cmr.repository.TemplateService;
|
||||||
import org.alfresco.service.cmr.rule.RuleService;
|
import org.alfresco.service.cmr.rule.RuleService;
|
||||||
import org.alfresco.service.cmr.search.SearchService;
|
import org.alfresco.service.cmr.search.SearchService;
|
||||||
|
import org.alfresco.service.cmr.security.AccessStatus;
|
||||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||||
import org.alfresco.service.cmr.security.PermissionService;
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
@@ -156,6 +157,14 @@ public class NavigationBean
|
|||||||
this.authService = authService;
|
this.authService = authService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param permissionService The PermissionService to set.
|
||||||
|
*/
|
||||||
|
public void setPermissionService(PermissionService permissionService)
|
||||||
|
{
|
||||||
|
this.permissionService = permissionService;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the User object representing the current instance for this user
|
* @return the User object representing the current instance for this user
|
||||||
*/
|
*/
|
||||||
@@ -444,38 +453,56 @@ public class NavigationBean
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if the current node has a template view available
|
* @return true if the current node has a custom view available
|
||||||
*/
|
*/
|
||||||
public boolean getCurrentNodeHasTemplate()
|
public boolean getHasCustomView()
|
||||||
|
{
|
||||||
|
return getHasWebscriptView() || getHasTemplateView();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if the current node has a Template based custom view available
|
||||||
|
*/
|
||||||
|
public boolean getHasTemplateView()
|
||||||
{
|
{
|
||||||
boolean templateView = false;
|
|
||||||
Node node = getCurrentNode();
|
Node node = getCurrentNode();
|
||||||
if (node.hasAspect(ContentModel.ASPECT_TEMPLATABLE))
|
if (node.hasAspect(ContentModel.ASPECT_TEMPLATABLE))
|
||||||
{
|
{
|
||||||
NodeRef templateRef = (NodeRef)node.getProperties().get(ContentModel.PROP_TEMPLATE);
|
NodeRef templateRef = (NodeRef)node.getProperties().get(ContentModel.PROP_TEMPLATE);
|
||||||
try
|
return (templateRef != null && this.nodeService.exists(templateRef) &&
|
||||||
{
|
this.permissionService.hasPermission(templateRef, PermissionService.READ) == AccessStatus.ALLOWED);
|
||||||
templateView = (templateRef != null && this.nodeService.exists(templateRef));
|
|
||||||
}
|
}
|
||||||
catch (AccessDeniedException err)
|
return false;
|
||||||
{
|
|
||||||
// default to false if no access to template
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return templateView;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the NodeRef.toString() for the current node template view if it has one set
|
* @return true if the current node has a Webscript based custom view available
|
||||||
|
*/
|
||||||
|
public boolean getHasWebscriptView()
|
||||||
|
{
|
||||||
|
Node node = getCurrentNode();
|
||||||
|
if (node.hasAspect(ContentModel.ASPECT_WEBSCRIPTABLE))
|
||||||
|
{
|
||||||
|
return (node.getProperties().get(ContentModel.PROP_WEBSCRIPT) != null);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the NodeRef.toString() for the current node Template custom view if it has one
|
||||||
*/
|
*/
|
||||||
public String getCurrentNodeTemplate()
|
public String getCurrentNodeTemplate()
|
||||||
{
|
{
|
||||||
String strRef = null;
|
NodeRef ref = (NodeRef)getCurrentNode().getProperties().get(ContentModel.PROP_TEMPLATE);
|
||||||
if (getCurrentNodeHasTemplate() == true)
|
return ref != null ? ref.toString() : null;
|
||||||
{
|
|
||||||
strRef = getCurrentNode().getProperties().get(ContentModel.PROP_TEMPLATE).toString();
|
|
||||||
}
|
}
|
||||||
return strRef;
|
|
||||||
|
/**
|
||||||
|
* @return the service url for the current node Webscript custom view if it has one
|
||||||
|
*/
|
||||||
|
public String getCurrentNodeWebscript()
|
||||||
|
{
|
||||||
|
return (String)getCurrentNode().getProperties().get(ContentModel.PROP_WEBSCRIPT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -486,7 +513,7 @@ public class NavigationBean
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Map getTemplateModel()
|
public Map getTemplateModel()
|
||||||
{
|
{
|
||||||
HashMap model = new HashMap(1, 1.0f);
|
HashMap model = new HashMap(2, 1.0f);
|
||||||
|
|
||||||
model.put("space", getCurrentNode().getNodeRef());
|
model.put("space", getCurrentNode().getNodeRef());
|
||||||
model.put(TemplateService.KEY_IMAGE_RESOLVER,
|
model.put(TemplateService.KEY_IMAGE_RESOLVER,
|
||||||
@@ -928,6 +955,9 @@ public class NavigationBean
|
|||||||
/** The Authentication service bean reference */
|
/** The Authentication service bean reference */
|
||||||
protected AuthenticationService authService;
|
protected AuthenticationService authService;
|
||||||
|
|
||||||
|
/** The PermissionService reference */
|
||||||
|
protected PermissionService permissionService;
|
||||||
|
|
||||||
/** Cached path to our CIFS server and top level node DIR */
|
/** Cached path to our CIFS server and top level node DIR */
|
||||||
private String cifsServerPath;
|
private String cifsServerPath;
|
||||||
|
|
||||||
|
@@ -67,6 +67,10 @@ public class UIWebScript extends SelfRenderingComponent
|
|||||||
|
|
||||||
/** WebScript URL to execute */
|
/** WebScript URL to execute */
|
||||||
private String scriptUrl = null;
|
private String scriptUrl = null;
|
||||||
|
|
||||||
|
/** User defined script context value */
|
||||||
|
private Object context = null;
|
||||||
|
|
||||||
private boolean scriptUrlModified = false;
|
private boolean scriptUrlModified = false;
|
||||||
|
|
||||||
private WebScriptRegistry registry;
|
private WebScriptRegistry registry;
|
||||||
@@ -104,6 +108,7 @@ public class UIWebScript extends SelfRenderingComponent
|
|||||||
super.restoreState(context, values[0]);
|
super.restoreState(context, values[0]);
|
||||||
this.scriptUrl = (String)values[1];
|
this.scriptUrl = (String)values[1];
|
||||||
this.scriptUrlModified = (Boolean)values[2];
|
this.scriptUrlModified = (Boolean)values[2];
|
||||||
|
this.context = values[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -112,7 +117,7 @@ public class UIWebScript extends SelfRenderingComponent
|
|||||||
public Object saveState(FacesContext context)
|
public Object saveState(FacesContext context)
|
||||||
{
|
{
|
||||||
Object values[] = new Object[] {
|
Object values[] = new Object[] {
|
||||||
super.saveState(context), this.scriptUrl, this.scriptUrlModified};
|
super.saveState(context), this.scriptUrl, this.scriptUrlModified, this.context};
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,11 +168,35 @@ public class UIWebScript extends SelfRenderingComponent
|
|||||||
@Override
|
@Override
|
||||||
public void encodeBegin(FacesContext context) throws IOException
|
public void encodeBegin(FacesContext context) throws IOException
|
||||||
{
|
{
|
||||||
|
String scriptUrl = getScriptUrl();
|
||||||
|
|
||||||
|
Object scriptContext = getContext();
|
||||||
|
if (scriptContext != null)
|
||||||
|
{
|
||||||
|
// context object supplied, perform simple variable substitution
|
||||||
|
if (scriptContext instanceof Map)
|
||||||
|
{
|
||||||
|
Map<String, Object> scriptContextMap = (Map<String, Object>)scriptContext;
|
||||||
|
for (String key : scriptContextMap.keySet())
|
||||||
|
{
|
||||||
|
scriptUrl = scriptUrl.replace(key, scriptContextMap.get(key).toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// currently we only support {noderef} replacement directly
|
||||||
|
// TODO: move the variable substitution into the WebScript engine - pass in
|
||||||
|
// a bag of context objects i.e. name/value pairs of well known keys
|
||||||
|
// allow common values such as noderef, nodeid, path, user etc.
|
||||||
|
scriptUrl = scriptUrl.replace("{noderef}", scriptContext.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// execute WebScript
|
// execute WebScript
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
logger.debug("Processing UIWebScript encodeBegin(): " + getScriptUrl());
|
logger.debug("Processing UIWebScript encodeBegin(): " + scriptUrl);
|
||||||
|
|
||||||
WebScriptRuntime runtime = new WebScriptJSFRuntime(context, getScriptUrl());
|
WebScriptRuntime runtime = new WebScriptJSFRuntime(context, scriptUrl);
|
||||||
runtime.executeScript();
|
runtime.executeScript();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,12 +220,34 @@ public class UIWebScript extends SelfRenderingComponent
|
|||||||
ValueBinding vb = getValueBinding("scriptUrl");
|
ValueBinding vb = getValueBinding("scriptUrl");
|
||||||
if (vb != null)
|
if (vb != null)
|
||||||
{
|
{
|
||||||
this.scriptUrl = (String)vb.getValue(getFacesContext());
|
this.scriptUrl = getFacesContext().getExternalContext().getRequestContextPath() +
|
||||||
|
(String)vb.getValue(getFacesContext());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this.scriptUrl;
|
return this.scriptUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the user defined script context object
|
||||||
|
*/
|
||||||
|
public Object getContext()
|
||||||
|
{
|
||||||
|
ValueBinding vb = getValueBinding("context");
|
||||||
|
if (vb != null)
|
||||||
|
{
|
||||||
|
this.context = vb.getValue(getFacesContext());
|
||||||
|
}
|
||||||
|
return this.context;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param context the user defined script context to set
|
||||||
|
*/
|
||||||
|
public void setContext(Object context)
|
||||||
|
{
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Inner classes
|
// Inner classes
|
||||||
@@ -209,7 +260,7 @@ public class UIWebScript extends SelfRenderingComponent
|
|||||||
public WebScriptEvent(UIComponent component, String url)
|
public WebScriptEvent(UIComponent component, String url)
|
||||||
{
|
{
|
||||||
super(component);
|
super(component);
|
||||||
Url = url;
|
this.Url = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String Url = null;
|
public String Url = null;
|
||||||
|
@@ -61,6 +61,7 @@ public class WebScriptTag extends BaseComponentTag
|
|||||||
{
|
{
|
||||||
super.setProperties(component);
|
super.setProperties(component);
|
||||||
setStringProperty(component, "scriptUrl", this.scriptUrl);
|
setStringProperty(component, "scriptUrl", this.scriptUrl);
|
||||||
|
setStringProperty(component, "context", this.context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -70,18 +71,32 @@ public class WebScriptTag extends BaseComponentTag
|
|||||||
{
|
{
|
||||||
super.release();
|
super.release();
|
||||||
this.scriptUrl = null;
|
this.scriptUrl = null;
|
||||||
|
this.context = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the scriptUrl
|
* Set the script service Url
|
||||||
*
|
*
|
||||||
* @param scriptUrl the scriptUrl
|
* @param scriptUrl the script service Url
|
||||||
*/
|
*/
|
||||||
public void setScriptUrl(String scriptUrl)
|
public void setScriptUrl(String scriptUrl)
|
||||||
{
|
{
|
||||||
this.scriptUrl = scriptUrl;
|
this.scriptUrl = scriptUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the script context
|
||||||
|
*
|
||||||
|
* @param context the script context
|
||||||
|
*/
|
||||||
|
public void setContext(String context)
|
||||||
|
{
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** the script context */
|
||||||
|
private String context;
|
||||||
|
|
||||||
/** the scriptUrl */
|
/** the scriptUrl */
|
||||||
private String scriptUrl;
|
private String scriptUrl;
|
||||||
|
@@ -58,8 +58,6 @@ import org.apache.log4j.Logger;
|
|||||||
*/
|
*/
|
||||||
public class UITemplate extends SelfRenderingComponent
|
public class UITemplate extends SelfRenderingComponent
|
||||||
{
|
{
|
||||||
//private final static String ENGINE_DEFAULT = "freemarker";
|
|
||||||
|
|
||||||
private static Logger logger = Logger.getLogger(UITemplate.class);
|
private static Logger logger = Logger.getLogger(UITemplate.class);
|
||||||
|
|
||||||
/** Template name/classpath */
|
/** Template name/classpath */
|
||||||
@@ -182,8 +180,6 @@ public class UITemplate extends SelfRenderingComponent
|
|||||||
*/
|
*/
|
||||||
private Object getTemplateModel(Object model, String template)
|
private Object getTemplateModel(Object model, String template)
|
||||||
{
|
{
|
||||||
//if (getEngine().equals(ENGINE_DEFAULT))
|
|
||||||
//{
|
|
||||||
// create an instance of the default FreeMarker template object model
|
// create an instance of the default FreeMarker template object model
|
||||||
FacesContext fc = FacesContext.getCurrentInstance();
|
FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
ServiceRegistry services = Repository.getServiceRegistry(fc);
|
ServiceRegistry services = Repository.getServiceRegistry(fc);
|
||||||
@@ -207,9 +203,7 @@ public class UITemplate extends SelfRenderingComponent
|
|||||||
|
|
||||||
root.putAll((Map)model);
|
root.putAll((Map)model);
|
||||||
}
|
}
|
||||||
|
|
||||||
model = root;
|
model = root;
|
||||||
// }
|
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
@@ -240,6 +240,10 @@
|
|||||||
<property-name>authenticationService</property-name>
|
<property-name>authenticationService</property-name>
|
||||||
<value>#{AuthenticationService}</value>
|
<value>#{AuthenticationService}</value>
|
||||||
</managed-property>
|
</managed-property>
|
||||||
|
<managed-property>
|
||||||
|
<property-name>permissionService</property-name>
|
||||||
|
<value>#{PermissionService}</value>
|
||||||
|
</managed-property>
|
||||||
</managed-bean>
|
</managed-bean>
|
||||||
|
|
||||||
<managed-bean>
|
<managed-bean>
|
||||||
@@ -1363,6 +1367,10 @@
|
|||||||
<property-name>editionService</property-name>
|
<property-name>editionService</property-name>
|
||||||
<value>#{EditionService}</value>
|
<value>#{EditionService}</value>
|
||||||
</managed-property>
|
</managed-property>
|
||||||
|
<managed-property>
|
||||||
|
<property-name>permissionService</property-name>
|
||||||
|
<value>#{PermissionService}</value>
|
||||||
|
</managed-property>
|
||||||
</managed-bean>
|
</managed-bean>
|
||||||
|
|
||||||
<managed-bean>
|
<managed-bean>
|
||||||
@@ -1396,6 +1404,10 @@
|
|||||||
<property-name>copyService</property-name>
|
<property-name>copyService</property-name>
|
||||||
<value>#{CopyService}</value>
|
<value>#{CopyService}</value>
|
||||||
</managed-property>
|
</managed-property>
|
||||||
|
<managed-property>
|
||||||
|
<property-name>permissionService</property-name>
|
||||||
|
<value>#{PermissionService}</value>
|
||||||
|
</managed-property>
|
||||||
</managed-bean>
|
</managed-bean>
|
||||||
|
|
||||||
<managed-bean>
|
<managed-bean>
|
||||||
|
@@ -2100,6 +2100,12 @@
|
|||||||
<required>true</required>
|
<required>true</required>
|
||||||
<rtexprvalue>true</rtexprvalue>
|
<rtexprvalue>true</rtexprvalue>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>context</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
</tag>
|
</tag>
|
||||||
|
|
||||||
</taglib>
|
</taglib>
|
||||||
|
@@ -193,7 +193,7 @@
|
|||||||
<a:listItem value="details" label="#{msg.details_view}" />
|
<a:listItem value="details" label="#{msg.details_view}" />
|
||||||
<a:listItem value="icons" label="#{msg.view_icon}" />
|
<a:listItem value="icons" label="#{msg.view_icon}" />
|
||||||
<a:listItem value="list" label="#{msg.view_browse}" />
|
<a:listItem value="list" label="#{msg.view_browse}" />
|
||||||
<a:listItem value="dashboard" label="#{msg.custom_view}" disabled="#{!NavigationBean.currentNodeHasTemplate}" />
|
<a:listItem value="dashboard" label="#{msg.custom_view}" disabled="#{!NavigationBean.hasCustomView}" />
|
||||||
</a:modeList>
|
</a:modeList>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -211,14 +211,15 @@
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<%-- Custom Template View --%>
|
<%-- Custom Template View --%>
|
||||||
<a:panel id="custom-wrapper-panel" rendered="#{NavigationBean.currentNodeHasTemplate}">
|
<a:panel id="custom-wrapper-panel" rendered="#{NavigationBean.hasCustomView}">
|
||||||
<tr valign=top>
|
<tr valign=top>
|
||||||
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_4.gif)" width=4></td>
|
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_4.gif)" width=4></td>
|
||||||
<td style="padding:4px">
|
<td style="padding:4px">
|
||||||
<a:panel id="custom-panel" border="white" bgcolor="white" titleBorder="lbgrey" expandedTitleBorder="dotted" titleBgcolor="white" styleClass="mainSubTitle"
|
<a:panel id="custom-panel" border="white" bgcolor="white" titleBorder="lbgrey" expandedTitleBorder="dotted" titleBgcolor="white" styleClass="mainSubTitle"
|
||||||
label="#{msg.custom_view}" progressive="true"
|
label="#{msg.custom_view}" progressive="true"
|
||||||
expanded='#{BrowseBean.panels["custom-panel"]}' expandedActionListener="#{BrowseBean.expandPanel}">
|
expanded='#{BrowseBean.panels["custom-panel"]}' expandedActionListener="#{BrowseBean.expandPanel}">
|
||||||
<r:template id="template" template="#{NavigationBean.currentNodeTemplate}" model="#{NavigationBean.templateModel}" />
|
<r:webScript id="webscript" scriptUrl="#{NavigationBean.currentNodeWebscript}" context="#{NavigationBean.currentNode.nodeRef}" rendered="#{NavigationBean.hasWebscriptView}" />
|
||||||
|
<r:template id="template" template="#{NavigationBean.currentNodeTemplate}" model="#{NavigationBean.templateModel}" rendered="#{!NavigationBean.hasWebscriptView && NavigationBean.hasTemplateView}" />
|
||||||
</a:panel>
|
</a:panel>
|
||||||
</td>
|
</td>
|
||||||
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_6.gif)" width=4></td>
|
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_6.gif)" width=4></td>
|
||||||
|
@@ -120,7 +120,8 @@
|
|||||||
|
|
||||||
<a:panel id="dashboard-panel" border="white" bgcolor="white" titleBorder="lbgrey" expandedTitleBorder="dotted" titleBgcolor="white" styleClass="mainSubTitle" label="#{msg.custom_view}">
|
<a:panel id="dashboard-panel" border="white" bgcolor="white" titleBorder="lbgrey" expandedTitleBorder="dotted" titleBgcolor="white" styleClass="mainSubTitle" label="#{msg.custom_view}">
|
||||||
|
|
||||||
<r:template id="template" template="#{NavigationBean.currentNodeTemplate}" model="#{NavigationBean.templateModel}" />
|
<r:webScript id="webscript" scriptUrl="#{NavigationBean.currentNodeWebscript}" context="#{NavigationBean.currentNode.nodeRef}" rendered="#{NavigationBean.hasWebscriptView}" />
|
||||||
|
<r:template id="template" template="#{NavigationBean.currentNodeTemplate}" model="#{NavigationBean.templateModel}" rendered="#{!NavigationBean.hasWebscriptView && NavigationBean.hasTemplateView}" />
|
||||||
|
|
||||||
</a:panel>
|
</a:panel>
|
||||||
|
|
||||||
|
@@ -24,4 +24,4 @@
|
|||||||
--%>
|
--%>
|
||||||
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
|
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
|
||||||
|
|
||||||
<r:webScript scriptUrl="/alfresco/wcs/doclist" />
|
<r:webScript scriptUrl="/wcs/doclist" />
|
@@ -24,4 +24,4 @@
|
|||||||
--%>
|
--%>
|
||||||
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
|
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
|
||||||
|
|
||||||
<r:webScript scriptUrl="/alfresco/wcs/myspaces" />
|
<r:webScript scriptUrl="/wcs/myspaces" />
|
@@ -24,4 +24,4 @@
|
|||||||
--%>
|
--%>
|
||||||
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
|
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
|
||||||
|
|
||||||
<r:webScript scriptUrl="/alfresco/wcs/mytasks" />
|
<r:webScript scriptUrl="/wcs/mytasks" />
|
@@ -24,4 +24,4 @@
|
|||||||
--%>
|
--%>
|
||||||
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
|
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
|
||||||
|
|
||||||
<r:webScript scriptUrl="/alfresco/wcs/mywebforms" />
|
<r:webScript scriptUrl="/wcs/mywebforms" />
|
@@ -158,11 +158,12 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td align=left>
|
<td align=left>
|
||||||
<r:permissionEvaluator value="#{DocumentDetailsBean.document}" allow="Write" id="evalApply">
|
<r:permissionEvaluator value="#{DocumentDetailsBean.document}" allow="Write" id="evalApply">
|
||||||
<a:actionLink id="actDashboard" value="#{msg.apply_template}" rendered="#{DocumentDetailsBean.templatable == false}" action="dialog:applyTemplate" />
|
<a:actionLink id="actDashboard" value="#{msg.apply_template}" rendered="#{!DocumentDetailsBean.hasCustomView}" action="dialog:applyTemplate" />
|
||||||
</r:permissionEvaluator>
|
</r:permissionEvaluator>
|
||||||
<a:panel id="template-panel" rendered="#{DocumentDetailsBean.templatable == true}">
|
<a:panel id="template-panel" rendered="#{DocumentDetailsBean.hasCustomView}">
|
||||||
<div style="padding:4px;border: 1px dashed #cccccc">
|
<div style="padding:4px;border: 1px dashed #cccccc">
|
||||||
<r:template id="dashboard" template="#{DocumentDetailsBean.templateRef}" model="#{DocumentDetailsBean.templateModel}" />
|
<r:webScript id="webscript" scriptUrl="#{DocumentDetailsBean.webscriptUrl}" context="#{DocumentDetailsBean.document.nodeRef}" rendered="#{DocumentDetailsBean.hasWebscriptView}" />
|
||||||
|
<r:template id="dashboard" template="#{DocumentDetailsBean.templateRef}" model="#{DocumentDetailsBean.templateModel}" rendered="#{!DocumentDetailsBean.hasWebscriptView && DocumentDetailsBean.hasTemplateView}" />
|
||||||
</div>
|
</div>
|
||||||
</a:panel>
|
</a:panel>
|
||||||
</td>
|
</td>
|
||||||
|
@@ -146,11 +146,12 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td align=left>
|
<td align=left>
|
||||||
<r:permissionEvaluator value="#{SpaceDetailsBean.space}" allow="Write" id="evalApply">
|
<r:permissionEvaluator value="#{SpaceDetailsBean.space}" allow="Write" id="evalApply">
|
||||||
<a:actionLink id="actDashboard" value="#{msg.apply_template}" rendered="#{SpaceDetailsBean.templatable == false}" action="dialog:applyTemplate" />
|
<a:actionLink id="actDashboard" value="#{msg.apply_template}" rendered="#{!SpaceDetailsBean.hasCustomView}" action="dialog:applyTemplate" />
|
||||||
</r:permissionEvaluator>
|
</r:permissionEvaluator>
|
||||||
<a:panel id="template-panel" rendered="#{SpaceDetailsBean.templatable == true}">
|
<a:panel id="template-panel" rendered="#{SpaceDetailsBean.hasCustomView}">
|
||||||
<div style="padding:4px;border: 1px dashed #cccccc">
|
<div style="padding:4px;border: 1px dashed #cccccc">
|
||||||
<r:template id="dashboard" template="#{SpaceDetailsBean.templateRef}" model="#{SpaceDetailsBean.templateModel}" />
|
<r:webScript id="webscript" scriptUrl="#{SpaceDetailsBean.webscriptUrl}" context="#{SpaceDetailsBean.space.nodeRef}" rendered="#{SpaceDetailsBean.hasWebscriptView}" />
|
||||||
|
<r:template id="dashboard" template="#{SpaceDetailsBean.templateRef}" model="#{SpaceDetailsBean.templateModel}" rendered="#{!SpaceDetailsBean.hasWebscriptView && SpaceDetailsBean.hasTemplateView}" />
|
||||||
</div>
|
</div>
|
||||||
</a:panel>
|
</a:panel>
|
||||||
</td>
|
</td>
|
||||||
|
Reference in New Issue
Block a user