| Vendor | MindTouch |
| Type | Native |
| Categories | Communication |
| Requires | MindTouch 9.02 or later |
| OS Restriction | None |
| Status | Stable |
| License | Standard/Enterprise |
| SID (service id) | sid://mindtouch.com/std/2009/04/activitystream |
| Assembly | mindtouch.activitystream |
Table of Contents
This extension creates per user timelines of comment and other activity.
See also How to add an extension, Using the Extension Dialog, Learn about DekiScript, Extensions Directory.
ActivityStream uses the Deki Event Bus to create a timeline of comment activity and messages sent to the user using @username addressing. It exists both for the purpose of tracking a user's activity and to be able to easily notify another user by means of an activity event.
activitystream.timeline(username : str, max : int?, skip : int?, ascending : bool?) : map
Return data fo:
[
{
title: <type of activity>,
content: <activity message>,
time: <datetime of activity>
user: <user object function pointer>,
page: <page object function pointer>,
reply: (true|false),
replyuser: (nil|<reply user object function pointer>)
},
...
]
Retrieves the timeline for {username} as an Xml document
Accces: Public
Request
| Parameter | Type | Description |
| max | int? | The maximum items to return. (optional, unlimited by default) |
| skip | int? | The offset from the beginning of the list (optional, default: 0) |
| ascending | bool? | return in ascending (oldest first) order (optional, default: false) |
Response
| Response | Response Body | Description |
| Ok (200) | see below | operation completed successfully |
| Bad Request (400) | text/html | request could not be completed, because of invalid data in the request |
<timeline>
<event event-time="2009-05-07T20:42:17Z">
<path>{path of the activity event, if not a comment}</path>
<content>{message content}</content>
<page href="..." id="..." />
<user href="..." id="..." />
<!-- included if this an event from another user's timeline and refers to the recipient,
i.e. the user mentioned as @username -->
<user.reply href="..." id="..." />
</event>
</timeline>
Clears the current user's timeline. I.e. it uses the Deki session to determine who the caller is and clear's that user's timeline
Accces: Public, but requires a Deki session cookie
Response
| Response | Response Body | Description |
| Ok (200) | text/html | operation completed successfully |
| Bad Request (400) | text/html | request could not be completed, because of invalid data in the request |
Clears the timeline for {username}.
Accces: Internal (i.e. requires apikey)
Response
| Response | Response Body | Description |
| Ok (200) | text/html | operation completed successfully |
| Bad Request (400) | text/html | request could not be completed, because of invalid data in the request |
Required (we cannot provide a default)
Optional (general)
Optional (to use email notification of @user notifications)
The Timeline template is used to render the output of the activitystream.timeline() dekiscript and mostly shares its signature:
timeline(username, max, skip)
The template uses DekiAPI javascript to reload the timeline section of the page every 10 seconds. The template must be manually created with the below content pasted into the editor in source mode:
<pre class="script">
// includes
dekiapi();
jquery.ui('smoothness');
</pre>
<div><style type="text/css">/*<![CDATA[*/
#deki-timeline {
font-size: 12px;
margin: 12px 0;
}
div.dekitl-item {
overflow: auto;
padding: 8px;
}
div.dekitl-at {
background-color: #ffffce;
}
div.dekitl-user {
width: 60px;
float: left;
text-align: center;
font-weight: strong;
}
div.dekitl-user a img {
border: none;
}
div.dekitl-title,
div.dekitl-title a {
color: #333;
}
div.dekitl-message {
padding-left: 70px;
}
div.dekitl-message span {
font-size: 11px;
color: #666;
font-style: italic;
}
div.dekitl-message p {
margin: 0;
padding: 4px 0;
font-size: 14px;
}
/*]]>*/</style></div>
<div ctor=" when(@update) {
Deki.Api.Reload(this);
timelineWait();
}" id="timeline_block">
<div id="deki-timeline" class="deki-timeline">
<div init=" var username = $0 ?? $username ?? user.name;
var max = $1 ?? $max ?? 50; var skip = $2 ?? $skip ?? 0;" class="{{"dekitl-item"; entry.reply ? " dekitl-at" : "";}}" foreach="var entry in activitystream.timeline(username, max, skip)" block=" var user = entry.user,
page = entry.page;">
<div class="dekitl-user"><a href="{{user.uri}}" rel="internal" target="_blank"><img src="{{user.gravatar&{s:60}}}" alt="" /><br />
{{ user.name }} </a></div>
<div class="dekitl-message">
<div class="dekitl-title">{{ entry.title }} on page <a href="{{page.uri}}" title="{{ page.title }}" rel="internal" target="_blank">{{ page.title }}</a></div>
<p>{{ entry.content }} <span class="dekitl-timestamp">{{ entry.time }}</span></p>
</div>
</div>
</div>
<script type="text/jem">/*<![CDATA[*/
var update = Deki.$('#update');
function timelineWait() { setTimeout(function() {@update();}, 10000)};
timelineWait();
/*]]>*/</script></div>
The sendmessage() template create a simple form that allows users to send messages to other users outside the scope of comments. Messages are sent as @replies. The template must be manually created with the below content pasted into the editor in source mode:
// includes
dekiapi();
jquery.ui('smoothness');
// input form
<form>
"What: "; <input id="todowhat" type="text" />
" Who: ";
<select id="todowho">
foreach(var u in site.users where !u.anonymous) {
<option value=(u.name) selected=((u.id == user.id) ? 'selected' : nil)>u.name</option>
}
</select>
<input id="todoadd" type="button" value="Send" ctor="
when($this.click) {
@todosend({ entry: { what: #todowhat.val(), who: #todowho.val()}});
#todowhat.val('');
#todoadd.val('Send');
#todoadd.blur();
}
when(@todosend) {
Deki.Api.PostMessage(null, 'activity/poke',
'@'+ @todosend.entry.who+': '+ @todosend.entry.what );
}
" />
</form>
The cleartimeline() template creates a button that will clear the current user's timeline. The template must be manually created with the below content pasted into the editor in source mode:
// includes
dekiapi();
jquery.ui('smoothness');
// input form
<form>
<input id="clearexec" type="button" value="Clear Timeline"
ctor="
when($this.click) {
@clearsend();
#clearexec.blur();
}
when(@clearsend) {
Deki.$.ajax({
type: 'DELETE',
url: {{activitystream.uri}}+'/timeline',
});
}
" />
</form>
The cleartimelineadmin() template creates a form for someone with access to the apikey to clear the timeline of a specific user. The template must be manually created with the below content pasted into the editor in source mode:
// includes
dekiapi();
jquery.ui('smoothness');
// input form
<form>
"Key: "; <input id="clearkey" type="text" />
" Who: ";
<select id="clearwho">
foreach(var u in site.users where !u.anonymous) {
<option value=(u.name) selected=((u.id == user.id) ? 'selected' : nil)>u.name</option>
}
</select>
<input id="clearexec" type="button" value="Clear Timeline"
ctor="
when($this.click) {
@clearsend({ entry: { key: #clearkey.val(), who: #clearwho.val()}});
#clearexec.blur();
}
when(@clearsend) {
Deki.$.ajax({
type: 'DELETE',
url: {{activitystream.uri}}+'/timeline/'+@clearsend.entry.who+'?apikey='+@clearsend.entry.key,
});
}
" />
</form>
| File | Size | Date | Attached by | |||
|---|---|---|---|---|---|---|
| mindtouch.activitystream.dll Hotfix 1 for 9.2.4 release | 44 kB | 17:39, 7 Aug 2009 | arnec | Actions | ||
| Images 0 | ||
|---|---|---|
| No images to display in the gallery. |