Przeglądaj źródła

! Kill the simple permissions page as per #509

Signed-off-by: Peter Spicer <[email protected]>
Peter Spicer 10 lat temu
rodzic
commit
d3d96e5108

+ 111 - 186
Sources/ManagePermissions.php

@@ -692,23 +692,11 @@ function ModifyMembergroup()
 
 	$context['group']['id'] = (int) $_GET['group'];
 
-	// Are they toggling the view?
-	if (isset($_GET['view']))
-	{
-		$context['admin_preferences']['pv'] = $_GET['view'] == 'classic' ? 'classic' : 'simple';
-
-		// Update the users preferences.
-		require_once($sourcedir . '/Subs-Admin.php');
-		updateAdminPreferences();
-	}
-
-	$context['view_type'] = !empty($context['admin_preferences']['pv']) && $context['admin_preferences']['pv'] == 'classic' ? 'classic' : 'simple';
-
 	// It's not likely you'd end up here with this setting disabled.
 	if ($_GET['group'] == 1)
 		redirectexit('action=admin;area=permissions');
 
-	loadAllPermissions($context['view_type']);
+	loadAllPermissions();
 	loadPermissionProfiles();
 
 	if ($context['group']['id'] > 0)
@@ -809,20 +797,14 @@ function ModifyMembergroup()
 				{
 					// Create a shortcut for the current permission.
 					$curPerm = &$context['permissions'][$permissionType]['columns'][$position][$permissionGroup]['permissions'][$perm['id']];
-					if ($tmp['view'] == 'classic')
+
+					if ($perm['has_own_any'])
 					{
-						if ($perm['has_own_any'])
-						{
-							$curPerm['any']['select'] = in_array($perm['id'] . '_any', $permissions[$permissionType]['allowed']) ? 'on' : (in_array($perm['id'] . '_any', $permissions[$permissionType]['denied']) ? 'denied' : 'off');
-							$curPerm['own']['select'] = in_array($perm['id'] . '_own', $permissions[$permissionType]['allowed']) ? 'on' : (in_array($perm['id'] . '_own', $permissions[$permissionType]['denied']) ? 'denied' : 'off');
-						}
-						else
-							$curPerm['select'] = in_array($perm['id'], $permissions[$permissionType]['denied']) ? 'denied' : (in_array($perm['id'], $permissions[$permissionType]['allowed']) ? 'on' : 'off');
+						$curPerm['any']['select'] = in_array($perm['id'] . '_any', $permissions[$permissionType]['allowed']) ? 'on' : (in_array($perm['id'] . '_any', $permissions[$permissionType]['denied']) ? 'denied' : 'off');
+						$curPerm['own']['select'] = in_array($perm['id'] . '_own', $permissions[$permissionType]['allowed']) ? 'on' : (in_array($perm['id'] . '_own', $permissions[$permissionType]['denied']) ? 'denied' : 'off');
 					}
 					else
-					{
 						$curPerm['select'] = in_array($perm['id'], $permissions[$permissionType]['denied']) ? 'denied' : (in_array($perm['id'], $permissions[$permissionType]['allowed']) ? 'on' : 'off');
-					}
 				}
 			}
 		}
@@ -1401,10 +1383,8 @@ function setPermissionLevel($level, $group, $profile = 'null')
 /**
  * Load permissions into $context['permissions'].
  * @internal
- *
- * @param string $loadType options: 'classic' or 'simple'
  */
