Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
The G2 import sets the sort_order to "asc"/"desc" but
Item_Model::get_position() expects "DESC".  This breaks navigation in
any album imported from G2 that has a descending sort order.

Two things:
1) Use "ASC"/"DESC" in G2 import for consistency
2) Make Item_Model::get_position() more robust against capitalization

Fixes ticket #1334.
  • Loading branch information
bharat committed Sep 8, 2010
1 parent 2f94dfc commit ab88012
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions modules/g2_import/helpers/g2_import.php
Expand Up @@ -452,9 +452,9 @@ static function import_album(&$queue) {
"title" => "title",
"viewCount" => "view_count");
$direction_map = array(
1 => "asc",
ORDER_ASCENDING => "asc",
ORDER_DESCENDING => "desc");
1 => "ASC",
ORDER_ASCENDING => "ASC",
ORDER_DESCENDING => "DESC");
// Only consider G2's first sort order
$g2_order = explode("|", $g2_album->getOrderBy() . "");
$g2_order = $g2_order[0];
Expand Down
2 changes: 1 addition & 1 deletion modules/gallery/models/item.php
Expand Up @@ -530,7 +530,7 @@ public function album_cover() {
* the first child in the album is at position 1.
*/
public function get_position($child, $where=array()) {
if ($this->sort_order == "DESC") {
if (!strcasecmp($this->sort_order, "DESC")) {
$comp = ">";
} else {
$comp = "<";
Expand Down

0 comments on commit ab88012

Please sign in to comment.