Finally set up registration into *activitystream_events* table by creating a
page with groovy as source and calling it from footer.vm
*CALL FROM footer.vm:*
#set($g=$xwiki.parseGroovyFromPage("UserActivity.ViewEventRegistrationMacro"))
#set($s=$g.log($xwiki,$doc))
$s
*PAGE SOURCE OF ViewEventRegistrationMacro PAGE:*
import java.util.Date;
import com.xpn.xwiki.plugin.activitystream.impl.ActivityStreamImpl;
import com.xpn.xwiki.plugin.activitystream.impl.ActivityEventImpl;
import com.xpn.xwiki.plugin.activitystream.api.ActivityEventPriority;
class ViewEventRegistrationMacro
{
String log(xwiki,doc)
{
def xcontext=doc.getXWikiContext();
def action="";
try { action=xcontext.getContext().action } catch(e) {}
def ast=new ActivityStreamImpl();
def event = new ActivityEventImpl();
event.setStream("");
event.setPage(doc.getFullName());
event.setDate(new Date());
event.setPriority(ActivityEventPriority.NOTIFICATION);
event.setType("view");
event.setTitle("");
event.setBody("");
event.setVersion(doc.getVersion());
event.setUser(xcontext.getLocalUser());
event.setHidden(false);
event.setParam1(xcontext.getContext().toString());
ast.addActivityEvent(event, doc.getDocument(), xcontext);
return "<div style='font-size: 8px; color: rgb(204, 204,
204);'>View
stat is on</div>";
}
}
--
View this message in context:
http://xwiki.475771.n2.nabble.com/User-activity-log-tp7594888p7594978.html
Sent from the XWiki- Users mailing list archive at
Nabble.com.