diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/myspaces_get_html.ftl b/config/alfresco/templates/webscripts/org/alfresco/portlets/myspaces_get_html.ftl index 6ee9599ef4..1d8eee4500 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/portlets/myspaces_get_html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/myspaces_get_html.ftl @@ -48,19 +48,31 @@ + <#-- Refresh action --> Refresh
${home.name?html}
- <#-- TODO: haspermission check! --> + <#-- TODO: permission checks on the actions! --> + <#-- Upload File action -->
Upload
<#-- Url encode the path value, and encode any single quotes to generate valid string --> - + +
+ <#-- Create Space action --> +
Create Space
+
+ + + + +
Name:
Title:
Description:
+ +
-
Create Space
@@ -75,12 +87,12 @@
- <#-- populated via an AJAX call myspacecontent webscript --> - <#-- resolved path, filter and home.noderef required as arguments! --> + <#-- populated via an AJAX call to 'myspacespanel' webscript --> + <#-- resolved path, filter and home.noderef required as arguments -->
- <#-- TODO: get the count value dynamically from the AJAX webscript output above... --> + <#-- the count value is retrieved and set dynamically from the AJAX webscript output above --> Showing 0 items(s)
@@ -271,6 +283,20 @@ a.spaceBreadcrumbLink:link, a.spaceBreadcrumbLink:visited, a.spaceBreadcrumbLink -moz-border-radius: 5px; } +.spaceCreateSpacePanel +{ + position: absolute; + border: 1px solid #CCD4DB; + background-color: #EEF7FB; + width: 24em; + height: 11em; + padding: 8px; + margin: 8px; + display: none; + left: 8px; + -moz-border-radius: 5px; +} + a.refreshViewLink:link, a.refreshViewLink:visited, a.refreshViewLink:hover { font-family: Trebuchet MS, Arial, Helvetica, sans-serif; diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/myspacespanel_get_html.ftl b/config/alfresco/templates/webscripts/org/alfresco/portlets/myspacespanel_get_html.ftl index ab73829e8b..eef1981b32 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/portlets/myspacespanel_get_html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/myspacespanel_get_html.ftl @@ -1,10 +1,11 @@ <#assign user=person.properties.userName> <#assign count=0> -<#list companyhome.nodeByReference[args.h].childAssocs["cm:contains"]?sort_by('name') as d> - <#if (args.f="0") || - (args.f="1" && d.isContainer) || - (args.f="2" && d.isDocument) || - (args.f="3" && (d.properties.creator == user || d.properties.modifier == user))> +<#list companyhome.nodeByReference[args.h].children?sort_by('name') as d> + <#if (d.isContainer || d.isDocument) && + ((args.f="0") || + (args.f="1" && d.isContainer) || + (args.f="2" && d.isDocument) || + (args.f="3" && (d.properties.creator == user || d.properties.modifier == user)))> <#assign count=count+1>
diff --git a/source/java/org/alfresco/web/bean/ajax/FileUploadBean.java b/source/java/org/alfresco/web/bean/ajax/FileUploadBean.java index e098631ff7..55fd3b7f5e 100644 --- a/source/java/org/alfresco/web/bean/ajax/FileUploadBean.java +++ b/source/java/org/alfresco/web/bean/ajax/FileUploadBean.java @@ -62,6 +62,9 @@ import org.w3c.dom.Element; import org.w3c.dom.Node; /** + * Bean managing the ajax servlet upload of a multi-part form containing file content + * to be added at a specific path in the server. + * * @author Kevin Roast */ public class FileUploadBean @@ -69,11 +72,11 @@ public class FileUploadBean private static Log logger = LogFactory.getLog(FileUploadBean.class); /** - * Ajax method to upload a file. A multi-part form is required as the input. + * Ajax method to upload file content. A multi-part form is required as the input. * - * "return-page" = - * "currentPath" = - * and the file item itself + * "return-page" = javascript to execute on return from the upload request + * "currentPath" = the cm:name based server path to upload the content into + * and the file item content. * * @throws Exception */ diff --git a/source/java/org/alfresco/web/scripts/WebScriptServlet.java b/source/java/org/alfresco/web/scripts/WebScriptServlet.java index fdaa662d8a..b6d0b2fc4b 100644 --- a/source/java/org/alfresco/web/scripts/WebScriptServlet.java +++ b/source/java/org/alfresco/web/scripts/WebScriptServlet.java @@ -90,7 +90,10 @@ public class WebScriptServlet extends HttpServlet { if (logger.isDebugEnabled()) logger.debug("Processing request (" + req.getMethod() + ") " + req.getRequestURL() + (req.getQueryString() != null ? "?" + req.getQueryString() : "")); - + + res.setHeader("Cache-Control", "no-cache"); + res.setHeader("Pragma", "no-cache"); + WebScriptRuntime runtime = new WebScriptServletRuntime(registry, transactionService, authenticator, req, res); runtime.executeScript(); } diff --git a/source/web/scripts/ajax/myspaces.js b/source/web/scripts/ajax/myspaces.js index 3c5ac970f1..d08889d3f5 100644 --- a/source/web/scripts/ajax/myspaces.js +++ b/source/web/scripts/ajax/myspaces.js @@ -17,8 +17,8 @@ var MySpaces = { // is responsible for rendering just the contents of the main panel div YAHOO.util.Connect.asyncRequest( "GET", - getContextPath() + '/service/myspacespanel?p='+MySpaces.Path+'&f='+MySpaces.Filter+'&h='+MySpaces.Home, - { + getContextPath() + '/service/myspacespanel?p='+MySpaces.Path+'&f='+MySpaces.Filter+'&h='+MySpaces.Home, //+'&_='+(Math.random()) + { success: function(response) { // push the response into the space panel div @@ -239,6 +239,39 @@ var MySpaces = { }); }, + /** + * Display the Create Space pop-up panel + */ + createSpace: function(actionEl) + { + var panel = $E(".spaceCreateSpacePanel", $(actionEl).getParent()); + panel.setStyle("opacity", 0); + panel.setStyle("display", "inline"); + var anim = new Fx.Styles(panel, {duration: MySpaces.ANIM_LENGTH, transition: Fx.Transitions.linear}); + anim.start({'opacity': 1}); + }, + + /** + * OK button click handler for the Create Space pop-up panel + */ + createSpaceOK: function(actionEl, path) + { + // TODO: ajax call to create space... + //path = path.replace("_%_", "'"); + }, + + /** + * Cancel button click handler for various pop-up panels + */ + closePanel: function(actionEl) + { + var panel = $(actionEl).getParent(); + panel.setStyle("display", "none"); + }, + + /** + * Display the Upload File pop-up panel + */ upload: function(actionEl) { var panel = $E(".spaceUploadPanel", $(actionEl).getParent()); @@ -272,22 +305,13 @@ var MySpaces = { { // call the upload help to perform the upload handleUploadHelper(this.fileInput, - "1", // TODO: generate unique ID (parent space noderef?) + "1", // TODO: generate unique ID? (parent space noderef?) MySpaces.uploadCompleteHandler, getContextPath(), "/ajax/invoke/FileUploadBean.uploadFile", {currentPath: path.replace("_%_", "'")}); // decode path this.fileInput = null; - this.uploadClose(actionEl); - }, - - /** - * Cancel button click handler for the Upload File pop-up panel - */ - uploadClose: function(actionEl) - { - var panel = $(actionEl).getParent(); - panel.setStyle("display", "none"); + this.closePanel(actionEl); }, /**