[evolvis-commits] r18397: fix PHP errors for not-yet-approved groups

mirabilos at evolvis.org mirabilos at evolvis.org
Fri May 11 17:15:39 CEST 2012


Author: mirabilos
Date: 2012-05-11 17:15:38 +0200 (Fri, 11 May 2012)
New Revision: 18397

Modified:
   trunk/gforge_base/evolvisforge-5.1/src/www/include/role_utils.php
   trunk/gforge_base/evolvisforge-5.1/src/www/project/admin/users.php
Log:
fix PHP errors for not-yet-approved groups

Modified: trunk/gforge_base/evolvisforge-5.1/src/www/include/role_utils.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/www/include/role_utils.php	2012-05-11 15:15:30 UTC (rev 18396)
+++ trunk/gforge_base/evolvisforge-5.1/src/www/include/role_utils.php	2012-05-11 15:15:38 UTC (rev 18397)
@@ -44,7 +44,7 @@
 		$names[] = $role->getDisplayableName($group) ;
 	}
 
-	if ($selected == 'xzxzxz') {
+	if ($selected == 'xzxzxz' & isset($ids[0])) {
 		$selected = $ids[0] ;
 	}
 

Modified: trunk/gforge_base/evolvisforge-5.1/src/www/project/admin/users.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/www/project/admin/users.php	2012-05-11 15:15:30 UTC (rev 18396)
+++ trunk/gforge_base/evolvisforge-5.1/src/www/project/admin/users.php	2012-05-11 15:15:38 UTC (rev 18397)
@@ -280,73 +280,76 @@
 
 $members = $group->getUsers() ;
 
-echo '<table width="100%"><thead><tr>';
-echo '<th>'._('User name').'</th>';
-echo '<th>'._('Role').'</th>';
-echo '<th style="text-align:right">'._('Action').'</th>';
-echo '</tr></thead><tbody>';
+if ($members) {
 
-$i = 0;
-foreach ($members as $user) {
-	$i++;
-	
-	$roles = array () ;
-	foreach (RBACEngine::getInstance()->getAvailableRolesForUser ($user) as $role) {
-		if ($role->getHomeProject() && $role->getHomeProject()->getID() == $group->getID()) {
-			$roles[] = $role ;
+	echo '<table width="100%"><thead><tr>';
+	echo '<th>'._('User name').'</th>';
+	echo '<th>'._('Role').'</th>';
+	echo '<th style="text-align:right">'._('Action').'</th>';
+	echo '</tr></thead><tbody>';
+
+	$i = 0;
+	foreach ($members as $user) {
+		$i++;
+		
+		$roles = array () ;
+		foreach (RBACEngine::getInstance()->getAvailableRolesForUser ($user) as $role) {
+			if ($role->getHomeProject() && $role->getHomeProject()->getID() == $group->getID()) {
+				$roles[] = $role ;
+			}
 		}
-	}
 
-	sortRoleList ($roles) ;
+		sortRoleList ($roles) ;
 
-	$seen = false ;
-	foreach ($roles as $role) {
-		echo '<tr '. $HTML->boxGetAltRowStyle($i) . '>' ;
-		if (!$seen) {
-			$seen = $user->getRealName();
-			if ($seen) {
-				$seen .= html_e('br');
-			} else {
-				$seen = "";
+		$seen = false ;
+		foreach ($roles as $role) {
+			echo '<tr '. $HTML->boxGetAltRowStyle($i) . '>' ;
+			if (!$seen) {
+				$seen = $user->getRealName();
+				if ($seen) {
+					$seen .= html_e('br');
+				} else {
+					$seen = "";
+				}
+				echo html_e('td', array(
+					'style' => 'white-space:nowrap;',
+					'rowspan' => count($roles) + 1,
+				    ), html_e('a', array(
+					'href' => '/users/' . $user->getUnixName(),
+				    ), $seen . $user->getUnixName()));
+				$seen = true ;
 			}
-			echo html_e('td', array(
-				'style' => 'white-space:nowrap;',
-				'rowspan' => count($roles) + 1,
-			    ), html_e('a', array(
-				'href' => '/users/' . $user->getUnixName(),
-			    ), $seen . $user->getUnixName()));
-			$seen = true ;
+
+			echo '<td colspan="2">
+			<div style="float:left;">
+				' . $role->getName() . '
+			</div><div style="float:right;">
+				<form action="'.getStringFromServer('PHP_SELF').'" method="post">
+				<input type="hidden" name="submit" value="y" />
+				<input type="hidden" name="username" value="'.$user->getUnixName() // Functionally ignored, only used for testsuite
+	.'" />
+				<input type="hidden" name="user_id" value="'.$user->getID().'" />
+				<input type="hidden" name="group_id" value="'. $group_id .'" />
+				<input type="hidden" name="role_id" value="'.$role->getID().'" />
+				<input type="submit" name="rmuser" value="'._("Remove").'" />
+				</form>
+			</div></td></tr>';
 		}
 
-		echo '<td colspan="2">
-		<div style="float:left;">
-			' . $role->getName() . '
-		</div><div style="float:right;">
+		echo '<tr '. $HTML->boxGetAltRowStyle($i) . '><td colspan="2">
 			<form action="'.getStringFromServer('PHP_SELF').'" method="post">
 			<input type="hidden" name="submit" value="y" />
-			<input type="hidden" name="username" value="'.$user->getUnixName() // Functionally ignored, only used for testsuite
-.'" />
-			<input type="hidden" name="user_id" value="'.$user->getID().'" />
+			<input type="hidden" name="form_unix_name" value="'.$user->getUnixName().'" />
 			<input type="hidden" name="group_id" value="'. $group_id .'" />
-			<input type="hidden" name="role_id" value="'.$role->getID().'" />
-			<input type="submit" name="rmuser" value="'._("Remove").'" />
-			</form>
-		</div></td></tr>';
+			<div style="float:left;">
+				' . role_box($group_id,'role_id',$role->getID()) . '
+			</div><div style="float:right;">
+				<input type="submit" name="adduser" value="'._("Grant extra role").'" />
+			</div>
+			</form></td></tr>';
 	}
-
-	echo '<tr '. $HTML->boxGetAltRowStyle($i) . '><td colspan="2">
-		<form action="'.getStringFromServer('PHP_SELF').'" method="post">
-		<input type="hidden" name="submit" value="y" />
-		<input type="hidden" name="form_unix_name" value="'.$user->getUnixName().'" />
-		<input type="hidden" name="group_id" value="'. $group_id .'" />
-		<div style="float:left;">
-			' . role_box($group_id,'role_id',$role->getID()) . '
-		</div><div style="float:right;">
-			<input type="submit" name="adduser" value="'._("Grant extra role").'" />
-		</div>
-		</form></td></tr>';
+	echo '</tbody></table>';
 }
-echo '</tbody></table>';
 
 		echo $HTML->boxBottom();
 



More information about the evolvis-commits mailing list