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

Install Extension
URL of your MindTouch install (ex: http://www.mindtouch.com)
    

 

Table of Contents

Description

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.

Purpose

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.

DekiScript Functions

timeline()

activitystream.timeline(username : str, max : int?, skip : int?, ascending : bool?) : map
  • username - the user who's timelines to fetch (required)
  • max - maximum timeline items to fetch (optional, default: 50)
  • skip - offset from beginning of list, used for paging the timeline (optional, default: 0)
  • ascending - return in ascending (oldest first) order (optional, default: false)

 

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>)
    },
    ...
]

Service Features

GET:timeline/{username}

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>

DELETE: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

DELETE:timeline/{username}

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

Install

Pre-requisite Extensions

Extension Configuration

Required (we cannot provide a default)

  • apikey - Apikey for accessing deki

Optional (general)

  • uri.deki - Uri to deki instance (default: http://localhost:8081/deki)
  • wikiid - Wiki instance to query (default: default)
  • cache-ttl - Seconds to cache page and user data (default: 10*60 seconds)
  • timeline-ttl - Days to keep timeline entries (30 days default)

Optional (to use email notification of @user notifications)

  • email-sender - The email address notification should be sent from (required for email notifications)
  • email-subject - The email subject for notifications (required for email notifications)
  • uri.email - Emailer service (default: {uri.deki}/mailer/message)

Template:Timeline

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="{{&quot;dekitl-item&quot;; entry.reply ? &quot; dekitl-at&quot; : &quot;&quot;;}}" 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&amp;{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>

Template:SendMessage

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>

Template:ClearTimeline

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>

Template:ClearTimelineAdmin

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>

 

Files 1

FileSizeDateAttached by 
mindtouch.activitystream.dll
Hotfix 1 for 9.2.4 release
44 kB17:39, 7 Aug 2009arnecActions
You must login to post a comment.