Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Wire up 'ACTIVITY'
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Jul 12, 2014
1 parent 21d7d9d commit d44855b
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 19 deletions.
2 changes: 1 addition & 1 deletion core/src/plugins/access.fs/fsTemplatePart.xml
Expand Up @@ -15,7 +15,7 @@
<div id="topPane" ajxpClass="AjxpPane" ajxpOptions=''>
<div id="navigation_pane" ajxpClass="AjxpPane" ajxpOptions='{"fit":"height","replaceScroller":true}' >
<h3 class="colorcode-alert">Alerts <small id="alerts_toggler" class="simple-toggler-show" ajxpClass="VisibilityToggler" ajxpOptions='{"widget_id":"notif_pane"}'>show</small></h3>
<div style="display:none;" id="notif_pane" ajxpClass="FetchedResultPane" ajxpOptions='{"fit":"content", "columnsDef":[{"attributeName":"ajxp_label", "messageId":1, "sortType":"String"},{"attributeName":"event_time", "messageString":"Time", "sortType":"MyDate"},{"attributeName":"event_type", "messageString":"Type", "sortType":"String"}], "reloadOnServerMessage":"tree/reload_user_feed", "silentLoading":true, "groupByData":"event_type", "fixedSortColumn":"event_time", "fixedSortDirection":"desc","nodeProviderProperties":{"get_action":"get_my_feed", "connexion_discrete":true, "format":"xml", "current_repository":"true", "merge_description":"true"}}'></div>
<div style="display:none;" id="notif_pane" ajxpClass="FetchedResultPane" ajxpOptions='{"fit":"content", "columnsDef":[{"attributeName":"ajxp_label", "messageId":1, "sortType":"String"},{"attributeName":"event_time", "messageString":"Time", "sortType":"MyDate"},{"attributeName":"event_type", "messageString":"Type", "sortType":"String"}], "reloadOnServerMessage":"tree/reload_user_feed", "silentLoading":true, "fixedSortColumn":"event_time", "fixedSortDirection":"desc","nodeProviderProperties":{"get_action":"get_my_feed", "connexion_discrete":true, "format":"xml", "current_repository":"true", "feed_type":"alert", "merge_description":"true"}}'></div>
<h3 class="colorcode-bookmark">Bookmarks <small id="bookmarks_toggler" class="simple-toggler-show" ajxpClass="VisibilityToggler" ajxpOptions='{"widget_id":"flagged_elements"}'>show</small></h3>
<div style="display:none;" id="flagged_elements" ajxpClass="FetchedResultPane" ajxpOptions='{"replaceScroller":false, "fit":"content", "silentLoading":true, "nodeProviderProperties":{"get_action":"search", "query":"keyword:ajxp_bookmarked"},"reloadOnServerMessage":"tree/reload_bookmarks", "connexion_discrete":true}'></div>
<h3 class="colorcode-shared">Shared <small id="shared_files_toggler" class="simple-toggler-show" ajxpClass="VisibilityToggler" ajxpOptions='{"widget_id":"shared_files_list"}'>show</small></h3>
Expand Down
Expand Up @@ -128,7 +128,12 @@ public function loadUserFeed($actionName, $httpVars, $fileVars)
}
$offset = isSet($httpVars["offset"]) ? intval($httpVars["offset"]): 0;
$limit = isSet($httpVars["limit"]) ? intval($httpVars["limit"]): 15;
$res = $this->eventStore->loadEvents($authRepos, $userId, $userGroup, $offset, $limit, /*(isSet($httpVars["repository_id"])?false:true)*/false);
if(!isSet($httpVars["feed_type"]) || $httpVars["feed_type"] == "notif" || $httpVars["feed_type"] == "all"){
$res = $this->eventStore->loadEvents($authRepos, isSet($httpVars["path"])?$httpVars["path"]:"", $userGroup, $offset, $limit, false, $userId);
}else{
$res = array();
}

