Changeset 2072 for sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/routes/locale.php
- Timestamp:
- 11/11/2015 02:00:12 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/routes/locale.php
r1901 r2072 26 26 $page = (int) gp_get( 'page', 1 ); 27 27 $search = gp_get( 's', '' ); 28 $filter = gp_get( 'filter', 'default');28 $filter = gp_get( 'filter', false ); 29 29 30 30 $locale = GP_Locales::by_slug( $locale_slug ); … … 88 88 $sub_projects = $paged_sub_projects['projects']; 89 89 $pages = $paged_sub_projects['pages']; 90 $filter = $paged_sub_projects['filter']; 90 91 unset( $paged_sub_projects ); 91 92 … … 386 387 'set_slug' => '', 387 388 'locale' => '', 388 'filter' => 'default',389 'filter' => false, 389 390 ); 390 391 $r = wp_parse_args( $args, $defaults ); … … 408 409 if ( 'waiting' == $project->slug && GP::$user->current()->id && isset( GP::$plugins->wporg_rosetta_roles ) ) { 409 410 410 if ( 'default' ===$filter ) {411 $filter = 'strings-waiting ';411 if ( ! $filter ) { 412 $filter = 'strings-waiting-and-fuzzy'; 412 413 } 413 414 … … 452 453 453 454 $filter_order_by = $filter_where = ''; 454 switch ( $filter ) { 455 $sort_order = 'DESC'; 456 $filter_name = $filter; 457 if ( $filter && '-asc' == substr( $filter, -4 ) ) { 458 $sort_order = 'ASC'; 459 $filter_name = substr( $filter, 0, -4 ); 460 } 461 switch ( $filter_name ) { 455 462 default: 456 case ' default':463 case 'special': 457 464 // Float favorites to the start, but only if they have untranslated strings 458 465 $user_fav_projects = array_map( array( $gpdb, 'escape' ), $this->get_user_favorites( $project->slug ) ); … … 481 488 case 'strings-remaining': 482 489 $filter_where = 'AND stats.untranslated > 0'; 483 $filter_order_by = 'stats.untranslated DESC, tp.name ASC';490 $filter_order_by = "stats.untranslated $sort_order, tp.name ASC"; 484 491 break; 485 492 486 case 'strings-waiting ':493 case 'strings-waiting-and-fuzzy': 487 494 $filter_where = 'AND (stats.waiting > 0 OR stats.fuzzy > 0 )'; 488 495 $filter_order_by = "tp.path LIKE 'wp/%%' AND (stats.fuzzy + stats.waiting) > 0 DESC, (stats.fuzzy + stats.waiting) DESC, tp.name ASC"; 489 496 break; 490 497 491 case 'strings-fuzzy-and-warnings':492 $filter_where = 'AND ( stats.fuzzy > 0 OR stats.warnings > 0 )';493 $filter_order_by = '(stats.fuzzy+stats.warnings) DESC, tp.name ASC';494 break;495 496 498 case 'percent-completed': 497 499 $filter_where = 'AND stats.untranslated > 0'; 498 $filter_order_by = ' ( stats.current / stats.all ) DESC, tp.name ASC';500 $filter_order_by = "( stats.current / stats.all ) $sort_order, tp.name ASC"; 499 501 break; 500 502 } … … 534 536 'pages' => compact( 'pages', 'page', 'per_page', 'results' ), 535 537 'projects' => $projects, 538 'filter' => $filter, 536 539 ); 537 540 }
Note: See TracChangeset
for help on using the changeset viewer.