소스 검색

Fixed several issues with deny boards access code

Signed-off-by: emanuele <[email protected]>
emanuele 12 년 전
부모
커밋
0f827defe5
5개의 변경된 파일41개의 추가작업 그리고 19개의 파일을 삭제
  1. 1 1
      Sources/Load.php
  2. 1 1
      Sources/ManageBoards.php
  3. 31 16
      Themes/default/ManageBoards.template.php
  4. 1 1
      Themes/default/languages/ManageBoards.english.php
  5. 7 0
      Themes/default/scripts/script.js

+ 1 - 1
Sources/Load.php

@@ -452,7 +452,7 @@ function loadUserSettings()
 		$user_info['query_see_board'] = '1=1';
 	// Otherwise just the groups in $user_info['groups'].
 	else
-		$user_info['query_see_board'] = '((FIND_IN_SET(' . implode(', b.member_groups) != 0 OR FIND_IN_SET(', $user_info['groups']) . ', b.member_groups) != 0' . (!empty($modSettings['denyBoardsAccess']) ? ') AND (FIND_IN_SET(' . implode(', b.deny_member_groups) = 0 AND FIND_IN_SET(', $user_info['groups']) . ', b.deny_member_groups) = 0)' : '') . (isset($user_info['mod_cache']) ? ' OR ' . $user_info['mod_cache']['mq'] : '') . ')';
+		$user_info['query_see_board'] = '((FIND_IN_SET(' . implode(', b.member_groups) != 0 OR FIND_IN_SET(', $user_info['groups']) . ', b.member_groups) != 0' . (!empty($modSettings['deny_boards_access']) ? ') AND (FIND_IN_SET(' . implode(', b.deny_member_groups) = 0 AND FIND_IN_SET(', $user_info['groups']) . ', b.deny_member_groups) = 0)' : '') . (isset($user_info['mod_cache']) ? ' OR ' . $user_info['mod_cache']['mq'] : '') . ')';
 
 	// Build the list of boards they WANT to see.
 	// This will take the place of query_see_boards in certain spots, so it better include the boards they can see also

+ 1 - 1
Sources/ManageBoards.php

@@ -799,7 +799,7 @@ function EditBoardSettings($return_config = false)
 			array('check', 'recycle_enable', 'onclick' => 'document.getElementById(\'recycle_board\').disabled = !this.checked;'),
 			array('select', 'recycle_board', $recycle_boards),
 			array('check', 'allow_ignore_boards'),
-			array('check', 'denyBoardsAccess'),
+			array('check', 'deny_boards_access'),
 	);
 
 	call_integration_hook('integrate_modify_board_settings', array(&$config_vars));

+ 31 - 16
Themes/default/ManageBoards.template.php

