Hello, my name is Jeroen. Im a MSc. student information sciences at Tilburg University, the Netherlands.
Im working on my graduation thesis which is about wiki usage in higher education.

Please leave a message after the beep (which you'll hear eventually if you listen long enough).




Draft. Recently edited social awareness functionality


Patch description
If you open a WikiPage in edit mode (invoke the edit page handler),
a display of social awareness information might come in handy (eg. for collaboration purposes).
This patch displays an overview of users who recently opened the WikiPage in edit mode, on a per-page basis.

If you want this functionality you need to do the following:

1. Create new table to log necessary information.

CREATE TABLE yourprefix_log (
  id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  handler VARCHAR(30) NOT NULL DEFAULT '',
  tag VARCHAR(75) NOT NULL DEFAULT '0',
  username VARCHAR(255) NOT NULL DEFAULT '',
  accessed_at datetime NOT NULL,
  PRIMARY KEY  (id)
) TYPE=MyISAM;


2. Patch edit page handler, handler/page/edit.php

After the following existing code snippet in edit.php (wikka v1.1.6.0):

// append a comment?
if ($_REQUEST['appendcomment'])
{
    $body = trim($body)."\n\n----\n\n--".$this->GetUserName().' ('.strftime("%c").')';
}


Add the following code, after line 124

//PATCH BEGIN
// indicates the number of minutes logs will be shown, eg. 5 = display users who accessed page in last 5 minutes and purge the rest
$minutes_interval = 30;
                       
// first purge old showlogs
$deletebool = $this->Query("DELETE FROM ".$this->config["table_prefix"]."log WHERE handler=\"edit\" AND tag=\"" . $this->GetPageTag() . "\" AND accessed_at < (NOW() - INTERVAL " . $minutes_interval . " MINUTE)");

// if latest page version insert record in viewlog
$insertbool = $this->Query("INSERT INTO ".$this->config["table_prefix"]."log VALUES(\"\", \"edit\", \"" . $this->GetPageTag(). "\", \"" . $this->GetUserName() . "\", NOW()" . ")");
           
if($insertbool && $deletebool) $ispurged = true;
           
$lastusers = $this->LoadAll("SELECT * FROM ".$this->config["table_prefix"]."log WHERE handler=\"edit\" AND tag=\"" . $this->GetPageTag() . "\" AND accessed_at >= (NOW() - INTERVAL " . $minutes_interval . " MINUTE) GROUP BY username ORDER by username DESC");
           
foreach ($lastusers as $lastuser){             
   if($lastuser["username"] != $this->GetUserName()) {
       if($x > 0) $userstoprint .= "::";
       $userstoprint .= $this->Format($lastuser["username"]);
       $x++;
   }
}

if($userstoprint) $lastusersmessage = "In the last " . $minutes_interval . " minutes, the following users opened this page in edit mode:<p>" .$userstoprint . "</p>\n";
           
$output .= $lastusersmessage;
//PATCH END


After this you should be ready to play ball. Try playing around with a couple of different users who open the same page in edit mode and you'll see what this patch does. Please provide feedback if you think whether this is (not) usefull.


CategoryUsers
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki