[evolvis-commits] r18411: small-fixes pending merges:↵ Thorsten Glaser 2012-05-16 note which fields are required↵ Thorsten Glaser 2012-05-16 rewrite using EvolvisTable to get alternating row backgrounds↵ Thorsten Glaser 2012-05-16 finally, define what “higher-up” role means: sort stably by role_id↵ Thorsten Glaser 2012-05-16 now sort the list of users in a role↵ Thorsten Glaser 2012-05-16 do not use array_unique, as it may not preserve the input array order↵ Thorsten Glaser 2012-05-16 always, always, always display the unixname of a user along with the ...↵ Thorsten Glaser 2012-05-16 sort the user list↵ Thorsten Glaser 2012-05-16 Tweak UI↵ Thorsten Glaser 2012-05-16 keep the same style over the document

mirabilos at evolvis.org mirabilos at evolvis.org
Wed May 16 12:26:40 CEST 2012


Author: mirabilos
Date: 2012-05-16 12:26:40 +0200 (Wed, 16 May 2012)
New Revision: 18411

Modified:
   trunk/gforge_base/evolvisforge-5.1/src/common/include/Group.class.php
   trunk/gforge_base/evolvisforge-5.1/src/www/admin/globalroleedit.php
   trunk/gforge_base/evolvisforge-5.1/src/www/tracker/admin/ind.php
Log:
small-fixes pending merges:
  Thorsten Glaser 2012-05-16 note which fields are required
    Thorsten Glaser 2012-05-16 rewrite using EvolvisTable to get alternating row backgrounds
    Thorsten Glaser 2012-05-16 finally, define what “higher-up” role means: sort stably by role_id
    Thorsten Glaser 2012-05-16 now sort the list of users in a role
    Thorsten Glaser 2012-05-16 do not use array_unique, as it may not preserve the input array order
    Thorsten Glaser 2012-05-16 always, always, always display the unixname of a user along with the ...
    Thorsten Glaser 2012-05-16 sort the user list
    Thorsten Glaser 2012-05-16 Tweak UI
    Thorsten Glaser 2012-05-16 keep the same style over the document

