aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2015-07-07 22:29:27 +0200
committerMario Vavti <mario@mariovavti.com>2015-07-07 22:29:27 +0200
commitf67d9d59afea32a90ea546163da25e36cc4ad9fb (patch)
treea9bf8aae9c798226dfadab62e1af168e2d61b2e2
parent9c577e042292bd8227b40f9500d19eecd974a8e4 (diff)
downloadvolse-hubzilla-f67d9d59afea32a90ea546163da25e36cc4ad9fb.tar.gz
volse-hubzilla-f67d9d59afea32a90ea546163da25e36cc4ad9fb.tar.bz2
volse-hubzilla-f67d9d59afea32a90ea546163da25e36cc4ad9fb.zip
rename function get_directory_settings => get_directory_setting and move sort options to directory title bar
-rw-r--r--include/dir_fns.php24
-rw-r--r--include/taxonomy.php2
-rw-r--r--mod/directory.php13
-rw-r--r--view/tpl/dir_sort_links.tpl7
-rwxr-xr-xview/tpl/directory_header.tpl12
5 files changed, 26 insertions, 32 deletions
diff --git a/include/dir_fns.php b/include/dir_fns.php
index e13c05100..29f33f46e 100644
--- a/include/dir_fns.php
+++ b/include/dir_fns.php
@@ -72,7 +72,7 @@ function check_upstream_directory() {
set_config('system', 'directory_server', '');
}
-function get_directory_settings($observer, $setting) {
+function get_directory_setting($observer, $setting) {
if ($observer)
$ret = get_xconfig($observer, 'directory', $setting);
@@ -97,14 +97,13 @@ function dir_sort_links() {
$observer = get_observer_hash();
- $safe_mode = get_directory_settings($observer, 'safemode');
- $globaldir = get_directory_settings($observer, 'globaldir');
- $pubforums = get_directory_settings($observer, 'pubforums');
+ $safe_mode = get_directory_setting($observer, 'safemode');
+ $globaldir = get_directory_setting($observer, 'globaldir');
+ $pubforums = get_directory_setting($observer, 'pubforums');
// Build urls without order and pubforums so it's easy to tack on the changed value
// Probably there's an easier way to do this
-
$directory_sort_order = get_config('system','directory_sort_order');
if(! $directory_sort_order)
$directory_sort_order = 'date';
@@ -117,14 +116,6 @@ function dir_sort_links() {
$tmp = array_merge($_GET,$_POST);
unset($tmp['suggest']);
unset($tmp['pubforums']);
- unset($tmp['order']);
- unset($tmp['q']);
- unset($tmp['f']);
- $sorturl = $url . $suggest . http_build_query($tmp);
-
- $tmp = array_merge($_GET,$_POST);
- unset($tmp['suggest']);
- unset($tmp['pubforums']);
unset($tmp['global']);
unset($tmp['safe']);
unset($tmp['q']);
@@ -133,13 +124,6 @@ function dir_sort_links() {
$o = replace_macros(get_markup_template('dir_sort_links.tpl'), array(
'$header' => t('Directory Options'),
- '$normal' => t('Alphabetic'),
- '$reverse' => t('Reverse Alphabetic'),
- '$date' => t('Newest to Oldest'),
- '$reversedate' => t('Oldest to Newest'),
- '$sort' => t('Sort'),
- '$selected_sort' => $current_order,
- '$sorturl' => $sorturl,
'$forumsurl' => $forumsurl,
'$safemode' => array('safemode', t('Safe Mode'),$safe_mode,'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&safe="+(this.checked ? 1 : 0)\''),
'$pubforums' => array('pubforums', t('Public Forums Only'),$pubforums,'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&pubforums="+(this.checked ? 1 : 0)\''),
diff --git a/include/taxonomy.php b/include/taxonomy.php
index 135843614..a5da190d4 100644
--- a/include/taxonomy.php
+++ b/include/taxonomy.php
@@ -276,7 +276,7 @@ function dir_tagblock($link,$r) {
$o = '';
$observer = get_observer_hash();
- if(! get_directory_settings($observer, 'globaldir'))
+ if(! get_directory_setting($observer, 'globaldir'))
return $o;
diff --git a/mod/directory.php b/mod/directory.php
index 6dea0e992..ff892d381 100644
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -62,14 +62,14 @@ function directory_content(&$a) {
$observer = get_observer_hash();
- $globaldir = get_directory_settings($observer, 'globaldir');
+ $globaldir = get_directory_setting($observer, 'globaldir');
// override your personal global search pref if we're doing a navbar search of the directory
if(intval($_REQUEST['navsearch']))
$globaldir = 1;
- $safe_mode = get_directory_settings($observer, 'safemode');
+ $safe_mode = get_directory_setting($observer, 'safemode');
- $pubforums = get_directory_settings($observer, 'pubforums');
+ $pubforums = get_directory_setting($observer, 'pubforums');
$o = '';
nav_set_selected('directory');
@@ -382,7 +382,12 @@ function directory_content(&$a) {
'$entries' => $entries,
'$dirlbl' => $suggest ? t('Channel Suggestions') : $dirtitle,
'$submit' => t('Find'),
- '$next' => alt_pager($a,$j['records'], t('next page'), t('previous page'))
+ '$next' => alt_pager($a,$j['records'], t('next page'), t('previous page')),
+ '$sort' => t('Sort options'),
+ '$normal' => t('Alphabetic'),
+ '$reverse' => t('Reverse Alphabetic'),
+ '$date' => t('Newest to Oldest'),
+ '$reversedate' => t('Oldest to Newest'),
));
diff --git a/view/tpl/dir_sort_links.tpl b/view/tpl/dir_sort_links.tpl
index 5cefe2f28..9346a7455 100644
--- a/view/tpl/dir_sort_links.tpl
+++ b/view/tpl/dir_sort_links.tpl
@@ -5,11 +5,4 @@
{{include file="field_checkbox.tpl" field=$globaldir}}
{{include file="field_checkbox.tpl" field=$pubforums}}
-{{$sort}}: <select onchange='window.location.href="{{$sorturl}}&order="+this.value'>
-<option value='normal' {{if $selected_sort == 'normal'}}selected='selected'{{/if}}>{{$normal}}</option>
-<option value='reverse' {{if $selected_sort == 'reverse'}}selected='selected'{{/if}}>{{$reverse}}</option>
-<option value='date' {{if $selected_sort == 'date'}}selected='selected'{{/if}}>{{$date}}</option>
-<option value='reversedate' {{if $selected_sort == 'reversedate'}}selected='selected'{{/if}}>{{$reversedate}}</option>
-</select><br />
-
</div>
diff --git a/view/tpl/directory_header.tpl b/view/tpl/directory_header.tpl
index 26739efc3..25a9b8279 100755
--- a/view/tpl/directory_header.tpl
+++ b/view/tpl/directory_header.tpl
@@ -1,6 +1,18 @@
<div class="generic-content-wrapper">
<div class="section-title-wrapper">
+ <div class="btn-group pull-right">
+ <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="{{$sort}}">
+ <i class="icon-sort"></i>
+ </button>
+ <ul class="dropdown-menu">
+ <li><a href="directory?f=&order=date">{{$date}}</a></li>
+ <li><a href="directory?f=&order=normal">{{$normal}}</a></li>
+ <li><a href="directory?f=&order=reversedate">{{$reversedate}}</a></li>
+ <li><a href="directory?f=&order=reverse">{{$reverse}}</a></li>
+ </ul>
+ </div>
<h2>{{$dirlbl}}{{if $search}}:&nbsp;{{$safetxt}}{{/if}}</h2>
+ <div class="clear"></div>
</div>
{{foreach $entries as $entry}}
{{include file="direntry.tpl"}}