$mess = ConfService::getMessages();
$format = "html";
if (isSet($httpVars["format"])) {
Expand All @@ -144,7 +149,9 @@ public function loadUserFeed($actionName, $httpVars, $fileVars)
}

// APPEND USER ALERT IN THE SAME QUERY FOR NOW
$this->loadUserAlerts("", array_merge($httpVars, array("skip_container_tags" => "true")), $fileVars);
if(!isSet($httpVars["feed_type"]) || $httpVars["feed_type"] == "alert" || $httpVars["feed_type"] == "all"){
$this->loadUserAlerts("", array_merge($httpVars, array("skip_container_tags" => "true")), $fileVars);
}
restore_error_handler();
$index = 1;
foreach ($res as $n => $object) {
Expand Down Expand Up @@ -188,8 +195,12 @@ public function loadUserFeed($actionName, $httpVars, $fileVars)
// Replace PATH, to make sure they will be distinct children of the loader node
$node->real_path = $node->getPath();
$node->setLabel(basename($node->getPath()));
if(isSet($httpVars["merge_description"])){
$node->setLabel(basename($node->getPath())." <small>".$node->event_description."</small>");
if(isSet($httpVars["merge_description"]) && $httpVars["merge_description"] == "true"){
if(isSet($httpVars["description_as_label"]) && $httpVars["description_as_label"] == "true"){
$node->setLabel($node->event_description." ".$node->event_date);
}else{
$node->setLabel(basename($node->getPath())." <small class='notif_desc'>".$node->event_description." ".$node->event_date."</small>");
}
}
$url = parse_url($node->getUrl());
$node->setUrl($url["scheme"]."://".$url["host"]."/notification_".$index);
Expand Down Expand Up @@ -238,10 +249,10 @@ public function loadUserAlerts($actionName, $httpVars, $fileVars)
if (isSet($httpVars["repository_id"]) && $u->mergedRole->canRead($httpVars["repository_id"])) {
$repositoryFilter = $httpVars["repository_id"];
}
$res = $this->eventStore->loadAlerts($userId, $repositoryFilter);
if ($repositoryFilter == null) {
$repositoryFilter = ConfService::getRepository()->getId();
}
$res = $this->eventStore->loadAlerts($userId, $repositoryFilter);
if(!count($res)) return;

$format = $httpVars["format"];
Expand Down
42 changes: 41 additions & 1 deletion core/src/plugins/core.notifications/class.NotificationLoader.js
Expand Up @@ -31,7 +31,7 @@ Class.create("NotificationLoader", {

initialize: function(){

if(window.ajxpMinisite || document.documentElement.hasClassName('ajxp_theme_orbit')) return;
if(window.ajxpMinisite || window.ajxpNoNotifLoader) return;

var rP = new RemoteNodeProvider();
rP.initProvider({get_action:'get_my_feed', format:'xml', connexion_discrete:true});
Expand Down Expand Up @@ -293,6 +293,46 @@ Class.create("NotificationLoader", {
var offset = protoMenu.computeAnchorOffset();
protoMenu.container.setStyle(offset);
protoMenu.correctWindowClipping(protoMenu.container, offset, dim);
},

loadInfoPanel : function(container, node){
container.down("#ajxp_activity_panel").update('<div class="panelHeader" style="display: none;">'+(node.isLeaf()?'File Activity':'Folder Activity')+'</div><div id="activity_results">Nothing</div>');
var resultPane = container.down("#activity_results");
var fRp = new FetchedResultPane(resultPane, {
"fit":"content",
"columnsDef":[
{"attributeName":"ajxp_label", "messageId":1, "sortType":"String"},
{"attributeName":"event_time", "messageString":"Time", "sortType":"MyDate"},
{"attributeName":"event_type", "messageString":"Type", "sortType":"String"}],
"silentLoading":true,
"fixedSortColumn":"event_time",
"fixedSortDirection":"desc",
"nodeProviderProperties":{
"get_action":"get_my_feed",
"connexion_discrete":true,
"format":"xml", "current_repository":"true",
"feed_type":"notif",
"limit":5,
"path":(node.isLeaf() || node.isRoot()?node.getPath():node.getPath()+'/'),
"merge_description":"true",
"description_as_label":node.isLeaf()?"true":"false"
}});
var pane = container.up('[ajxpClass="InfoPanel"]');
fRp._rootNode.observe("loaded", function(){
if(pane && pane.ajxpPaneObject){
window.setTimeout(function(){
pane.ajxpPaneObject.resize();
},0.2);
}
if(!fRp._rootNode.getChildren().length){
container.down('#ajxp_activity_panel > div.panelHeader').hide();
}else{
container.down('#ajxp_activity_panel > div.panelHeader').show();
}
});
fRp.showElement(true);

// TODO , RESIZE CONTAINER PANEL WHEN DATAMODEL IS REFRESHED - OR HIDE THE TITLE
}

});
Expand Down
Expand Up @@ -43,14 +43,15 @@ public function persistEvent($hookName, $data, $repositoryId, $repositoryScope,
/**
* @abstract
* @param array $filterByRepositories
* @param string $userId
* @param $filterByPath
* @param string $userGroup
* @param integer $offset
* @param integer $limit
* @param boolean $enlargeToOwned
* @param string $userId
* @return AJXP_Notification[]
*/
public function loadEvents($filterByRepositories, $userId, $userGroup, $offset = 0, $limit = 10, $enlargeToOwned = true);
public function loadEvents($filterByRepositories, $filterByPath, $userGroup, $offset = 0, $limit = 10, $enlargeToOwned = true, $userId);

/**
* @abstract
Expand Down
13 changes: 13 additions & 0 deletions core/src/plugins/core.notifications/manifest.xml
Expand Up @@ -71,6 +71,19 @@
<serverCallback methodName="persistChangeHookToFeed" hookName="node.change" defer="true"/>
<serverCallback methodName="persistNotificationToAlerts" hookName="msg.notification"/>
</hooks>
<client_configs>
<component_config className="InfoPanel">
<infoPanelExtension mime="generic_dir,generic_file" attributes="" modifier="NotificationLoader.prototype.loadInfoPanel">
<messages>
<message key="type_string" id="share_center.50"/>
</messages>
<html><![CDATA[
<div id="ajxp_activity_panel">
</div>
]]></html>
</infoPanelExtension>
</component_config>
</client_configs>
</registry_contributions>
<dependencies>
<activePlugin pluginName="core.conf"/>
Expand Down
41 changes: 31 additions & 10 deletions core/src/plugins/feed.sql/class.AJXP_SqlFeedStore.php
Expand Up @@ -84,13 +84,15 @@ public function persistEvent($hookName, $data, $repositoryId, $repositoryScope,

/**
* @param array $filterByRepositories
* @param string $userId
* @param $filterByPath
* @param string $userGroup
* @param integer $offset
* @param integer $limit
* @param bool $enlargeToOwned
* @param string $userId
* @return An array of stdClass objects with keys hookname, arguments, author, date, repository
*/
public function loadEvents($filterByRepositories, $userId, $userGroup, $offset = 0, $limit = 10, $enlargeToOwned = true)
public function loadEvents($filterByRepositories, $filterByPath, $userGroup, $offset = 0, $limit = 10, $enlargeToOwned = true, $userId)
{
if($this->sqlDriver["password"] == "XXXX") return array();
require_once(AJXP_BIN_FOLDER."/dibi.compact.php");
Expand All @@ -105,14 +107,33 @@ public function loadEvents($filterByRepositories, $userId, $userGroup, $offset =
)
ORDER BY [edate] DESC %lmt %ofs", "event", $filterByRepositories, $userId, $userId, $userGroup, $limit, $offset);
} else {
$res = dibi::query("SELECT * FROM [ajxp_feed] WHERE [etype] = %s AND
( [repository_id] IN (%s))
AND (
[repository_scope] = 'ALL'
OR ([repository_scope] = 'USER' AND [user_id] = %s )
OR ([repository_scope] = 'GROUP' AND [user_group] = %s )
)
ORDER BY [edate] DESC %lmt %ofs", "event", $filterByRepositories, $userId, $userGroup, $limit, $offset);
if(!empty($filterByPath)){
$groupByClause = "";
if($filterByPath[strlen($filterByPath)-1]=='/'){
$groupByClause = " GROUP BY [index_path] ";
}
$index_path = "ajxp.fs://".$filterByRepositories[0].$filterByPath."%";
$res = dibi::query("SELECT * FROM [ajxp_feed] WHERE [etype] = %s
AND
( [repository_id] IN (%s))
AND
([index_path] LIKE %s)
AND (
[repository_scope] = 'ALL'
OR ([repository_scope] = 'USER' AND [user_id] = %s )
OR ([repository_scope] = 'GROUP' AND [user_group] = %s )
)
$groupByClause ORDER BY [edate] DESC %lmt %ofs", "event", $filterByRepositories, $index_path, $userId, $userGroup, $limit, $offset);
}else{
$res = dibi::query("SELECT * FROM [ajxp_feed] WHERE [etype] = %s AND
( [repository_id] IN (%s))
AND (
[repository_scope] = 'ALL'
OR ([repository_scope] = 'USER' AND [user_id] = %s )
OR ([repository_scope] = 'GROUP' AND [user_group] = %s )
)
ORDER BY [edate] DESC %lmt %ofs", "event", $filterByRepositories, $userId, $userGroup, $limit, $offset);
}
}
$data = array();
foreach ($res as $n => $row) {
Expand Down
20 changes: 20 additions & 0 deletions core/src/plugins/gui.ajax/res/themes/orbit/css/ajaxplorer.css
Expand Up @@ -3210,6 +3210,26 @@ div.class-FetchedResultPane div.thumbnail_selectable_cell.detailed span.text_lab
cursor: pointer;
}

#info_panel div.class-FetchedResultPane div.thumbnail_selectable_cell.detailed{
padding: 7px 1px;
cursor: default;
}

#info_panel div.class-FetchedResultPane div.thumbnail_selectable_cell.detailed div.thumbnail_selectable_cell{
display: none;
}

#info_panel div.class-FetchedResultPane div.thumbnail_selectable_cell.detailed div.thumbLabel{
font-weight: lighter;
font-size: 1.4em;
color: #555;
}

#info_panel div.class-FetchedResultPane div.ajxpNodeProvider:hover{
background-color: transparent !important;
}


div.foldedPanel_tooltip{
width: 210px !important;
background-color: #399997;
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/gui.ajax/res/themes/orbit/html/gui.html
Expand Up @@ -12,6 +12,7 @@
</head>
<body bgcolor="#FFFFFF" text="#000000" marginheight="0" marginwidth="0" leftmargin="0" topmargin="0" style="overflow:hidden;">
<script type="text/javascript">
window.ajxpNoNotifLoader = true;
// Initialize booter. Do not remove the commented line AJXP_JSON_START_PARAMETERS, as it is
// dynamically replaced by the application!
var ajaxplorer, startParameters = {}, MessageHash={};
Expand Down
Expand Up @@ -33,6 +33,7 @@
<div id="ajxp_desktop" ajxpClass="AjxpPane" ajxpOptions='{"fit":"height","fitParent":"window","fitMarginBottom":"$(\"optional_bottom_div\").getHeight()"}'></div>

<script type="text/javascript">
window.ajxpNoNotifLoader = true;
var ajaxplorer, startParameters = {};
<?php if($JSON_START_PARAMETERS) print "startParameters = ".$JSON_START_PARAMETERS.";"; ?>
window.ajxpBootstrap = new AjxpBootstrap(startParameters);
Expand Down

0 comments on commit d44855b

Please sign in to comment.