From b89c40242f85ecb49393e4fe6aeb3659550f60a4 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 24 Apr 2011 07:49:41 -0700 Subject: Sentence-case the url. Fixes #1706. --- modules/g2_import/helpers/g2_import_event.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/g2_import/helpers/g2_import_event.php b/modules/g2_import/helpers/g2_import_event.php index 0e078d08..0afa62d8 100644 --- a/modules/g2_import/helpers/g2_import_event.php +++ b/modules/g2_import/helpers/g2_import_event.php @@ -34,7 +34,7 @@ class g2_import_event_Core { ->get("settings_menu") ->append(Menu::factory("link") ->id("g2_import") - ->label(t("Gallery 2 Import")) + ->label(t("Gallery 2 import")) ->url(url::site("admin/g2_import"))); } } -- cgit v1.2.3 From b4cdd016dc97f2df608bb14d2088cb4ddbd32c35 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Sun, 24 Apr 2011 11:53:29 -0400 Subject: Third times the charm. Rethink unordered lists and bullets. Revert to turning them off by default and provide a new class, g-text, to define a list or a section of text as needing to display bullets. --- modules/g2_import/views/admin_g2_import.html.php | 4 ++-- modules/gallery/views/admin_block_welcome.html.php | 2 +- themes/admin_wind/css/screen.css | 17 ++--------------- 3 files changed, 5 insertions(+), 18 deletions(-) (limited to 'modules') diff --git a/modules/g2_import/views/admin_g2_import.html.php b/modules/g2_import/views/admin_g2_import.html.php index cf5e4755..2f4a1b28 100644 --- a/modules/g2_import/views/admin_g2_import.html.php +++ b/modules/g2_import/views/admin_g2_import.html.php @@ -112,8 +112,8 @@ $("document").ready(function() {

