Plugin($id);
//$this->setScope(Plugin::SCOPE_PROJECT);
$this->name = "mailman" ;
$this->text = "Mailman" ; // To show in the tabs, use...
$this->_addHook("user_personal_links");//to make a link to the user�s personal part of the plugin
$this->_addHook("usermenu") ;
$this->_addHook("groupmenu"); // To put into the project tabs
$this->_addHook("groupisactivecheckbox") ; // The "use ..." checkbox in editgroupinfo
$this->_addHook("groupisactivecheckboxpost") ; //
$this->_addHook("userisactivecheckbox") ; // The "use ..." checkbox in user account
$this->_addHook("userisactivecheckboxpost") ; //
$this->_addHook("project_admin_plugins"); // to show up in the admin page fro group
$this->_addHook("monitored_element"); // to show monitored items in my page
$this->_addHook("group_delete"); // to delete mailing list associated when deleting a group
$this->_addHook("group_approve"); // to create mailing list 'Commit' when creating a group
$this->_addHook('site_admin_option_hook');
$this->_addHook(Event::GET_SYSTEM_EVENT_CLASS,'getSystemEventClass', false);//to make SystemEvent manager knows about mailman plugin
}
function process() {
echo '
Mailman
';
echo $this->getPluginInfo()->getpropVal('answer');
}
function getPluginInfo() {
if (!is_a($this->pluginInfo, 'MailmanPluginInfo')) {
require_once('MailmanPluginInfo.class.php');
$this->pluginInfo =& new MailmanPluginInfo($this);
}
return $this->pluginInfo;
}
function CallHook ($hookname, $params) {
global $use_mailmanplugin,$G_SESSION,$HTML,$gfcommon,$gfwww,$gfplugins;
if ($hookname == "usermenu") {
$text = $this->text; // this is what shows in the tab
if ($G_SESSION->usesPlugin("mailman")) {
$param = '?type=user&id=' . $G_SESSION->getId() . "&pluginname=" . $this->name; // we indicate the part we�re calling is the user one
echo ' | ' . $HTML->PrintSubMenu (array ($text),
array ('/plugins/mailman/index.php' . $param ));
}
} elseif ($hookname == "groupmenu") {
$group_id=$params['group'];
$project = &group_get_object($group_id);
if (!$project || !is_object($project)) {
return;
}
if ($project->isError()) {
return;
}
if (!$project->isProject()) {
return;
}
if ( $project->usesPlugin ( $this->name ) ) {
$params['TITLES'][]=$this->text;
$params['DIRS'][]='/plugins/mailman/index.php?group_id=' . $group_id . "&pluginname=" . $this->name; // we indicate the part we�re calling is the project one
}
(($params['toptab'] == $this->name) ? $params['selected']=(count($params['TITLES'])-1) : '' );
} elseif ($hookname == "groupisactivecheckbox") {
//Check if the group is active
// this code creates the checkbox in the project edit public info page to activate/deactivate the plugin
$group_id=$params['group'];
$group = &group_get_object($group_id);
echo "
";
} elseif ($hookname == "groupisactivecheckboxpost") {
// this code actually activates/deactivates the plugin after the form was submitted in the project edit public info page
$group_id=$params['group'];
$group = &group_get_object($group_id);
$use_mailmanplugin = getStringFromRequest('use_mailmanplugin');
if ( $use_mailmanplugin == 1 ) {
$group->setPluginUse ( $this->name );
} else {
$group->setPluginUse ( $this->name, false );
}
} elseif ($hookname == "user_personal_links") {
// this displays the link in the user�s profile page to it�s personal mailman (if you want other sto access it, youll have to change the permissions in the index.php
$userid = $params['user_id'];
$user = user_get_object($userid);
$text = $params['text'];
//check if the user has the plugin activated
if ($user->usesPlugin($this->name)) {
echo '