mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Webscript JSR-168 Portlet runtime fixes for webscript url generation client-side function and url argument decoding.
JSR-168 portlet webscripts now use different service url - /168service/... UI improvements to pop-up dialogs in portlets - now draggable and position now relative. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5912 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -90,7 +90,13 @@
|
|||||||
<div id="spacePanel">
|
<div id="spacePanel">
|
||||||
<#-- populated via an AJAX call to 'myspacespanel' webscript -->
|
<#-- populated via an AJAX call to 'myspacespanel' webscript -->
|
||||||
<#-- resolved path, filter and home.noderef required as arguments -->
|
<#-- resolved path, filter and home.noderef required as arguments -->
|
||||||
<script>MySpaces.ServiceContext="${url.serviceContext}";MySpaces.ScriptUrlEncoder=eval("MySpaces.ScriptUrlEncoder=" + unescape("${url.getClientUrlFunction("encUrl")}"));MySpaces.Path="${path?replace("\"","\\\"")}";MySpaces.Filter="${filter}";MySpaces.Home="${home.nodeRef}";</script>
|
<script>
|
||||||
|
MySpaces.ServiceContext="${url.serviceContext}";
|
||||||
|
MySpaces.ScriptUrlEncoder=eval("MySpaces.ScriptUrlEncoder=" + unescape("${url.getClientUrlFunction("encUrl")}"));
|
||||||
|
MySpaces.Path="${path?replace("\"","\\\"")}";
|
||||||
|
MySpaces.Filter="${filter}";
|
||||||
|
MySpaces.Home="${home.nodeRef}";
|
||||||
|
</script>
|
||||||
</div>
|
</div>
|
||||||
<div class="spaceFooter">
|
<div class="spaceFooter">
|
||||||
<#-- the count value is retrieved and set dynamically from the AJAX webscript output above -->
|
<#-- the count value is retrieved and set dynamically from the AJAX webscript output above -->
|
||||||
@@ -402,7 +408,6 @@ a.spaceBreadcrumbLink:link, a.spaceBreadcrumbLink:visited, a.spaceBreadcrumbLink
|
|||||||
padding: 8px;
|
padding: 8px;
|
||||||
margin: 8px;
|
margin: 8px;
|
||||||
display: none;
|
display: none;
|
||||||
left: 8px;
|
|
||||||
-moz-border-radius: 5px;
|
-moz-border-radius: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -416,7 +421,6 @@ a.spaceBreadcrumbLink:link, a.spaceBreadcrumbLink:visited, a.spaceBreadcrumbLink
|
|||||||
padding: 8px;
|
padding: 8px;
|
||||||
margin: 8px;
|
margin: 8px;
|
||||||
display: none;
|
display: none;
|
||||||
left: 8px;
|
|
||||||
-moz-border-radius: 5px;
|
-moz-border-radius: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -25,6 +25,8 @@
|
|||||||
package org.alfresco.web.scripts.portlet;
|
package org.alfresco.web.scripts.portlet;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLDecoder;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.portlet.ActionRequest;
|
import javax.portlet.ActionRequest;
|
||||||
@@ -39,6 +41,7 @@ import javax.portlet.RenderRequest;
|
|||||||
import javax.portlet.RenderResponse;
|
import javax.portlet.RenderResponse;
|
||||||
import javax.portlet.WindowState;
|
import javax.portlet.WindowState;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||||
import org.alfresco.service.cmr.security.AuthorityService;
|
import org.alfresco.service.cmr.security.AuthorityService;
|
||||||
import org.alfresco.web.scripts.DeclarativeWebScriptRegistry;
|
import org.alfresco.web.scripts.DeclarativeWebScriptRegistry;
|
||||||
@@ -154,7 +157,7 @@ public class WebScriptPortlet implements Portlet
|
|||||||
if (scriptUrl != null)
|
if (scriptUrl != null)
|
||||||
{
|
{
|
||||||
// build web script url from render request
|
// build web script url from render request
|
||||||
String scriptUrlArgs = "";
|
StringBuilder scriptUrlArgs = new StringBuilder(128);
|
||||||
Map<String, String[]> params = req.getParameterMap();
|
Map<String, String[]> params = req.getParameterMap();
|
||||||
for (Map.Entry<String, String[]> param : params.entrySet())
|
for (Map.Entry<String, String[]> param : params.entrySet())
|
||||||
{
|
{
|
||||||
@@ -164,12 +167,22 @@ public class WebScriptPortlet implements Portlet
|
|||||||
String argName = name.substring("arg.".length());
|
String argName = name.substring("arg.".length());
|
||||||
for (String argValue : param.getValue())
|
for (String argValue : param.getValue())
|
||||||
{
|
{
|
||||||
scriptUrlArgs += (scriptUrlArgs.length() == 0) ? "" : "&";
|
scriptUrlArgs.append((scriptUrlArgs.length() == 0) ? "" : "&");
|
||||||
scriptUrlArgs += argName + "=" + argValue;
|
// decode url arg (as it would be if this was a servlet)
|
||||||
|
try
|
||||||
|
{
|
||||||
|
scriptUrlArgs.append(argName).append("=")
|
||||||
|
.append(URLDecoder.decode(argValue, "UTF-8"));
|
||||||
|
}
|
||||||
|
catch (UnsupportedEncodingException e)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Unable to decode UTF-8 url!", e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scriptUrl += "?" + scriptUrlArgs;
|
scriptUrl += (scriptUrlArgs.length() != 0 ? ("?" + scriptUrlArgs.toString()) : "");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -154,7 +154,7 @@ public class WebScriptPortletResponse implements WebScriptResponse
|
|||||||
" var args = url.substring(argsIndex + 1).split(\"&\");" +
|
" var args = url.substring(argsIndex + 1).split(\"&\");" +
|
||||||
" for (var i=0; i<args.length; i++)" +
|
" for (var i=0; i<args.length; i++)" +
|
||||||
" {" +
|
" {" +
|
||||||
" out += \"arg.\" + args[i];" +
|
" out += \"&arg.\" + args[i];" +
|
||||||
" }" +
|
" }" +
|
||||||
" }" +
|
" }" +
|
||||||
" return out; } }";
|
" return out; } }";
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
<init-param>
|
<init-param>
|
||||||
<name>scriptUrl</name>
|
<name>scriptUrl</name>
|
||||||
<value>/alfresco/wcservice/mytasks</value>
|
<value>/alfresco/168service/mytasks</value>
|
||||||
</init-param>
|
</init-param>
|
||||||
|
|
||||||
<supports>
|
<supports>
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
|
|
||||||
<init-param>
|
<init-param>
|
||||||
<name>scriptUrl</name>
|
<name>scriptUrl</name>
|
||||||
<value>/alfresco/wcservice/doclist</value>
|
<value>/alfresco/168service/doclist</value>
|
||||||
</init-param>
|
</init-param>
|
||||||
|
|
||||||
<supports>
|
<supports>
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
|
|
||||||
<init-param>
|
<init-param>
|
||||||
<name>scriptUrl</name>
|
<name>scriptUrl</name>
|
||||||
<value>/alfresco/wcservice/myspaces</value>
|
<value>/alfresco/168service/myspaces</value>
|
||||||
</init-param>
|
</init-param>
|
||||||
|
|
||||||
<supports>
|
<supports>
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
|
|
||||||
<init-param>
|
<init-param>
|
||||||
<name>scriptUrl</name>
|
<name>scriptUrl</name>
|
||||||
<value>/alfresco/wcservice/mywebforms</value>
|
<value>/alfresco/168service/mywebforms</value>
|
||||||
</init-param>
|
</init-param>
|
||||||
|
|
||||||
<supports>
|
<supports>
|
||||||
|
@@ -269,6 +269,11 @@
|
|||||||
<param-value>webscripts.authenticator.webclient</param-value>
|
<param-value>webscripts.authenticator.webclient</param-value>
|
||||||
</init-param>
|
</init-param>
|
||||||
</servlet>
|
</servlet>
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>portalapiServlet</servlet-name>
|
||||||
|
<servlet-class>org.alfresco.web.scripts.WebScriptServlet</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>proxyServlet</servlet-name>
|
<servlet-name>proxyServlet</servlet-name>
|
||||||
@@ -399,6 +404,16 @@
|
|||||||
<servlet-name>wcapiServlet</servlet-name>
|
<servlet-name>wcapiServlet</servlet-name>
|
||||||
<url-pattern>/wcs/*</url-pattern>
|
<url-pattern>/wcs/*</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>portalapiServlet</servlet-name>
|
||||||
|
<url-pattern>/168service/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>portalapiServlet</servlet-name>
|
||||||
|
<url-pattern>/168s/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>proxyServlet</servlet-name>
|
<servlet-name>proxyServlet</servlet-name>
|
||||||
|
@@ -473,6 +473,10 @@ var MySpaces = {
|
|||||||
var panel = $E(".spaceCreateSpacePanel", $(actionEl).getParent());
|
var panel = $E(".spaceCreateSpacePanel", $(actionEl).getParent());
|
||||||
panel.setStyle("opacity", 0);
|
panel.setStyle("opacity", 0);
|
||||||
panel.setStyle("display", "inline");
|
panel.setStyle("display", "inline");
|
||||||
|
Alfresco.Dom.smartAlignElement(panel, panel.getParent());
|
||||||
|
// make into a dragable panel
|
||||||
|
new Drag.Move(panel);
|
||||||
|
|
||||||
var anim = new Fx.Styles(
|
var anim = new Fx.Styles(
|
||||||
panel,
|
panel,
|
||||||
{
|
{
|
||||||
@@ -544,6 +548,9 @@ var MySpaces = {
|
|||||||
var panel = $E(".spaceUploadPanel", $(actionEl).getParent());
|
var panel = $E(".spaceUploadPanel", $(actionEl).getParent());
|
||||||
panel.setStyle("opacity", 0);
|
panel.setStyle("opacity", 0);
|
||||||
panel.setStyle("display", "inline");
|
panel.setStyle("display", "inline");
|
||||||
|
Alfresco.Dom.smartAlignElement(panel, panel.getParent());
|
||||||
|
// make into a dragable panel
|
||||||
|
new Drag.Move(panel);
|
||||||
|
|
||||||
// Generate a file upload element
|
// Generate a file upload element
|
||||||
// To perform the actual upload, the element is moved to a hidden iframe
|
// To perform the actual upload, the element is moved to a hidden iframe
|
||||||
|
Reference in New Issue
Block a user