-function loadAllPermissions($loadType = 'classic')
+function loadAllPermissions()
 {
 	global $context, $txt, $modSettings;
 
@@ -1412,129 +1392,105 @@ function loadAllPermissions($loadType = 'classic')
 	// Note to Mod authors - you don't need to stick your permission group here if you don't mind SMF sticking it the last group of the page.
 	$permissionGroups = array(
 		'membergroup' => array(
-			'simple' => array(
-				'view_basic_info',
-				'use_pm_system',
-				'post_calendar',
-				'edit_profile',
-				'delete_account',
-				'use_avatar',
-				'moderate_general',
-				'administrate',
-			),
-			'classic' => array(
-				'general',
-				'pm',
-				'calendar',
-				'maintenance',
-				'member_admin',
-				'profile',
-			),
+			'general',
+			'pm',
+			'calendar',
+			'maintenance',
+			'member_admin',
+			'profile',
 		),
 		'board' => array(
-			'simple' => array(
-				'make_posts',
-				'make_unapproved_posts',
-				'post_polls',
-				'participate',
-				'modify',
-				'notification',
-				'attach',
-				'moderate',
-			),
-			'classic' => array(
-				'general_board',
-				'topic',
-				'post',
-				'poll',
-				'notification',
-				'attachment',
-			),
+			'general_board',
+			'topic',
+			'post',
+			'poll',
+			'notification',
+			'attachment',
 		),
 	);
 
 	/*   The format of this list is as follows:
 		'membergroup' => array(
-			'permissions_inside' => array(has_multiple_options, classic_view_group, simple_view_group(_own)*, simple_view_group_any*),
+			'permissions_inside' => array(has_multiple_options, view_group),
 		),
 		'board' => array(
-			'permissions_inside' => array(has_multiple_options, classic_view_group, simple_view_group(_own)*, simple_view_group_any*),
+			'permissions_inside' => array(has_multiple_options, view_group),
 		);
 	*/
 	$permissionList = array(
 		'membergroup' => array(
-			'view_stats' => array(false, 'general', 'view_basic_info'),
-			'view_mlist' => array(false, 'general', 'view_basic_info'),
-			'who_view' => array(false, 'general', 'view_basic_info'),
-			'search_posts' => array(false, 'general', 'view_basic_info'),
-			'karma_edit' => array(false, 'general', 'moderate_general'),
-			'pm_read' => array(false, 'pm', 'use_pm_system'),
-			'pm_send' => array(false, 'pm', 'use_pm_system'),
-			'pm_draft' => array(false, 'pm', 'use_pm_system'),
-			'pm_autosave_draft' => array(false, 'pm', 'use_pm_system'),
-			'send_email_to_members' => array(false, 'pm', 'use_pm_system'),
-			'calendar_view' => array(false, 'calendar', 'view_basic_info'),
-			'calendar_post' => array(false, 'calendar', 'post_calendar'),
-			'calendar_edit' => array(true, 'calendar', 'post_calendar', 'moderate_general'),
-			'admin_forum' => array(false, 'maintenance', 'administrate'),
-			'manage_boards' => array(false, 'maintenance', 'administrate'),
-			'manage_attachments' => array(false, 'maintenance', 'administrate'),
-			'manage_smileys' => array(false, 'maintenance', 'administrate'),
-			'edit_news' => array(false, 'maintenance', 'administrate'),
-			'access_mod_center' => array(false, 'maintenance', 'moderate_general'),
-			'moderate_forum' => array(false, 'member_admin', 'moderate_general'),
-			'manage_membergroups' => array(false, 'member_admin', 'administrate'),
-			'manage_permissions' => array(false, 'member_admin', 'administrate'),
-			'manage_bans' => array(false, 'member_admin', 'administrate'),
-			'send_mail' => array(false, 'member_admin', 'administrate'),
-			'issue_warning' => array(false, 'member_admin', 'moderate_general'),
-			'profile_view' => array(false, 'profile', 'view_basic_info'),
-			'profile_identity' => array(true, 'profile', 'edit_profile', 'moderate_general'),
-			'profile_forum' => array(true, 'profile', 'edit_profile', 'moderate_general'),
-			'profile_password' => array(true, 'profile', 'edit_profile', 'moderate_general'),
-			'profile_extra' => array(true, 'profile', 'edit_profile', 'moderate_general'),
-			'profile_signature' => array(true, 'profile', 'edit_profile', 'moderate_general'),
-			'profile_other' => array(true, 'profile', 'edit_profile', 'moderate_general'),
-			'profile_title' => array(true, 'profile', 'edit_profile', 'moderate_general'),
-			'profile_displayed_name' => array(true, 'profile', 'edit_profile', 'moderate_general'),
-			'profile_blurb' => array(true, 'profile', 'edit_profile', 'moderate_general'),
-			'profile_remove' => array(true, 'profile', 'delete_account', 'moderate_general'),
-			'profile_server_avatar' => array(false, 'profile', 'use_avatar'),
-			'profile_upload_avatar' => array(false, 'profile', 'use_avatar'),
-			'profile_remote_avatar' => array(false, 'profile', 'use_avatar'),
+			'view_stats' => array(false, 'general'),
+			'view_mlist' => array(false, 'general'),
+			'who_view' => array(false, 'general'),
+			'search_posts' => array(false, 'general'),
+			'karma_edit' => array(false, 'general'),
+			'pm_read' => array(false, 'pm'),
+			'pm_send' => array(false, 'pm'),
+			'pm_draft' => array(false, 'pm'),
+			'pm_autosave_draft' => array(false, 'pm'),
+			'send_email_to_members' => array(false, 'pm'),
+			'calendar_view' => array(false, 'calendar'),
+			'calendar_post' => array(false, 'calendar'),
+			'calendar_edit' => array(true, 'calendar'),
+			'admin_forum' => array(false, 'maintenance'),
+			'manage_boards' => array(false, 'maintenance'),
+			'manage_attachments' => array(false, 'maintenance'),
+			'manage_smileys' => array(false, 'maintenance'),
+			'edit_news' => array(false, 'maintenance'),
+			'access_mod_center' => array(false, 'maintenance'),
+			'moderate_forum' => array(false, 'member_admin'),
+			'manage_membergroups' => array(false, 'member_admin'),
+			'manage_permissions' => array(false, 'member_admin'),
+			'manage_bans' => array(false, 'member_admin'),
+			'send_mail' => array(false, 'member_admin'),
+			'issue_warning' => array(false, 'member_admin'),
+			'profile_view' => array(false, 'profile'),
+			'profile_identity' => array(true, 'profile'),
+			'profile_forum' => array(true, 'profile'),
+			'profile_password' => array(true, 'profile'),
+			'profile_extra' => array(true, 'profile'),
+			'profile_signature' => array(true, 'profile'),
+			'profile_other' => array(true, 'profile'),
+			'profile_title' => array(true, 'profile'),
+			'profile_displayed_name' => array(true, 'profile'),
+			'profile_blurb' => array(true, 'profile'),
+			'profile_remove' => array(true, 'profile'),
+			'profile_server_avatar' => array(false, 'profile'),
+			'profile_upload_avatar' => array(false, 'profile'),
+			'profile_remote_avatar' => array(false, 'profile'),
 		),
 		'board' => array(
-			'moderate_board' => array(false, 'general_board', 'moderate'),
-			'approve_posts' => array(false, 'general_board', 'moderate'),
-			'post_new' => array(false, 'topic', 'make_posts'),
-			'post_draft' => array(false, 'topic', 'make_posts'),
-			'post_autosave_draft' => array(false, 'topic', 'make_posts'),
-			'post_unapproved_topics' => array(false, 'topic', 'make_unapproved_posts'),
-			'post_unapproved_replies' => array(true, 'topic', 'make_unapproved_posts', 'make_unapproved_posts'),
-			'post_reply' => array(true, 'topic', 'make_posts', 'make_posts'),
-			'merge_any' => array(false, 'topic', 'moderate'),
-			'split_any' => array(false, 'topic', 'moderate'),
-			'send_topic' => array(false, 'topic', 'moderate'),
-			'make_sticky' => array(false, 'topic', 'moderate'),
-			'move' => array(true, 'topic', 'moderate', 'moderate'),
-			'lock' => array(true, 'topic', 'moderate', 'moderate'),
-			'remove' => array(true, 'topic', 'modify', 'moderate'),
-			'modify_replies' => array(false, 'topic', 'moderate'),
-			'delete_replies' => array(false, 'topic', 'moderate'),
-			'announce_topic' => array(false, 'topic', 'moderate'),
-			'delete' => array(true, 'post', 'modify', 'moderate'),
-			'modify' => array(true, 'post', 'modify', 'moderate'),
-			'report_any' => array(false, 'post', 'participate'),
-			'poll_view' => array(false, 'poll', 'participate'),
-			'poll_vote' => array(false, 'poll', 'participate'),
-			'poll_post' => array(false, 'poll', 'post_polls'),
-			'poll_add' => array(true, 'poll', 'post_polls', 'moderate'),
-			'poll_edit' => array(true, 'poll', 'modify', 'moderate'),
-			'poll_lock' => array(true, 'poll', 'moderate', 'moderate'),
-			'poll_remove' => array(true, 'poll', 'modify', 'moderate'),
-			'view_attachments' => array(false, 'attachment', 'participate'),
-			'post_unapproved_attachments' => array(false, 'attachment', 'make_unapproved_posts'),
-			'post_attachment' => array(false, 'attachment', 'attach'),
+			'moderate_board' => array(false, 'general_board'),
+			'approve_posts' => array(false, 'general_board'),
+			'post_new' => array(false, 'topic'),
+			'post_draft' => array(false, 'topic'),
+			'post_autosave_draft' => array(false, 'topic'),
+			'post_unapproved_topics' => array(false, 'topic'),
+			'post_unapproved_replies' => array(true, 'topic'),
+			'post_reply' => array(true, 'topic'),
+			'merge_any' => array(false, 'topic'),
+			'split_any' => array(false, 'topic'),
+			'send_topic' => array(false, 'topic'),
+			'make_sticky' => array(false, 'topic'),
+			'move' => array(true, 'topic', 'moderate'),
+			'lock' => array(true, 'topic', 'moderate'),
+			'remove' => array(true, 'topic', 'modify'),
+			'modify_replies' => array(false, 'topic'),
+			'delete_replies' => array(false, 'topic'),
+			'announce_topic' => array(false, 'topic'),
+			'delete' => array(true, 'post'),
+			'modify' => array(true, 'post'),
+			'report_any' => array(false, 'post'),
+			'poll_view' => array(false, 'poll'),
+			'poll_vote' => array(false, 'poll'),
+			'poll_post' => array(false, 'poll'),
+			'poll_add' => array(true, 'poll'),
+			'poll_edit' => array(true, 'poll'),
+			'poll_lock' => array(true, 'poll'),
+			'poll_remove' => array(true, 'poll'),
+			'view_attachments' => array(false, 'attachment'),
+			'post_unapproved_attachments' => array(false, 'attachment'),
+			'post_attachment' => array(false, 'attachment'),
 		),
 	);
 
@@ -1605,7 +1561,6 @@ function loadAllPermissions($loadType = 'classic')
 	{
 		$context['permissions'][$permissionType] = array(
 			'id' => $permissionType,
-			'view' => $loadType,
 			'columns' => array()
 		);
 		foreach ($permissionList as $permission => $permissionArray)
@@ -1615,76 +1570,46 @@ function loadAllPermissions($loadType = 'classic')
 				continue;
 
 			// What groups will this permission be in?
-			$own_group = $permissionArray[($loadType == 'classic' ? 1 : 2)];
-			$any_group = $loadType == 'simple' && !empty($permissionArray[3]) ? $permissionArray[3] : ($loadType == 'simple' && $permissionArray[0] ? $permissionArray[2] : '');
+			$own_group = $permissionArray[1];
 
 			// First, Do these groups actually exist - if not add them.
-			if (!isset($permissionGroups[$permissionType][$loadType][$own_group]))
-				$permissionGroups[$permissionType][$loadType][$own_group] = true;
-			if (!empty($any_group) && !isset($permissionGroups[$permissionType][$loadType][$any_group]))
-				$permissionGroups[$permissionType][$loadType][$any_group] = true;
+			if (!isset($permissionGroups[$permissionType][$own_group]))
+				$permissionGroups[$permissionType][$own_group] = true;
 
 			// What column should this be located into?
-			$position = $loadType == 'classic' && !in_array($own_group, $leftPermissionGroups) ? 1 : 0;
+			$position = !in_array($own_group, $leftPermissionGroups) ? 1 : 0;
 
 			// If the groups have not yet been created be sure to create them.
 			$bothGroups = array('own' => $own_group);
-			$bothGroups = array();
-
-			// For guests, just reset the array.
-			if (!isset($context['group']['id']) || !($context['group']['id'] == -1 && $any_group))
-				$bothGroups['own'] = $own_group;
-
-			if ($any_group)
-			{
-				$bothGroups['any'] = $any_group;
-
-			}
 
 			foreach ($bothGroups as $group)
 				if (!isset($context['permissions'][$permissionType]['columns'][$position][$group]))
 					$context['permissions'][$permissionType]['columns'][$position][$group] = array(
 						'type' => $permissionType,
 						'id' => $group,
-						'name' => $loadType == 'simple' ? (isset($txt['permissiongroup_simple_' . $group]) ? $txt['permissiongroup_simple_' . $group] : '') : $txt['permissiongroup_' . $group],
+						'name' => $txt['permissiongroup_' . $group],
 						'icon' => isset($txt['permissionicon_' . $group]) ? $txt['permissionicon_' . $group] : $txt['permissionicon'],
 						'help' => isset($txt['permissionhelp_' . $group]) ? $txt['permissionhelp_' . $group] : '',
 						'hidden' => false,
 						'permissions' => array()
 					);
 
-			// This is where we set up the permission dependant on the view.
-			if ($loadType == 'classic')
-			{
-				$context['permissions'][$permissionType]['columns'][$position][$own_group]['permissions'][$permission] = array(
-					'id' => $permission,
-					'name' => !isset($relabelPermissions[$permission]) ? $txt['permissionname_' . $permission] : $txt[$relabelPermissions[$permission]],
-					'show_help' => isset($txt['permissionhelp_' . $permission]),
-					'note' => isset($txt['permissionnote_' . $permission]) ? $txt['permissionnote_' . $permission] : '',
-					'has_own_any' => $permissionArray[0],
-					'own' => array(
-						'id' => $permission . '_own',
-						'name' => $permissionArray[0] ? $txt['permissionname_' . $permission . '_own'] : ''
-					),
-					'any' => array(
-						'id' => $permission . '_any',
-						'name' => $permissionArray[0] ? $txt['permissionname_' . $permission . '_any'] : ''
-					),
-					'hidden' => in_array($permission, $hiddenPermissions),
-				);
-			}
-			else
-			{
-				foreach ($bothGroups as $group_type => $group)
-				{
-					$context['permissions'][$permissionType]['columns'][$position][$group]['permissions'][$permission . ($permissionArray[0] ? '_' . $group_type : '')] = array(
-						'id' => $permission . ($permissionArray[0] ? '_' . $group_type : ''),
-						'name' => isset($txt['permissionname_simple_' . $permission . ($permissionArray[0] ? '_' . $group_type : '')]) ? $txt['permissionname_simple_' . $permission . ($permissionArray[0] ? '_' . $group_type : '')] : $txt['permissionname_' . $permission],
-						'help_index' => isset($txt['permissionhelp_' . $permission]) ? 'permissionhelp_' . $permission : '',
-						'hidden' => in_array($permission, $hiddenPermissions),
-					);
-				}
-			}
+			$context['permissions'][$permissionType]['columns'][$position][$own_group]['permissions'][$permission] = array(
+				'id' => $permission,
+				'name' => !isset($relabelPermissions[$permission]) ? $txt['permissionname_' . $permission] : $txt[$relabelPermissions[$permission]],
+				'show_help' => isset($txt['permissionhelp_' . $permission]),
+				'note' => isset($txt['permissionnote_' . $permission]) ? $txt['permissionnote_' . $permission] : '',
+				'has_own_any' => $permissionArray[0],
+				'own' => array(
+					'id' => $permission . '_own',
+					'name' => $permissionArray[0] ? $txt['permissionname_' . $permission . '_own'] : ''
+				),
+				'any' => array(
+					'id' => $permission . '_any',
+					'name' => $permissionArray[0] ? $txt['permissionname_' . $permission . '_any'] : ''
+				),
+				'hidden' => in_array($permission, $hiddenPermissions),
+			);
 
 			if (in_array($permission, $hiddenPermissions))
 			{

+ 4 - 283
Themes/default/ManagePermissions.template.php

@@ -509,19 +509,10 @@ function template_modify_group()
 	echo '
 				</h3>
 			</div>
-			<div class="windowbg">
-				<div class="content">
-					', $txt['permissions_change_view'], ': ', ($context['view_type'] == 'simple' ? '<img src="' . $settings['images_url'] . '/selected.png" alt="*" />' : ''), '<a href="', $scripturl, '?action=admin;area=permissions;sa=modify;group=', $context['group']['id'], ($context['permission_type'] == 'board' ? ';pid=' . $context['profile']['id'] : ''), ';view=simple">', $txt['permissions_view_simple'], '</a> |
-					', ($context['view_type'] == 'classic' ? '<img src="' . $settings['images_url'] . '/selected.png" alt="*" />' : ''), '<a href="', $scripturl, '?action=admin;area=permissions;sa=modify;group=', $context['group']['id'], ($context['permission_type'] == 'board' ? ';pid=' . $context['profile']['id'] : ''), ';view=classic">', $txt['permissions_view_classic'], '</a>
-				</div>
-			</div>
 			<div class="flow_hidden">';
 
 	// Draw out the main bits.
-	if ($context['view_type'] == 'simple')
-		template_modify_group_simple($context['permission_type']);
-	else
-		template_modify_group_classic($context['permission_type']);
+	template_modify_group_display($context['permission_type']);
 
 	// If this is general permissions also show the default profile.
 	if ($context['permission_type'] == 'membergroup')
@@ -537,10 +528,7 @@ function template_modify_group()
 			</div>
 			<div class="flow_hidden">';
 
-		if ($context['view_type'] == 'simple')
-			template_modify_group_simple('board');
-		else
-			template_modify_group_classic('board');
+		template_modify_group_display('board');
 
 		echo '
 			</div>';
@@ -557,277 +545,10 @@ function template_modify_group()
 			<input type="hidden" name="', $context['admin-mp_token_var'], '" value="', $context['admin-mp_token'], '" />
 		</form>
 	</div>';
-
-}
-
-// A javascript enabled clean permissions view.
-function template_modify_group_simple($type)
-{
-	global $context, $settings, $options, $scripturl, $txt, $modSettings;
-
-	// Simple only has one column so we only need bother ourself with that one.
-	$permission_data = &$context['permissions'][$type]['columns'][0];
-
-	// Short cut for disabling fields we can't change.
-	$disable_field = $context['profile']['can_modify'] ? '' : 'disabled="disabled" ';
-
-	echo '
-			<table width="100%" class="table_grid">
-				<thead>
-					<tr class="catbg">
-						<th colspan="2" width="100%" align="left" class="first_th"></th>';
-				if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1)
-					echo '
-						<th colspan="3" width="9" class="last_th">&nbsp;</th>';
-				else
-					echo '
-						<th>', $txt['permissions_option_on'], '</th>
-						<th>', $txt['permissions_option_off'], '</th>
-						<th class="last_th">', $txt['permissions_option_deny'], '</th>';
-					echo '
-					</tr>
-				</thead>
-				<tbody>';
-
-	foreach ($permission_data as $id_group => $permissionGroup)
-	{
-		if (empty($permissionGroup['permissions']))
-			continue;
-
-		// Are we likely to have something in this group to display or is it all hidden?
-		$has_display_content = false;
-		if (!$permissionGroup['hidden'])
-		{
-			// Before we go any further check we are going to have some data to print otherwise we just have a silly heading.
-			foreach ($permissionGroup['permissions'] as $permission)
-				if (!$permission['hidden'])
-					$has_display_content = true;
-
-			if ($has_display_content)
-			{
-				echo '
-					<tr class="windowbg">
-						<td colspan="2" width="100%" align="left">
-							<a href="#" onclick="return toggleBreakdown(\'', $id_group, '\');">
-								<img src="', $settings['images_url'], '/selected_open.png" id="group_toggle_img_', $id_group, '" alt="*" />&nbsp;<strong>', $permissionGroup['name'], '</strong>
-							</a>
-						</td>';
-				if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1)
-					echo '
-						<td colspan="3" width="10">
-							<div id="group_select_div_', $id_group, '">
-								<input type="checkbox" id="group_select_', $id_group, '" name="group_select_', $id_group, '" class="input_check" onclick="determineGroupState(\'', $id_group, '\', this.checked ? \'on\' : \'off\');" style="display: none;" ', $disable_field, '/>
-							</div>
-						</td>';
-				else
-					echo '
-						<td align="center">
-							<div id="group_select_div_on_', $id_group, '">
-								<input type="radio" id="group_select_on_', $id_group, '" name="group_select_', $id_group, '" value="on" onclick="determineGroupState(\'', $id_group, '\', \'on\');" style="display: none;" ', $disable_field, ' class="input_radio" />
-							</div>
-						</td>
-						<td align="center">
-							<div id="group_select_div_off_', $id_group, '">
-								<input type="radio" id="group_select_off_', $id_group, '" name="group_select_', $id_group, '" value="off" onclick="determineGroupState(\'', $id_group, '\', \'off\');" style="display: none;" ', $disable_field, ' class="input_radio" />
-							</div>
-						</td>
-						<td align="center">
-							<div id="group_select_div_deny_', $id_group, '">
-								<input type="radio" id="group_select_deny_', $id_group, '" name="group_select_', $id_group, '" value="deny" onclick="determineGroupState(\'', $id_group, '\', \'deny\');" style="display: none;" ', $disable_field, ' class="input_radio" />
-							</div>
-						</td>';
-					echo '
-					</tr>';
-			}
-		}
-
-		$alternate = false;
-		foreach ($permissionGroup['permissions'] as $permission)
-		{
-			// If it's hidden keep the last value.
-			if ($permission['hidden'] || $permissionGroup['hidden'])
-			{
-				echo '
-					<tr style="display: none;">
-						<td>
-							<input type="hidden" name="perm[', $type, '][', $permission['id'], ']" value="', $permission['select'] == 'denied' && !empty($modSettings['permission_enable_deny']) ? 'deny' : $permission['select'], '" />
-						</td>
-					</tr>';
-			}
-			else
-			{
-				echo '
-					<tr id="perm_div_', $id_group, '_', $permission['id'], '" class="', $alternate ? 'windowbg' : 'windowbg2', '">
-						<td valign="top" width="10" style="padding-right: 1ex;">
-							', $permission['help_index'] ? '<a href="' . $scripturl . '?action=helpadmin;help=' . $permission['help_index'] . '" onclick="return reqOverlayDiv(this.href);" class="help"><img src="' . $settings['images_url'] . '/helptopics.png" alt="' . $txt['help'] . '" /></a>' : '', '
-						</td>
-						<td valign="top" width="100%" align="left" style="padding-bottom: 2px;">', $permission['name'], '</td>';
-
-					if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1)
-						echo '
-						<td valign="top" style="padding-bottom: 2px;"><input type="checkbox" id="select_', $permission['id'], '" name="perm[', $type, '][', $permission['id'], ']"', $permission['select'] == 'on' ? ' checked="checked"' : '', ' onclick="determineGroupState(\'', $id_group, '\');" value="on" class="input_check" ', $disable_field, '/></td>';
-					else
-						echo '
-						<td valign="top" width="10" style="padding-bottom: 2px;"><input type="radio" id="select_on_', $permission['id'], '" name="perm[', $type, '][', $permission['id'], ']"', $permission['select'] == 'on' ? ' checked="checked"' : '', ' value="on" onclick="determineGroupState(\'', $id_group, '\');" class="input_radio" ', $disable_field, '/></td>
-						<td valign="top" width="10" style="padding-bottom: 2px;"><input type="radio" id="select_off_', $permission['id'], '" name="perm[', $type, '][', $permission['id'], ']"', $permission['select'] == 'off' ? ' checked="checked"' : '', ' value="off" onclick="determineGroupState(\'', $id_group, '\');" class="input_radio" ', $disable_field, '/></td>
-						<td valign="top" width="10" style="padding-bottom: 2px;"><input type="radio" id="select_deny_', $permission['id'], '" name="perm[', $type, '][', $permission['id'], ']"', $permission['select'] == 'denied' ? ' checked="checked"' : '', ' value="deny" onclick="window.smf_usedDeny = true; determineGroupState(\'', $id_group, '\');" class="input_radio" ', $disable_field, '/></td>';
-
-					echo '
-					</tr>';
-			}
-				$alternate = !$alternate;
-		}
-
-		if (!$permissionGroup['hidden'] && $has_display_content)
-			echo '
-					<tr id="group_hr_div_', $id_group, '" class="windowbg2 perm_groups">
-						<td colspan="5" width="100%"></td>
-					</tr>';
-	}
-	echo '
-				</tbody>
-			</table>
-	<script type="text/javascript"><!-- // --><![CDATA[';
-
-	if ($context['profile']['can_modify'] && empty($context['simple_javascript_displayed']))
-	{
-		// Only show this once.
-		$context['simple_javascript_displayed'] = true;
-
-		// This function decides what to do when ANYTHING is touched!
-		echo '
-		var groupPermissions = new Array();
-		function determineGroupState(id_group, forceState)
-		{
-			if (typeof(forceState) != "undefined")
-				thisState = forceState;
-
-			// Cycle through this groups elements.
-			var curState = false, thisState;
-			for (var i = 0; i < groupPermissions[id_group].length; i++)
-			{';
-
-		if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1)
-			echo '
-				if (typeof(forceState) != "undefined")
-				{
-					document.getElementById(\'select_\' + groupPermissions[id_group][i]).checked = forceState == \'on\' ? 1 : 0;
-				}
-
-				thisState = document.getElementById(\'select_\' + groupPermissions[id_group][i]).checked ? \'on\' : \'off\';';
-		else
-			echo '
-				if (typeof(forceState) != "undefined")
-				{
-					document.getElementById(\'select_on_\' + groupPermissions[id_group][i]).checked = forceState == \'on\' ? 1 : 0;
-					document.getElementById(\'select_off_\' + groupPermissions[id_group][i]).checked = forceState == \'off\' ? 1 : 0;
-					document.getElementById(\'select_deny_\' + groupPermissions[id_group][i]).checked = forceState == \'deny\' ? 1 : 0;
-				}
-
-				if (document.getElementById(\'select_on_\' + groupPermissions[id_group][i]).checked)
-					thisState = \'on\';
-				else if (document.getElementById(\'select_off_\' + groupPermissions[id_group][i]).checked)
-					thisState = \'off\';
-				else
-					thisState = \'deny\';';
-
-		echo '
-				// Unless this is the first element, or it\'s the same state as the last we\'re buggered.
-				if (curState == false || thisState == curState)
-				{
-					curState = thisState;
-				}
-				else
-				{
-					curState = \'fudged\';
-					i = 999;
-				}
-			}
-
-			// First check the right master is selected!';
-		if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1)
-			echo '
-			document.getElementById("group_select_" + id_group).checked = curState == \'on\' ? 1 : 0;';
-		else
-			echo '
-			document.getElementById("group_select_on_" + id_group).checked = curState == \'on\' ? 1 : 0;
-			document.getElementById("group_select_off_" + id_group).checked = curState == \'off\' ? 1 : 0;
-			document.getElementById("group_select_deny_" + id_group).checked = curState == \'deny\' ? 1 : 0;';
-
-		// Force the display?
-		echo '
-			if (curState != \'fudged\')
-				toggleBreakdown(id_group, "none");';
-		echo '
-		}';
-	}
-
-	// Some more javascript to be displayed as long as we are editing.
-	if ($context['profile']['can_modify'])
-	{
-		foreach ($permission_data as $id_group => $permissionGroup)
-		{
-			if (empty($permissionGroup['permissions']))
-				continue;
-
-			// As before...
-			$has_display_content = false;
-			if (!$permissionGroup['hidden'])
-			{
-				// Make sure we can show it.
-				foreach ($permissionGroup['permissions'] as $permission)
-					if (!$permission['hidden'])
-						$has_display_content = true;
-
-				// Make all the group indicators visible on JS only.
-				if ($has_display_content)
-				{
-					if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1)
-						echo '
-			document.getElementById("group_select_div_', $id_group, '").parentNode.className = "lockedbg";
-			document.getElementById("group_select_', $id_group, '").style.display = "";';
-					else
-						echo '
-			document.getElementById("group_select_div_on_', $id_group, '").parentNode.className = "lockedbg";
-			document.getElementById("group_select_div_off_', $id_group, '").parentNode.className = "lockedbg";
-			document.getElementById("group_select_div_deny_', $id_group, '").parentNode.className = "lockedbg";
-			document.getElementById("group_select_on_', $id_group, '").style.display = "";
-			document.getElementById("group_select_off_', $id_group, '").style.display = "";
-			document.getElementById("group_select_deny_', $id_group, '").style.display = "";';
-				}
-
-				$perm_ids = array();
-				$count = 0;
-				foreach ($permissionGroup['permissions'] as $permission)
-				{
-					if (!$permission['hidden'])
-					{
-						// Need this for knowing what can be tweaked.
-						$perm_ids[] = "'$permission[id]'";
-					}
-				}
-				// Declare this groups permissions into an array.
-				if (!empty($perm_ids))
-					echo '
-			groupPermissions[\'', $id_group, '\'] = new Array(', count($perm_ids), ');';
-				foreach ($perm_ids as $count => $id)
-					echo '
-			groupPermissions[\'', $id_group, '\'][', $count, '] = ', $id, ';';
-
-				// Show the group as required.
-				if ($has_display_content)
-				echo '
-			determineGroupState(\'', $id_group, '\');';
-			}
-		}
-	}
-
-	echo '
-		// ]]></script>';
 }
 
-// The SMF 1.x way of looking at permissions.
-function template_modify_group_classic($type)
+// The way of looking at permissions.
+function template_modify_group_display($type)
 {
 	global $context, $settings, $options, $scripturl, $txt, $modSettings;
 

+ 0 - 65
Themes/default/languages/ManagePermissions.english.php

@@ -97,9 +97,6 @@ $txt['permissions_option_on'] = 'A';
 $txt['permissions_option_off'] = 'X';
 $txt['permissions_option_deny'] = 'D';
 $txt['permissions_option_desc'] = 'For each permission you can pick either \'Allow\' (A), \'Disallow\' (X), or <span style="color: red;">\'Deny\' (D)</span>.<br /><br />Remember that if you deny a permission, any member - whether moderator or otherwise - that is in that group will be denied that as well.<br />For this reason, you should use deny carefully, only when <strong>necessary</strong>. Disallow, on the other hand, denies unless otherwise granted.';
-$txt['permissions_change_view'] = 'Change View';
-$txt['permissions_view_simple'] = 'Simple';
-$txt['permissions_view_classic'] = 'Classic';
 
 $txt['permissiongroup_general'] = 'General';
 $txt['permissionname_view_stats'] = 'View forum statistics';
@@ -260,21 +257,13 @@ $txt['permissionname_poll_remove_own'] = 'Own poll';
 $txt['permissionname_poll_remove_any'] = 'Any poll';
 
 $txt['permissionname_post_draft'] = 'Save drafts of new posts';
-$txt['permissionname_simple_post_draft'] = 'Save drafts of new posts';
 $txt['permissionhelp_post_draft'] = 'This permission allows users to save drafts of thier posts so they can complete them later.';
-$txt['permissionhelp_simple_post_draft'] = 'This permission allows users to save drafts of thier posts so they can complete them later.';
 $txt['permissionname_post_autosave_draft'] = 'Automaticaly save drafts of new posts';
-$txt['permissionname_simple_post_autosave_draft'] = 'Automaticaly save drafts of new posts';
 $txt['permissionhelp_post_autosave_draft'] = 'This permission allows users to have their posts autosaved as drafts so they can avoid loosing their work in the event of a timeout, disconnection or other error.  The autosave schedule is defined in the admin panel';
-$txt['permissionhelp_simple_post_autosave_draft'] = 'This permission allows users to have their posts autosaved as drafts so they can avoid loosing their work in the event of a timeout, disconnection or other error.  The autosave schedule is defined in the admin panel';
 $txt['permissionname_pm_autosave_draft'] = 'Automaticaly save drafts of new PM\'s';
-$txt['permissionname_simple_pm_autosave_draft'] = 'Automaticaly save drafts of new PM\'s';
 $txt['permissionhelp_pm_autosave_draft'] = 'This permission allows users to have their posts autosaved as drafts so they can avoid loosing their work in the event of a timeout, disconnection or other error.  The autosave schedule is defined in the admin panel';
-$txt['permissionhelp_simple_post_autosave_draft'] = 'This permission allows users to have their posts autosaved as drafts so they can avoid loosing their work in the event of a timeout, disconnection or other error.  The autosave schedule is defined in the admin panel';
 $txt['permissionname_pm_draft'] = 'Save drafts of personal messages';
-$txt['permissionname_simple_pm_draft'] = 'Save drafts of personal messages';
 $txt['permissionhelp_pm_draft'] = 'This permission allows users to save drafts of thier personal messages so they can complete them later.';
-$txt['permissionhelp_simple_pm_draft'] = 'This permission allows users to save drafts of thier personal messages so they can complete them later.';
 
 $txt['permissiongroup_approval'] = 'Post Moderation';
 $txt['permissionname_approve_posts'] = 'Approve items awaiting moderation';
@@ -294,60 +283,6 @@ $txt['permissionhelp_view_attachments'] = 'Attachments are files that are attach
 $txt['permissionname_post_attachment'] = 'Post attachments';
 $txt['permissionhelp_post_attachment'] = 'Attachments are files that are attached to posted messages. One message can contain multiple attachments.';
 
-$txt['permissiongroup_simple_disable_censor'] = 'Word Censor';
-$txt['permissiongroup_simple_view_basic_info'] = 'Use basic forum functionality';
-$txt['permissiongroup_simple_use_pm_system'] = 'Contact members using the personal messaging system';
-$txt['permissiongroup_simple_post_calendar'] = 'Post events onto the calendar';
-$txt['permissiongroup_simple_edit_profile'] = 'Personalize their profile';
-$txt['permissiongroup_simple_delete_account'] = 'Delete their account';
-$txt['permissiongroup_simple_use_avatar'] = 'Select or upload an avatar';
-$txt['permissiongroup_simple_moderate_general'] = 'Moderate the entire forum';
-$txt['permissiongroup_simple_administrate'] = 'Carry out administrative duties';
-
-$txt['permissionname_simple_calendar_edit_own'] = 'Edit their own calendar events';
-$txt['permissionname_simple_calendar_edit_any'] = 'Edit other people\'s calendar events';
-$txt['permissionname_simple_profile_view'] = 'View other people\'s profiles';
-$txt['permissionname_simple_profile_identity_own'] = 'Edit their account settings';
-$txt['permissionname_simple_profile_identity_any'] = 'Edit other people\'s account settings';
-$txt['permissionname_simple_profile_extra_own'] = 'Edit their additional profile options';
-$txt['permissionname_simple_profile_extra_any'] = 'Edit other people\'s profile options';
-$txt['permissionname_simple_profile_title_own'] = 'Choose a custom title for themselves';
-$txt['permissionname_simple_profile_title_any'] = 'Edit other people\'s custom titles';
-$txt['permissionname_simple_profile_remove_own'] = 'Delete their own account';
-$txt['permissionname_simple_profile_remove_any'] = 'Delete other user\'s accounts';
-
-$txt['permissiongroup_simple_make_unapproved_posts'] = 'Post topics and replies to the board <span style="text-decoration: underline">only</span> after they have been approved';
-$txt['permissiongroup_simple_make_posts'] = 'Post topics and replies to the board';
-$txt['permissiongroup_simple_post_polls'] = 'Make new polls';
-$txt['permissiongroup_simple_participate'] = 'View additional board content';
-$txt['permissiongroup_simple_modify'] = 'Modify their posts';
-$txt['permissiongroup_simple_notification'] = 'Request notifications';
-$txt['permissiongroup_simple_attach'] = 'Post attachments';
-$txt['permissiongroup_simple_moderate'] = 'Moderate the board';
-
-$txt['permissionname_simple_post_unapproved_replies_own'] = 'Post replies to their own topic - but require approval';
-$txt['permissionname_simple_post_unapproved_replies_any'] = 'Post replies to any topic - but require approval';
-$txt['permissionname_simple_post_reply_own'] = 'Post replies to a topic they started';
-$txt['permissionname_simple_post_reply_any'] = 'Post replies to any topic';
-$txt['permissionname_simple_move_own'] = 'Move their own topics';
-$txt['permissionname_simple_move_any'] = 'Move anyone\'s topic';
-$txt['permissionname_simple_lock_own'] = 'Lock their own topic';
-$txt['permissionname_simple_lock_any'] = 'Lock anyone\'s topic';
-$txt['permissionname_simple_remove_own'] = 'Remove their own topic';
-$txt['permissionname_simple_remove_any'] = 'Remove anyone\'s topic';
-$txt['permissionname_simple_delete_own'] = 'Delete a post that they made';
-$txt['permissionname_simple_delete_any'] = 'Delete a post made by anyone';
-$txt['permissionname_simple_modify_own'] = 'Modify their own post';
-$txt['permissionname_simple_modify_any'] = 'Modify someone else\'s post';
-$txt['permissionname_simple_poll_add_own'] = 'Add a poll to a topic they created';
-$txt['permissionname_simple_poll_add_any'] = 'Add a poll to any topic';
-$txt['permissionname_simple_poll_edit_own'] = 'Edit a poll they created';
-$txt['permissionname_simple_poll_edit_any'] = 'Edit anyone\'s poll';
-$txt['permissionname_simple_poll_lock_own'] = 'Lock their own poll';
-$txt['permissionname_simple_poll_lock_any'] = 'Lock anyone\'s poll';
-$txt['permissionname_simple_poll_remove_own'] = 'Remove a poll they created';
-$txt['permissionname_simple_poll_remove_any'] = 'Remove anyone\'s poll';
-
 $txt['permissionicon'] = '';
 
 $txt['permission_settings_title'] = 'Permission Settings';