Prevent subsearches from appearing on tool page is subsearches turned off, a=chris
Prevent subsearches from appearing on tool page is subsearches turned off, a=chris
diff --git a/views/elements/moreoptions_element.php b/views/elements/moreoptions_element.php
index cd6b63d07..231ddda98 100644
--- a/views/elements/moreoptions_element.php
+++ b/views/elements/moreoptions_element.php
@@ -49,77 +49,82 @@ class MoreoptionsElement extends Element
*/
function render($data)
{
- $max_column_num = 10;
- if(MOBILE) {
- $num_columns = 1;
- } else {
- $num_columns = 4;
- }
- $max_items = $max_column_num * $num_columns;
- $subsearches = array_slice($data["SUBSEARCHES"], $max_items *
- $data['MORE_PAGE']);
- $spacer = "";
- $prev_link = false;
- $next_link = false;
- if($data['MORE_PAGE'] > 0) {
- $prev_link = true;
- }
- $num_remaining = count($subsearches);
- if($num_remaining > $max_items) {
- $next_link = true;
- $subsearches = array_slice($subsearches, 0,
- $max_items);
- }
- if($next_link && $prev_link) {
- $spacer = " -- ";
- }
- $num_rows = ceil(count($subsearches)/$num_columns);
- ?>
- <h2><?php e(tl('moreoptions_element_other_searches'))?></h2>
- <table>
- <tr class="align-top">
- <?php
- $cur_row = 0;
- foreach($subsearches as $search) {
- if($cur_row == 0) {
- e("<td><ul class='square-list'>");
- $ul_open = true;
+ if(SUBSEARCH_LINK) {
+ $max_column_num = 10;
+ if(MOBILE) {
+ $num_columns = 1;
+ } else {
+ $num_columns = 4;
+ }
+ $max_items = $max_column_num * $num_columns;
+ $subsearches = array_slice($data["SUBSEARCHES"], $max_items *
+ $data['MORE_PAGE']);
+ $spacer = "";
+ $prev_link = false;
+ $next_link = false;
+ if($data['MORE_PAGE'] > 0) {
+ $prev_link = true;
+ }
+ $num_remaining = count($subsearches);
+ if($num_remaining > $max_items) {
+ $next_link = true;
+ $subsearches = array_slice($subsearches, 0,
+ $max_items);
+ }
+ if($next_link && $prev_link) {
+ $spacer = " -- ";
}
- $cur_row++;
- if(!$search['SUBSEARCH_NAME']) {
- $search['SUBSEARCH_NAME'] = $search['LOCALE_STRING'];
+ $num_rows = ceil(count($subsearches)/$num_columns);
+ ?>
+ <h2><?php e(tl('moreoptions_element_other_searches'))?></h2>
+ <table>
+ <tr class="align-top">
+ <?php
+ $cur_row = 0;
+ foreach($subsearches as $search) {
+ if($cur_row == 0) {
+ e("<td><ul class='square-list'>");
+ $ul_open = true;
+ }
+ $cur_row++;
+ if(!$search['SUBSEARCH_NAME']) {
+ $search['SUBSEARCH_NAME'] = $search['LOCALE_STRING'];
+ }
+ $query = ($search["FOLDER_NAME"] == "") ? "?":
+ "?s={$search["FOLDER_NAME"]}";
+ $query .= (isset($data[CSRF_TOKEN])) ? "&".CSRF_TOKEN.
+ "=".$data[CSRF_TOKEN] : "";
+ e("<li><a href='$query'>".
+ "{$search['SUBSEARCH_NAME']}</a></li>");
+ if($cur_row >= $num_rows) {
+ $ul_open = false;
+ e("</ul></td>");
+ $cur_row = 0;
+ }
}
- $query = ($search["FOLDER_NAME"] == "") ? "?":
- "?s={$search["FOLDER_NAME"]}";
- $query .= (isset($data[CSRF_TOKEN])) ? "&".CSRF_TOKEN.
- "=".$data[CSRF_TOKEN] : "";
- e("<li><a href='$query'>".
- "{$search['SUBSEARCH_NAME']}</a></li>");
- if($cur_row >= $num_rows) {
- $ul_open = false;
+ if($ul_open) {
e("</ul></td>");
- $cur_row = 0;
}
- }
- if($ul_open) {
- e("</ul></td>");
+ ?>
+ </tr>
+ </table>
+ <div class="indent"><?php
+ if($prev_link) {
+ e("<a href='./?a=more&".CSRF_TOKEN."=".
+ $data[CSRF_TOKEN].
+ "&more_page=".($data['MORE_PAGE'] -1)."'>".
+ tl('moreoptions_element_previous')."</a>");
+ }
+ e($spacer);
+ if($next_link) {
+ e("<a href='./?a=more&".CSRF_TOKEN."=".$data[CSRF_TOKEN].
+ "&more_page=".($data['MORE_PAGE'] + 1)."'>".
+ tl('moreoptions_element_next')."</a>");
+ }
+ ?></div>
+ <?php
}
?>
- </tr>
- </table>
- <div class="indent"><?php
- if($prev_link) {
- e("<a href='./?a=more&".CSRF_TOKEN."=".$data[CSRF_TOKEN].
- "&more_page=".($data['MORE_PAGE'] -1)."'>".
- tl('moreoptions_element_previous')."</a>");
- }
- e($spacer);
- if($next_link) {
- e("<a href='./?a=more&".CSRF_TOKEN."=".$data[CSRF_TOKEN].
- "&more_page=".($data['MORE_PAGE'] + 1)."'>".
- tl('moreoptions_element_next')."</a>");
- }
- ?></div>
<h2 class="reduce-top"><?php
e(tl('moreoptions_element_my_accounts'))?></h2>
<table class="reduce-top">
@@ -170,7 +175,14 @@ class MoreoptionsElement extends Element
$tools[$token_url . "&c=group&a=wiki&arg=pages"] =
tl('moreoptions_element_wiki_pages');
if($tools != array()) {
- ?>
+ $max_column_num = 10;
+ if(MOBILE) {
+ $num_columns = 1;
+ } else {
+ $num_columns = 4;
+ }
+ $num_rows = ceil(count($tools)/$num_columns);
+ ?>
<h2 id="tools" class="reduce-top"><?php
e(tl('moreoptions_element_tools'))?></h2>
<table class="reduce-top">