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

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove notifications from GLOBAL_TYPES, add an option to disable Acti…
…vity panel.
  • Loading branch information
cdujeu committed Sep 5, 2016
1 parent e9acca3 commit 9e0ce4d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
2 changes: 1 addition & 1 deletion core/src/plugins/access.ajxp_conf/src/RolesManager.php
Expand Up @@ -282,7 +282,7 @@ public function rolesActions(ServerRequestInterface $requestInterface, ResponseI
// Make sure it's utf8
$data["ALL"] = array_merge((isSet($data["ALL"]) ? $data["ALL"]: []), [
"PLUGINS_SCOPES" => [
"GLOBAL_TYPES" => ["conf", "auth", "authfront", "log", "mq", "notifications", "gui", "sec"],
"GLOBAL_TYPES" => ["conf", "auth", "authfront", "log", "mq", "gui", "sec"],
"GLOBAL_PLUGINS" => ["action.avatar", "action.disclaimer", "action.scheduler", "action.skeleton", "action.updater"]
],
"REPOSITORIES" => $repos,
Expand Down
36 changes: 21 additions & 15 deletions core/src/plugins/core.notifications/NotificationCenter.php
Expand Up @@ -81,23 +81,29 @@ public function init(ContextInterface $ctx, $options = [])
*/
protected function parseSpecificContributions(ContextInterface $ctx, \DOMNode &$contribNode)
{
parent::parseSpecificContributions($ctx, $contribNode);

// DISABLE STUFF
if (empty($this->pluginConf["USER_EVENTS"])) {
if($contribNode->nodeName == "actions"){
$actionXpath=new DOMXPath($contribNode->ownerDocument);
$publicUrlNodeList = $actionXpath->query('action[@name="get_my_feed"]', $contribNode);
$publicUrlNode = $publicUrlNodeList->item(0);
$contribNode->removeChild($publicUrlNode);
}else if($contribNode->nodeName == "client_configs"){
$actionXpath=new DOMXPath($contribNode->ownerDocument);
$children = $actionXpath->query('component_config', $contribNode);
foreach($children as $child){
$contribNode->removeChild($child);
}
parent::parseSpecificContributions($ctx, $contribNode);
$disableWsActivity = $this->getContextualOption($ctx, "SHOW_WORKSPACES_ACTIVITY") === false;
$disableUserEvents = $this->getContextualOption($ctx, "USER_EVENTS") === false;
if(!$disableUserEvents && !$disableWsActivity){
return;
}
// DISABLE STUFF AS NEEDED
if($contribNode->nodeName == "actions" && $disableUserEvents){
$actionXpath=new DOMXPath($contribNode->ownerDocument);
$publicUrlNodeList = $actionXpath->query('action[@name="get_my_feed"]', $contribNode);
$publicUrlNode = $publicUrlNodeList->item(0);
$contribNode->removeChild($publicUrlNode);
}else if($contribNode->nodeName == "client_configs"){
$actionXpath=new DOMXPath($contribNode->ownerDocument);
$children = $actionXpath->query('component_config', $contribNode);
/** @var \DOMElement $child */
foreach($children as $child){
if($child->getAttribute("className") !== "InfoPanel" && !$disableUserEvents){
continue;
}
$contribNode->removeChild($child);
}
}
}

/**
Expand Down
3 changes: 2 additions & 1 deletion core/src/plugins/core.notifications/manifest.xml
Expand Up @@ -17,7 +17,8 @@
</client_settings>
<server_settings>
<param name="activate_notifications" scope="user" description="CONF_MESSAGE[Activate desktop notifications]" label="CONF_MESSAGE[Desktop Notifications]" type="button" choices="run_client_action:activateDesktopNotifications" expose="true" editable="true"/>
<global_param description="CONF_MESSAGE[Display a new entry with all events happening on a user workspaces, and alerts. An SQL database must be setup for the FEED_DRIVER configuration.]" label="CONF_MESSAGE[User events and alerts]" name="USER_EVENTS" type="boolean" default="false"/>
<global_param name="USER_EVENTS" description="CONF_MESSAGE[Display a new entry with all events happening on a user workspaces, and alerts. An SQL database must be setup for the FEED_DRIVER configuration.]" label="CONF_MESSAGE[User events and alerts]" type="boolean" default="false"/>
<global_param name="SHOW_WORKSPACES_ACTIVITY" label="CONF_MESSAGE[Display Workspaces Activity]" description="CONF_MESSAGE[Display workspaces activity to the users in the right-hand information panel]" type="boolean" default="true"/>
<global_param type="plugin_instance:feed" name="UNIQUE_FEED_INSTANCE" group="CONF_MESSAGE[Instance Params]" label="CONF_MESSAGE[Feed Instance]" description="CONF_MESSAGE[Choose the plugin]" mandatory="true" default="feed.sql"/>
</server_settings>
<registry_contributions>
Expand Down

0 comments on commit 9e0ce4d

Please sign in to comment.