mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Added activity feed templates for event edit. Fixed date display problem. All edited details are now updated.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@9512 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
<entry xmlns='http://www.w3.org/2005/Atom'>
|
||||||
|
<title>Event deleted: ${eventName!""}</title>
|
||||||
|
<icon></icon>
|
||||||
|
<id>${id}</id>
|
||||||
|
<updated>${xmldate(date)}</updated>
|
||||||
|
<summary>
|
||||||
|
${firstName!"anon"} ${lastName!""} just updated the event ${eventName}.</summary>
|
||||||
|
<author>
|
||||||
|
<name>${userId!""}</name>
|
||||||
|
</author>
|
||||||
|
</entry>
|
||||||
|
|
@@ -0,0 +1,7 @@
|
|||||||
|
<item>
|
||||||
|
<title>Event deleted: ${eventName!""}</title>
|
||||||
|
<link></link>
|
||||||
|
<guid>${id}</guid>
|
||||||
|
<description>${firstName!"anon"} ${lastName!""} just updated the event ${eventName}.</description>
|
||||||
|
</item>
|
||||||
|
|
@@ -27,30 +27,30 @@ function getTemplateParams()
|
|||||||
|
|
||||||
function main()
|
function main()
|
||||||
{
|
{
|
||||||
var params = getTemplateParams();
|
var params = getTemplateParams();
|
||||||
if (params === null)
|
if (params === null)
|
||||||
{
|
{
|
||||||
return status.STATUS_BAD_REQUEST;
|
return status.STATUS_BAD_REQUEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the site
|
// Get the site
|
||||||
var site = siteService.getSite(params.siteid);
|
var site = siteService.getSite(params.siteid);
|
||||||
if (site === null)
|
if (site === null)
|
||||||
{
|
{
|
||||||
return status.STATUS_NOT_FOUND;
|
return status.STATUS_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
var eventsFolder = site.getContainer("calendar");
|
var eventsFolder = site.getContainer("calendar");
|
||||||
if (eventsFolder === null)
|
if (eventsFolder === null)
|
||||||
{
|
{
|
||||||
return status.STATUS_NOT_FOUND;
|
return status.STATUS_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
var event = eventsFolder.childByNamePath(params.eventname);
|
var event = eventsFolder.childByNamePath(params.eventname);
|
||||||
if (event === null)
|
if (event === null)
|
||||||
{
|
{
|
||||||
return status.STATUS_NOT_FOUND;
|
return status.STATUS_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
var props = [
|
var props = [
|
||||||
"what",
|
"what",
|
||||||
@@ -58,32 +58,51 @@ function main()
|
|||||||
"where"
|
"where"
|
||||||
];
|
];
|
||||||
|
|
||||||
var propsmap = {
|
var propsmap = {
|
||||||
"what" : "ia:whatEvent",
|
"what" : "ia:whatEvent",
|
||||||
"desc" : "ia:descriptionEvent",
|
"desc" : "ia:descriptionEvent",
|
||||||
"where" : "ia:whereEvent"
|
"where" : "ia:whereEvent"
|
||||||
};
|
};
|
||||||
|
|
||||||
for (var i=0; i < props.length; i++)
|
for (var i=0; i < props.length; i++)
|
||||||
{
|
{
|
||||||
var prop = props[i];
|
var prop = props[i];
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var value = json.get(prop);
|
var value = json.get(prop);
|
||||||
// TODO: deal with formatting date strings correctly
|
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
event.properties[ propsmap[prop] ] = value;
|
event.properties[ propsmap[prop] ] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(e)
|
catch(e)
|
||||||
{
|
{
|
||||||
// Couldn't find the property in the JSON data
|
// Couldn't find the property in the JSON data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Handle date formatting as a separate case
|
||||||
|
var from = new Date(json.get("from") + " " + json.get("start"));
|
||||||
|
event.properties["ia:fromDate"] = from;
|
||||||
|
|
||||||
|
var to = new Date(json.get("to") + " " + json.get("end"));
|
||||||
|
event.properties["ia:toDate"] = to;
|
||||||
|
|
||||||
|
var eventName = json.get("what");
|
||||||
|
activities.postActivity("org.alfresco.calendar.event-updated", params.siteid, "calendar", '{ "eventName" : ' + eventName + ' }');
|
||||||
|
}
|
||||||
|
catch(e)
|
||||||
|
{
|
||||||
|
if (logger.isLoggingEnabled())
|
||||||
|
{
|
||||||
|
logger.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
event.save();
|
event.save();
|
||||||
return status.STATUS_NO_CONTENT;
|
return status.STATUS_NO_CONTENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
var response = main();
|
var response = main();
|
||||||
|
Reference in New Issue
Block a user