7 * Daniel Perez <danielperez.arg@gmail.com>
9 * This is an example to watch things in action. You can obviously modify things and logic as you see fit
11 * Portions Copyright 2010 (c) Mélanie Le Bail
12 * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
14 require_once 'env.inc.php';
15 require_once 'pre.php';
16 require_once 'preplugins.php';
17 require_once 'plugins_utils.php';
18 require_once 'mailman_utils.php';
19 $request =& HTTPRequest::instance();
21 $group_id = $request->get('group_id');
22 $pm = ProjectManager::instance();
23 $Group = $pm->getProject($group_id);
24 if (isset ($group_id)) {
26 if (!$Group || !is_object($Group)) {
27 exit_error(_('Error'), 'Could Not Get Group');
28 } elseif ($Group->isError()) {
32 $mlFactory = new MailmanListFactory($Group);
33 if (!$mlFactory || !is_object($mlFactory)) {
34 exit_error(_('Error'), 'Could Not Get MailmanListFactory');
36 elseif ($mlFactory->isError()) {
37 exit_error(_('Error'), $mlFactory->getErrorMessage());
40 mailman_header(array (
41 'title' => _('Mailing Lists for') . $Group->getPublicName(),
42 'help' => 'CommunicationServices.html#MailingLists',
43 'pv' => isset ($pv) ? $pv : false
46 $mlArray = & $mlFactory->getMailmanLists();
48 if ($mlFactory->isError()) {
49 echo '<h1>' . _('Error') . ' ' . sprintf(_('Unable to get the list %s'), $Group->getPublicName()) . '</h1>';
50 echo $mlFactory->getErrorMessage();
51 mail_footer(array ());
55 $mlCount = count($mlArray);
57 echo '<p>' . sprintf(_('No Lists found for %1$s'), $Group->getPublicName()) . '</p>';
58 echo '<p>' . _('Project administrators use the admin link to request mailing lists.') . '</p>';
59 mail_footer(array ());
65 if ($mlFactory->compareInfos()) {
67 echo _('You seem to have mailman account with a different name or password. If you want to update mailman information, click on ');
68 echo '<a href="index.php?group_id=' . $group_id . '&action=update">' . _('Update') . '</a>';
74 echo _('Choose a list to browse, search, and post messages.');
78 for ($j = 0; $j < $mlCount; $j++) {
79 $currentList = & $mlArray[$j];
80 display_list($currentList);
84 if ($request->exist('action')) {
85 if ($request->exist('id')) {
86 $list = new MailmanList($group_id, $request->get('id'));
87 switch ($request->get('action')) {
89 $list->getOptionsURL();
98 $list->getArchivesUrl();
101 $list->getExternalAdminUrl();
107 if ($request->get('action') == 'update') {
108 $mlFactory->updateInfos();
112 mail_footer(array ());