From fb9abe8fea6bf40c5628467158edf2fc6881a8dd Mon Sep 17 00:00:00 2001 From: rvelices Date: Wed, 3 Oct 2007 23:36:21 +0000 Subject: - bug 755: admin permalinks page - fix category field sort - web service functions: 1 fix and 3 optimizations git-svn-id: http://piwigo.org/svn/trunk@2119 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/permalinks.php | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'admin/permalinks.php') diff --git a/admin/permalinks.php b/admin/permalinks.php index cbbbbc4e5..77becf76f 100644 --- a/admin/permalinks.php +++ b/admin/permalinks.php @@ -30,11 +30,11 @@ function parse_sort_variables( $anchor = '' ) { global $template; - + $url_components = parse_url( $_SERVER['REQUEST_URI'] ); $base_url = $url_components['path']; - + parse_str($url_components['query'], $vars); $is_first = true; foreach ($vars as $key => $value) @@ -51,18 +51,24 @@ function parse_sort_variables( foreach( $sortable_by as $field) { $url = $base_url; + $disp = '⇓'; // TODO: an small image is better + if ( $field !== @$_GET[$get_param] ) { if ( !isset($default_field) or $default_field!=$field ) { // the first should be the default $url = add_url_params($url, array($get_param=>$field) ); } - $disp = '⇓'; // TODO: an small image is better + elseif (isset($default_field) and !isset($_GET[$get_param]) ) + { + array_push($ret, $field); + $disp = ''.$disp.''; + } } else { array_push($ret, $field); - $disp = ''; // TODO: an small image is better + $disp = ''.$disp.''; } if ( isset($template_var) ) { @@ -103,10 +109,10 @@ DELETE FROM '.OLD_PERMALINKS_TABLE.' $template->set_filename('permalinks', 'admin/permalinks.tpl' ); $query = ' -SELECT - id, +SELECT + id, CONCAT(id, " - ", name, IF(permalink IS NULL, "", " √") ) AS name, - uppercats, global_rank + uppercats, global_rank FROM '.CATEGORIES_TABLE; display_select_cat_wrapper( $query, $selected_cat, 'categories', false ); @@ -124,9 +130,7 @@ SELECT id, permalink, uppercats, global_rank FROM '.CATEGORIES_TABLE.' WHERE permalink IS NOT NULL '; -if ( count($sort_by) and - ($sort_by[0]=='id' or $sort_by[0]=='permalink') - ) +if ( $sort_by[0]=='id' or $sort_by[0]=='permalink' ) { $query .= ' ORDER BY '.$sort_by[0]; } @@ -138,7 +142,7 @@ while ( $row=mysql_fetch_assoc($result) ) $categories[] = $row; } -if ( !count($sort_by) or $sort_by[0]=='name') +if ( $sort_by[0]=='name') { usort($categories, 'global_rank_compare'); } -- cgit v1.2.3