-
-
    +
    +
    • Review permissions!") ?>
    • diff --git a/modules/gallery/views/admin_block_welcome.html.php b/modules/gallery/views/admin_block_welcome.html.php index d8c96187..d3765d19 100644 --- a/modules/gallery/views/admin_block_welcome.html.php +++ b/modules/gallery/views/admin_block_welcome.html.php @@ -2,7 +2,7 @@

      -
        +
        • graphics and language settings.", array("graphics_url" => html::mark_clean(url::site("admin/graphics")), diff --git a/themes/admin_wind/css/screen.css b/themes/admin_wind/css/screen.css index f01c2a94..6f1c0962 100644 --- a/themes/admin_wind/css/screen.css +++ b/themes/admin_wind/css/screen.css @@ -92,25 +92,12 @@ a:hover, /* Lists ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -#g-content ul li { +ul.g-text li, +.g-text ul li { list-style-type: disc; margin-left: 1em; } -form ul li, -#g-action-status li, -#g-log-entries li, -#g-tag-admin li, -.g-buttonset li, -.g-buttonset-vertical li, -.g-paginator li, -.ui-sortable li, -.ui-widget-header li { - list-style: none !important; - margin-left: 0 !important; -} - - /* Forms ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ form { -- cgit v1.2.3 From f8493a1df26f242959e931d862c5f1282dd324e8 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 24 Apr 2011 08:57:09 -0700 Subject: Revert my two "fixes" on top of Andy's tag combine change. Leave Tag_Model::items() calling Item_Model::viewable() because it's too dangerous to separate that out, and it's fragile to rely on only admins doing tag combines. Revert "Undo the change made in 5ce85636329b14673718836b3631a3e46efdc3bb because it messes up tag counts" - This reverts commit 67d2e8081c6e5f0b679881bca3fdc81fe1e78ccc. Revert "Move the calculation for item_related_update ahead of the duplicate" - This reverts commit 5ce85636329b14673718836b3631a3e46efdc3bb. --- modules/tag/models/tag.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/tag/models/tag.php b/modules/tag/models/tag.php index 13e253ba..bb79e707 100644 --- a/modules/tag/models/tag.php +++ b/modules/tag/models/tag.php @@ -75,8 +75,12 @@ class Tag_Model_Core extends ORM { ->where("id", "!=", $this->id) ->find(); if ($duplicate_tag->loaded()) { - // If so, tag its items with this tag so as to merge it. - foreach ($duplicate_tag->items() as $item) { + // If so, tag its items with this tag so as to merge it + $duplicate_tag_items = ORM::factory("item") + ->join("items_tags", "items.id", "items_tags.item_id") + ->where("items_tags.tag_id", "=", $duplicate_tag->id) + ->find_all(); + foreach ($duplicate_tag_items as $item) { $this->add($item); } @@ -84,7 +88,6 @@ class Tag_Model_Core extends ORM { $duplicate_tag->delete(); } - // Figure out what items have changed in this tag for our item_related_update event below if (isset($this->object_relations["items"])) { $added = array_diff($this->changed_relations["items"], $this->object_relations["items"]); $removed = array_diff($this->object_relations["items"], $this->changed_relations["items"]); -- cgit v1.2.3 From f4d76a8abe04612efe01f146617d760ffdd4b69f Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Sun, 24 Apr 2011 13:56:39 -0400 Subject: Don't put the Admin > Theme Options Save button in a fieldset. --- modules/gallery/controllers/admin_theme_options.php | 1 - 1 file changed, 1 deletion(-) (limited to 'modules') diff --git a/modules/gallery/controllers/admin_theme_options.php b/modules/gallery/controllers/admin_theme_options.php index a968a56d..d9323ea0 100644 --- a/modules/gallery/controllers/admin_theme_options.php +++ b/modules/gallery/controllers/admin_theme_options.php @@ -108,7 +108,6 @@ class Admin_Theme_Options_Controller extends Admin_Controller { module::event("theme_edit_form", $form); - $group = $form->group("buttons"); $group->submit("")->value(t("Save")); return $form; } -- cgit v1.2.3 From ea2127c3b2ddef5709e02b4804c074bd1f942159 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 24 Apr 2011 21:02:34 -0700 Subject: Fix a bug introduced in f2477703faa7cd05ff1aa16da3ecef7b666bef40 which was a fix for #1581 that caused us to skip adding highlights for any albums that had no sub-albums. --- modules/g2_import/helpers/g2_import.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'modules') diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 23fb29e5..e9c19c9d 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -518,12 +518,11 @@ class g2_import_Core { static function set_album_highlight(&$queue) { // Dequeue the current album and enqueue its children list($g2_album_id, $children) = each($queue); - if (empty($children)) { - return; - } unset($queue[$g2_album_id]); - foreach ($children as $key => $value) { - $queue[$key] = $value; + if (!empty($children)) { + foreach ($children as $key => $value) { + $queue[$key] = $value; + } } $messages = array(); -- cgit v1.2.3 From 701c1fb12f2f254d8d7e7756a09cb5e825123a2f Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 24 Apr 2011 22:45:45 -0700 Subject: Ignore the presort when transferring over sort orders. Fixes #1710. --- modules/g2_import/helpers/g2_import.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index e9c19c9d..50ab8a23 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -475,9 +475,10 @@ class g2_import_Core { 1 => "ASC", ORDER_ASCENDING => "ASC", ORDER_DESCENDING => "DESC"); - // Only consider G2's first sort order + // G2 sorts can either be or |. Right now we can't + // map presorts so ignore them. $g2_order = explode("|", $g2_album->getOrderBy() . ""); - $g2_order = $g2_order[0]; + $g2_order = end($g2_order); if (empty($g2_order)) { $g2_order = g2(GalleryCoreApi::getPluginParameter('module', 'core', 'default.orderBy')); } -- cgit v1.2.3 From 953be781dc91254599224fa6e95fcc435e787975 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 24 Apr 2011 22:51:14 -0700 Subject: Refactor the meat of g2_import::import_album() off into a separate function so taht we can call it on the root album as well. Fixes --- modules/g2_import/helpers/g2_import.php | 96 +++++++++++++++------------- modules/g2_import/helpers/g2_import_task.php | 6 ++ 2 files changed, 58 insertions(+), 44 deletions(-) (limited to 'modules') diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 50ab8a23..22a054ac 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -448,50 +448,8 @@ class g2_import_Core { $album = ORM::factory("item"); $album->type = "album"; $album->parent_id = self::map($g2_album->getParentId()); - $album->name = $g2_album->getPathComponent(); - $album->title = self::_decode_html_special_chars($g2_album->getTitle()); - $album->title or $album->title = $album->name; - $album->description = self::_decode_html_special_chars(self::extract_description($g2_album)); - $album->owner_id = self::map($g2_album->getOwnerId()); - try { - $album->view_count = (int) g2(GalleryCoreApi::fetchItemViewCount($g2_album_id)); - } catch (Exception $e) { - // @todo log - $album->view_count = 0; - } - $album->created = $g2_album->getCreationTimestamp(); - - $order_map = array( - "originationTimestamp" => "captured", - "creationTimestamp" => "created", - "description" => "description", - "modificationTimestamp" => "updated", - "orderWeight" => "weight", - "pathComponent" => "name", - "summary" => "description", - "title" => "title", - "viewCount" => "view_count"); - $direction_map = array( - 1 => "ASC", - ORDER_ASCENDING => "ASC", - ORDER_DESCENDING => "DESC"); - // G2 sorts can either be or |. Right now we can't - // map presorts so ignore them. - $g2_order = explode("|", $g2_album->getOrderBy() . ""); - $g2_order = end($g2_order); - if (empty($g2_order)) { - $g2_order = g2(GalleryCoreApi::getPluginParameter('module', 'core', 'default.orderBy')); - } - $g2_order_direction = explode("|", $g2_album->getOrderDirection() . ""); - $g2_order_direction = $g2_order_direction[0]; - if (empty($g2_order_direction)) { - $g2_order_direction = - g2(GalleryCoreApi::getPluginParameter('module', 'core', 'default.orderDirection')); - } - if (array_key_exists($g2_order, $order_map)) { - $album->sort_column = $order_map[$g2_order]; - $album->sort_order = $direction_map[$g2_order_direction]; - } + + g2_import::set_album_values($album, $g2_album); try { $album->save(); @@ -513,6 +471,56 @@ class g2_import_Core { self::_import_permissions($g2_album, $album); } + /** + * Transfer over all the values from a G2 album to a G3 album. + */ + static function set_album_values($album, $g2_album) { + $album->name = $g2_album->getPathComponent(); + $album->title = self::_decode_html_special_chars($g2_album->getTitle()); + $album->title or $album->title = $album->name; + $album->description = self::_decode_html_special_chars(self::extract_description($g2_album)); + $album->owner_id = self::map($g2_album->getOwnerId()); + try { + $album->view_count = (int) g2(GalleryCoreApi::fetchItemViewCount($g2_album_id)); + } catch (Exception $e) { + // @todo log + $album->view_count = 0; + } + $album->created = $g2_album->getCreationTimestamp(); + + $order_map = array( + "originationTimestamp" => "captured", + "creationTimestamp" => "created", + "description" => "description", + "modificationTimestamp" => "updated", + "orderWeight" => "weight", + "pathComponent" => "name", + "summary" => "description", + "title" => "title", + "viewCount" => "view_count"); + $direction_map = array( + 1 => "ASC", + ORDER_ASCENDING => "ASC", + ORDER_DESCENDING => "DESC"); + // G2 sorts can either be or |. Right now we can't + // map presorts so ignore them. + $g2_order = explode("|", $g2_album->getOrderBy() . ""); + $g2_order = end($g2_order); + if (empty($g2_order)) { + $g2_order = g2(GalleryCoreApi::getPluginParameter('module', 'core', 'default.orderBy')); + } + $g2_order_direction = explode("|", $g2_album->getOrderDirection() . ""); + $g2_order_direction = $g2_order_direction[0]; + if (empty($g2_order_direction)) { + $g2_order_direction = + g2(GalleryCoreApi::getPluginParameter('module', 'core', 'default.orderDirection')); + } + if (array_key_exists($g2_order, $order_map)) { + $album->sort_column = $order_map[$g2_order]; + $album->sort_order = $direction_map[$g2_order_direction]; + } + } + /** * Set the highlight properly for a single album */ diff --git a/modules/g2_import/helpers/g2_import_task.php b/modules/g2_import/helpers/g2_import_task.php index 5e908676..31615a55 100644 --- a/modules/g2_import/helpers/g2_import_task.php +++ b/modules/g2_import/helpers/g2_import_task.php @@ -127,6 +127,12 @@ class g2_import_task_Core { $g2_root_id = g2(GalleryCoreApi::getDefaultAlbumId()); $tree = g2(GalleryCoreApi::fetchAlbumTree()); $task->set("queue", $queue = array($g2_root_id => $tree)); + + // Update the root album to reflect the Gallery2 root album. + $root_album = item::root(); + g2_import::set_album_values( + $root_album, g2(GalleryCoreApi::loadEntitiesById($g2_root_id))); + $root_album->save(); } $log_message = g2_import::import_album($queue); if ($log_message) { -- cgit v1.2.3 From 8533420f5d307e81a90c3d26a75b666350aee0f2 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 24 Apr 2011 22:55:01 -0700 Subject: Look for and return embed.php files in the autocomplete list if we can find them. Fixes #1708. --- modules/g2_import/controllers/admin_g2_import.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'modules') diff --git a/modules/g2_import/controllers/admin_g2_import.php b/modules/g2_import/controllers/admin_g2_import.php index cf68d911..5c4995c9 100644 --- a/modules/g2_import/controllers/admin_g2_import.php +++ b/modules/g2_import/controllers/admin_g2_import.php @@ -100,6 +100,11 @@ class Admin_g2_import_Controller extends Admin_Controller { foreach (glob("{$path_prefix}*") as $file) { if (is_dir($file) && !is_link($file)) { $directories[] = $file; + + // If we find an embed.php, include it as well + if (file_exists("$file/embed.php")) { + $directories[] = "$file/embed.php"; + } } } -- cgit v1.2.3 From 4e7524664a24dd2ca2309c9d67843a19e74b48e0 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 24 Apr 2011 23:04:50 -0700 Subject: Show the tabs after the page has loaded to prevent Firefox from rendering the unstyled page and then flashing. Fixes #1705. --- modules/g2_import/views/admin_g2_import.html.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/g2_import/views/admin_g2_import.html.php b/modules/g2_import/views/admin_g2_import.html.php index 2f4a1b28..9c4eb840 100644 --- a/modules/g2_import/views/admin_g2_import.html.php +++ b/modules/g2_import/views/admin_g2_import.html.php @@ -30,9 +30,13 @@ $("document").ready(function() { .tabs("select", 1) ; + + // Show the tabs after the page has loaded to prevent Firefox from rendering the + // unstyled page and then flashing. + $("#g-admin-g2-import-tabs").show(); }); -
          + diff --git a/modules/gallery/libraries/Gallery_View.php b/modules/gallery/libraries/Gallery_View.php index 1395686c..e04b9169 100644 --- a/modules/gallery/libraries/Gallery_View.php +++ b/modules/gallery/libraries/Gallery_View.php @@ -30,6 +30,52 @@ class Gallery_View_Core extends View { return $absolute_url ? url::abs_file($arg) : url::file($arg); } + /** + * Set up the data and render a pager. + * + * See themes/wind/views/pager.html for documentation on the variables generated here. + */ + public function paginator() { + $v = new View("paginator.html"); + $v->page_type = $this->page_type; + $v->page_subtype = $this->page_subtype; + $v->first_page_url = null; + $v->previous_page_url = null; + $v->next_page_url = null; + $v->last_page_url = null; + + if ($this->page_type == "collection") { + $v->page = $this->page; + $v->max_pages = $this->max_pages; + $v->total = $this->children_count; + + if ($this->page != 1) { + $v->first_page_url = url::site(url::merge(array("page" => 1))); + $v->previous_page_url = url::site(url::merge(array("page" => $this->page - 1))); + } + + if ($this->page != $this->max_pages) { + $v->next_page_url = url::site(url::merge(array("page" => $this->page + 1))); + $v->last_page_url = url::site(url::merge(array("page" => $this->max_pages))); + } + + $v->first_visible_position = ($this->page - 1) * $this->page_size + 1; + $v->last_visible_position = min($this->page * $this->page_size, $v->total); + } else if ($this->page_type == "item") { + $v->position = $this->position; + $v->total = $this->sibling_count; + if ($this->previous_item) { + $v->previous_page_url = $this->previous_item->url(); + } + + if ($this->next_item) { + $v->next_page_url = $this->next_item->url(); + } + } + + return $v; + } + /** * Begin gather up scripts or css files so that they can be combined into a single request. * diff --git a/modules/gallery/libraries/MY_Pagination.php b/modules/gallery/libraries/MY_Pagination.php deleted file mode 100644 index e697c0bd..00000000 --- a/modules/gallery/libraries/MY_Pagination.php +++ /dev/null @@ -1,35 +0,0 @@ -auto_hide === TRUE AND $this->total_pages <= 1) { - return ""; - } - - if ($style === NULL) { - // Use default style - $style = $this->style; - } - - // Return rendered pagination view - return View::factory("pager.html", get_object_vars($this))->render(); - } -} diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index 152efc37..d6834464 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -138,52 +138,6 @@ class Theme_View_Core extends Gallery_View { return $menu->render(); } - /** - * Set up the data and render a pager. - * - * See themes/wind/views/pager.html for documentation on the variables generated here. - */ - public function paginator() { - $v = new View("paginator.html"); - $v->page_type = $this->page_type; - $v->page_subtype = $this->page_subtype; - $v->first_page_url = null; - $v->previous_page_url = null; - $v->next_page_url = null; - $v->last_page_url = null; - - if ($this->page_type == "collection") { - $v->page = $this->page; - $v->max_pages = $this->max_pages; - $v->total = $this->children_count; - - if ($this->page != 1) { - $v->first_page_url = url::site(url::merge(array("page" => 1))); - $v->previous_page_url = url::site(url::merge(array("page" => $this->page - 1))); - } - - if ($this->page != $this->max_pages) { - $v->next_page_url = url::site(url::merge(array("page" => $this->page + 1))); - $v->last_page_url = url::site(url::merge(array("page" => $this->max_pages))); - } - - $v->first_visible_position = ($this->page - 1) * $this->page_size + 1; - $v->last_visible_position = min($this->page * $this->page_size, $v->total); - } else if ($this->page_type == "item") { - $v->position = $this->position; - $v->total = $this->sibling_count; - if ($this->previous_item) { - $v->previous_page_url = $this->previous_item->url(); - } - - if ($this->next_item) { - $v->next_page_url = $this->next_item->url(); - } - } - - return $v; - } - /** * Print out any site wide status information. */ diff --git a/modules/user/controllers/admin_users.php b/modules/user/controllers/admin_users.php index a3633b52..41be6c03 100644 --- a/modules/user/controllers/admin_users.php +++ b/modules/user/controllers/admin_users.php @@ -21,6 +21,8 @@ class Admin_Users_Controller extends Admin_Controller { public function index() { $view = new Admin_View("admin.html"); $view->page_title = t("Users and groups"); + $view->page_type = "collection"; + $view->page_subtype = "admin_users"; $view->content = new View("admin_users.html"); // @todo: add this as a config option @@ -29,6 +31,12 @@ class Admin_Users_Controller extends Admin_Controller { $builder = db::build(); $user_count = $builder->from("users")->count_records(); + // Pagination info + $view->page = $page; + $view->page_size = $page_size; + $view->children_count = $user_count; + $view->max_pages = ceil($view->children_count / $view->page_size); + $view->content->pager = new Pagination(); $view->content->pager->initialize( array("query_string" => "page", diff --git a/modules/user/views/admin_users.html.php b/modules/user/views/admin_users.html.php index a7bd6b27..033c9dae 100644 --- a/modules/user/views/admin_users.html.php +++ b/modules/user/views/admin_users.html.php @@ -110,7 +110,7 @@
          - + paginator() ?>
          diff --git a/themes/admin_wind/views/pager.html.php b/themes/admin_wind/views/pager.html.php deleted file mode 100644 index 5fff5845..00000000 --- a/themes/admin_wind/views/pager.html.php +++ /dev/null @@ -1,44 +0,0 @@ - - -
            - $current_first_item, - "to_number" => $current_last_item, - "count" => $total_items)) ?> -
          • - - - - - - - - - - - - - - -
          • -
          • -
          • - - - - - - - - - - - - - - -
          • -
          diff --git a/themes/admin_wind/views/paginator.html.php b/themes/admin_wind/views/paginator.html.php new file mode 100644 index 00000000..3cb0223d --- /dev/null +++ b/themes/admin_wind/views/paginator.html.php @@ -0,0 +1,88 @@ + + + +
            +
          • + + + + + + + + + + + + + + + + + +
          • + +
          • + + + $first_visible_position, + "to_number" => $last_visible_position, + "count" => $total)) ?> + + $position, "total" => $total)) ?> + + + + +
          • + +
          • + + + + + + + + + + + + + + + + + +
          • +
          -- cgit v1.2.3 From 743e2f88d8cbba7ea5f7b3b78ab721c141d1ec99 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 26 Apr 2011 21:02:43 -0700 Subject: Overhaul the Admin > Content > Comments page. Use a tabbed interface for consistency with other parts of the admin UI (ie: G2 import). The UI is now Ajax driven because that's how jQuery tabs works best in this case. This requires a little finagling in JS to get the paginator links to load properly. While I'm in there, add a paginator at the top of the table, make the buttons in the delete tab sane and smooth scroll back to the top of the tab when switching pages. Fixes #1702 --- .../comment/controllers/admin_manage_comments.php | 32 ++-- .../comment/views/admin_manage_comments.html.php | 211 +++------------------ .../views/admin_manage_comments_queue.html.php | 157 +++++++++++++++ 3 files changed, 205 insertions(+), 195 deletions(-) create mode 100644 modules/comment/views/admin_manage_comments_queue.html.php (limited to 'modules') diff --git a/modules/comment/controllers/admin_manage_comments.php b/modules/comment/controllers/admin_manage_comments.php index effefcbb..72684e70 100644 --- a/modules/comment/controllers/admin_manage_comments.php +++ b/modules/comment/controllers/admin_manage_comments.php @@ -28,8 +28,10 @@ class Admin_Manage_Comments_Controller extends Admin_Controller { ->where("updated", "<", db::expr("UNIX_TIMESTAMP() - 86400 * 7")) ->execute(); - // Redirect to the appropriate queue - url::redirect("admin/manage_comments/queue/unpublished"); + $view = new Admin_View("admin.html"); + $view->content = new View("admin_manage_comments.html"); + $view->content->menu = $this->_menu($this->_counts()); + print $view; } public function menu_labels() { @@ -43,15 +45,11 @@ class Admin_Manage_Comments_Controller extends Admin_Controller { public function queue($state) { $page = max(Input::instance()->get("page"), 1); - $view = new Admin_View("admin.html"); - $view->page_title = t("Manage comments"); - $view->page_type = "collection"; - $view->page_subtype = "admin_comments"; - $view->content = new View("admin_manage_comments.html"); - $view->content->counts = $this->_counts(); - $view->content->menu = $this->_menu($view->content->counts); - $view->content->state = $state; - $view->content->comments = ORM::factory("comment") + $view = new Gallery_View("admin_manage_comments_queue.html"); + $view->counts = $this->_counts(); + $view->menu = $this->_menu($view->counts); + $view->state = $state; + $view->comments = ORM::factory("comment") ->order_by("created", "DESC") ->order_by("id", "DESC") ->where("state", "=", $state) @@ -59,11 +57,21 @@ class Admin_Manage_Comments_Controller extends Admin_Controller { ->offset(($page - 1) * self::$items_per_page) ->find_all(); - // Pagination info + // This view is not themed so we can't use $theme->url() in the view and have to + // reproduce Gallery_View::url() logic here. + $atn = theme::$admin_theme_name; + $view->fallback_avatar_url = url::abs_file("themes/$atn/images/avatar.jpg"); + $view->page = $page; + $view->page_type = "collection"; + $view->page_subtype = "admin_comments"; $view->page_size = self::$items_per_page; $view->children_count = $this->_counts()->$state; $view->max_pages = ceil($view->children_count / $view->page_size); + + // Also we want to use $theme->paginator() so we need a dummy theme + $view->theme = $view; + print $view; } diff --git a/modules/comment/views/admin_manage_comments.html.php b/modules/comment/views/admin_manage_comments.html.php index e7a61837..e3c8546c 100644 --- a/modules/comment/views/admin_manage_comments.html.php +++ b/modules/comment/views/admin_manage_comments.html.php @@ -2,200 +2,45 @@ - -
          -

          -
          - -
          - render() ?> -
          - - -

          - - - - - - - - - -

          - - -
          - - 0): ?> -

          - -

          - -

          - spam): ?> - spam) ?> -

          -

          - "> - - - - - -

          -
          - - - -
          -

          - -

          -
          - - - - - - - - - - "> - - - - - -
          - - - - - -
          - - " - class="g-avatar" - alt="author_name()) ?>" - width="40" - height="40" /> - -

          author_name()) ?>

          -
          - -

          created) ?>

          - text)) ?> -
          -
            - state != "unpublished"): ?> -
          • - - - - -
          • - - state != "published"): ?> -
          • - - - - -
          • - - state != "spam"): ?> -
          • - - - - -
          • - - -
          • - - - - -
          • -
          -
          + // Paginator clicks load their href in the active tab panel + var fix_links = function() { + $(".g-paginator a, a#g-delete-all-spam").click(function(event) { + event.stopPropagation(); + $.scrollTo(0, 800, { easing: "swing" }); + $(this).parents(".ui-tabs-panel").load( + $(this).attr("href"), + function() { + fix_links(); + }); + return false; + }); + } -
          - paginator() ?> -
          + $(document).ready(function() { + $("#g-admin-comments").tabs({ + show: fix_links, + }); + }); + -
          +
          + render() ?>
          diff --git a/modules/comment/views/admin_manage_comments_queue.html.php b/modules/comment/views/admin_manage_comments_queue.html.php new file mode 100644 index 00000000..d847d729 --- /dev/null +++ b/modules/comment/views/admin_manage_comments_queue.html.php @@ -0,0 +1,157 @@ + +
          + +
          + + 0): ?> +

          + +

          + +

          + spam): ?> + spam) ?> +

          +

          + "> + + + + + +

          +
          + + + +
          +

          + +

          +
          + + +
          + paginator() ?> +
          + + + + + + + + "> + + + + + +
          + + + + + +
          + + <?= html::clean_attribute($comment->author_name()) ?> + +

          + + author_name()) ?> + +

          +
          + +

          created) ?>

          + text)) ?> +
          +
            + state != "unpublished" && $comment->state != "deleted"): ?> +
          • + + + + +
          • + + state != "published"): ?> +
          • + + + + + + + + +
          • + + state != "spam"): ?> +
          • + + + + +
          • + + + state != "deleted"): ?> +
          • + + + + +
          • + +
          +
          + +
          + paginator() ?> +
          +
          -- cgit v1.2.3