From ab880120e69b27bdcfed07d3b0729108326b335d Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 7 Sep 2010 21:04:38 -0700 Subject: 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. --- modules/g2_import/helpers/g2_import.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'modules/g2_import') diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index c3737f8f..515eb73d 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -452,9 +452,9 @@ class g2_import_Core { "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]; -- cgit v1.2.3 From fe3dd6b55d4a820a2b33de5a883c2f64112cfbd4 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 8 Sep 2010 21:12:20 -0700 Subject: Add information about disabling XCache during the import process. Fixes ticket #1352. --- modules/g2_import/views/admin_g2_import.html.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'modules/g2_import') diff --git a/modules/g2_import/views/admin_g2_import.html.php b/modules/g2_import/views/admin_g2_import.html.php index 8ec4b5ce..7a6f88ce 100644 --- a/modules/g2_import/views/admin_g2_import.html.php +++ b/modules/g2_import/views/admin_g2_import.html.php @@ -8,8 +8,6 @@

-

-

  • @@ -22,7 +20,7 @@ notification, search and exif modules during your import will make it go faster.") ?>
  • - php_value eaccelerator.enable 0 in gallery3/.htaccess") ?> + %lines to gallery3/.htaccess and remove them when the import is done.", array("lines" => "\n\n php_value eaccelerator.enable 0\n php_value xcache.cacher off\n php_value xcache.optimizer off\n\n")) ?>
-- cgit v1.2.3 From 5cd34160af2fa1d4499d98aaa807712995082a20 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 8 Sep 2010 21:34:16 -0700 Subject: Remove unnecessary g2_import CSS (which we were loading on every page -- doh!) and replace it with a new "enumeration" list style in the admin_wind CSS. Reshuffle the page a little bit to make it look cleaner. --- modules/g2_import/css/g2_import.css | 30 ------- modules/g2_import/helpers/g2_import_theme.php | 28 ------ modules/g2_import/views/admin_g2_import.html.php | 107 ++++++++++++----------- themes/admin_wind/css/screen.css | 5 ++ 4 files changed, 60 insertions(+), 110 deletions(-) delete mode 100644 modules/g2_import/css/g2_import.css delete mode 100644 modules/g2_import/helpers/g2_import_theme.php (limited to 'modules/g2_import') diff --git a/modules/g2_import/css/g2_import.css b/modules/g2_import/css/g2_import.css deleted file mode 100644 index d53564d7..00000000 --- a/modules/g2_import/css/g2_import.css +++ /dev/null @@ -1,30 +0,0 @@ -#g-admin-g2-import-notes { - padding-bottom: 20px; -} - -#g-admin-g2-import-details { - padding-top: 20px; -} - -#g-admin-g2-import-details .g-warning { - margin-top: 4px; -} - -#g-admin-g2-import-details .g-info { - padding: 2px; - border: 1px solid #999; - margin-bottom: 10px; -} - -#g-admin-g2-import-notes p, -#g-admin-g2-import-details .g-info p { - padding: 0; - margin: 0; -} - -#g-admin-g2-import-notes ul li, -#g-admin-g2-import .g-info ul li { - padding-left: 0; - margin-left: 20px; - list-style-type: disc; -} diff --git a/modules/g2_import/helpers/g2_import_theme.php b/modules/g2_import/helpers/g2_import_theme.php deleted file mode 100644 index 788253f9..00000000 --- a/modules/g2_import/helpers/g2_import_theme.php +++ /dev/null @@ -1,28 +0,0 @@ -css("g2_import.css"); - } - - static function admin_head($theme) { - $theme->css("g2_import.css"); - } -} \ No newline at end of file diff --git a/modules/g2_import/views/admin_g2_import.html.php b/modules/g2_import/views/admin_g2_import.html.php index 7a6f88ce..a1ee53f6 100644 --- a/modules/g2_import/views/admin_g2_import.html.php +++ b/modules/g2_import/views/admin_g2_import.html.php @@ -6,27 +6,10 @@

-
-

-

-
    -
  • - Review permissions after your import is done.") ?> -
  • -
  • - -
  • -
  • - notification, search and exif modules during your import will make it go faster.") ?> -
  • -
  • - %lines to gallery3/.htaccess and remove them when the import is done.", array("lines" => "\n\n php_value eaccelerator.enable 0\n php_value xcache.cacher off\n php_value xcache.optimizer off\n\n")) ?> -
  • -
-
- +
+

@@ -51,59 +34,79 @@ "url" => html::mark_clean(url::site("admin/theme_options")))) ?> - -
-