Modified: trunk/gforge_base/evolvisforge-5.1/src/common/include/Group.class.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/common/include/Group.class.php	2012-05-16 10:26:36 UTC (rev 18410)
+++ trunk/gforge_base/evolvisforge-5.1/src/common/include/Group.class.php	2012-05-16 10:26:40 UTC (rev 18411)
@@ -2970,12 +2970,12 @@
 		$role_ids = array () ;
 
 		if (USE_PFO_RBAC) {
-			$res = db_query_params ('SELECT role_id FROM pfo_role WHERE home_group_id=$1',
+			$res = db_query_params ('SELECT role_id FROM pfo_role WHERE home_group_id=$1 ORDER BY role_id',
 						array ($this->getID()));
 			while ($arr = db_fetch_array($res)) {
 				$role_ids[] = $arr['role_id'] ;
 			}
-			$res = db_query_params ('SELECT role_id FROM role_project_refs WHERE group_id=$1',
+			$res = db_query_params ('SELECT role_id FROM role_project_refs WHERE group_id=$1 ORDER BY role_id',
 						array ($this->getID()));
 			while ($arr = db_fetch_array($res)) {
 				$role_ids[] = $arr['role_id'] ;
@@ -3087,12 +3087,18 @@
 					    && ($role->getHomeProject() == NULL || $role->getHomeProject()->getID() != $this->getID())) {
 						continue ;
 					}
-					foreach ($role->getUsers() as $user) {
+					$roleusers = $role->getUsers();
+					sortUserList($roleusers, 'unixname');
+					foreach ($roleusers as $user) {
 						$ids[] = $user->getID() ;
 					}
 				}
-				$ids = array_unique ($ids) ;
+				$ids_seen = array();
 				foreach ($ids as $id) {
+					if (isset($ids_seen[$id])) {
+						continue;
+					}
+					$ids_seen[$id] = true;
 					$u = user_get_object ($id) ;
 					if ($u->isActive()) {
 						$this->membersArr[] = $u ;

Modified: trunk/gforge_base/evolvisforge-5.1/src/www/admin/globalroleedit.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/www/admin/globalroleedit.php	2012-05-16 10:26:36 UTC (rev 18410)
+++ trunk/gforge_base/evolvisforge-5.1/src/www/admin/globalroleedit.php	2012-05-16 10:26:40 UTC (rev 18411)
@@ -3,7 +3,8 @@
  * Role Editing Page
  *
  * Copyright 2010-2011, Roland Mas
- * Copyright (c) 2011 Thorsten Glaser <t.glaser at tarent.de>
+ * Copyright © 2011, 2012
+ *	Thorsten “mirabilos” 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
@@ -139,42 +140,54 @@
 
 if ($role instanceof RoleExplicit) {
 	$users = $role->getUsers () ;
+	sortUserList($users, 'unixname');
 	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>';
+			';
 
+		$t = new EvolvisTable(array(
+			_('User name'),
+			_('Unix name'),
+			_('Remove'),
+		    ), false, array(
+			'narrow' => true,
+		    ));
+
 		foreach ($users as $user) {
-			echo '
-		<tr>
-			<td style="white-space:nowrap;">
-				<a href="/users/'.$user->getUnixName().'">';
-			$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>';
+			$r = $t->tr();
+			$r->td(array(
+				'style' => 'white-space:nowrap;',
+			    ))->setRaw(html_e('a', array(
+				'href' => '/users/' . $user->getUnixName(),
+			    ), util_html_encode($user->getRealName())));
+			$r->td()->set($user->getUnixName());
+			$r->td()->setRaw(html_e('input', array(
+				'type' => 'checkbox',
+				'name' => 'rmusers[]',
+				'value' => $user->getID(),
+			    )) . ' ' . _('Remove'));
 		}
-		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>';
+
+		$t->tr()->td(array(
+			'colspan' => 3,
+		    ))->setRaw(html_e('input', array(
+			'type' => 'checkbox',
+			'name' => 'reallyremove',
+			'value' => 1,
+		    )) . ' ' . _('Really remove ticked users from role?'));
+		$t->tr()->td(array(
+			'colspan' => 3,
+		    ))->setRaw(html_e('input', array(
+			'type' => 'submit',
+			'name' => 'dormusers',
+			'value' => _("Remove"),
+		    )));
+
+		echo $t->emit() . "\n</form>\n";
 	} else {
 		echo '<p><strong>'._('No users currently have this role').'</strong></p>' ;
 	}
@@ -192,11 +205,13 @@
 		</form>
 <?php
 }
-		
+
 echo '
-<form action="'.util_make_url('/admin/globalroleedit.php').'" method="post">';
+<form
+ style="border:solid 1px black; margin:3px; padding:3px;"
+ action="'.util_make_url('/admin/globalroleedit.php').'" method="post">';
 echo '<input type="hidden" name="role_id" value="'.$role_id.'" />';
-		
+
 if ($role instanceof RoleExplicit) {
 	echo '<p><strong>'._('Role Name').'</strong><br /><input type="text" name="role_name" value="'.$role->getName().'" /></p>';
 	echo '<input type="checkbox" name="public" value="1"' ;
@@ -204,6 +219,7 @@
 		echo ' checked="checked"' ;
 	}
 	echo '/> '._('Public role (can be referenced by projects)');
+	echo "<h3>" . _('Change global role permissions') . "</h3>\n";
 } else {
 	echo '<p><strong>'._('Role Name').'</strong><br />'.$role->getName().'</p>';
 }
@@ -239,7 +255,7 @@
 	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>';
-	
+
 }
 
 echo $HTML->listTableBottom();
@@ -250,10 +266,10 @@
 echo '
 <form action="'.util_make_url('/admin/globalroledelete.php').'" method="post">';
 echo '<input type="hidden" name="role_id" value="'.$role_id.'" />';
-		
+
 echo '<p><strong>'._('Delete role').'</strong></p>';
-echo '<p><input type="checkbox" name="sure" value="1"/> '._("Really delete this role?");
-echo '<input type="submit" name="submit" value="'._('Delete role').'" /></p>
+echo '<p><input type="checkbox" name="sure" value="1"/> '._("Really delete this role?").'</p>
+<p><input type="submit" name="submit" value="'._('Delete role').'" /></p>
 </form>';
 
 site_admin_footer(array());
@@ -262,5 +278,3 @@
 // mode: php
 // c-file-style: "bsd"
 // End:
-
-?>

Modified: trunk/gforge_base/evolvisforge-5.1/src/www/tracker/admin/ind.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/www/tracker/admin/ind.php	2012-05-16 10:26:36 UTC (rev 18410)
+++ trunk/gforge_base/evolvisforge-5.1/src/www/tracker/admin/ind.php	2012-05-16 10:26:40 UTC (rev 18411)
@@ -135,11 +135,12 @@
 	?><?php echo _('<h3>Create a new tracker</h3><p>You can use this system to track virtually any kind of data, with each tracker having separate user, group, category, and permission lists. You can also easily move items between trackers when needed.</p><p>Trackers are referred to as "Artifact Types" and individual pieces of data are "Artifacts". "Bugs" might be an Artifact Type, whiles a bug report would be an Artifact. You can create as many Artifact Types as you want, but remember you need to set up categories, groups, and permission for each type, which can get time-consuming.</p>') ?>
 	<form action="<?php echo getStringFromServer('PHP_SELF').'?group_id='.$group_id; ?>" method="post">
 	<input type="hidden" name="add_at" value="y" />
-	<p>
-	<?php echo _('<strong> Name:</strong> (examples: meeting minutes, test results, RFP Docs)') ?><br />
+	<p><strong><?php echo _('Name') .
+	    utils_requiredField(); ?>:</strong> <?php
+	<?php echo _('(examples: meeting minutes, test results, RFP Docs)') ?><br />
 	<input type="text" name="name" value="" /></p>
-	<p>
-	<strong><?php echo _('Description') ?>:</strong><br />
+	<p><strong><?php echo _('Description') .
+	    utils_requiredField(); ?>:</strong><br />
 	<input type="text" name="description" value="" size="50" /></p>
 	<p>
 	<input type="checkbox" name="is_public" value="1" /> <strong><?php echo _('Publicly Available') ?></strong><br />
@@ -149,11 +150,11 @@
 	<input type="text" name="email_address" value="" /></p>
 	<p>
 	<input type="checkbox" name="email_all" value="1" /> <strong><?php echo _('Send email on all changes') ?></strong></p>
-	<p>
-	<strong><?php echo _('Days till considered overdue') ?>:</strong><br />
+	<p><strong><?php echo _('Days till considered overdue') .
+	    utils_requiredField(); ?>:</strong><br />
 	<input type="text" name="due_period" value="30" /></p>
-	<p style="display:none;">
-	<strong><?php echo _('Days till pending tracker items time out') ?>:</strong><br />
+	<p style="display:none;"><strong><?php echo _('Days till pending tracker items time out') .
+	    utils_requiredField(); ?>:</strong><br />
 	<input type="text" name="status_timeout" value="14" /></p>
 	<p>
 	<strong><?php echo _('Free form text for the "submit new item" page') ?>:</strong><br />
@@ -161,6 +162,8 @@
 	<p>
 	<strong><?php echo _('Free form text for the "browse items" page') ?>:</strong><br />
 	<textarea name="browse_instructions" rows="10" cols="55"></textarea></p>
+	<p><?php echo utils_requiredField() . ' ' .
+	    _('indicates required fields.'); ?></p>
 	<p>
 	<input type="submit" name="post_changes" value="<?php echo _('Submit') ?>" /></p>
 	</form>
@@ -173,5 +176,3 @@
 // mode: php
 // c-file-style: "bsd"
 // End:
-
-?>



More information about the evolvis-commits mailing list