From 2f873a1e1433d105bebea8990136d50edf08fac4 Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Mon, 22 May 2006 13:25:58 +0000 Subject: [PATCH] . Improvements to portlet session handling in Login/Logout situations - Storing of "inPortal" flag in a Threadlocal - No longer invalidate portlet session on logout - clear session by hand instead - Makes it easier to integrate with other JSR-168 vendors such as Liferay . Added the current template NodeRef to the default templating model - Accessable as an object in the root of the templating model called "template" . Added the current script NodeRef to the default scripting model - Accessable as a root scope object called "script" git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2934 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../action/executer/ScriptActionExecutor.java | 1 + .../repo/jscript/RhinoScriptService.java | 21 ++++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/source/java/org/alfresco/repo/action/executer/ScriptActionExecutor.java b/source/java/org/alfresco/repo/action/executer/ScriptActionExecutor.java index 369b30911e..e9ba2b2363 100644 --- a/source/java/org/alfresco/repo/action/executer/ScriptActionExecutor.java +++ b/source/java/org/alfresco/repo/action/executer/ScriptActionExecutor.java @@ -101,6 +101,7 @@ public class ScriptActionExecutor extends ActionExecuterAbstractBase personRef, getCompanyHome(), homeSpaceRef, + scriptRef, actionedUponNodeRef, spaceRef); diff --git a/source/java/org/alfresco/repo/jscript/RhinoScriptService.java b/source/java/org/alfresco/repo/jscript/RhinoScriptService.java index ea07f04f66..ce716e433e 100644 --- a/source/java/org/alfresco/repo/jscript/RhinoScriptService.java +++ b/source/java/org/alfresco/repo/jscript/RhinoScriptService.java @@ -238,15 +238,18 @@ public class RhinoScriptService implements ScriptService * @param person The current user Person Node * @param companyHome The CompanyHome ref * @param userHome The User home space ref + * @param script Optional ref to the script itself * @param document Optional ref to a document Node * @param space Optional ref to a space Node * * @return A Map of global scope scriptable Node objects */ - public static Map buildDefaultModel(ServiceRegistry services, - NodeRef person, NodeRef companyHome, NodeRef userHome, NodeRef document, NodeRef space) + public static Map buildDefaultModel( + ServiceRegistry services, + NodeRef person, NodeRef companyHome, NodeRef userHome, + NodeRef script, NodeRef document, NodeRef space) { - return buildDefaultModel(services, person, companyHome, userHome, document, space, null); + return buildDefaultModel(services, person, companyHome, userHome, script, document, space, null); } /** @@ -255,6 +258,7 @@ public class RhinoScriptService implements ScriptService * 'companyhome' - the Company Home node
* 'userhome' - the current user home space node
* 'person' - the node representing the current user Person
+ * 'script' - the node representing the script itself (may not be available)
* 'document' - document context node (may not be available)
* 'space' - space context node (may not be available) * @@ -262,14 +266,17 @@ public class RhinoScriptService implements ScriptService * @param person The current user Person Node * @param companyHome The CompanyHome ref * @param userHome The User home space ref + * @param script Optional ref to the script itself * @param document Optional ref to a document Node * @param space Optional ref to a space Node * @param resolver Image resolver to resolve icon images etc. * * @return A Map of global scope scriptable Node objects */ - public static Map buildDefaultModel(ServiceRegistry services, - NodeRef person, NodeRef companyHome, NodeRef userHome, NodeRef document, NodeRef space, + public static Map buildDefaultModel( + ServiceRegistry services, + NodeRef person, NodeRef companyHome, NodeRef userHome, + NodeRef script, NodeRef document, NodeRef space, TemplateImageResolver resolver) { Map model = new HashMap(); @@ -278,6 +285,10 @@ public class RhinoScriptService implements ScriptService model.put("companyhome", new Node(companyHome, services, resolver)); model.put("userhome", new Node(userHome, services, resolver)); model.put("person", new Node(person, services, resolver)); + if (script != null) + { + model.put("script", new Node(script, services, resolver)); + } if (document != null) { model.put("document", new Node(document, services, resolver));