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:
Kevin Roast
2007-06-11 14:50:05 +00:00
parent adb817b386
commit 1be49d2679
6 changed files with 51 additions and 12 deletions

View File

@@ -90,7 +90,13 @@
<div id="spacePanel">
<#-- populated via an AJAX call to 'myspacespanel' webscript -->
<#-- 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 class="spaceFooter">
<#-- 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;
margin: 8px;
display: none;
left: 8px;
-moz-border-radius: 5px;
}
@@ -416,7 +421,6 @@ a.spaceBreadcrumbLink:link, a.spaceBreadcrumbLink:visited, a.spaceBreadcrumbLink
padding: 8px;
margin: 8px;
display: none;
left: 8px;
-moz-border-radius: 5px;
}

View File

@@ -25,6 +25,8 @@
package org.alfresco.web.scripts.portlet;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.Map;
import javax.portlet.ActionRequest;
@@ -39,6 +41,7 @@ import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.WindowState;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.service.cmr.security.AuthorityService;
import org.alfresco.web.scripts.DeclarativeWebScriptRegistry;
@@ -154,7 +157,7 @@ public class WebScriptPortlet implements Portlet
if (scriptUrl != null)
{
// build web script url from render request
String scriptUrlArgs = "";
StringBuilder scriptUrlArgs = new StringBuilder(128);
Map<String, String[]> params = req.getParameterMap();
for (Map.Entry<String, String[]> param : params.entrySet())
{
@@ -164,12 +167,22 @@ public class WebScriptPortlet implements Portlet
String argName = name.substring("arg.".length());
for (String argValue : param.getValue())
{
scriptUrlArgs += (scriptUrlArgs.length() == 0) ? "" : "&";
scriptUrlArgs += argName + "=" + argValue;
scriptUrlArgs.append((scriptUrlArgs.length() == 0) ? "" : "&");
// 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
{

View File

@@ -154,7 +154,7 @@ public class WebScriptPortletResponse implements WebScriptResponse
" var args = url.substring(argsIndex + 1).split(\"&\");" +
" for (var i=0; i<args.length; i++)" +
" {" +
" out += \"arg.\" + args[i];" +
" out += \"&arg.\" + args[i];" +
" }" +
" }" +
" return out; } }";

View File

@@ -29,7 +29,7 @@
<init-param>
<name>scriptUrl</name>
<value>/alfresco/wcservice/mytasks</value>
<value>/alfresco/168service/mytasks</value>
</init-param>
<supports>
@@ -50,7 +50,7 @@
<init-param>
<name>scriptUrl</name>
<value>/alfresco/wcservice/doclist</value>
<value>/alfresco/168service/doclist</value>
</init-param>
<supports>
@@ -71,7 +71,7 @@
<init-param>
<name>scriptUrl</name>
<value>/alfresco/wcservice/myspaces</value>
<value>/alfresco/168service/myspaces</value>
</init-param>
<supports>
@@ -92,7 +92,7 @@
<init-param>
<name>scriptUrl</name>
<value>/alfresco/wcservice/mywebforms</value>
<value>/alfresco/168service/mywebforms</value>
</init-param>
<supports>

View File

@@ -269,6 +269,11 @@
<param-value>webscripts.authenticator.webclient</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>portalapiServlet</servlet-name>
<servlet-class>org.alfresco.web.scripts.WebScriptServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>proxyServlet</servlet-name>
@@ -399,6 +404,16 @@
<servlet-name>wcapiServlet</servlet-name>
<url-pattern>/wcs/*</url-pattern>
</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-name>proxyServlet</servlet-name>

View File

@@ -473,6 +473,10 @@ var MySpaces = {
var panel = $E(".spaceCreateSpacePanel", $(actionEl).getParent());
panel.setStyle("opacity", 0);
panel.setStyle("display", "inline");
Alfresco.Dom.smartAlignElement(panel, panel.getParent());
// make into a dragable panel
new Drag.Move(panel);
var anim = new Fx.Styles(
panel,
{
@@ -544,6 +548,9 @@ var MySpaces = {
var panel = $E(".spaceUploadPanel", $(actionEl).getParent());
panel.setStyle("opacity", 0);
panel.setStyle("display", "inline");
Alfresco.Dom.smartAlignElement(panel, panel.getParent());
// make into a dragable panel
new Drag.Move(panel);
// Generate a file upload element
// To perform the actual upload, the element is moved to a hidden iframe