Эх сурвалжийг харах

User Create/Edit: Require a group assignment.

Nate Jones 11 жил өмнө
parent
commit
aff07f9c9f

+ 8 - 17
core/users/signup.php

@@ -94,6 +94,7 @@ if (count($_POST)>0 && check_str($_POST["persistform"]) != "1") {
 	//if (strlen($contact_name_given) == 0) { $msg .= $text['message-required'].$text['label-first_name']."<br>\n"; }
 	//if (strlen($contact_name_family) == 0) { $msg .= $text['message-required'].$text['label-last_name']."<br>\n"; }
 	if (strlen($user_email) == 0) { $msg .= $text['message-required'].$text['label-email']."<br>\n"; }
+	if (strlen($group_uuid_name) == 0) { $msg .= $text['message-required'].$text['label-group']."<br>\n"; }
 
 	if (strlen($msg) > 0) {
 		require_once "resources/header.php";
@@ -237,26 +238,23 @@ if (count($_POST)>0 && check_str($_POST["persistform"]) != "1") {
 	echo "	}";
 	echo "</script>";
 
-	echo "<div align='center'>";
-
 	$tablewidth ='width="100%"';
 	echo "<form method='post' action=''>";
-	echo "<div class='borderlight' style='padding:10px;'>\n";
 
-	echo "<table border='0' $tablewidth cellpadding='6' cellspacing='0'>";
+	echo "<table border='0' $tablewidth cellpadding='0' cellspacing='0'>";
 	echo "	<tr>\n";
-	echo "		<td width='80%'>\n";
+	echo "		<td width='80%' valign='top'>\n";
 	echo "			<b>".$text['header-user_add']."</b>\n";
 	echo "			<br><br>\n";
 	echo "			".$text['description-user_add']."\n";
 	echo "		</td>\n";
-	echo "		<td width='20%' align='right'>\n";
-	echo "			<input type='button' class='btn' name='back' alt='".$text['button-back']."' onclick=\"window.history.back()\" value='".$text['button-back']."'>\n";
+	echo "		<td width='20%' valign='top' align='right'>\n";
+	echo "			<input type='button' class='btn' name='back' alt='".$text['button-back']."' onclick=\"document.location.href='index.php';\" value='".$text['button-back']."'>\n";
 	echo "		</td>\n";
 	echo "	</tr>\n";
 	echo "</table>\n";
 
-	echo "<table border='0' $tablewidth cellpadding='6' cellspacing='0'>";
+	echo "<table border='0' $tablewidth cellpadding='0' cellspacing='0'>";
 	echo "	<tr>";
 	echo "		<td class='vncellreq' width='30%'>".$text['label-username'].":</td>";
 	echo "		<td class='vtable' width='70%'><input type='text' class='formfld' autocomplete='off' name='username' value='$username'></td>";
@@ -275,7 +273,7 @@ if (count($_POST)>0 && check_str($_POST["persistform"]) != "1") {
 	echo "		<td class='vtable'><input type='text' class='formfld' name='user_email' value='$user_email'></td>";
 	echo "	</tr>";
 	echo "	<tr>";
-	echo "		<td class='vncell' valign='top'>".$text['label-group'].":</td>";
+	echo "		<td class='vncellreq' valign='top'>".$text['label-group'].":</td>";
 	echo "		<td class='vtable'>";
 	$sql = "SELECT * FROM v_groups ";
 	$sql .= "where domain_uuid = '".$domain_uuid."' ";
@@ -306,21 +304,14 @@ if (count($_POST)>0 && check_str($_POST["persistform"]) != "1") {
 	echo "		<td class='vncell'>".$text['label-company_name'].":</td>";
 	echo "		<td class='vtable'><input type='text' class='formfld' name='contact_organization' value='$contact_organization'></td>";
 	echo "	</tr>";
-	echo "</table>";
-	echo "</div>";
-
-	echo "<div class='' style='padding:10px;'>\n";
-	echo "<table $tablewidth>";
 	echo "	<tr>";
 	echo "		<td colspan='2' align='right'>";
-	echo "       <input type='submit' name='submit' class='btn' value='".$text['button-create_account']."'>";
+	echo "      	<br><input type='submit' name='submit' class='btn' value='".$text['button-create_account']."'>";
 	echo "		</td>";
 	echo "	</tr>";
 	echo "</table>";
 	echo "</form>";
 
-	echo "</div>";
-
 //show the footer
 	require_once "resources/footer.php";
 ?>

+ 11 - 23
core/users/usersupdate.php

@@ -416,14 +416,9 @@ else {
 
 	echo "<form method='post' action=''>";
 
-	echo "<div align='center'>";
-	echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
-	echo "<tr>\n";
-	echo "<td>\n";
-
-	echo "<table $table_width cellpadding='3' cellspacing='0' border='0'>";
+	echo "<table $table_width cellpadding='0' cellspacing='0' border='0'>";
 	echo "<td align='left' width='90%' nowrap><b>".$text['header-user_edit']."</b></td>\n";
-	echo "<td nowrap='nowrap'>\n";
+	echo "<td align='right' nowrap>\n";
 	echo "	<input type='button' class='btn' onclick=\"window.location='index.php'\" value='".$text['button-back']."'>";
 	echo "	<input type='submit' name='submit' class='btn' value='".$text['button-save']."'>";
 	echo "</td>\n";
@@ -437,7 +432,7 @@ else {
 
 	echo "<br />\n";
 
-	echo "<table $table_width cellpadding='6' cellspacing='0' border='0'>";
+	echo "<table $table_width cellpadding='0' cellspacing='0' border='0'>";
 	echo "<tr>\n";
 	echo "	<th class='th' colspan='2' align='left'>".$text['label-user_info']."</th>\n";
 	echo "</tr>\n";
@@ -464,7 +459,7 @@ else {
 	echo "	</tr>";
 
 	echo "	<tr>";
-	echo "		<td class='vncell' valign='top'>".$text['label-groups'].":</td>";
+	echo "		<td class='vncellreq' valign='top'>".$text['label-groups'].":</td>";
 	echo "		<td class='vtable'>";
 
 	$sql = "SELECT * FROM v_group_users ";
@@ -482,11 +477,13 @@ else {
 			if (strlen($field['group_name']) > 0) {
 				echo "<tr>\n";
 				echo "	<td class='vtable'>".$field['group_name']."</td>\n";
-				echo "	<td>\n";
-				if (permission_exists('group_member_delete') || if_group("superadmin")) {
-					echo "		<a href='usersupdate.php?id=".$user_uuid."&domain_uuid=".$domain_uuid."&group_uuid=".$field['group_uuid']."&a=delete' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
+				if ($result_count > 1) {
+					echo "	<td>\n";
+					if (permission_exists('group_member_delete') || if_group("superadmin")) {
+						echo "		<a href='usersupdate.php?id=".$user_uuid."&domain_uuid=".$domain_uuid."&group_uuid=".$field['group_uuid']."&a=delete' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
+					}
+					echo "	</td>\n";
 				}
-				echo "	</td>\n";
 				echo "</tr>\n";
 				$assigned_groups[] = $field['group_uuid'];
 			}
@@ -717,13 +714,8 @@ else {
 	echo "</td>\n";
 	echo "</tr>\n";
 
-	echo "	</table>";
-	echo "<br>";
-
-	echo "<div class='' style='padding:10px;'>\n";
-	echo "<table $table_width>";
 	echo "	<tr>";
-	echo "		<td colspan='2' align='right'>";
+	echo "		<td colspan='2' align='right'><br>";
 	echo "			<input type='hidden' name='id' value=\"$user_uuid\">";
 	echo "			<input type='hidden' name='username_old' value=\"$username\">";
 	echo "			<input type='submit' name='submit' class='btn' value='".$text['button-save']."'>";
@@ -731,10 +723,6 @@ else {
 	echo "	</tr>";
 	echo "</table>";
 
-	echo "	</td>";
-	echo "	</tr>";
-	echo "</table>";
-	echo "</div>";
 	echo "</form>";
 
 //include the footer