<?php
/**
- * mailmanPlugin class
+ * mailmanPlugin class
*
* This file is part of FusionForge.
*
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with FusionForge; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
* Portions Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
* Portions Copyright 2010 (c) Mélanie Le Bail
*/
-
+
require_once 'plugins_utils.php';
require_once('common/system_event/SystemEvent.class.php');
require_once('common/event/Event.class.php');
$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 '<h1>Mailman</h1>';
echo $this->getPluginInfo()->getpropVal('answer');
}
-
+
function getPluginInfo() {
if (!is_a($this->pluginInfo, 'MailmanPluginInfo')) {
require_once('MailmanPluginInfo.class.php');
- $this->pluginInfo =& new MailmanPluginInfo($this);
+ $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
+ $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 ));
+ array ('/plugins/mailman/index.php' . $param ));
}
} elseif ($hookname == "groupmenu") {
$group_id=$params['group'];
}
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['DIRS'][]='/plugins/mailman/index.php?group_id=' . $group_id . "&pluginname=" . $this->name; // we indicate the part we�re calling is the project one
+ $params['ADMIN'][]='';
+ }
(($params['toptab'] == $this->name) ? $params['selected']=(count($params['TITLES'])-1) : '' );
} elseif ($hookname == "groupisactivecheckbox") {
//Check if the group is active
echo "<strong>Use ".$this->text." Plugin</strong>";
echo "</td>";
echo "</tr>";
-
+
} 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->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
+ // 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 ' <p>' ;
- echo util_make_link ("/plugins/mailman/index.php?id=$userid&type=user&pluginname=".$this->name,
+ echo util_make_link ("/plugins/mailman/index.php?id=$userid&type=user&pluginname=".$this->name,
_('View Personal mailman')
);
echo '</p>';
}
} elseif ($hookname == "project_admin_plugins") {
- // this displays the link in the project admin options page to it�s mailman administration
+ // this displays the link in the project admin options page to it's mailman administration
$group_id = $params['group_id'];
$group = &group_get_object($group_id);
if ( $group->usesPlugin ( $this->name ) ) {
- echo '<p>'.util_make_link ("/plugins/projects_hierarchy/index.php?id=".$group->getID().'&type=admin&pluginname='.$this->name,
+ echo '<p>'.util_make_link ("/plugins/".$this->name."/index.php?id=".$group->getID().'&type=admin&pluginname='.$this->name,
_('View the mailman Administration')).'</p>';
}
- }
+ }
elseif ($hookname == "monitored_element") {
$current_user=UserManager::instance()->getCurrentUser();
$last_group=0;
$order_name_arr[]=_('Remove');
$order_name_arr[]=_('Monitored Lists');
echo $HTML->listTableTop($order_name_arr);
- $dao = & new MailmanListDao(CodendiDataAccess::instance());
+ $dao = new MailmanListDao(CodendiDataAccess::instance());
$result = $dao->listsMonitoredByUser($current_user->getEmail());
for ($i=0; $i<$result->rowCount(); $i++) {
$listResult = $result->getRow();
- $list =& new MailmanList($listResult['group_id'],$listResult['group_list_id']);
+ $list = new MailmanList($listResult['group_id'],$listResult['group_list_id']);
if ($list->isError()) {
$this->setError($list->getErrorMessage());
} else {
}
echo '
<tr '.$HTML->boxGetAltRowStyle(0).'><td class="align-center"><a href="/plugins/mailman/index.php?group_id='.$group->getID().
- '&action=unsubscribe&id='.$l->getID().'">' .
+ '&action=unsubscribe&id='.$l->getID().'">' .
'<img src="'.$HTML->imgroot.'/ic/trash.png" height="16" width="16" '.'border="0" alt="" /></a>' .
- '</td><td width="99%"><a href="/plugins/mailman/index.php?group_id='.$group->getID().'&action=options&id='.$l->getID().'">'.
+ '</td><td width="99%"><a href="/plugins/mailman/index.php?group_id='.$group->getID().'&action=options&id='.$l->getID().'">'.
$l->getName().'"</a></td></tr>';
$last_group= $group->getID();
}
}
echo $HTML->listTableBottom();
-
+
}
elseif ($hookname == "group_delete") {
$group_id = $params['group_id'];
$this->setError(_('Could not properly delete the mailing list'));
}
//echo 'MailmanListFactory'.db_error();
- }
- }
+ }
+ }
elseif ($hookname == "group_approve") {
$idadmin_group =$params[0];
$group_id=$params[1];
return false;
}
}
+ // TODO : WTF ? : I think this should probably be gotten rid of -- OlivierBerger
elseif ($hookname=='site_admin_option_hook') {
- echo '<li><a href="'.$this->getPluginPath().'/">Template</a></li>';
+ echo '<li><a href="'.$this->getPluginPath().'/">Template [' . _('Mailman plugin') . ']</a></li>';
}
-
-
-
+
+
+
}
function getSystemEventClass($params) {
-
+
switch($params['type']) {
case 'MAILMAN_LIST_CREATE' :
-
+
require_once(dirname(__FILE__).'/events/SystemEvent_MAILMAN_LIST_CREATE.class.php');
-
+
$params['class'] = 'SystemEvent_MAILMAN_LIST_CREATE';
break;
case 'MAILMAN_LIST_DELETE' :
}
}
-
-
-
-
-
+
+
+
+
+
}
// Local Variables: