Ver Fonte

Better keep hidden what don't work with javascript disabled

Signed-off-by: emanuele <[email protected]>
emanuele há 12 anos atrás
pai
commit
2c7f3608e0

+ 12 - 2
Themes/default/ManageBoards.template.php

@@ -405,12 +405,15 @@ function template_modify_board()
 
 	if (empty($modSettings['deny_boards_access']))
 		echo '
-							<em>', $txt['check_all'], '</em> <input type="checkbox" class="input_check" onclick="invertAll(this, this.form, \'groups[\');" /><br />
+							<span class="select_all_box">
+								<em>', $txt['check_all'], '</em> <input type="checkbox" class="input_check" onclick="invertAll(this, this.form, \'groups[\');" />
+							</span>
+							<br />
 							<br />
 						</dd>';
 	else
 		echo '
-								<tr>
+								<tr class="select_all_box">
 									<td>
 									</td>
 									<td>
@@ -440,6 +443,13 @@ function template_modify_board()
 							<div id="moderator_container"></div>
 						</dd>
 					</dl>
+					<script type="text/javascript"><!-- // --><![CDATA[
+						$(document).ready(function () {
+							$(".select_all_box").each(function () {
+								$(this).removeClass(\'select_all_box\');
+							});
+						});
+					// ]]></script>
 					<hr class="hrcolor" />';
 
 	if (empty($context['board']['is_recycle']) && empty($context['board']['topics']))

+ 32 - 22
Themes/default/ManageMembergroups.template.php

@@ -388,15 +388,16 @@ function template_add_edit_group_boards_list($collapse = true)
 			echo '
 									<li class="category">
 										<strong>', $category['name'], '</strong>
-										<em style="margin-left:5em;">', $txt['all_boards_in_cat'], ': </em>
-										<select onchange="select_in_category(', $category['id'], ', this, [', implode(',', array_keys($category['boards'])), ']);">
-											<option>---</option>
-											<option value="allow">', $txt['board_perms_allow'], '</option>
-											<option value="ignore">', $txt['board_perms_ignore'], '</option>
-											<option value="deny">', $txt['board_perms_deny'], '</option>
-										</select>
-									</td>
-									<ul style="width:100%" id="boards_list_', $category['id'], '">';
+										<span class="select_all_box">
+											<em style="margin-left:5em;">', $txt['all_boards_in_cat'], ': </em>
+											<select onchange="select_in_category(', $category['id'], ', this, [', implode(',', array_keys($category['boards'])), ']);">
+												<option>---</option>
+												<option value="allow">', $txt['board_perms_allow'], '</option>
+												<option value="ignore">', $txt['board_perms_ignore'], '</option>
+												<option value="deny">', $txt['board_perms_deny'], '</option>
+											</select>
+										</span>
+										<ul style="width:100%" id="boards_list_', $category['id'], '">';
 
 		foreach ($category['boards'] as $board)
 		{
@@ -407,14 +408,14 @@ function template_add_edit_group_boards_list($collapse = true)
 										</li>';
 			else
 				echo '
-										<li class="board" style="width:100%">
-											<span style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">', $board['name'], ': </span>
-											<span style="width:50%;float:right">
-												<input type="radio" name="boardaccess[', $board['id'], ']" id="allow_brd', $board['id'], '" value="allow" ', $board['allow'] ? ' checked="checked"' : '', ' class="input_check" /> <label for="allow_brd', $board['id'], '">', $txt['permissions_option_on'], '</label>
-												<input type="radio" name="boardaccess[', $board['id'], ']" id="ignore_brd', $board['id'], '" value="ignore" ', !$board['allow'] && !$board['deny'] ? ' checked="checked"' : '', ' class="input_check" /> <label for="ignore_brd', $board['id'], '">', $txt['permissions_option_off'], '</label>
-												<input type="radio" name="boardaccess[', $board['id'], ']" id="deny_brd', $board['id'], '" value="deny" ', $board['deny'] ? ' checked="checked"' : '', ' class="input_check" /> <label for="deny_brd', $board['id'], '">', $txt['permissions_option_deny'], '</label>
-											</span>
-										</li>';
+											<li class="board" style="width:100%">
+												<span style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">', $board['name'], ': </span>
+												<span style="width:50%;float:right">
+													<input type="radio" name="boardaccess[', $board['id'], ']" id="allow_brd', $board['id'], '" value="allow" ', $board['allow'] ? ' checked="checked"' : '', ' class="input_check" /> <label for="allow_brd', $board['id'], '">', $txt['permissions_option_on'], '</label>
+													<input type="radio" name="boardaccess[', $board['id'], ']" id="ignore_brd', $board['id'], '" value="ignore" ', !$board['allow'] && !$board['deny'] ? ' checked="checked"' : '', ' class="input_check" /> <label for="ignore_brd', $board['id'], '">', $txt['permissions_option_off'], '</label>
+													<input type="radio" name="boardaccess[', $board['id'], ']" id="deny_brd', $board['id'], '" value="deny" ', $board['deny'] ? ' checked="checked"' : '', ' class="input_check" /> <label for="deny_brd', $board['id'], '">', $txt['permissions_option_deny'], '</label>
+												</span>
+											</li>';
 		}
 
 		echo '
@@ -434,11 +435,20 @@ function template_add_edit_group_boards_list($collapse = true)
 	else
 		echo '
 								<br />
-								<em>', $txt['all'], ': </em>
-								<input type="radio" name="select_all" id="allow_all" class="input_radio" onclick="selectAllRadio(this, this.form, \'boardaccess\', \'allow\');" /> <label for="allow_all">', $txt['board_perms_allow'], '</label>
-								<input type="radio" name="select_all" id="ignore_all" class="input_radio" onclick="selectAllRadio(this, this.form, \'boardaccess\', \'ignore\');" /> <label for="ignore_all">', $txt['board_perms_ignore'], '</label>
-								<input type="radio" name="select_all" id="deny_all" class="input_radio" onclick="selectAllRadio(this, this.form, \'boardaccess\', \'deny\');" /> <label for="deny_all">', $txt['board_perms_deny'], '</label>
-							</fieldset>';
+								<span class="select_all_box">
+									<em>', $txt['all'], ': </em>
+									<input type="radio" name="select_all" id="allow_all" class="input_radio" onclick="selectAllRadio(this, this.form, \'boardaccess\', \'allow\');" /> <label for="allow_all">', $txt['board_perms_allow'], '</label>
+									<input type="radio" name="select_all" id="ignore_all" class="input_radio" onclick="selectAllRadio(this, this.form, \'boardaccess\', \'ignore\');" /> <label for="ignore_all">', $txt['board_perms_ignore'], '</label>
+									<input type="radio" name="select_all" id="deny_all" class="input_radio" onclick="selectAllRadio(this, this.form, \'boardaccess\', \'deny\');" /> <label for="deny_all">', $txt['board_perms_deny'], '</label>
+								</span>
+							</fieldset>
+							<script type="text/javascript"><!-- // --><![CDATA[
+								$(document).ready(function () {
+									$(".select_all_box").each(function () {
+										$(this).removeClass(\'select_all_box\');
+									});
+								});
+							// ]]></script>';
 
 	if ($collapse)
 		echo '

+ 3 - 0
Themes/default/css/admin.css

@@ -288,6 +288,9 @@ pre.file_content {
 	border-bottom: 1px dotted #000;
 	cursor: help;
 }
+.select_all_box {
+	display:none;
+}
 
 /* Styles for the manage members section.
 ------------------------------------------------- */

+ 2 - 2
Themes/default/scripts/admin.js

@@ -604,7 +604,7 @@ function repeatString(sString, iTime)
 function select_in_category(cat_id, elem, brd_list)
 {
 	for (var brd in brd_list)
-	{
 		document.getElementById(elem.value + '_brd' + brd_list[brd]).checked = true;
-	}
+
+	elem.selectedIndex = 0;
 }

+ 3 - 0
Themes/penguin/css/admin.css

@@ -316,6 +316,9 @@ pre.file_content {
 	border-bottom: 1px dotted #000;
 	cursor: help;
 }
+.select_all_box {
+	display:none;
+}
 
 /* Styles for the manage members section.
 ------------------------------------------------- */

+ 8 - 0
Themes/penguin/scripts/admin.js

@@ -599,4 +599,12 @@ function repeatString(sString, iTime)
 		return '';
 	else
 		return sString + repeatString(sString, iTime - 1);
+}
+
+function select_in_category(cat_id, elem, brd_list)
+{
+	for (var brd in brd_list)
+	{
+		document.getElementById(elem.value + '_brd' + brd_list[brd]).checked = true;
+	}
 }