+

  • -

    -
      -
    • - -
    • -
    • - -
    • -
    • - -
    • +
        +
      • + +
      • +
      • + +
      • +
      • + +
      • +
      • + +
      • +
      • + +
      • +
      • + +
      • +
      • + +
      • +
      + +
    + +

    + "> + + +

    +
  • + +
    +
    +

    +
    • - + Review permissions after your import is done.") ?>
    • - +
    • - + notification, search and exif modules during your import will make it go faster.") ?>
    • - + %lines to gallery3/.htaccess and remove them when the import is done.", array("lines" => "\n\n php_value eaccelerator.enable 0\n php_value xcache.cacher off\n php_value xcache.optimizer off\n\n")) ?>
    - -

    - "> - - -

    -
    -

    -

    - -

    +
    +
    +

    +

    + +

    - +
    +
    -
    diff --git a/themes/admin_wind/css/screen.css b/themes/admin_wind/css/screen.css index eda79b97..0d891149 100644 --- a/themes/admin_wind/css/screen.css +++ b/themes/admin_wind/css/screen.css @@ -222,6 +222,11 @@ th { background-color: #fff; } +ul.enumeration li { + list-style-type: disc; + margin-left: 20px; +} + /*** ****************************************************************** * 3) Page layout containers *********************************************************************/ -- cgit v1.2.3 From 36f3a0387ddc484ebe867cf284aaf05f6ce6e5e1 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 8 Sep 2010 21:39:35 -0700 Subject: Tighten up the "your gallery2 has xxx in it" info display. --- modules/g2_import/views/admin_g2_import.html.php | 36 ++++++++---------------- 1 file changed, 11 insertions(+), 25 deletions(-) (limited to 'modules/g2_import') diff --git a/modules/g2_import/views/admin_g2_import.html.php b/modules/g2_import/views/admin_g2_import.html.php index a1ee53f6..564bea9f 100644 --- a/modules/g2_import/views/admin_g2_import.html.php +++ b/modules/g2_import/views/admin_g2_import.html.php @@ -36,31 +36,17 @@
  • - -
      -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    + +

    + , + , + , + , + , + , + +

  • -- cgit v1.2.3 From 77ec06166320dee631bbffcf3d57b0e2debcb157 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 18 Sep 2010 15:12:43 -0700 Subject: Redirect to the root album when there's an empty path and empty id. Fixes ticket #1387. --- modules/g2_import/controllers/g2.php | 54 ++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 24 deletions(-) (limited to 'modules/g2_import') diff --git a/modules/g2_import/controllers/g2.php b/modules/g2_import/controllers/g2.php index d260c9b4..1c07c729 100644 --- a/modules/g2_import/controllers/g2.php +++ b/modules/g2_import/controllers/g2.php @@ -34,38 +34,44 @@ class G2_Controller extends Controller { $path = $input->get("path"); $id = $input->get("g2_itemId"); - if ($id) { - // Requests by id are either core.DownloadItem or core.ShowItem requests. Later versions of - // Gallery 2 don't specify g2_view if it's the default (core.ShowItem). And in some cases - // (bbcode, embedding) people are using the id style URLs although URL rewriting is enabled. - $where = array(array("g2_id", "=", $id)); - $view = $input->get("g2_view"); - if ($view) { - $where[] = array("g2_url", "like", "%g2_view=$view%"); - } // else: Assuming that the first search hit is sufficiently good. - } else if ($path) { - $where = array(array("g2_url", "=", $path)); - } else { - throw new Kohana_404_Exception(); - } + if ($path || $id) { + if ($id) { + // Requests by id are either core.DownloadItem or core.ShowItem requests. Later versions of + // Gallery 2 don't specify g2_view if it's the default (core.ShowItem). And in some cases + // (bbcode, embedding) people are using the id style URLs although URL rewriting is enabled. + $where = array(array("g2_id", "=", $id)); + $view = $input->get("g2_view"); + if ($view) { + $where[] = array("g2_url", "like", "%g2_view=$view%"); + } // else: Assuming that the first search hit is sufficiently good. + } else if ($path) { + $where = array(array("g2_url", "=", $path)); + } else { + throw new Kohana_404_Exception(); + } - $g2_map = ORM::factory("g2_map") - ->merge_where($where) - ->find(); + $g2_map = ORM::factory("g2_map") + ->merge_where($where) + ->find(); - if (!$g2_map->loaded()) { - throw new Kohana_404_Exception(); - } + if (!$g2_map->loaded()) { + throw new Kohana_404_Exception(); + } - $item = ORM::factory("item", $g2_map->g3_id); - if (!$item->loaded()) { - throw new Kohana_404_Exception(); + $item = ORM::factory("item", $g2_map->g3_id); + if (!$item->loaded()) { + throw new Kohana_404_Exception(); + } + $resource_type = $g2_map->resource_type(); + } else { + $item = item::root(); + $resource_type = "album"; } access::required("view", $item); // Redirect the user to the new url - switch ($g2_map->resource_type) { + switch ($resource_type) { case "thumbnail": url::redirect($item->thumb_url(true)); -- cgit v1.2.3 From 6bb75f623e6dbb58e873b5c7f3f2f3238abe99fd Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 18 Sep 2010 16:34:48 -0700 Subject: Fix a bug in that last commit where I was treating resource_type as a function. --- modules/g2_import/controllers/g2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/g2_import') diff --git a/modules/g2_import/controllers/g2.php b/modules/g2_import/controllers/g2.php index 1c07c729..c529c147 100644 --- a/modules/g2_import/controllers/g2.php +++ b/modules/g2_import/controllers/g2.php @@ -62,7 +62,7 @@ class G2_Controller extends Controller { if (!$item->loaded()) { throw new Kohana_404_Exception(); } - $resource_type = $g2_map->resource_type(); + $resource_type = $g2_map->resource_type; } else { $item = item::root(); $resource_type = "album"; -- cgit v1.2.3 From a1b1d323af458958c9e06c8160bffb97882b8d41 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 18 Sep 2010 16:46:15 -0700 Subject: When looking for G2 urls in the g2_map, try also swapping spaces for + in case the url had spaces in it. Fixes ticket #1388. --- modules/g2_import/controllers/g2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/g2_import') diff --git a/modules/g2_import/controllers/g2.php b/modules/g2_import/controllers/g2.php index c529c147..0f51173a 100644 --- a/modules/g2_import/controllers/g2.php +++ b/modules/g2_import/controllers/g2.php @@ -45,7 +45,7 @@ class G2_Controller extends Controller { $where[] = array("g2_url", "like", "%g2_view=$view%"); } // else: Assuming that the first search hit is sufficiently good. } else if ($path) { - $where = array(array("g2_url", "=", $path)); + $where = array(array("g2_url", "IN", array($path, str_replace(" ", "+", $path)))); } else { throw new Kohana_404_Exception(); } -- cgit v1.2.3