@@ -257,10 +257,6 @@ function template_modify_board()
 {
 	global $context, $settings, $options, $scripturl, $txt, $modSettings;
 
-	if (!empty($modSettings['denyBoardsAccess']))
-		echo '
-		<div class="information">', $txt['boardsaccess_option_desc'], '</div>';
-
 	// The main table header.
 	echo '
 	<div id="manage_boards">
@@ -358,11 +354,13 @@ function template_modify_board()
 						</dd>
 						<dt>
 							<strong>', $txt['mboards_groups'], ':</strong><br />
-							<span class="smalltext">', $txt['mboards_groups_desc'], '</span>
+							<span class="smalltext">', empty($modSettings['deny_boards_access']) ? $txt['mboards_groups_desc'] : $txt['boardsaccess_option_desc'], '</span>';
+
+	echo '
 						</dt>
 						<dd>';
 
-	if (!empty($modSettings['denyBoardsAccess']))
+	if (!empty($modSettings['deny_boards_access']))
 		echo '
 							<table>
 								<tr>
@@ -374,10 +372,10 @@ function template_modify_board()
 
 	// List all the membergroups so the user can choose who may access this board.
 	foreach ($context['groups'] as $group)
-		if (empty($modSettings['denyBoardsAccess']))
+		if (empty($modSettings['deny_boards_access']))
 			echo '
 							<label for="groups_', $group['id'], '">
-								<input type="checkbox" name="groups[', $group['id'], ']" value="allow" id="groups_', $group['id'], '"', $group['checked'] ? ' checked="checked"' : '', ' class="input_check" />
+								<input type="checkbox" name="groups[', $group['id'], ']" value="allow" id="groups_', $group['id'], '"', $group['allow'] ? ' checked="checked"' : '', ' class="input_check" />
 								<span', $group['is_post_group'] ? ' class="post_group" title="' . $txt['mboards_groups_post_group'] . '"' : '', $group['id'] == 0 ? ' class="regular_members" title="' . $txt['mboards_groups_regular_members'] . '"' : '', '>
 									', $group['name'], '
 								</span>
@@ -393,24 +391,41 @@ function template_modify_board()
 										</label>
 									</td>
 									<td>
-										<input type="radio" name="groups[', $group['id'], ']" value="allow" id="groups_', $group['id'], '"', $group['allow'] ? ' checked="checked"' : '', ' class="input_radio" />
+										<input type="radio" name="groups[', $group['id'], ']" value="allow" id="groups_', $group['id'], '_a"', $group['allow'] ? ' checked="checked"' : '', ' class="input_radio" />
 									</td>
 									<td>
-										<input type="radio" name="groups[', $group['id'], ']" value="ignore" id="groups_', $group['id'], '"', !$group['allow'] && !$group['deny'] ? ' checked="checked"' : '', ' class="input_radio" />
+										<input type="radio" name="groups[', $group['id'], ']" value="ignore" id="groups_', $group['id'], '_x"', !$group['allow'] && !$group['deny'] ? ' checked="checked"' : '', ' class="input_radio" />
 									</td>
 									<td>
-										<input type="radio" name="groups[', $group['id'], ']" value="deny" id="groups_', $group['id'], '"', $group['deny'] ? ' checked="checked"' : '', ' class="input_radio" />
+										<input type="radio" name="groups[', $group['id'], ']" value="deny" id="groups_', $group['id'], '_d"', $group['deny'] ? ' checked="checked"' : '', ' class="input_radio" />
 									</td>
-';
+									<td></td>
+								</tr>';
 
-	if (!empty($modSettings['denyBoardsAccess']))
+	if (empty($modSettings['deny_boards_access']))
 		echo '
-							</table>
+							<em>', $txt['check_all'], '</em> <input type="checkbox" class="input_check" onclick="invertAll(this, this.form, \'groups[]\');" /><br />
+							<br />
 						</dd>';
 	else
 		echo '
-							<em>', $txt['check_all'], '</em> <input type="checkbox" class="input_check" onclick="invertAll(this, this.form, \'groups[]\');" /><br />
-							<br />
+								<tr>
+									<td>
+									</td>
+									<td>
+										<input type="radio" name="select_all" class="input_radio" onclick="selectAllRadio(this, this.form, \'groups\', \'allow\');" />
+									</td>
+									<td>
+										<input type="radio" name="select_all" class="input_radio" onclick="selectAllRadio(this, this.form, \'groups\', \'ignore\');" />
+									</td>
+									<td>
+										<input type="radio" name="select_all" class="input_radio" onclick="selectAllRadio(this, this.form, \'groups\', \'deny\');" />
+									</td>
+									<td>
+										<em>', $txt['check_all'], '</em>
+									</td>
+								</tr>
+							</table>
 						</dd>';
 
 	// Options to choose moderators, specifiy as announcement board and choose whether to count posts here.

+ 1 - 1
Themes/default/languages/ManageBoards.english.php

@@ -88,7 +88,7 @@ $txt['recycle_board'] = 'Board for recycled topics';
 $txt['recycle_board_unselected_notice'] = 'You have enabled the recycling of topics without specifying a board to place them in.  This feature will not be enabled until you specify a board to place recycled topics into.';
 $txt['countChildPosts'] = 'Count child\'s posts in parent\'s totals';
 $txt['allow_ignore_boards'] = 'Allow boards to be ignored';
-$txt['denyBoardsAccess'] = 'Enable the option to deny boards access to a group';
+$txt['deny_boards_access'] = 'Enable the option to deny boards access to a group';
 $txt['boardsaccess_option_desc'] = 'For each permission you can pick either \'Allow\' (A), \'Ignore\' (X), or <span class="alert">\'Deny\' (D)</span>.<br /><br />Remember that if you deny access, 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>. Ignore, on the other hand, denies unless otherwise granted.';
 
 $txt['mboards_select_destination'] = 'Select destination for board \'<strong>%1$s</strong>\'';

+ 7 - 0
Themes/default/scripts/script.js

@@ -530,6 +530,13 @@ function selectRadioByName(oRadioGroup, sName)
 	return false;
 }
 
+function selectAllRadio(oInvertCheckbox, oForm, sMask, sValue)
+{
+	for (var i = 0; i < oForm.length; i++)
+		if (oForm[i].name.substr(0, sMask.length) == sMask && oForm[i].value == sValue)
+			oForm[i].checked = true;
+}
+
 // Invert all checkboxes at once by clicking a single checkbox.
 function invertAll(oInvertCheckbox, oForm, sMask, bIgnoreDisabled)
 {