mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
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:
@@ -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("&", "&")}" />
|
||||
<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>
|
||||
|
@@ -0,0 +1,11 @@
|
||||
<#assign username=userId>
|
||||
<#if firstName?exists>
|
||||
<#assign username = firstName + " " + lastName>
|
||||
</#if>
|
||||
<item>
|
||||
<title>${fileName!"File uploaded"}</title>
|
||||
<link>${browseURL?replace("&", "&")}</link>
|
||||
<guid>${id}</guid>
|
||||
<description>${username} added ${fileName} to the Document Library.</description>
|
||||
</item>
|
||||
|
@@ -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("&", "&")}" />
|
||||
<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>
|
||||
|
@@ -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("&", "&")}</link>
|
||||
<guid>${id}</guid>
|
||||
<description>${username} added ${fileCount!"multiple"} files to the Document Library.</description>
|
||||
</item>
|
||||
|
@@ -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"
|
||||
}
|
||||
}
|
||||
|
@@ -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>
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"success": true
|
||||
}
|
@@ -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><img src="${absurl(url.context)?replace("alfresco", "slingshot/proxy/alfresco")}/api/node/content/${d.storeType}/${d.storeId}/${d.id}/${d.name?url}"><br/></#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>
|
Reference in New Issue
Block a user