diff --git a/config/alfresco/templates/client/portlet_node_summary_panel.ftl b/config/alfresco/templates/client/portlet_node_summary_panel.ftl
index 7eeb9afec5..5e6d3f9887 100644
--- a/config/alfresco/templates/client/portlet_node_summary_panel.ftl
+++ b/config/alfresco/templates/client/portlet_node_summary_panel.ftl
@@ -21,17 +21,8 @@
<#assign isImage=node.isDocument && (node.mimetype = "image/gif" || node.mimetype = "image/jpeg" || node.mimetype = "image/png")>
- <#assign isVideo=node.isDocument && node.mimetype?starts_with("video/")>
<#if isImage>
- <#elseif isVideo>
-
<#else>
@@ -72,7 +63,7 @@
- <#if node.isDocument && !isImage && !isVideo>
+ <#if node.isDocument && !isImage>
<#assign c=cropContent(node.properties.content, 512)>
<#if c?length != 0>
diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/doclist_get_html.ftl b/config/alfresco/templates/webscripts/org/alfresco/portlets/doclist_get_html.ftl
index 99c57e0b24..fb3a52e796 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/portlets/doclist_get_html.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/doclist_get_html.ftl
@@ -36,13 +36,16 @@
-
+
@@ -139,6 +142,7 @@ a.docfilterLinkSelected:link, a.docfilterLinkSelected:visited
height: 320px;
width: 716px;
overflow: auto;
+ overflow-y: scroll;
border-top: 1px solid #CCD4DB;
border-bottom: 1px solid #CCD4DB;
visibility: hidden;
@@ -302,4 +306,12 @@ a.docfilterLinkSelected:link, a.docfilterLinkSelected:visited
overflow: hidden;
}
+a.refreshViewLink:link, a.refreshViewLink:visited, a.refreshViewLink:hover
+{
+ font-family: Trebuchet MS, Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ color: #515D6B;
+ text-decoration: none;
+}
+
\ No newline at end of file
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 db2590b711..6ee9599ef4 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,15 +48,15 @@
#if>
#list>
+ Refresh
-  ${home.name?html}
+  ${home.name?html}
-
- Upload
-
+ <#-- TODO: haspermission check! -->
+ Upload
- <#-- TODO: Url encode the path value! -->
+ <#-- Url encode the path value, and encode any single quotes to generate valid string -->
@@ -75,52 +75,13 @@
- <#assign user=person.properties.userName>
- <#assign count=0>
- <#list home.children?sort_by('name') as d>
- <#if (filter=0) ||
- (filter=1 && d.isContainer) ||
- (filter=2 && d.isDocument) ||
- (filter=3 && (d.properties.creator == user || d.properties.modifier == user))>
- <#assign count=count+1>
-
-
- <#if d.isDocument>
- 
- <#else>
- 
- #if>
-
-
-
- ${d.name?html}
-
-
-
-
-
-
-
-
- Description: <#if d.properties.description?exists>${d.properties.description?html}<#else> #if>
- Modified: ${d.properties.modified?datetime}
- Modified By: ${d.properties.modifier}
- |
- |
-
- Created: ${d.properties.created?datetime}
- Created By: ${d.properties.creator}
- Size: ${(d.size/1000)?string("0.##")} KB
- |
-
-
-
-
- #if>
- #list>
+ <#-- populated via an AJAX call myspacecontent webscript -->
+ <#-- resolved path, filter and home.noderef required as arguments! -->
+
@@ -172,6 +133,7 @@ a.spacefilterLinkSelected:link, a.spacefilterLinkSelected:visited
height: 320px;
width: 720px;
overflow: auto;
+ overflow-y: scroll;
border-top: 1px solid #CCD4DB;
border-bottom: 1px solid #CCD4DB;
visibility: hidden;
@@ -309,4 +271,12 @@ a.spaceBreadcrumbLink:link, a.spaceBreadcrumbLink:visited, a.spaceBreadcrumbLink
-moz-border-radius: 5px;
}
+a.refreshViewLink:link, a.refreshViewLink:visited, a.refreshViewLink:hover
+{
+ font-family: Trebuchet MS, Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ color: #515D6B;
+ text-decoration: none;
+}
+
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/myspacespanel_get_desc.xml b/config/alfresco/templates/webscripts/org/alfresco/portlets/myspacespanel_get_desc.xml
new file mode 100644
index 0000000000..5b728da5af
--- /dev/null
+++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/myspacespanel_get_desc.xml
@@ -0,0 +1,7 @@
+
+ My Spaces Panel
+ Generate the inner panel for the My Spaces portlet page
+
+ user
+ required
+
\ No newline at end of file
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
new file mode 100644
index 0000000000..ab73829e8b
--- /dev/null
+++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/myspacespanel_get_html.ftl
@@ -0,0 +1,45 @@
+<#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))>
+ <#assign count=count+1>
+
+
+ <#if d.isDocument>
+ 
+ <#else>
+ 
+ #if>
+
+
+
+ ${d.name?html}
+
+
+
+
+
+
+
+
+ Description: <#if d.properties.description?exists>${d.properties.description?html}<#else> #if>
+ Modified: ${d.properties.modified?datetime}
+ Modified By: ${d.properties.modifier}
+ |
+ |
+
+ Created: ${d.properties.created?datetime}
+ Created By: ${d.properties.creator}
+ Size: ${(d.size/1000)?string("0.##")} KB
+ |
+
+
+
+
+ #if>
+#list>
+<#-- hidden div with the count value for the page -->
+${count}
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebforms_get_html.ftl b/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebforms_get_html.ftl
index 76a8a5e50d..3fa5151f7c 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebforms_get_html.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebforms_get_html.ftl
@@ -81,6 +81,7 @@
height: 480px;
width: 716px;
overflow: auto;
+ overflow-y: scroll;
}
a.webPreviewLink:link, a.webPreviewLink:visited, a.webPreviewLink:hover
diff --git a/source/java/org/alfresco/web/bean/ajax/FileUploadBean.java b/source/java/org/alfresco/web/bean/ajax/FileUploadBean.java
index 6770b14219..e098631ff7 100644
--- a/source/java/org/alfresco/web/bean/ajax/FileUploadBean.java
+++ b/source/java/org/alfresco/web/bean/ajax/FileUploadBean.java
@@ -55,6 +55,8 @@ import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -64,6 +66,17 @@ import org.w3c.dom.Node;
*/
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.
+ *
+ * "return-page" =
+ * "currentPath" =
+ * and the file item itself
+ *
+ * @throws Exception
+ */
@InvokeCommand.ResponseMimetype(value=MimetypeMap.MIMETYPE_HTML)
public void uploadFile() throws Exception
{
@@ -76,7 +89,6 @@ public class FileUploadBean
List fileItems = upload.parseRequest(request);
FileUploadBean bean = new FileUploadBean();
- String uploadId = null;
String currentPath = null;
String filename = null;
String returnPage = null;
@@ -84,10 +96,6 @@ public class FileUploadBean
for (FileItem item : fileItems)
{
- if (item.isFormField() && item.getFieldName().equals("upload-id"))
- {
- uploadId = item.getString();
- }
if (item.isFormField() && item.getFieldName().equals("return-page"))
{
returnPage = item.getString();
@@ -103,10 +111,13 @@ public class FileUploadBean
item.write(file);
}
}
-
+
+ if (logger.isDebugEnabled())
+ logger.debug("Ajax file upload request: " + filename + " to path: " + currentPath + " return page: " + returnPage);
+
try
{
- if (file != null)
+ if (file != null && currentPath != null && currentPath.length() != 0)
{
// convert cm:name based path to a NodeRef
StringTokenizer t = new StringTokenizer(currentPath, "/");
@@ -188,6 +199,9 @@ public class FileUploadBean
Node scriptText = result.createTextNode(returnPage);
scriptEl.appendChild(scriptText);
+ if (logger.isDebugEnabled())
+ logger.debug("File upload request complete.");
+
ResponseWriter out = fc.getResponseWriter();
XMLUtil.print(result, out);
out.close();
diff --git a/source/java/org/alfresco/web/bean/ajax/NodeInfoBean.java b/source/java/org/alfresco/web/bean/ajax/NodeInfoBean.java
index bee1dab985..de379d848a 100644
--- a/source/java/org/alfresco/web/bean/ajax/NodeInfoBean.java
+++ b/source/java/org/alfresco/web/bean/ajax/NodeInfoBean.java
@@ -26,6 +26,7 @@ package org.alfresco.web.bean.ajax;
import java.io.IOException;
import java.util.Date;
+import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
@@ -60,7 +61,8 @@ public class NodeInfoBean
/**
* Returns information on the node identified by the 'noderef'
- * parameter found in the ExternalContext.
+ * parameter found in the ExternalContext. If no noderef is supplied, then the template
+ * is executed without context.
*
* The result is the formatted HTML to show on the client.
*/
@@ -69,28 +71,26 @@ public class NodeInfoBean
FacesContext context = FacesContext.getCurrentInstance();
ResponseWriter out = context.getResponseWriter();
- String strNodeRef = (String)context.getExternalContext().getRequestParameterMap().get("noderef");
- if (strNodeRef == null || strNodeRef.length() == 0)
- {
- throw new IllegalArgumentException("'noderef' parameter is missing");
- }
-
- String strTemplate = (String)context.getExternalContext().getRequestParameterMap().get("template");
+ Map requestMap = context.getExternalContext().getRequestParameterMap();
+ String strNodeRef = (String)requestMap.get("noderef");
+ String strTemplate = (String)requestMap.get("template");
if (strTemplate == null || strTemplate.length() == 0)
{
strTemplate = "node_summary_panel.ftl";
}
- NodeRef nodeRef = new NodeRef(strNodeRef);
- if (this.nodeService.exists(nodeRef))
+ NodeRef nodeRef = null;
+ if (strNodeRef != null && strNodeRef.length() != 0)
{
- Repository.getServiceRegistry(context).getTemplateService().processTemplate(
- "/alfresco/templates/client/" + strTemplate, getModel(nodeRef), out);
- }
- else
- {
- out.write("Node could not be found in the repository!");
+ nodeRef = new NodeRef(strNodeRef);
+ if (this.nodeService.exists(nodeRef) == false)
+ {
+ out.write("Node could not be found in the repository!");
+ return;
+ }
}
+ Repository.getServiceRegistry(context).getTemplateService().processTemplate(
+ "/alfresco/templates/client/" + strTemplate, getModel(nodeRef, requestMap), out);
}
@@ -109,7 +109,7 @@ public class NodeInfoBean
// ------------------------------------------------------------------------------
// Helper methods
- private Map getModel(NodeRef nodeRef)
+ private Map getModel(NodeRef nodeRef, Map requestMap)
{
FacesContext context = FacesContext.getCurrentInstance();
Map model = new HashMap(8, 1.0f);
@@ -119,10 +119,21 @@ public class NodeInfoBean
model.put("cropContent", new CropContentMethod());
model.put("url", new BaseTemplateContentServlet.URLHelper(
context.getExternalContext().getRequestContextPath()));
- model.put("node", new TemplateNode(
- nodeRef,
- Repository.getServiceRegistry(context),
- this.imageResolver));
+ if (nodeRef != null)
+ {
+ model.put("node", new TemplateNode(
+ nodeRef,
+ Repository.getServiceRegistry(context),
+ this.imageResolver));
+ }
+
+ // add URL arguments as a map called 'args' to the root of the model
+ Map args = new HashMap(4, 1.0f);
+ for (String name : requestMap.keySet())
+ {
+ args.put(name, requestMap.get(name));
+ }
+ model.put("args", args);
return model;
}
diff --git a/source/java/org/alfresco/web/scripts/ScriptUrlMethod.java b/source/java/org/alfresco/web/scripts/ScriptUrlMethod.java
index 82eed62143..a83b099bfe 100644
--- a/source/java/org/alfresco/web/scripts/ScriptUrlMethod.java
+++ b/source/java/org/alfresco/web/scripts/ScriptUrlMethod.java
@@ -26,6 +26,7 @@ package org.alfresco.web.scripts;
import java.util.List;
+import freemarker.template.TemplateBooleanModel;
import freemarker.template.TemplateMethodModelEx;
import freemarker.template.TemplateModelException;
import freemarker.template.TemplateScalarModel;
@@ -64,17 +65,22 @@ public final class ScriptUrlMethod implements TemplateMethodModelEx
{
String result = "";
- if (args.size() == 1)
+ if (args.size() != 0)
{
Object arg0 = args.get(0);
+ boolean prefixServiceUrl = true;
+ if (args.size() == 2 && args.get(1) instanceof TemplateBooleanModel)
+ {
+ prefixServiceUrl = ((TemplateBooleanModel)args.get(1)).getAsBoolean();
+ }
if (arg0 instanceof TemplateScalarModel)
{
String arg = ((TemplateScalarModel)arg0).getAsString();
- String url = req.getServicePath();
+ String url = prefixServiceUrl ? req.getServicePath() : "";
url += arg;
- url += (arg.length() > 0) ? "&" : "";
+ url += (arg.length() != 0) ? "&" : "";
url += "guest=" + (req.isGuest() ? "true" : "");
- url += (req.getFormat().length() > 0) ? "&format=" + req.getFormat() : "";
+ url += (req.getFormat().length() != 0) ? "&format=" + req.getFormat() : "";
result = res.encodeScriptUrl(url);
}
}
diff --git a/source/web/scripts/ajax/myspaces.js b/source/web/scripts/ajax/myspaces.js
index a511560e4d..c986e63e55 100644
--- a/source/web/scripts/ajax/myspaces.js
+++ b/source/web/scripts/ajax/myspaces.js
@@ -5,16 +5,48 @@ var MySpaces = {
DETAIL_MARGIN: 56,
TITLE_FONT_SIZE: 18,
fileInput: null,
+ Path: null,
+ Filter: null,
+ Home: null,
start: function()
{
if ($('spacePanel'))
{
- MySpaces.parseSpacePanels();
- $('spacePanel').setStyle('visibility', 'visible');
+ // fire off the ajax request to populate the spaces list - the 'myspacespanel' webscript
+ // 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,
+ {
+ success: function(response)
+ {
+ // push the response into the space panel div
+ $('spacePanel').setHTML(response.responseText);
+ // extract the count value from a hidden div and display it
+ $('spaceCount').setHTML($('spaceCountValue').innerHTML);
+ // wire up all the events and animations
+ MySpaces.init();
+ },
+ failure: function(response)
+ {
+ $('spacePanel').setHTML("Sorry, preview currently unavailable.");
+ }
+ }
+ );
}
},
+
+ init: function()
+ {
+ MySpaces.parseSpacePanels();
+ $('spacePanel').setStyle('visibility', 'visible');
+ },
+ /**
+ * Perform the operations required to add the events and animations required to anim various
+ * nodes when the user mouseovers and clicks on rows in the space panel
+ */
parseSpacePanels: function()
{
var spaces = $$('#spacePanel .spaceRow');
@@ -256,8 +288,9 @@ var MySpaces = {
{
if (error == null)
{
- // TODO: refresh!
- alert("Uploaded: " + fileName);
+ // empty the main panel div and restart by reloading the panel contents
+ $('spacePanel').empty();
+ MySpaces.start();
}
else
{
| |