[evolvis-commits] r6681: per-project Lists tab: add quick subscribe functionality for logged-in users↵
Thorsten Glaser
t.glaser at tarent.de
Wed Jun 2 16:42:52 CEST 2010
Author: Thorsten Glaser <t.glaser at tarent.de>
Date: 2010-06-02 16:42:52 +0200 (Wed, 02 Jun 2010)
New Revision: 6681
Added:
trunk/gforge_base/evolvisforge/gforge/common/include/mm.php
Modified:
trunk/gforge_base/evolvisforge/gforge/debian/changelog
trunk/gforge_base/evolvisforge/gforge/etc/local.d/15system
trunk/gforge_base/evolvisforge/gforge/www/mail/index.php
Log:
per-project Lists tab: add quick subscribe functionality for logged-in users
Added: trunk/gforge_base/evolvisforge/gforge/common/include/mm.php
===================================================================
--- trunk/gforge_base/evolvisforge/gforge/common/include/mm.php (rev 0)
+++ trunk/gforge_base/evolvisforge/gforge/common/include/mm.php 2010-06-02 14:42:52 UTC (rev 6681)
@@ -0,0 +1,32 @@
+<?php
+/*-
+ * Mailman related helper functions for FusionForge
+ *
+ * Copyright © 2010
+ * First M. Last <user at domain>
+ * All rights reserved.
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+function mm_quicksubscribe($listname, $email) {
+ global $sys_var_lib_gforge_path;
+
+ return file_put_contents($sys_var_lib_gforge_path .
+ "/mmsubscribe/" . $listname, $email . "\n", FILE_APPEND);
+}
+
+?>
\ No newline at end of file
Modified: trunk/gforge_base/evolvisforge/gforge/debian/changelog
===================================================================
--- trunk/gforge_base/evolvisforge/gforge/debian/changelog 2010-06-02 14:42:48 UTC (rev 6680)
+++ trunk/gforge_base/evolvisforge/gforge/debian/changelog 2010-06-02 14:42:52 UTC (rev 6681)
@@ -15,8 +15,9 @@
* Mailman: reject mails from non-members by default
* Mailman: commit lists have no message size limit
* Mailman: commit lists accept from svn from everyone by default
+ * Lists tab: add quick subscribe functionality for logged-in users
- -- Thorsten Glaser <t.glaser at tarent.de> Wed, 02 Jun 2010 12:54:06 +0200
+ -- Thorsten Glaser <t.glaser at tarent.de> Wed, 02 Jun 2010 14:59:31 +0200
gforge (4.8.3+evolvis16) unstable; urgency=low
Modified: trunk/gforge_base/evolvisforge/gforge/etc/local.d/15system
===================================================================
--- trunk/gforge_base/evolvisforge/gforge/etc/local.d/15system 2010-06-02 14:42:48 UTC (rev 6680)
+++ trunk/gforge_base/evolvisforge/gforge/etc/local.d/15system 2010-06-02 14:42:52 UTC (rev 6681)
@@ -24,3 +24,6 @@
// this value MUST be plain
$unix_cipher = 'MD5';
+// Path to var directory
+$sys_var_lib_gforge_path = '{var_lib_gforge}';
+
Modified: trunk/gforge_base/evolvisforge/gforge/www/mail/index.php
===================================================================
--- trunk/gforge_base/evolvisforge/gforge/www/mail/index.php 2010-06-02 14:42:48 UTC (rev 6680)
+++ trunk/gforge_base/evolvisforge/gforge/www/mail/index.php 2010-06-02 14:42:52 UTC (rev 6681)
@@ -9,10 +9,11 @@
require_once('../env.inc.php');
require_once $gfwww.'include/pre.php';
-require_once $gfwww.'mail/../mail/mail_utils.php';
+require_once $gfwww.'mail/mail_utils.php';
require_once $gfcommon.'mail/MailingList.class.php';
require_once $gfcommon.'mail/MailingListFactory.class.php';
+require_once $gfcommon.'include/mm.php';
$group_id = getIntFromGet('group_id');
@@ -53,33 +54,79 @@
exit;
}
+ $thelist = getStringFromRequest('thelist');
+ if ($thelist) {
+ $feedback = false;
+ $thelist = getStringFromRequest('thelist');
+
+ if (!session_loggedin()) {
+ $feedback = _('Sorry, you are not logged in.');
+ } else {
+ $feedback = sprintf(_('Could not find the %s list.'), $thelist);
+ for ($j = 0; $j < $mlCount; $j++) {
+ $currentList =& $mlArray[$j];
+ if ($currentList->getName() == $thelist) {
+ $feedback = false;
+ break;
+ }
+ }
+ }
+ if (!$feedback) {
+ $umail = session_get_user()->getUnixName() .
+ "@" . $sys_default_domain;
+ if (mm_quicksubscribe($thelist, $umail)) {
+ $feedback = sprintf(_('Subscribed %s to %s@%s – this will take up to an hour to be processed.'),
+ $umail, $thelist, $sys_lists_host);
+ } else {
+ $feedback = '<b style="color:red;">' .
+ _("Error writing subscription file.") .
+ '</b>';
+ }
+ } else {
+ $feedback = '<b style="color:red;">' . $feedback . '</b>';
+ }
+ echo "<p>" . $feedback . "</p>\n";
+ }
+
echo _('<p>Mailing lists provided via a GForge version of <a href="http://www.list.org/">GNU Mailman</a>. Thanks to the Mailman and <a href="http://www.python.org/">Python</a> crews for excellent software.</p>');
echo _('<p>Choose a list to browse, search, and post messages.</p>');
$tableHeaders = array(
_('Mailing list'),
_('Description'),
+ _('Quick'),
_('Subscription')
);
echo $HTML->listTableTop($tableHeaders);
+ $isloggedin = session_loggedin() ? true : false;
+
for ($j = 0; $j < $mlCount; $j++) {
$currentList =& $mlArray[$j];
echo '<tr '. $HTML->boxGetAltRowStyle($j) .'>';
if ($currentList->isError()) {
- echo '<td colspan="3">'.$currentList->getErrorMessage().'</td></tr>';
+ echo '<td colspan="4">'.$currentList->getErrorMessage().'</td></tr>';
} else if($currentList->getStatus() == MAIL__MAILING_LIST_IS_REQUESTED) {
echo '<td width="33%">'.
'<strong>'.$currentList->getName().'</strong></td>'.
'<td width="33%">'.htmlspecialchars($currentList->getDescription()). '</td>'.
- '<td width="33%" style="text-align:center">'._('Not activated yet').'</td></tr>';
+ '<td colspan="2" width="33%" style="text-align:center">'._('Not activated yet').'</td></tr>';
} else {
+ if ($isloggedin) {
+ $c = '<td><a href="' .
+ getStringFromServer('PHP_SELF') .
+ '?thelist=' . $currentList->getName() .
+ '">' . _('Subscribe') . '</a></td><td>' .
+ '<a href="'.$currentList->getExternalInfoUrl().'">'._('Unsubscribe/Preferences').'</a>';
+ } else {
+ $c = '<td width="33%" colspan="2">' .
+ '<a href="'.$currentList->getExternalInfoUrl().'">'._('Subscribe/Unsubscribe/Preferences').'</a>';
+ }
echo '<td width="33%">'.
'<strong><a href="'.$currentList->getArchivesUrl().'">' .
sprintf(_('%1$s Archives'), $currentList->getName()).'</a></strong></td>'.
'<td>'.htmlspecialchars($currentList->getDescription()). '</td>'.
- '<td width="33%" style="text-align:center"><a href="'.$currentList->getExternalInfoUrl().'">'._('Subscribe/Unsubscribe/Preferences').'</a>'.
- '</td>';
+ $c . '</td>';
}
echo '</tr>';
}
More information about the evolvis-commits
mailing list