DocLib file upload posting to Activities service. Fixes for hash updates in browser address bar. More placeholder images for DocLib actions. Fix to json.status.ftl to pass YAHOO JSON isValid() test.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@9681 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mike Hatfield
2008-07-08 14:35:29 +00:00
parent ae8d81fa5d
commit f14738c917
9 changed files with 162 additions and 6 deletions

View File

@@ -0,0 +1,17 @@
<#assign username=userId>
<#if firstName?exists>
<#assign username = firstName + " " + lastName>
</#if>
<entry xmlns='http://www.w3.org/2005/Atom'>
<title>${fileName!"File uploaded"}</title>
<link rel="alternate" type="text/html" href="${browseURL?replace("&", "&amp;")}" />
<id>${id}</id>
<updated>${xmldate(date)}</updated>
<summary type="html">
<![CDATA[${username} added <a href="${contentURL}">${fileName}</a> to the <a href="${browseURL}">Document Library</a>.]]>
</summary>
<author>
<name>${userId!""}</name>
</author>
</entry>

View File

@@ -0,0 +1,11 @@
<#assign username=userId>
<#if firstName?exists>
<#assign username = firstName + " " + lastName>
</#if>
<item>
<title>${fileName!"File uploaded"}</title>
<link>${browseURL?replace("&", "&amp;")}</link>
<guid>${id}</guid>
<description>${username} added ${fileName} to the Document Library.</description>
</item>

View File

@@ -0,0 +1,17 @@
<#assign username=userId>
<#if firstName?exists>
<#assign username = firstName + " " + lastName>
</#if>
<entry xmlns='http://www.w3.org/2005/Atom'>
<title>${fileCount!"Many"} files uploaded</title>
<link rel="alternate" type="text/html" href="${browseURL?replace("&", "&amp;")}" />
<id>${id}</id>
<updated>${xmldate(date)}</updated>
<summary type="html">
<![CDATA[${username} added ${fileCount!"multiple"} files to the <a href="${browseURL}">Document Library</a>.]]>
</summary>
<author>
<name>${userId!""}</name>
</author>
</entry>

View File

@@ -0,0 +1,11 @@
<#assign username=userId>
<#if firstName?exists>
<#assign username = firstName + " " + lastName>
</#if>
<item>
<title>${fileCount!"Many"} files uploaded</title>
<link>${browseURL?replace("&", "&amp;")}</link>
<guid>${id}</guid>
<description>${username} added ${fileCount!"multiple"} files to the Document Library.</description>
</item>

View File

@@ -1,8 +1,9 @@
{
status :
{
"code" : "200,
"name" : "OK",
"description" : "Hardcoded response template"
}
"nodeRef": "${upload.nodeRef}",
"status":
{
"code": 200,
"name": "OK",
"description" : "File uploaded successfully"
}
}

View File

@@ -0,0 +1,8 @@
<webscript>
<shortname>activity</shortname>
<description>Document List Component - activity data webscript</description>
<url>/slingshot/doclib/activity</url>
<format default="json"></format>
<authentication>user</authentication>
<transaction>required</transaction>
</webscript>

View File

@@ -0,0 +1,52 @@
/**
* Document List Component: activity
*/
postActivity();
/* Posts to the activities service after a Document Library action */
function postActivity()
{
var obj = {};
var type = json.get("type");
if (type == null || type.length == 0)
{
status.setCode(status.STATUS_BAD_REQUEST, "Activity type missing when posting activity");
return;
}
var siteId = json.get("siteId");
if (siteId == null || siteId.length == 0)
{
status.setCode(status.STATUS_BAD_REQUEST, "SiteId missing when posting activity");
return;
}
switch (String(type).toLowerCase())
{
case "file-added":
obj.browseURL = json.get("browseURL");
obj.contentURL = json.get("contentURL");
obj.fileName = json.get("fileName");
break;
case "files-added":
obj.browseURL = json.get("browseURL");
obj.fileCount = json.get("fileCount");
break;
}
try
{
// Log to activity service
activities.postActivity("org.alfresco.documentlibrary." + type, siteId, "documentlibrary", jsonUtils.toJSONString(obj));
}
catch(e)
{
if (logger.isLoggingEnabled())
{
logger.log(e);
}
}
}

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<channel rdf:about="http://www.alfresco.com/">
<title>Alfresco - Documents</title>
<link>${absurl(url.context)}/</link>
<description>Alfresco Document List</description>
<lastBuildDate>${xmldate(date)}</lastBuildDate>
<pubDate>${xmldate(date)}</pubDate>
<generator>Alfresco ${server.edition} v${server.version}</generator>
<image>
<title>Alfresco - My Documents</title>
<url>${absurl(url.context)?replace("alfresco", "slingshot/proxy/alfresco")}/images/logo/AlfrescoLogo200.png</url>
</image>
<#list doclist.items as item>
<#assign d = item.asset>
<#if d.isDocument>
<#assign isImage=(d.mimetype="image/gif" || d.mimetype="image/jpeg" || d.mimetype="image/png")>
<#assign isMP3=(d.mimetype="audio/x-mpeg" || d.mimetype="audio/mpeg")>
<item>
<title>${d.name?html}</title>
<#assign navurl='/navigate/showDocDetails/' + d.nodeRef.storeRef.protocol + '/' + d.nodeRef.storeRef.identifier + '/' + d.nodeRef.id>
<link>${absurl(url.context)?replace("alfresco", "slingshot/proxy/alfresco")}/api/node/content/${d.storeType}/${d.storeId}/${d.id}/${d.name?url}</link>
<#if isMP3>
<enclosure url="api/node/content/${d.storeType}/${d.storeId}/${d.id}/${d.name?url}" length="${d.size?string?replace(",","")}" type="audio/mpeg"/>
</#if>
<description>
<#if isImage || true>&lt;img src=&quot;${absurl(url.context)?replace("alfresco", "slingshot/proxy/alfresco")}/api/node/content/${d.storeType}/${d.storeId}/${d.id}/${d.name?url}&quot;&gt;&lt;br/&gt;</#if>
<#if d.properties.description?exists>${d.properties.description?html}</#if>
</description>
<pubDate>${xmldate(d.properties.modified)}</pubDate>
<guid isPermaLink="false">${d.id}</guid>
</item>
</#if>
</#list>
</channel>
</rss>