[Fusionforge-commits] FusionForge branch master updated. 0a105dc64e5da5e3da9a47dfb42c307d736e88e0

Franck Villaume nerville at fusionforge.org
Thu Mar 27 15:29:32 CET 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  0a105dc64e5da5e3da9a47dfb42c307d736e88e0 (commit)
       via  db71252a27bba99dafda78e07f01ce459253e8d6 (commit)
       via  6f6ebd6b7f4074275621123b491b36fcfb94eb3e (commit)
       via  0919bf292b4f1ed2fec9f44c82c4252e87b817e6 (commit)
      from  c0db64e4dec5ebdda259dd7033a90ddb4c62d1eb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 0a105dc64e5da5e3da9a47dfb42c307d736e88e0
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Thu Mar 27 15:18:27 2014 +0100

    massmail: rewrite and handle the del action which was present but hidden

diff --git a/src/www/admin/massmail.php b/src/www/admin/massmail.php
index 5624e7a..42ec940 100644
--- a/src/www/admin/massmail.php
+++ b/src/www/admin/massmail.php
@@ -9,6 +9,7 @@
  * Copyright 1999-2001 (c) VA Linux Systems
  * Copyright 2010 (c) Franck Villaume - Capgemini
  * Copyright (C) 2010 Alain Peyrat - Alcatel-Lucent
+ * Copyright 2014, Franck Villaume - TrivialDev
  *
  * This file is part of FusionForge. FusionForge is free software;
  * you can redistribute it and/or modify it under the terms of the
@@ -30,50 +31,68 @@ require_once '../env.inc.php';
 require_once $gfcommon.'include/pre.php';
 require_once $gfwww.'admin/admin_utils.php';
 
+global $HTML;
+global $error_msg, $feedback;
+
 session_require_global_perm ('forge_admin');
 
