Directory sorting as a dropdown, forum filter as checkbox, option to sort oldest first
This commit is contained in:
parent
3855be4910
commit
647311db3e
@ -51,13 +51,30 @@ function check_upstream_directory() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function dir_sort_links() {
|
function dir_sort_links() {
|
||||||
|
// 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
|
||||||
|
$url = 'directory?';
|
||||||
|
$tmp = $_REQUEST;
|
||||||
|
unset($tmp['order']);
|
||||||
|
$sorturl = $url . http_build_query($tmp);
|
||||||
|
$tmp = $_REQUEST;
|
||||||
|
|
||||||
|
unset($tmp['pubforums']);
|
||||||
|
$forumsurl = $url . http_build_query($tmp);
|
||||||
|
|
||||||
$o = replace_macros(get_markup_template('dir_sort_links.tpl'), array(
|
$o = replace_macros(get_markup_template('dir_sort_links.tpl'), array(
|
||||||
'$header' => t('Directory Options'),
|
'$header' => t('Directory Options'),
|
||||||
'$normal' => t('Alphabetic'),
|
'$normal' => t('Alphabetic'),
|
||||||
'$reverse' => t('Reverse Alphabetic'),
|
'$reverse' => t('Reverse Alphabetic'),
|
||||||
'$date' => t('Newest to Oldest'),
|
'$date' => t('Newest to Oldest'),
|
||||||
|
'$reversedate' => t('Oldest to Newest'),
|
||||||
'$pubforums' => t('Public Forums Only'),
|
'$pubforums' => t('Public Forums Only'),
|
||||||
|
'$pubforumsonly' => x($_REQUEST,'pubforums') ? $_REQUEST['pubforums'] : '',
|
||||||
|
'$sort' => t('Sort'),
|
||||||
|
'$selected_sort' => x($_REQUEST,'order') ? $_REQUEST['order'] : 'normal',
|
||||||
|
'$sorturl' => $sorturl,
|
||||||
|
'$forumsurl' => $forumsurl,
|
||||||
|
|
||||||
));
|
));
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
@ -100,8 +100,6 @@ function directory_content(&$a) {
|
|||||||
$query .= '&pubforums=' . intval($pubforums);
|
$query .= '&pubforums=' . intval($pubforums);
|
||||||
|
|
||||||
$sort_order = ((x($_REQUEST,'order')) ? $_REQUEST['order'] : '');
|
$sort_order = ((x($_REQUEST,'order')) ? $_REQUEST['order'] : '');
|
||||||
if($pubforums)
|
|
||||||
$sort_order = 'normal';
|
|
||||||
|
|
||||||
if($sort_order)
|
if($sort_order)
|
||||||
$query .= '&order=' . urlencode($sort_order);
|
$query .= '&order=' . urlencode($sort_order);
|
||||||
|
@ -64,7 +64,7 @@ function dirsearch_content(&$a) {
|
|||||||
$agege = ((x($_REQUEST,'agege')) ? intval($_REQUEST['agege']) : 0 );
|
$agege = ((x($_REQUEST,'agege')) ? intval($_REQUEST['agege']) : 0 );
|
||||||
$agele = ((x($_REQUEST,'agele')) ? intval($_REQUEST['agele']) : 0 );
|
$agele = ((x($_REQUEST,'agele')) ? intval($_REQUEST['agele']) : 0 );
|
||||||
$kw = ((x($_REQUEST,'kw')) ? intval($_REQUEST['kw']) : 0 );
|
$kw = ((x($_REQUEST,'kw')) ? intval($_REQUEST['kw']) : 0 );
|
||||||
$forums = ((array_key_exists('pubforums',$_REQUEST)) ? intval($_REQUEST['pubforums']) : null);
|
$forums = ((array_key_exists('pubforums',$_REQUEST)) ? intval($_REQUEST['pubforums']) : 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ function dirsearch_content(&$a) {
|
|||||||
if($keywords)
|
if($keywords)
|
||||||
$sql_extra .= dir_query_build($joiner,'xprof_keywords',$keywords);
|
$sql_extra .= dir_query_build($joiner,'xprof_keywords',$keywords);
|
||||||
|
|
||||||
if(! is_null($forums))
|
if($forums)
|
||||||
$sql_extra .= dir_flag_build($joiner,'xprof_flags',XCHAN_FLAGS_PUBFORUM, $forums);
|
$sql_extra .= dir_flag_build($joiner,'xprof_flags',XCHAN_FLAGS_PUBFORUM, $forums);
|
||||||
|
|
||||||
|
|
||||||
@ -183,6 +183,8 @@ function dirsearch_content(&$a) {
|
|||||||
$order = " order by xchan_name asc ";
|
$order = " order by xchan_name asc ";
|
||||||
elseif($sort_order == 'reverse')
|
elseif($sort_order == 'reverse')
|
||||||
$order = " order by xchan_name desc ";
|
$order = " order by xchan_name desc ";
|
||||||
|
elseif($sort_order == 'reversedate')
|
||||||
|
$order = " order by xchan_name_date asc ";
|
||||||
else
|
else
|
||||||
$order = " order by xchan_name_date desc ";
|
$order = " order by xchan_name_date desc ";
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
<div class="widget" id="dir_sort_links">
|
<div class="widget" id="dir_sort_links">
|
||||||
<h3>{{$header}}</h3>
|
<h3>{{$header}}</h3>
|
||||||
<ul class="nav nav-pills nav-stacked">
|
{{$sort}}: <select onchange='window.location.href="{{$sorturl}}&order="+this.value'>
|
||||||
<li><a href="directory?f=&order=normal">{{$normal}}</a></li>
|
<option value='normal' {{if $selected_sort == 'normal'}}selected='selected'{{/if}}>{{$normal}}</option>
|
||||||
<li><a href="directory?f=&order=reverse">{{$reverse}}</a></li>
|
<option value='reverse' {{if $selected_sort == 'reverse'}}selected='selected'{{/if}}>{{$reverse}}</option>
|
||||||
<li><a href="directory?f=&order=date">{{$date}}</a></li>
|
<option value='date' {{if $selected_sort == 'date'}}selected='selected'{{/if}}>{{$date}}</option>
|
||||||
<li><a href="directory?f=&pubforums=1">{{$pubforums}}</a></li>
|
<option value='reversedate' {{if $selected_sort == 'reversedate'}}selected='selected'{{/if}}>{{$reversedate}}</option>
|
||||||
</ul>
|
</select><br />
|
||||||
|
<input type='checkbox' {{if $pubforumsonly}}checked='checked'{{/if}} onchange='window.location.href="{{$forumsurl}}&pubforums="+(this.checked ? 1 : 0)'/> {{$pubforums}}<br />
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user