[evolvis-commits] r18378: fix cosmetic problem by rewriting to use EvolvisTable

mirabilos at evolvis.org mirabilos at evolvis.org
Wed Apr 25 14:47:49 CEST 2012


Author: mirabilos
Date: 2012-04-25 14:47:49 +0200 (Wed, 25 Apr 2012)
New Revision: 18378

Modified:
   trunk/gforge_base/evolvisforge-5.1/src/www/mail/index.php
Log:
fix cosmetic problem by rewriting to use EvolvisTable

Modified: trunk/gforge_base/evolvisforge-5.1/src/www/mail/index.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/www/mail/index.php	2012-04-25 12:47:45 UTC (rev 18377)
+++ trunk/gforge_base/evolvisforge-5.1/src/www/mail/index.php	2012-04-25 12:47:49 UTC (rev 18378)
@@ -6,7 +6,8 @@
  * Copyright 2003-2004 (c) Guillaume Smet - Open Wide
  * Copyright 2010 (c) Franck Villaume - Capgemini
  * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
- * http://fusionforge.org/
+ * Copyright © 2012
+ *	Thorsten Glaser <t.glaser at tarent.de>
  *
  * This file is part of FusionForge. FusionForge is free software;
  * you can redistribute it and/or modify it under the terms of the
@@ -33,86 +34,108 @@
 
 $group_id = getIntFromGet('group_id');
 
-if ($group_id) {
-	$group = group_get_object($group_id);
-	if (!$group || !is_object($group)) {
-		exit_no_group();
-	} elseif ($group->isError()) {
-		exit_error($group->getErrorMessage(),'mail');
-	}
-	
-	$mlFactory = new MailingListFactory($group);
-	if (!$mlFactory || !is_object($mlFactory)) {
-		exit_error(_('Could Not Get MailingListFactory'),'mail');
-	} elseif ($mlFactory->isError()) {
-		exit_error($mlFactory->getErrorMessage(),'mail');
-	}
+if (!$group_id) {
+	exit_no_group();
+}
 
-	mail_header(array(
-		'title' => sprintf(_('Mailing Lists for %1$s'), $group->getPublicName())
-	));
+$group = group_get_object($group_id);
+if (!$group || !is_object($group)) {
+	exit_no_group();
+} elseif ($group->isError()) {
+	exit_error($group->getErrorMessage(), 'mail');
+}
 
-	plugin_hook ("blocks", "mail index");
+$mlFactory = new MailingListFactory($group);
+if (!$mlFactory || !is_object($mlFactory)) {
+	exit_error(_('Could Not Get MailingListFactory'), 'mail');
+} elseif ($mlFactory->isError()) {
+	exit_error($mlFactory->getErrorMessage(), 'mail');
+}
 
-	$mlArray = $mlFactory->getMailingLists();
+mail_header(array(
+	'title' => sprintf(_('Mailing Lists for %1$s'), $group->getPublicName())
+));
 
-	if ($mlFactory->isError()) {
-		echo '<p class="error">'.sprintf(_('Unable to get the list %s : %s'), $group->getPublicName(), $mlFactory->getErrorMessage()) .'</p>';
-		mail_footer(array());
-		exit;
-	}
-	
-	$mlCount = count($mlArray);
-	if($mlCount == 0) {
-		echo '<p>'.sprintf(_('No Lists found for %1$s'), $group->getPublicName()) .'</p>';
-		echo '<p>'._('Project administrators use the admin link to request mailing lists.').'</p>';
-		mail_footer(array());
-		exit;
-	}
-	
-	echo '<p>' . _('Choose a list to browse, search, and post messages.') . '</p>';
-	
-	$tableHeaders = array(
-		_('Mailing list'),
-		_('Description'),
-		_('Subscription')
-	);
-	echo $HTML->listTableTop($tableHeaders);
+plugin_hook("blocks", "mail index");
 
-	for ($j = 0; $j < $mlCount; $j++) {
-		$currentList =& $mlArray[$j];
-		if ($currentList->isError() &&
-		    $currentList->isPermissionDeniedError()) {
-			//XXX boxGetAltRowStyle unniceness
-			continue;
-		}
-		echo '<tr '. $HTML->boxGetAltRowStyle($j) .'>';
-		if ($currentList->isError()) {
-			echo '<td colspan="3">'.$currentList->getErrorMessage().'</td>';
-		} 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>';
-		} else {
-			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>';
-		}
-		echo '</tr>';
-	}
+$mlArray = $mlFactory->getMailingLists();
 
-	echo $HTML->listTableBottom();
-	
+if ($mlFactory->isError()) {
+	echo '<p class="error">' .
+	    sprintf(_('Unable to get the list %1$s: %2$s'),
+	    $group->getPublicName(), $mlFactory->getErrorMessage()) .
+	    '</p>';
 	mail_footer(array());
+	exit;
+}
 
-} else {
+$mlCount = count($mlArray);
+if ($mlCount == 0) {
+	echo '<p>' . sprintf(_('No Lists found for %1$s'),
+	    $group->getPublicName()) . '</p>';
+	echo '<p>' .
+	   _('Project administrators use the admin link to request mailing lists.') .
+	   '</p>';
+	mail_footer(array());
+	exit;
+}
 
-	exit_no_group();
+echo '<p>' . _('Choose a list to browse, search, and post messages.') . '</p>';
 
+$t = new EvolvisTable(array(
+	_('Mailing list'),
+	_('Description'),
+	_('Subscription'),
+    ));
+
+for ($j = 0; $j < $mlCount; $j++) {
+	$currentList =& $mlArray[$j];
+	if ($currentList->isError() &&
+	    $currentList->isPermissionDeniedError()) {
+		continue;
+	}
+	if ($currentList->isError()) {
+		if ($currentList->isPermissionDeniedError()) {
+			/* skip silently */
+			continue;
+		}
+		$t->tr()->td(array(
+			'colspan' => 3,
+		    ), -1, $currentList->getErrorMessage());
+		continue;
+	}
+	$r = $t->tr();
+	if ($currentList->getStatus() == MAIL__MAILING_LIST_IS_REQUESTED) {
+		$r->td(array(
+			//'width' => '33%',
+		    ))->setraw(html_e('strong', array(),
+		    util_html_encode($currentList->getName())));
+	} else {
+		$r->td(array(
+			//'width' => '33%',
+		    ))->setraw(html_e('strong', array(), html_e('a', array(
+			'href' => $currentList->getArchivesUrl(),
+		    ), util_html_encode(sprintf(_('%1$s Archives'),
+		    $currentList->getName())))));
+	}
+	$r->td(array(
+		//'width' => '33%',
+	    ))->set($currentList->getDescription());
+	if ($currentList->getStatus() == MAIL__MAILING_LIST_IS_REQUESTED) {
+		$r->td(array(
+			//'width' => '33%',
+			'style' => 'text-align:center;',
+		    ))->set(_('Not activated yet'));
+	} else {
+		$r->td(array(
+			//'width' => '33%',
+			'style' => 'text-align:center;',
+		    ))->setraw(html_e('a', array(
+			'href' => $currentList->getExternalInfoUrl(),
+		    ), util_html_encode(_('Subscribe/Unsubscribe/Preferences'))));
+	}
 }
 
-?>
+echo $t->emit();
+
+mail_footer(array());



More information about the evolvis-commits mailing list