4 * GForge Mailing Lists Facility
6 * Portions Copyright 1999-2001 (c) VA Linux Systems
7 * The rest Copyright 2003-2004 (c) Guillaume Smet - Open Wide
11 * Portions Copyright 2010 (c) Mélanie Le Bail
13 require_once 'env.inc.php';
14 require_once 'pre.php';
15 require_once 'plugins_utils.php';
16 require_once '../mailman_utils.php';
18 $request =& HTTPRequest::instance();
19 $group_id=$request->get('group_id');
20 $group_list_id=$request->get('group_list_id');
21 $pm = ProjectManager::instance();
22 $Group = $pm->getProject($group_id);
23 $post_changes= $request->get('post_changes');
24 $add_list=$request->get('add_list');
25 $change_status=$request->get('change_status');
26 $list_name=$request->get('list_name');
27 $is_public=$request->get('is_public');
28 $description=$request->get('description');
29 $PHP_SELF = $request->get('PHP_SELF');
34 if (!$Group || !is_object($Group) || $Group->isError()) {
39 if (!$current_user->isMember($group_id,'A')) {
40 exit_permission_denied();
44 // Post Changes to database
46 if ($post_changes == 'y') {
50 if ($add_list == 'y') {
51 $mailingList = new MailmanList($group_id);
53 if(!$mailingList || !is_object($mailingList)) {
54 exit_error(_('Error'), _('Error getting the list'));
55 } elseif($mailingList->isError()) {
56 exit_error(_('Error'), $mailingList->getErrorMessage());
59 if(!$mailingList->create(
64 exit_error(_('Error'), $mailingList->getErrorMessage());
66 $feedback .= _('List Added');
71 } elseif ($change_status == 'y') {
72 $mailingList = new MailmanList($group_id, $group_list_id);
74 if(!$mailingList || !is_object($mailingList)) {
75 exit_error(_('Error'), _('Error getting the list'));
76 } elseif($mailingList->isError()) {
77 exit_error(_('Error'), $mailingList->getErrorMessage());
80 if(!$mailingList->update(
85 exit_error(_('Error'), $mailingList->getErrorMessage());
87 $feedback .= _('List updated');
98 'title' => _('Add a Mailing List'),
99 'help'=>'CommunicationServices.html#MailingLists',
101 printf(_('<p>Lists are named in this manner:<br /><strong>projectname-listname@%1$s</strong></p><p>It will take <span class="important">6-24 Hours</span> for your list to be created.</p>'), $GLOBALS['sys_lists_host']);
103 $mlFactory = new MailmanListFactory($Group);
104 if (!$mlFactory || !is_object($mlFactory) || $mlFactory->isError()) {
105 exit_error(_('Error'), $mlFactory->getErrorMessage());
108 $mlArray =& $mlFactory->getMailmanLists();
110 if ($mlFactory->isError()) {
111 echo '<h1>'._('Error').' '._('Unable to get the lists') .'</h1>';
112 echo $mlFactory->getErrorMessage();
113 mail_footer(array());
121 <form method="post" action="<?php echo $PHP_SELF; ?>?group_id=<?php echo $group_id ?>">
122 <input type="hidden" name="post_changes" value="y" />
123 <input type="hidden" name="add_list" value="y" />
124 <p><strong><?php echo _('Mailing List Name:'); ?></strong><br />
125 <strong><?php echo $Group->getUnixName(); ?>-<input type="text" name="list_name" value="" size="10" maxlength="12" />@<?php echo $GLOBALS['sys_lists_host']; ?></strong><br /></p>
127 <strong><?php echo _('Is Public?'); ?></strong><br />
128 <input type="radio" name="is_public" value="1" checked="checked" /> <?php echo _('Yes'); ?><br />
129 <input type="radio" name="is_public" value="0" /> <?php echo _('No'); ?></p><p>
130 <strong><?php echo _('Description:'); ?></strong><br />
131 <input type="text" name="description" value="" size="40" maxlength="80" /><br /></p>
133 <input type="submit" name="submit" value="<?php echo _('Add This List'); ?>" /></p>
136 mail_footer(array());
139 // Form to modify list
141 } elseif($change_status && $group_list_id) {
142 echo "je suis la group= et group_id=".$group_list_id;
143 $mailingList = new MailmanList($group_id, $group_list_id);
145 if(!$mailingList || !is_object($mailingList)) {
146 echo "mailinglist error";
147 exit_error(_('Error'), _('Error getting the list'));
148 } elseif($mailingList->isError()) {
149 exit_error(_('Error'), $mailingList->getErrorMessage());
152 mailman_header(array(
153 'title' => _('Mail admin'),
154 'help'=>'CommunicationServices.html#MailingLists',
156 echo "PHPSELF=".$PHP_SELF;
159 <h3><?php echo $mailingList->getName(); ?></h3>
160 <form method="post" action="<?php echo $PHP_SELF; ?>?group_id=<?php echo $group_id; ?>&group_list_id=<?php echo $mailingList->getID(); ?>">
161 <input type="hidden" name="post_changes" value="y" />
162 <input type="hidden" name="change_status" value="y" />
164 <strong><?php echo _('Is Public?'); ?></strong><br />
165 <input type="radio" name="is_public" value="1"<?php echo ($mailingList->isPublic() == 1 ? ' checked="checked"' : ''); ?> /> <?php echo _('Yes'); ?><br />
166 <input type="radio" name="is_public" value="0"<?php echo ($mailingList->isPublic() == 0 ? ' checked="checked"' : ''); ?> /> <?php echo _('No'); ?><br />
168 <p><strong><?php echo _('Description:'); ?></strong><br />
169 <input type="text" name="description" value="<?php echo $mailingList->getDescription(); ?>" size="40" maxlength="80" /><br /></p>
171 <input type="submit" name="submit" value="<?php echo _('Update'); ?>" /></p>
174 mail_footer(array());
179 $mlFactory = new MailmanListFactory($Group);
180 if (!$mlFactory || !is_object($mlFactory) || $mlFactory->isError()) {
181 exit_error(_('Error'), $mlFactory->getErrorMessage());
184 mailman_header(array(
185 'title' => _('Mailing List Administration'),
186 'help'=>'CommunicationServices.html#MailingLists',
190 $mlArray =& $mlFactory->getMailmanLists();
192 if ($mlFactory->isError()) {
193 echo '<p>'._('Error').' '.sprintf(_('Unable to get the list %s'), $Group->getPublicName()) .'</p>';
194 echo $mlFactory->getErrorMessage();
195 mail_footer(array());
198 echo '<p>'.sprintf(_('You can administrate lists from here. Please note that private lists can still be viewed by members of your project, but are not listed on %1$s.'), $GLOBALS['sys_name']).'</p>';
201 <a href="'.$PHP_SELF.'?group_id='.$group_id.'&add_list=1">'._('Add Mailing List').'</a>
204 $mlCount = count($mlArray);
208 for ($j = 0; $j < $mlCount; $j++) {
209 $currentList =& $mlArray[$j];
210 display_list_admin($currentList);
215 mail_footer(array());