diff options
author | rvelices <rv-github@modusoptimus.com> | 2007-10-03 23:36:21 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2007-10-03 23:36:21 +0000 |
commit | fb9abe8fea6bf40c5628467158edf2fc6881a8dd (patch) | |
tree | 978ba2948e6ddfe82be3982590b7d0a83b8638fd /admin | |
parent | 2889cbc4eb06ce32caf3d5f8d592120830c4b676 (diff) |
- 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
Diffstat (limited to '')
-rw-r--r-- | admin/permalinks.php | 26 |
1 files changed, 15 insertions, 11 deletions
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 = '<em>'.$disp.'</em>'; + } } else { array_push($ret, $field); - $disp = '<em>⇓</em>'; // TODO: an small image is better + $disp = '<em>'.$disp.'</em>'; } 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'); } |