-if (getStringFromRequest('submit')) {
+if (getStringFromRequest('action')) {
 	if (!form_key_is_valid(getStringFromRequest('form_key'))) {
 		exit_form_double_submit('admin');
 	}
-	$mail_type = getStringFromRequest('mail_type');
-	$mail_message = getStringFromRequest('mail_message');
-	$mail_subject = getStringFromRequest('mail_subject');
-
-	if (!$mail_type) {
-		form_release_key(getStringFromRequest('form_key'));
-		exit_missing_param('',array(_('Target Audience')),'admin');
+	switch (getStringFromRequest('action')) {
+		case 'add': {
+			$mail_type = getStringFromRequest('mail_type');
+			$mail_message = getStringFromRequest('mail_message');
+			$mail_subject = getStringFromRequest('mail_subject');
+
+			if (!$mail_type) {
+				form_release_key(getStringFromRequest('form_key'));
+				exit_missing_param('',array(_('Target Audience')),'admin');
+			}
+
+			if (!trim($mail_message)) {
+				form_release_key(getStringFromRequest('form_key'));
+				exit_missing_param('',array(_('No Message')),'admin');
+			}
+
+			if (trim($mail_subject) == '['.forge_get_config ('forge_name').']') {
+				form_release_key(getStringFromRequest('form_key'));
+				exit_missing_param('',array(_('No Subject')),'admin');
+			}
+
+			$res = db_query_params ('
+				INSERT INTO massmail_queue(type,subject,message,queued_date)
+				VALUES ($1,$2,$3,$4)
+			',
+					array($mail_type,
+						$mail_subject,
+						$mail_message,
+						time()));
+
+			if (!$res || db_affected_rows($res)<1) {
+				form_release_key(getStringFromRequest('form_key'));
+				$error_msg = _('Scheduling Mailing, Could not schedule mailing, database error: ').db_error();
+			} else {
+				$feedback = _('Mailing successfully scheduled for delivery');
+			}
+		}
+		case 'del': {
+			$id = getIntFromRequest('id');
+			if (!$id) {
+				form_release_key(getStringFromRequest('form_key'));
+				exit_missing_param('',array(_('Delivery Id')),'admin');
+			}
+			$res = db_query_params('DELETE FROM massmail_queue WHERE id = $1',
+						array($id));
+			if (!$res || db_affected_rows($res)<1) {
+				form_release_key(getStringFromRequest('form_key'));
+				$error_msg = _('Scheduling Mailing, Could not delete mailing, database error: ').db_error();
+			} else {
+				$feedback = _('Mailing successfully deleted for delivery');
+			}
+		}
 	}
-
-	if (!trim($mail_message)) {
-		form_release_key(getStringFromRequest('form_key'));
-		exit_missing_param('',array(_('No Message')),'admin');
-	}
-
-	if (trim($mail_subject) == '['.forge_get_config ('forge_name').']') {
-		form_release_key(getStringFromRequest('form_key'));
-		exit_missing_param('',array(_('No Subject')),'admin');
-	}
-
-	$res = db_query_params ('
-		INSERT INTO massmail_queue(type,subject,message,queued_date)
-		VALUES ($1,$2,$3,$4)
-	',
-			array($mail_type,
-				$mail_subject,
-				$mail_message,
-				time()));
-
-	if (!$res || db_affected_rows($res)<1) {
-		form_release_key(getStringFromRequest('form_key'));
-		exit_error(_('Scheduling Mailing, Could not schedule mailing, database error: ').db_error(),'admin');
-	}
-
-	$title = _('Massmail admin');
-	site_admin_header(array('title'=>$title));
-	print "<p class=\"feedback\">" ._('Mailing successfully scheduled for delivery'). "</p>";
-	site_admin_footer();
-	exit();
 }
 
 $title = sprintf(_('Mail Engine for %s Subscribers'), forge_get_config ('forge_name'));
@@ -89,7 +108,7 @@ print '
 ';
 
 print '
-<form action="'.getStringFromServer('PHP_SELF').'" method="post">'
+<form action="'.util_make_uri('/admin/massmail.php?action=add').'" method="post">'
 .'<input type="hidden" name="form_key" value="'.form_generate_key().'" />'
 .'<strong>'._('Target Audience').utils_requiredField()._(':').'</strong><br />'.html_build_select_box_from_arrays(
 	array(0,'SITE','COMMNTY','DVLPR','ADMIN','ALL','SFDVLPR'),
@@ -144,12 +163,12 @@ $seen = false;
 $i = 0;
 while ($row = db_fetch_array($res)) {
 	if (!$seen) {
-		echo $GLOBALS['HTML']->listTableTop($title);
+		echo $HTML->listTableTop($title);
 		$seen = true;
 	}
 	echo '
-	<tr '.$GLOBALS['HTML']->boxGetAltRowStyle($i++).'>
-	<td> <a href="massmail-del.php?id='.$row['id'].'"></a></td>
+	<tr '.$HTML->boxGetAltRowStyle($i++).'>
+	<td> <a href="/admin/massmail.php?id='.$row['id'].'&action=del">'._('Delete').'</a></td>
 	<td>'.$row['id'].'</td>
 	<td>'.$row['type'].'</td>
 	<td>'.$row['subject'].'</td>
@@ -160,7 +179,7 @@ while ($row = db_fetch_array($res)) {
 }
 
 if ($seen) {
-	echo $GLOBALS['HTML']->listTableBottom();
+	echo $HTML->listTableBottom();
 } else {
 	echo '<p>' . _('No deliveries active.') . "</p>\n";
 }

commit db71252a27bba99dafda78e07f01ce459253e8d6
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Thu Mar 27 15:17:43 2014 +0100

    more HTML helpers

diff --git a/src/www/admin/globalroleedit.php b/src/www/admin/globalroleedit.php
index bcc423c..73f5105 100644
--- a/src/www/admin/globalroleedit.php
+++ b/src/www/admin/globalroleedit.php
@@ -4,7 +4,7 @@
  *
  * Copyright 2010-2011, Roland Mas
  * Copyright (c) 2011 Thorsten Glaser <t.glaser at tarent.de>
- * Copyright 2013, Franck Villaume - TrivialDev
+ * Copyright 2013-2014, Franck Villaume - TrivialDev
  *
  * This file is part of FusionForge. FusionForge is free software;
  * you can redistribute it and/or modify it under the terms of the
@@ -140,50 +140,40 @@ if (getStringFromRequest('dormusers')) {
 }
 
 if ($role instanceof RoleExplicit) {
-	$users = $role->getUsers () ;
+	$users = $role->getUsers();
 	if (count ($users) > 0) {
 		echo '<p><strong>'._('Current users with this role').'</strong></p>' ;
 
 		echo '
-		<form action="'.util_make_url('/admin/globalroleedit.php').'" method="post">
-		<input type="hidden" name="role_id" value="'.$role_id.'" />
-		<table><thead><tr>
-			<th>'._('User Name').'</th>
-			<th>'._('Remove').'</th>
-		</tr></thead><tbody>';
-
+		<form action="'.util_make_uri('/admin/globalroleedit.php').'" method="post">
+		<input type="hidden" name="role_id" value="'.$role_id.'" />';
+		$titleArr = array(_('User Name'), _('Remove'));
+		echo $HTML->listTableTop($titleArr);
 		foreach ($users as $user) {
-			echo '
-		<tr>
-			<td style="white-space:nowrap;">
-				<a href="/users/'.$user->getUnixName().'">';
+			$cells = array();
 			$display = $user->getRealName();
 			if (empty($display)) {
 				$display = $user->getUnixName();
 			}
-			echo $display . '</a>
-			</td><td>
-				<input type="checkbox" name="rmusers[]" value="' .
-			    $user->getID() . '" /> ' . _('Remove') . '
-			</td>
-		</tr>';
+			$cells[] = array(util_make_link('/users/'.$user->getUnixName(), $display), 'style' => 'white-space:nowrap');
+			$cells[][] = '<input type="checkbox" name="rmusers[]" value="'.$user->getID().'" />'._('Remove');
+			echo $HTML->multiTableRow(array(), $cells);
 		}
-		echo '
-		<tr><td colspan="2">
-			<input type="checkbox" name="reallyremove" value="1" />
-			' . _('Really remove ticked users from role?') . '
-		</td></tr><tr><td colspan="2">
-			<input type="submit" name="dormusers" value="' .
-		    _("Remove") . '" />
-		</td></tr>
-		</tbody></table></form>';
+		$cells = array();
+		$cells[] = array('<input type="checkbox" name="reallyremove" value="1" />'._('Really remove ticked users from role?'), 'colspan' => 2);
+		echo $HTML->multiTableRow(array(), $cells);
+		$cells = array();
+		$cells[] = array('<input type="submit" name="dormusers" value="'._('Remove').'" />', 'colspan' => 2);
+		echo $HTML->multiTableRow(array(), $cells);
+		echo $HTML->listTableBottom();
+		echo '</form>';
 	} else {
 		echo '<p><strong>'._('No users currently have this role').'</strong></p>' ;
 	}
 
 			?>
 		<form
-			action="<?php echo util_make_url('/admin/globalroleedit.php'); ?>"
+			action="<?php echo util_make_uri('/admin/globalroleedit.php'); ?>"
 			method="post">
 		<p><input type="text"
 			name="form_unix_name" size="10" value="" />
@@ -197,7 +187,7 @@ if ($role instanceof RoleExplicit) {
 
 echo '
 <p>
-<form action="'.util_make_url('/admin/globalroleedit.php').'" method="post">';
+<form action="'.util_make_uri('/admin/globalroleedit.php').'" method="post">';
 echo '<input type="hidden" name="role_id" value="'.$role_id.'" />' ;
 
 if ($role instanceof RoleExplicit) {
@@ -224,7 +214,6 @@ echo $HTML->listTableTop($titles);
 //
 //	Everything is built on the multi-dimensional arrays in the Role object
 //
-$j = 0;
 
 $keys = array_keys($role->getGlobalSettings ()) ;
 $keys2 = array () ;
@@ -236,15 +225,11 @@ foreach ($keys as $key) {
 $keys = $keys2 ;
 
 for ($i=0; $i<count($keys); $i++) {
-	echo '<tr '. $HTML->boxGetAltRowStyle($j++) . '>
-		<td colspan="2"><strong>'.$rbac_edit_section_names[$keys[$i]].'</strong></td>
-		<td>';
-	echo html_build_select_box_from_assoc($role->getRoleVals($keys[$i]), "data[".$keys[$i]."][-1]", $role->getVal($keys[$i],-1), false, false ) ;
-	echo '</td>
-		</tr>';
-
+	$cells = array();
+	$cells[] = array('<strong>'.$rbac_edit_section_names[$keys[$i]].'</strong>', 'colspan' => 2);
+	$cells[][] = html_build_select_box_from_assoc($role->getRoleVals($keys[$i]), "data[".$keys[$i]."][-1]", $role->getVal($keys[$i],-1), false, false );
+	echo $HTML->multiTableRow(array('class' => $HTML->boxGetAltRowStyle($i, true)), $cells);
 }
-
 echo $HTML->listTableBottom();
 
 echo '<p><input type="submit" name="submit" value="'._('Submit').'" /></p>

commit 6f6ebd6b7f4074275621123b491b36fcfb94eb3e
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Wed Mar 26 17:33:14 2014 +0100

    more HTML helpers and fix php warning

diff --git a/src/www/admin/index.php b/src/www/admin/index.php
index 990db41..3cd5517 100644
--- a/src/www/admin/index.php
+++ b/src/www/admin/index.php
@@ -11,7 +11,7 @@
  * Copyright 2010 (c) FusionForge Team
  * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
  * Copyright 2011, Franck Villaume - Capgemini
- * Copyright 2013, Franck Villaume - TrivialDev
+ * Copyright 2013-2014, Franck Villaume - TrivialDev
  * http://fusionforge.org
  *
  * This file is part of FusionForge. FusionForge is free software;
@@ -50,11 +50,11 @@ $abc_array = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','
 		printf(_('Active site users: <strong>%d</strong>'),
 		    $gforge->getNumberOfActiveUsers());
 	?></li>
-	<li><a href="userlist.php"><?php echo _('Display Full User List/Edit Users'); ?></a></li>
+	<li><?php echo util_make_link('/admin/userlist.php', _('Display Full User List/Edit Users')); ?></li>
 	<li><?php
 	echo _('Display Users Beginning with:').' ';
 	for ($i=0; $i < count($abc_array); $i++) {
-		echo '<a href="userlist.php?user_name_search='.$abc_array[$i].'">'.$abc_array[$i].'</a>|';
+		echo util_make_link('/admin/userlist.php?user_name_search='.$abc_array[$i], $abc_array[$i]).'|';
 	}
 ?>
 	<br />
@@ -66,11 +66,12 @@ $abc_array = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','
 		<input type="submit" value="<?php echo _('Search'); ?>" />
 		</form>
 	</li>
-	<li><a href="../account/register.php"><?php
-	echo _('Register a New User');
-	?></a>
+	<li><?php
+	echo util_make_link('/account/register.php', _('Register a New User'));
+	?>
 	</li>
-	<li><a href="userlist.php?status=P"><?php echo _('Pending users'); ?></a></li>
+	<li><?php
+	echo util_make_link('/admin/userlist.php?status=P', _('Pending users')); ?></li>
 </ul>
 <?php
 	$params = array('result' => '');
@@ -139,11 +140,11 @@ $abc_array = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','
 		$row = db_fetch_array($res);
 		printf(_('Pending projects: <strong>%d</strong>'), $row['count']);
 	?></li>
-	<li><a href="grouplist.php"><?php echo _('Display Full Project List/Edit Projects'); ?></a></li>
+	<li><?php echo util_make_link('/admin/grouplist.php', _('Display Full Project List/Edit Projects')); ?></li>
 
 	<li><?php echo _('Display Projects Beginning with:').' ';
 	for ($i=0; $i < count($abc_array); $i++) {
-		echo '<a href="grouplist.php?group_name_search='.$abc_array[$i].'">'.$abc_array[$i].'</a>|';
+		echo util_make_link('/admin/grouplist.php?group_name_search='.$abc_array[$i], $abc_array[$i]).'|';
 	}
 ?>
 	<br />
@@ -155,8 +156,8 @@ $abc_array = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','
 		<input type="submit" value="<?php echo _('Search'); ?>" />
 		</form>
 	</li>
-	<li><?php echo util_make_link ('/register/',_('Register New Project')); ?></li>
-	<li><a href="approve-pending.php"><?php echo _('Pending projects (new project approval)'); ?></a></li>
+	<li><?php echo util_make_link('/register/',_('Register New Project')); ?></li>
+	<li><?php echo util_make_link('/admin/approve-pending.php', _('Pending projects (new project approval)')); ?></li>
 	<li><form name="projectsearch" action="search.php">
 	<?php echo _('Projects with status'); ?>
 	<select name="status">
@@ -168,7 +169,7 @@ $abc_array = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','
 	<input type="hidden" name="search" value="%"/>
 	<input type="submit" value="<?php echo _('Submit');?> "/>
 	</form></li>
-	<li><a href="search.php?groupsearch=1&is_public=0"><?php echo _('Private Projects'); ?></a></li>
+	<li><?php echo util_make_link('/admin/search.php?groupsearch=1&is_public=0', _('Private Projects')); ?></li>
 </ul>
 <?php
 	$params = array('result' => '');
@@ -190,7 +191,7 @@ $abc_array = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','
 <div class="info-box">
 <h2><?php echo _('News'); ?></h2>
 <ul>
-	<li><?php echo util_make_link ('/admin/pending-news.php',_('Pending news (moderation for front-page)')); ?></li>
+	<li><?php echo util_make_link('/admin/pending-news.php', _('Pending news (moderation for front-page)')); ?></li>
 </ul>
 </div>
 <?php } ?>
@@ -198,7 +199,7 @@ $abc_array = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','
 <div class="info-box">
 <h2><?php echo _('Stats'); ?></h2>
 <ul>
-	<li><?php echo util_make_link('/stats/',_('Site-Wide Stats')); ?></li>
+	<li><?php echo util_make_link('/stats/', _('Site-Wide Stats')); ?></li>
 	<?php plugin_hook('webanalytics_admin', array()); ?>
 </ul>
 </div>
@@ -206,37 +207,37 @@ $abc_array = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','
 <div class="info-box">
 <h2><?php echo _('Trove Project Tree'); ?></h2>
 <ul>
-	<li><a href="trove/trove_cat_list.php"><?php echo _('Display Trove Map'); ?></a></li>
-	<li><a href="trove/trove_cat_add.php"><?php echo _('Add to the Trove Map'); ?></a></li>
+	<li><?php echo util_make_link('/admin/trove/trove_cat_list.php', _('Display Trove Map')); ?></li>
+	<li><?php echo util_make_link('/admin/trove/trove_cat_add.php', _('Add to the Trove Map')); ?></li>
 </ul>
 </div>
 
 <div class="info-box">
 <h2><?php echo _('Site Utilities'); ?></h2>
 <ul>
-	<li><a href="massmail.php"><?php printf(_('Mail Engine for %s Subscribers'), forge_get_config ('forge_name')); ?></a></li>
-	<li><a href="unsubscribe.php"><?php echo forge_get_config ('forge_name'); ?> <?php echo _('Site Mailings Maintenance'); ?></a></li>
-	<li><a href="edit_frs_filetype.php"><?php echo _('Add, Delete, or Edit File Types'); ?></a></li>
-	<li><a href="edit_frs_processor.php"><?php echo _('Add, Delete, or Edit Processors'); ?></a></li>
-	<li><a href="edit_theme.php"><?php echo _('Add, Delete, or Edit Themes'); ?></a></li>
-	<li><a href="<?php echo util_make_url ('/stats/lastlogins.php'); ?>"><?php echo _('Most Recent Opened Sessions'); ?></a></li>
-	<li><a href="cronman.php"><?php echo _('Cron Manager'); ?></a></li>
-	<li><a href="pluginman.php"><?php echo _('Plugin Manager'); ?></a></li>
-	<li><a href="configman.php"><?php echo _('Config Manager'); ?></a></li>
+	<li><?php echo util_make_link('/admin/massmail.php', sprintf(_('Mail Engine for %s Subscribers'), forge_get_config ('forge_name'))); ?></li>
+	<li><?php echo util_make_link('/admin/unsubscribe.php', forge_get_config('forge_name').' '._('Site Mailings Maintenance')); ?></li>
+	<li><?php echo util_make_link('/admin/edit_frs_filetype.php', _('Add, Delete, or Edit File Types')); ?></li>
+	<li><?php echo util_make_link('/admin/edit_frs_processor.php', _('Add, Delete, or Edit Processors')); ?></li>
+	<li><?php echo util_make_link('/admin/edit_theme.php', _('Add, Delete, or Edit Themes')); ?></li>
+	<li><?php echo util_make_link('/stats/lastlogins.php', _('Most Recent Opened Sessions')); ?></li>
+	<li><?php echo util_make_link('/admin/cronman.php', _('Cron Manager')); ?></li>
+	<li><?php echo util_make_link('/admin/pluginman.php', _('Plugin Manager')); ?></li>
+	<li><?php echo util_make_link('/admin/configman.php', _('Config Manager')); ?></li>
 	<?php plugin_hook("site_admin_option_hook", array()); ?>
 </ul>
 
 <?php if(forge_get_config('use_project_database') || forge_get_config('use_project_vhost') || forge_get_config('use_people')) { ?>
 <ul>
 	<?php if(forge_get_config('use_project_vhost')) { ?>
-		<li><a href="vhost.php"><?php echo _('Virtual Host Admin Tool'); ?></a></li>
+		<li><?php echo util_make_link('/admin/vhost.php', _('Virtual Host Admin Tool')); ?></li>
 	<?php
 	}
 	if(forge_get_config('use_project_database')) { ?>
-		<li><a href="database.php"><?php echo _('Project Database Administration'); ?></a></li>
+		<li><?php echo util_make_link('/admin/database.php', _('Project Database Administration')); ?></li>
 	<?php }
 	if(forge_get_config('use_people')) { ?>
-		<li><a href="<?php echo util_make_url ('/people/admin/'); ?>"><?php echo _('Job / Categories Administration'); ?></a></li>
+		<li><?php echo util_make_link('/people/admin/', _('Job / Categories Administration')); ?></li>
 	<?php } ?>
 </ul>
 </div>
diff --git a/src/www/stats/lastlogins.php b/src/www/stats/lastlogins.php
index fb81db6..51594a1 100644
--- a/src/www/stats/lastlogins.php
+++ b/src/www/stats/lastlogins.php
@@ -27,6 +27,8 @@
 require_once '../env.inc.php';
 require_once $gfcommon.'include/pre.php';
 
+global $HTML;
+
 session_require_global_perm ('forge_admin');
 
 $res = db_query_params ('SELECT us.user_id AS user_id,
@@ -42,30 +44,17 @@ if (!$res || db_numrows($res) < 1) {
 	exit_error(_('No records found. Database error: ').db_error());
 }
 
-$HTML->header(array('title'=>_('Most Recent Opened Sessions')));
-
-?>
+$HTML->header(array('title' => _('Most Recent Opened Sessions')));
 
-<table class="fullwidth">
-<tr class="tableheading">
-	<th><?php echo _('Date'); ?></th>
-	<th><?php echo _('User Name'); ?></th>
-	<th><?php echo _('Source IP'); ?></th>
-</tr>
-
-<?php
-
-$alt=true;
+$titleArr = array(_('Date'), _('User Name'), _('Source IP'));
+echo $HTML->listTableTop($titleArr);
 $i=0;
 while ($row = db_fetch_array($res)) {
-	print ' <tr '.$GLOBALS['HTML']->boxGetAltRowStyle($i++).'>';
-	print '<td >'.date(_('Y-m-d H:i'), $row['time']).'</td>';
-	print '<td >'.util_display_user($row['user_name'], $row['user_id'], $row['realname']).'</td>';
-	print '<td >'.$row['ip_addr'].'</td>';
-	print '</tr>';
+	$cells = array();
+	$cells[][] = date(_('Y-m-d H:i'), $row['time']);
+	$cells[][] = util_display_user($row['user_name'], $row['user_id'], $row['realname']);
+	$cells[][] = $row['ip_addr'];
+	echo $HTML->multiTableRow(array('class' => $HTML->boxGetAltRowStyle($i++, true)), $cells);
 }
-?>
-
-</table>
-<?php
+echo $HTML->listTableBottom();
 $HTML->footer();

commit 0919bf292b4f1ed2fec9f44c82c4252e87b817e6
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Wed Mar 26 16:59:58 2014 +0100

    more HTML helpers

diff --git a/src/www/admin/admin_table.php b/src/www/admin/admin_table.php
index ade5aef..a1dc35c 100644
--- a/src/www/admin/admin_table.php
+++ b/src/www/admin/admin_table.php
@@ -4,7 +4,7 @@
  *
  * Copyright 1999-2001 (c) VA Linux Systems
  * Copyright 2010 (c) Franck Villaume - Capgemini
- * Copyright 2012, Franck Villaume - TrivialDev
+ * Copyright 2012,2014, Franck Villaume - TrivialDev
  *
  * This file is part of FusionForge. FusionForge is free software;
  * you can redistribute it and/or modify it under the terms of the
@@ -298,7 +298,7 @@ function admin_table_show($table, $unit, $primary_key) {
 		$cols = db_numfields($result);
 
 		$cell_data=array();
-		$cell_data[] = array(ucwords(getUnitLabel($unit)).' <a href="'.getStringFromServer('PHP_SELF').'?function=add">['._('add new').']</a>',
+		$cell_data[] = array(ucwords(getUnitLabel($unit)).' '.util_make_link(getStringFromServer('PHP_SELF').'?function=add', '['._('add new').']'),
 			'colspan' => ($cols+1));
 		echo '<table class="listing full">';
 		echo $HTML->multiTableRow(array(), $cell_data, TRUE);
@@ -314,8 +314,8 @@ function admin_table_show($table, $unit, $primary_key) {
 			echo '<tr '. $HTML->boxGetAltRowStyle($j) . '>';
 
 			$id = db_result($result,$j,0);
-			echo '<td><a href="'.getStringFromServer('PHP_SELF').'?function=edit&id='.$id.'">['._('Edit').']</a>';
-			echo '<a href="'.getStringFromServer('PHP_SELF').'?function=confirmdelete&id='.$id.'">['._('Delete').']</a> </td>';
+			echo '<td>'.util_make_link(getStringFromServer('PHP_SELF').'?function=edit&id='.$id, '['._('Edit').']');
+			echo util_make_link(getStringFromServer('PHP_SELF').'?function=confirmdelete&id='.$id, '['._('Delete').']').'</td>';
 			for ($i = 0; $i < $cols; $i++) {
 				echo '<td>'. db_result($result, $j, $i) .'</td>';
 			}
diff --git a/src/www/admin/userlist.php b/src/www/admin/userlist.php
index fc4ffee..6e02873 100644
--- a/src/www/admin/userlist.php
+++ b/src/www/admin/userlist.php
@@ -3,7 +3,7 @@
  *
  * Copyright 1999-2000 (c) The SourceForge Crew
  * Copyright 2010 (c) Franck Villaume - Capgemini
- * Copyright 2013, Franck Villaume - TrivialDev
+ * Copyright 2013-2014, Franck Villaume - TrivialDev
  * http://fusionforge.org
  *
  * This file is part of FusionForge. FusionForge is free software;
@@ -103,53 +103,55 @@ function show_users_list($users, $filter = '', $sortorder = 'realname') {
 					array(db_int_array_to_any_clause($users)));
 	$count = 0;
 	while ($arr = db_fetch_array($res)) {
+		$cells = array();
 		$u = new GFUser($arr['user_id'], $arr);
-		print '<tr '. $HTML->boxGetAltRowStyle($count) . '><td class="';
-		if ($u->getStatus() == 'A') print "active";
-		if ($u->getStatus() == 'D') print "deleted";
-		if ($u->getStatus() == 'S') print "suspended";
-		if ($u->getStatus() == 'P') print "pending";
-		print '"><a href="useredit.php?user_id='.$u->getID().'">';
-		if ($u->getStatus() == 'P') print "*";
-		echo $u->getRealName().' ('.$u->getUnixName().')</a>';
-		echo '</td>';
-		echo '<td width="15%" class="align-center">';
-		echo ($u->getAddDate() ? date(_('Y-m-d H:i'), $u->getAddDate()) : '-');
-		echo '</td>';
-		echo '<td width="15%" style="text-align:center">';
+		$nextcell = $u->getRealName().' ('.$u->getUnixName().')';
+		if ($u->getStatus() == 'P') {
+			$nextcell = '*'.$nextcell;
+		}
+		$nextcell = util_make_link('/admin/useredit.php?user_id='.$u->getID(), $nextcell);
+		if ($u->getStatus() == 'A') {
+			$cells[] = array($nextcell, 'class' => 'active');
+		}
+		if ($u->getStatus() == 'D') {
+			$cells[] = array($nextcell, 'class' => 'deleted');
+		}
+		if ($u->getStatus() == 'S') {
+			$cells[] = array($nextcell, 'class' => 'suspended');
+		}
+		if ($u->getStatus() == 'P') {
+			$cells[] = array($nextcell, 'class' => 'pending');
+		}
+		$cells[] = array(($u->getAddDate() ? date(_('Y-m-d H:i'), $u->getAddDate()) : '-'), 'width' => '15%', 'class' => 'align-center');
 		if ($u->getStatus() != 'D') {
-			echo util_make_link('/developer/?form_dev='.$u->getID(),_('User Profile'));
+			$nextcell = util_make_link('/developer/?form_dev='.$u->getID(),_('User Profile'));
 		} else {
-			echo '<strike>'._('User Profile').'</strike>';
+			$nextcell = '<strike>'._('User Profile').'</strike>';
 		}
-		echo '</td>';
-		echo '<td width="15%" style="text-align:center">';
+		$cells[] = array($nextcell, 'width' => '15%', 'class' => 'align-center');
 		if ($u->getStatus() != 'A') {
-			echo util_make_link('/admin/userlist.php?action=activate&user_id='.$u->getID().$filter,_('Activate'));
+			$nextcell = util_make_link('/admin/userlist.php?action=activate&user_id='.$u->getID().$filter,_('Activate'));
 		} else {
-			echo '<strike>'._('Activate').'</strike>';
+			$nextcell = '<strike>'._('Activate').'</strike>';
 		}
-		echo '</td>';
-		echo '<td width="15%" style="text-align:center">';
+		$cells[] = array($nextcell, 'width' => '15%', 'class' => 'align-center');
 		if ($u->getStatus() != 'D') {
-			echo util_make_link('/admin/userlist.php?action=delete&user_id='.$u->getID().$filter,_('Delete'));
+			$nextcell = util_make_link('/admin/userlist.php?action=delete&user_id='.$u->getID().$filter,_('Delete'));
 		} else {
-			echo '<strike>'._('Delete').'</strike>';
+			$nextcell = '<strike>'._('Delete').'</strike>';
 		}
-		echo '</td>';
-		echo '<td width="15%" style="text-align:center">';
+		$cells[] = array($nextcell, 'width' => '15%', 'class' => 'align-center');
 		if ($u->getStatus() != 'S') {
-			echo util_make_link('/admin/userlist.php?action=suspend&user_id='.$u->getID().$filter,_('Suspend')).'</td>';
+			$nextcell = util_make_link('/admin/userlist.php?action=suspend&user_id='.$u->getID().$filter,_('Suspend'));
 		} else {
-			echo '<strike>'._('Suspend').'</strike>';
+			$nextcell = '<strike>'._('Suspend').'</strike>';
 		}
-		echo '<td width="12%" style="text-align:center">'.util_make_link('/admin/passedit.php?user_id='.$u->getID().$filter,_('Change Password')).'</td>';
-		echo '</tr>';
+		$cells[] = array($nextcell, 'width' => '15%', 'class' => 'align-center');
+		$cells[] = array(util_make_link('/admin/passedit.php?user_id='.$u->getID().$filter,_('Change Password')), 'width' => '12%', 'class' => 'align-center');
+		echo $HTML->multiTableRow(array('class' => $HTML->boxGetAltRowStyle($count, true)), $cells);
 		$count ++;
 	}
-
 	echo $HTML->listTableBottom();
-
 }
 
 // Administrative functions
@@ -206,7 +208,7 @@ if ($usingplugin) {
 	}
 	$filter='';
 	if (in_array($status,array('D','A','S','P'))) {
-		$filter = '&status='.$status;
+		$filter = '&status='.$status;
 	}
 	$sort_order = getStringFromRequest('sortorder', 'realname');
 	util_ensure_value_in_set($sort_order,
@@ -223,7 +225,7 @@ if ($usingplugin) {
 		foreach ($project->getUsers() as $user) {
 			$users_id[] = $user->getID();
 		}
-		$filter = '&group_id='.$group_id;
+		$filter = '&group_id='.$group_id;
 		$sort_order = getStringFromRequest('sortorder', 'realname');
 		util_ensure_value_in_set($sort_order,
 					array('realname','user_name','lastname','firstname','user_id','status','add_date'));
diff --git a/src/www/include/Layout.class.php b/src/www/include/Layout.class.php
index f88549c..1b88dfe 100644
--- a/src/www/include/Layout.class.php
+++ b/src/www/include/Layout.class.php
@@ -601,15 +601,19 @@ if (isset($params['group']) && $params['group']) {
 	/**
 	 * boxGetAltRowStyle() - Get an alternating row style for tables.
 	 *
-	 * @param	int	$i	Row number
+	 * @param	int	$i		Row number
+	 * @param	bool	$classonly	Return class name only
 	 * @return	string	the class code
 	 */
-	function boxGetAltRowStyle($i) {
-		if ($i % 2 == 0) {
-			return ' class="altRowStyleEven"';
-		} else {
-			return ' class="altRowStyleOdd"';
-		}
+	function boxGetAltRowStyle($i, $classonly = false) {
+		if ($i % 2 == 0)
+			$ret = 'altRowStyleEven';
+		else
+			$ret = 'altRowStyleOdd';
+		if ($classonly)
+			return $ret;
+		else
+			return 'class="'.$ret.'"';
 	}
 
 	/**
diff --git a/src/www/themes/funky/Theme.class.php b/src/www/themes/funky/Theme.class.php
index 408af94..0990b1d 100644
--- a/src/www/themes/funky/Theme.class.php
+++ b/src/www/themes/funky/Theme.class.php
@@ -194,8 +194,8 @@ class Theme extends Layout {
 	/**
 	 * boxGetAltRowStyle() - Get an alternating row style for tables
 	 *
-	 * @param	int	$i	Row number
-	 * @param	bool $classonly Return class name only
+	 * @param	int	$i		Row number
+	 * @param	bool	$classonly	Return class name only
 	 * @return	string
 	 */
 	function boxGetAltRowStyle($i, $classonly = false) {

-----------------------------------------------------------------------

Summary of changes:
 src/www/admin/admin_table.php        |    8 +--
 src/www/admin/globalroleedit.php     |   63 ++++++++------------
 src/www/admin/index.php              |   57 +++++++++---------
 src/www/admin/massmail.php           |  105 ++++++++++++++++++++--------------
 src/www/admin/userlist.php           |   70 ++++++++++++-----------
 src/www/include/Layout.class.php     |   18 +++---
 src/www/stats/lastlogins.php         |   33 ++++-------
 src/www/themes/funky/Theme.class.php |    4 +-
 8 files changed, 179 insertions(+), 179 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list