From 72deeb1119e7888e26b0656ae811be3f4e534e11 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Fri, 20 Nov 2009 10:26:11 -0800 Subject: Remove all style from the organize.css file and make use of the themeroller styles as much as possible. --- modules/organize/css/organize.css | 30 ++-------------------- modules/organize/js/organize.js | 20 +++++++++++---- modules/organize/views/organize_dialog.html.php | 6 ++--- .../organize/views/organize_thumb_grid.html.php | 4 +-- modules/organize/views/organize_tree.html.php | 2 +- 5 files changed, 23 insertions(+), 39 deletions(-) (limited to 'modules/organize') diff --git a/modules/organize/css/organize.css b/modules/organize/css/organize.css index 16645c37..d8923ea7 100644 --- a/modules/organize/css/organize.css +++ b/modules/organize/css/organize.css @@ -30,9 +30,8 @@ width: 19%; } -#g-organize-album-tree .g-selected { - background-color: #eee; - border-bottom: 1px solid #999; +#g-organize-album-tree { + overflow: auto; } #g-organize-album-tree ul li { @@ -50,10 +49,6 @@ width: auto; } -.g-organize-album-text:hover { - background: #eee; -} - /******************************************************************* * Album panel styles */ @@ -77,8 +72,6 @@ } #g-organize-microthumb-panel { - background-color: #eee; - border: 1px solid #999; height: 100%; margin: 0 !important; position: relative; @@ -100,8 +93,6 @@ } .g-organize-microthumb { - background-color: #fff; - border: 1px solid #ccc; display: block; height: 100px; margin: 0; @@ -111,16 +102,7 @@ width: 110px; } -.g-organize-microthumb-grid-cell.ui-selecting, -.g-organize-microthumb-grid-cell.ui-selected { - border: 2px solid #13A; - margin: 4px; -} - .ui-selectable-helper { - background: #13A; - border: 1px dashed #00F; - opacity: 0.25; z-index: 2000 !important; } @@ -131,21 +113,13 @@ z-index: 4000; } -.g-organize-microthumb-grid-cell:hover { - border: 2px solid #13A; - margin: 4px; -} - /**************************************************************** * Controls styles */ #g-organize-controls { - background-color: #666; - color: #eee; margin: 0 !important; padding: .2em .4em; - width: 100%; } #g-organize-controls select { diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js index a7fe1ad2..26de18bb 100644 --- a/modules/organize/js/organize.js +++ b/modules/organize/js/organize.js @@ -163,7 +163,17 @@ set_handlers: function() { $("#g-organize-microthumb-panel") - .selectable({filter: ".g-organize-microthumb-grid-cell"}) + .selectable({ + filter: ".g-organize-microthumb-grid-cell", + selected: function(event, ui) { + ui.selected.children(".g-organize-microthumb") + .removeClass("ui-state-active").addClass("ui-state-focus"); + }, + unselected: function(event, ui) { + $(ui.unselected).children(".g-organize-microthumb") + .addClass("ui-state-active").removeClass("ui-state-focus"); + } + }) .droppable($.organize.content_droppable); $(".g-organize-microthumb-grid-cell") .draggable($.organize.micro_thumb_draggable) @@ -203,7 +213,7 @@ */ show_album: function(event) { event.preventDefault(); - if ($(event.currentTarget).hasClass("g-selected")) { + if ($(event.currentTarget).hasClass("ui-state-focus")) { return; } var parent = $(event.currentTarget).parents(".g-organize-branch"); @@ -212,8 +222,8 @@ } $("#g-organize-microthumb-panel").selectable("destroy"); var id = $(event.currentTarget).attr("ref"); - $("#g-organize-album-tree .g-selected").removeClass("g-selected"); - $(".g-organize-album-text[ref=" + id + "]").addClass("g-selected"); + $(".g-organize-album-text.ui-state-focus").removeClass("ui-state-focus"); + $(".g-organize-album-text[ref=" + id + "]").addClass("ui-state-focus"); var url = $("#g-organize-microthumb-panel").attr("ref").replace("__ITEM_ID__", id).replace("__OFFSET__", 0); $.get(url, {}, function(data) { @@ -230,7 +240,7 @@ */ resort: function(column, dir) { var url = sort_order_url - .replace("__ALBUM_ID__", $("#g-organize-album-tree .g-selected").attr("ref")) + .replace("__ALBUM_ID__", $("#g-organize-album-tree .ui-state-focus").attr("ref")) .replace("__COL__", column) .replace("__DIR__", dir); $.get(url, {}, diff --git a/modules/organize/views/organize_dialog.html.php b/modules/organize/views/organize_dialog.html.php index 31f788ad..435f5ae3 100644 --- a/modules/organize/views/organize_dialog.html.php +++ b/modules/organize/views/organize_dialog.html.php @@ -15,16 +15,16 @@
-
">
-
    +
-
+
diff --git a/modules/organize/views/organize_thumb_grid.html.php b/modules/organize/views/organize_thumb_grid.html.php index 3ac32ce0..9a9cd819 100644 --- a/modules/organize/views/organize_thumb_grid.html.php +++ b/modules/organize/views/organize_thumb_grid.html.php @@ -1,8 +1,8 @@ children(25, $offset) as $child): ?> -
  • +
  • "> + class="g-organize-microthumb is_album() ? "g-album" : "g-photo" ?> ui-state-active"> thumb_img(array("class" => "g-thumbnail", "ref" => $child->id), 90, true) ?> is_album() ? " class=\"ui-icon ui-icon-note\"" : "" ?>>
    diff --git a/modules/organize/views/organize_tree.html.php b/modules/organize/views/organize_tree.html.php index 740c2521..50c8c351 100644 --- a/modules/organize/views/organize_tree.html.php +++ b/modules/organize/views/organize_tree.html.php @@ -3,7 +3,7 @@ ref="id ?>"> - " + " ref="id ?>"> title) ?> -- cgit v1.2.3 From aa880c2b10331586a4c303dd6d6c1bf8a8e8b15d Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Fri, 20 Nov 2009 11:37:09 -0800 Subject: Use ui-state-highlight to display selected images. --- modules/organize/js/organize.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'modules/organize') diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js index 26de18bb..701bad4c 100644 --- a/modules/organize/js/organize.js +++ b/modules/organize/js/organize.js @@ -166,12 +166,10 @@ .selectable({ filter: ".g-organize-microthumb-grid-cell", selected: function(event, ui) { - ui.selected.children(".g-organize-microthumb") - .removeClass("ui-state-active").addClass("ui-state-focus"); + ui.selected.children(".g-organize-microthumb").addClass("ui-state-highlight"); }, unselected: function(event, ui) { - $(ui.unselected).children(".g-organize-microthumb") - .addClass("ui-state-active").removeClass("ui-state-focus"); + $(ui.unselected).children(".g-organize-microthumb").removeClass("ui-state-highlight"); } }) .droppable($.organize.content_droppable); -- cgit v1.2.3 From a1fbc8b1e14049765a3da07a57dffdf4205bc492 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Fri, 20 Nov 2009 12:15:05 -0800 Subject: Correct the reference so selections are handled properly when dragging the lasso --- modules/organize/js/organize.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/organize') diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js index 701bad4c..3dbf9a55 100644 --- a/modules/organize/js/organize.js +++ b/modules/organize/js/organize.js @@ -166,7 +166,7 @@ .selectable({ filter: ".g-organize-microthumb-grid-cell", selected: function(event, ui) { - ui.selected.children(".g-organize-microthumb").addClass("ui-state-highlight"); + $(ui.selected).children(".g-organize-microthumb").addClass("ui-state-highlight"); }, unselected: function(event, ui) { $(ui.unselected).children(".g-organize-microthumb").removeClass("ui-state-highlight"); -- cgit v1.2.3 From e8fb773b68335e955602c0d912e13c0f5ba23d58 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 26 Nov 2009 19:33:03 -0800 Subject: Update all portable where clauses to the new Kohana 2.4 format. --- modules/gallery/helpers/gallery_rss.php | 4 ++-- modules/gallery/tests/ORM_MPTT_Test.php | 4 ++-- modules/organize/views/organize_tree.html.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'modules/organize') diff --git a/modules/gallery/helpers/gallery_rss.php b/modules/gallery/helpers/gallery_rss.php index 93ace10b..4aef27ad 100644 --- a/modules/gallery/helpers/gallery_rss.php +++ b/modules/gallery/helpers/gallery_rss.php @@ -49,9 +49,9 @@ class gallery_rss_Core { $feed->children = $item ->viewable() - ->descendants($limit, $offset, array("type" => "photo")); + ->descendants($limit, $offset, array(array("type", "=", "photo"))); $feed->max_pages = ceil( - $item->viewable()->descendants_count(array("type" => "photo")) / $limit); + $item->viewable()->descendants_count(array("type", "=", "photo")) / $limit); $feed->title = html::purify($item->title); $feed->description = nl2br(html::purify($item->description)); diff --git a/modules/gallery/tests/ORM_MPTT_Test.php b/modules/gallery/tests/ORM_MPTT_Test.php index a749542b..36a81d2c 100644 --- a/modules/gallery/tests/ORM_MPTT_Test.php +++ b/modules/gallery/tests/ORM_MPTT_Test.php @@ -228,7 +228,7 @@ class ORM_MPTT_Test extends Unit_Test_Case { $parent->reload(); $this->assert_equal(3, $parent->descendants_count()); - $this->assert_equal(2, $parent->descendants_count(array("type" => "photo"))); - $this->assert_equal(1, $parent->descendants_count(array("type" => "album"))); + $this->assert_equal(2, $parent->descendants_count(array(array("type", "=", "photo")))); + $this->assert_equal(1, $parent->descendants_count(array(array("type", "=", "album")))); } } diff --git a/modules/organize/views/organize_tree.html.php b/modules/organize/views/organize_tree.html.php index 740c2521..1ccb942c 100644 --- a/modules/organize/views/organize_tree.html.php +++ b/modules/organize/views/organize_tree.html.php @@ -8,7 +8,7 @@ title) ?>
      - children(null, 0, array("type" => "album")) as $child): ?> + children(null, 0, array(array("type", "=", "album"))) as $child): ?> contains($selected)): ?> $selected, "album" => $child)); ?> -- cgit v1.2.3 From a3d904bcbab7cb153c2b617fc4389175ed00a4fc Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 26 Nov 2009 19:36:57 -0800 Subject: ORM::find_all() now uses null as the default value for offset. --- modules/gallery/libraries/ORM_MPTT.php | 2 +- modules/gallery/models/item.php | 2 +- modules/organize/views/organize_tree.html.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'modules/organize') diff --git a/modules/gallery/libraries/ORM_MPTT.php b/modules/gallery/libraries/ORM_MPTT.php index 90b9d38a..a67f05be 100644 --- a/modules/gallery/libraries/ORM_MPTT.php +++ b/modules/gallery/libraries/ORM_MPTT.php @@ -150,7 +150,7 @@ class ORM_MPTT_Core extends ORM { * @param array order_by * @return array ORM */ - function children($limit=null, $offset=0, $where=null, $order_by=array("id" => "ASC")) { + function children($limit=null, $offset=null, $where=null, $order_by=array("id" => "ASC")) { if ($where) { $this->merge_where($where); } diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index acc4e96f..16c57dbc 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -597,7 +597,7 @@ class Item_Model extends ORM_MPTT { * @param array order_by * @return array ORM */ - function children($limit=null, $offset=0, $where=array(), $order_by=null) { + function children($limit=null, $offset=null, $where=array(), $order_by=null) { if (empty($order_by)) { $order_by = array($this->sort_column => $this->sort_order); // Use id as a tie breaker diff --git a/modules/organize/views/organize_tree.html.php b/modules/organize/views/organize_tree.html.php index 1ccb942c..c5257956 100644 --- a/modules/organize/views/organize_tree.html.php +++ b/modules/organize/views/organize_tree.html.php @@ -8,7 +8,7 @@ title) ?>
        - children(null, 0, array(array("type", "=", "album"))) as $child): ?> + children(null, null, array(array("type", "=", "album"))) as $child): ?> contains($selected)): ?> $selected, "album" => $child)); ?> -- cgit v1.2.3 From 8b9a02084a8205fce67860c98ed4ab72b1156a0c Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 21 Dec 2009 21:27:43 -0800 Subject: Updates for the latest version of Kohana 2.4: 1) Controller::$input is gone -- use Input::instance() now 2) Handle new 'database..connection.params' parameter 3) Handle new 'cache..prefix' parameter --- installer/database_config.php | 3 ++- modules/digibug/controllers/digibug.php | 2 +- modules/gallery/config/cache.php | 3 ++- modules/gallery/controllers/admin_dashboard.php | 2 +- modules/gallery/controllers/admin_identity.php | 4 ++-- modules/gallery/controllers/admin_languages.php | 7 ++++--- modules/gallery/controllers/admin_modules.php | 2 +- modules/gallery/controllers/admin_sidebar.php | 2 +- modules/gallery/controllers/albums.php | 14 ++++++++------ modules/gallery/controllers/file_proxy.php | 2 +- modules/gallery/controllers/logout.php | 2 +- modules/gallery/controllers/move.php | 2 +- modules/gallery/libraries/MY_Database.php | 14 ++++++++++++++ modules/organize/controllers/organize.php | 4 ++-- modules/rss/controllers/rss.php | 4 ++-- modules/search/controllers/search.php | 4 ++-- modules/server_add/controllers/admin_server_add.php | 4 ++-- modules/server_add/controllers/server_add.php | 2 +- modules/tag/controllers/admin_tags.php | 2 +- modules/tag/controllers/tags.php | 6 +++--- 20 files changed, 52 insertions(+), 33 deletions(-) (limited to 'modules/organize') diff --git a/installer/database_config.php b/installer/database_config.php index 8abf35e7..a5dc8865 100644 --- a/installer/database_config.php +++ b/installer/database_config.php @@ -35,7 +35,8 @@ $config['default'] = array( 'host' => '', 'port' => '' false, 'socket' => false, - 'database' => '' + 'database' => '', + 'params' => null, ), 'character_set' => 'utf8', 'table_prefix' => '', diff --git a/modules/digibug/controllers/digibug.php b/modules/digibug/controllers/digibug.php index d070727d..a23d2863 100644 --- a/modules/digibug/controllers/digibug.php +++ b/modules/digibug/controllers/digibug.php @@ -59,7 +59,7 @@ class Digibug_Controller extends Controller { // If its a request for the full size then make sure we are coming from an // authorized address if ($type == "full") { - $remote_addr = ip2long($this->input->server("REMOTE_ADDR")); + $remote_addr = ip2long(Input::instance()->server("REMOTE_ADDR")); if ($remote_addr === false) { throw new Kohana_404_Exception(); } diff --git a/modules/gallery/config/cache.php b/modules/gallery/config/cache.php index cc3ac87d..d9a27c96 100644 --- a/modules/gallery/config/cache.php +++ b/modules/gallery/config/cache.php @@ -45,5 +45,6 @@ $config["default"] = array ( "driver" => "database", "params" => null, "lifetime" => 84600, - "requests" => 1000 + "requests" => 1000, + "prefix" => null, ); diff --git a/modules/gallery/controllers/admin_dashboard.php b/modules/gallery/controllers/admin_dashboard.php index 7e28f625..5f2cb41d 100644 --- a/modules/gallery/controllers/admin_dashboard.php +++ b/modules/gallery/controllers/admin_dashboard.php @@ -86,7 +86,7 @@ class Admin_Dashboard_Controller extends Admin_Controller { foreach (array("dashboard_sidebar", "dashboard_center") as $location) { $new_blocks = array(); - foreach ($this->input->get($location, array()) as $id) { + foreach (Input::instance()->get($location, array()) as $id) { $new_blocks[$id] = $active_set[$id]; } block_manager::set_active($location, $new_blocks); diff --git a/modules/gallery/controllers/admin_identity.php b/modules/gallery/controllers/admin_identity.php index acf71665..354e6c0c 100644 --- a/modules/gallery/controllers/admin_identity.php +++ b/modules/gallery/controllers/admin_identity.php @@ -30,7 +30,7 @@ class Admin_Identity_Controller extends Admin_Controller { access::verify_csrf(); $v = new View("admin_identity_confirm.html"); - $v->new_provider = $this->input->post("provider"); + $v->new_provider = Input::instance()->post("provider"); print $v; } @@ -40,7 +40,7 @@ class Admin_Identity_Controller extends Admin_Controller { $active_provider = module::get_var("gallery", "identity_provider", "user"); $providers = identity::providers(); - $new_provider = $this->input->post("provider"); + $new_provider = Input::instance()->post("provider"); if ($new_provider != $active_provider) { diff --git a/modules/gallery/controllers/admin_languages.php b/modules/gallery/controllers/admin_languages.php index 27537c7f..41523023 100644 --- a/modules/gallery/controllers/admin_languages.php +++ b/modules/gallery/controllers/admin_languages.php @@ -36,10 +36,11 @@ class Admin_Languages_Controller extends Admin_Controller { public function save() { access::verify_csrf(); - locales::update_installed($this->input->post("installed_locales")); + $input = Input::instance(); + locales::update_installed($input->post("installed_locales")); $installed_locales = array_keys(locales::installed()); - $new_default_locale = $this->input->post("default_locale"); + $new_default_locale = $input->post("default_locale"); if (!in_array($new_default_locale, $installed_locales)) { if (!empty($installed_locales)) { $new_default_locale = $installed_locales[0]; @@ -61,7 +62,7 @@ class Admin_Languages_Controller extends Admin_Controller { return $this->index($form); } - if ($this->input->post("share")) { + if (Input::instance()->post("share")) { l10n_client::submit_translations(); message::success(t("Translations submitted")); } else { diff --git a/modules/gallery/controllers/admin_modules.php b/modules/gallery/controllers/admin_modules.php index af6dbbdc..549718e7 100644 --- a/modules/gallery/controllers/admin_modules.php +++ b/modules/gallery/controllers/admin_modules.php @@ -37,7 +37,7 @@ class Admin_Modules_Controller extends Admin_Controller { continue; } - $desired = $this->input->post($module_name) == 1; + $desired = Input::instance()->post($module_name) == 1; if ($info->active && !$desired && module::is_active($module_name)) { $changes->deactivate[] = $module_name; $deactivated_names[] = t($info->name); diff --git a/modules/gallery/controllers/admin_sidebar.php b/modules/gallery/controllers/admin_sidebar.php index 77e83bc2..4c55bf89 100644 --- a/modules/gallery/controllers/admin_sidebar.php +++ b/modules/gallery/controllers/admin_sidebar.php @@ -34,7 +34,7 @@ class Admin_Sidebar_Controller extends Admin_Controller { $available_blocks = block_manager::get_available_site_blocks(); $active_blocks = array(); - foreach ($this->input->get("block", array()) as $block_id) { + foreach (Input::instance()->get("block", array()) as $block_id) { $active_blocks[md5($block_id)] = explode(":", (string) $block_id); } block_manager::set_active("site_sidebar", $active_blocks); diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index 319f1416..2134a419 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -42,7 +42,8 @@ class Albums_Controller extends Items_Controller { } } - $show = $this->input->get("show"); + $input = Input::instance(); + $show = $input->get("show"); if ($show) { $child = ORM::factory("item", $show); @@ -57,7 +58,7 @@ class Albums_Controller extends Items_Controller { } } - $page = $this->input->get("page", "1"); + $page = $input->get("page", "1"); $children_count = $album->viewable()->children_count(); $offset = ($page - 1) * $page_size; $max_pages = max(ceil($children_count / $page_size), 1); @@ -94,15 +95,16 @@ class Albums_Controller extends Items_Controller { access::required("view", $album); access::required("add", $album); + $input = Input::instance(); $form = album::get_add_form($album); if ($form->validate()) { $new_album = album::create( $album, - $this->input->post("name"), - $this->input->post("title", $this->input->post("name")), - $this->input->post("description"), + $input->post("name"), + $input->post("title", $input->post("name")), + $input->post("description"), identity::active_user()->id, - $this->input->post("slug")); + $input->post("slug")); log::success("content", "Created an album", html::anchor("albums/$new_album->id", "view album")); diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php index 8c46de08..6a80ad85 100644 --- a/modules/gallery/controllers/file_proxy.php +++ b/modules/gallery/controllers/file_proxy.php @@ -29,7 +29,7 @@ class File_Proxy_Controller extends Controller { public function __call($function, $args) { // request_uri: http://example.com/gallery3/var/trunk/albums/foo/bar.jpg - $request_uri = $this->input->server("REQUEST_URI"); + $request_uri = Input::instance()->server("REQUEST_URI"); $request_uri = preg_replace("/\?.*/", "", $request_uri); // var_uri: http://example.com/gallery3/var/ diff --git a/modules/gallery/controllers/logout.php b/modules/gallery/controllers/logout.php index 2b93655d..fe9c48ba 100644 --- a/modules/gallery/controllers/logout.php +++ b/modules/gallery/controllers/logout.php @@ -20,7 +20,7 @@ class Logout_Controller extends Controller { public function index() { auth::logout(); - if ($continue_url = $this->input->get("continue")) { + if ($continue_url = Input::instance()->get("continue")) { $item = url::get_item_from_uri($continue_url); if (access::can("view", $item)) { // Don't use url::redirect() because it'll call url::site() and munge the continue url. diff --git a/modules/gallery/controllers/move.php b/modules/gallery/controllers/move.php index 863b13bb..14513fdc 100644 --- a/modules/gallery/controllers/move.php +++ b/modules/gallery/controllers/move.php @@ -32,7 +32,7 @@ class Move_Controller extends Controller { public function save($source_id) { access::verify_csrf(); $source = ORM::factory("item", $source_id); - $target = ORM::factory("item", $this->input->post("target_id")); + $target = ORM::factory("item", Input::instance()->post("target_id")); access::required("view", $source); access::required("edit", $source); diff --git a/modules/gallery/libraries/MY_Database.php b/modules/gallery/libraries/MY_Database.php index a8f4bc08..de3e5a84 100644 --- a/modules/gallery/libraries/MY_Database.php +++ b/modules/gallery/libraries/MY_Database.php @@ -20,6 +20,20 @@ abstract class Database extends Database_Core { protected $_table_names; + /** + * Kohana 2.4 introduces a new connection parameter. If it's not specified, make sure that we + * define it here to avoid an error later on. + * + * @todo: add an upgrade path to modify var/database.php so that we can avoid doing this at + * runtime. + */ + protected function __construct(array $config) { + if (!isset($config["connection"]["params"])) { + $config["connection"]["params"] = null; + } + parent::__construct($config); + } + /** * Parse the query string and convert any strings of the form `\([a-zA-Z0-9_]*?)\] * table prefix . $1 diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php index 08c80de3..03dea13d 100644 --- a/modules/organize/controllers/organize.php +++ b/modules/organize/controllers/organize.php @@ -48,7 +48,7 @@ class Organize_Controller extends Controller { access::required("view", $target_album); access::required("add", $target_album); - foreach ($this->input->post("source_ids") as $source_id) { + foreach (Input::instance()->post("source_ids") as $source_id) { $source = ORM::factory("item", $source_id); if (!$source->contains($target_album)) { access::required("edit", $source); @@ -69,7 +69,7 @@ class Organize_Controller extends Controller { access::required("view", $album); access::required("edit", $album); - $source_ids = $this->input->post("source_ids", array()); + $source_ids = Input::instance()->post("source_ids", array()); if ($album->sort_column != "weight") { $i = 0; diff --git a/modules/rss/controllers/rss.php b/modules/rss/controllers/rss.php index a963a1dc..41c781d9 100644 --- a/modules/rss/controllers/rss.php +++ b/modules/rss/controllers/rss.php @@ -21,13 +21,13 @@ class Rss_Controller extends Controller { public static $page_size = 20; public function feed($module_id, $feed_id, $id=null) { - $page = (int) $this->input->get("page", 1); + $page = (int) Input::instance()->get("page", 1); if ($page < 1) { url::redirect(url::merge(array("page" => 1))); } // Configurable page size between 1 and 100, default 20 - $page_size = max(1, min(100, (int) $this->input->get("page_size", self::$page_size))); + $page_size = max(1, min(100, (int) Input::instance()->get("page_size", self::$page_size))); // Run the appropriate feed callback if (module::is_active($module_id)) { diff --git a/modules/search/controllers/search.php b/modules/search/controllers/search.php index 2f1aeb76..ea870847 100644 --- a/modules/search/controllers/search.php +++ b/modules/search/controllers/search.php @@ -20,8 +20,8 @@ class Search_Controller extends Controller { public function index() { $page_size = module::get_var("gallery", "page_size", 9); - $q = $this->input->get("q"); - $page = $this->input->get("page", 1); + $q = Input::instance()->get("q"); + $page = Input::instance()->get("page", 1); $offset = ($page - 1) * $page_size; // Make sure that the page references a valid offset diff --git a/modules/server_add/controllers/admin_server_add.php b/modules/server_add/controllers/admin_server_add.php index f32bb834..17c3f68b 100644 --- a/modules/server_add/controllers/admin_server_add.php +++ b/modules/server_add/controllers/admin_server_add.php @@ -58,7 +58,7 @@ class Admin_Server_Add_Controller extends Admin_Controller { public function remove_path() { access::verify_csrf(); - $path = $this->input->get("path"); + $path = Input::instance()->get("path"); $paths = unserialize(module::get_var("server_add", "authorized_paths")); if (isset($paths[$path])) { unset($paths[$path]); @@ -71,7 +71,7 @@ class Admin_Server_Add_Controller extends Admin_Controller { public function autocomplete() { $directories = array(); - $path_prefix = $this->input->get("q"); + $path_prefix = Input::instance()->get("q"); foreach (glob("{$path_prefix}*") as $file) { if (is_dir($file) && !is_link($file)) { $directories[] = $file; diff --git a/modules/server_add/controllers/server_add.php b/modules/server_add/controllers/server_add.php index 70ad6ea2..77487673 100644 --- a/modules/server_add/controllers/server_add.php +++ b/modules/server_add/controllers/server_add.php @@ -34,7 +34,7 @@ class Server_Add_Controller extends Admin_Controller { } public function children() { - $path = $this->input->get("path"); + $path = Input::instance()->get("path"); $tree = new View("server_add_tree.html"); $tree->files = array(); diff --git a/modules/tag/controllers/admin_tags.php b/modules/tag/controllers/admin_tags.php index ed4a0366..a56d4d20 100644 --- a/modules/tag/controllers/admin_tags.php +++ b/modules/tag/controllers/admin_tags.php @@ -19,7 +19,7 @@ */ class Admin_Tags_Controller extends Admin_Controller { public function index() { - $filter = $this->input->get("filter"); + $filter = Input::instance()->get("filter"); $view = new Admin_View("admin.html"); $view->content = new View("admin_tags.html"); diff --git a/modules/tag/controllers/tags.php b/modules/tag/controllers/tags.php index a44f6aa3..992c7411 100644 --- a/modules/tag/controllers/tags.php +++ b/modules/tag/controllers/tags.php @@ -21,7 +21,7 @@ class Tags_Controller extends Controller { public function show($tag_id) { $tag = ORM::factory("tag", $tag_id); $page_size = module::get_var("gallery", "page_size", 9); - $page = (int) $this->input->get("page", "1"); + $page = (int) Input::instance()->get("page", "1"); $children_count = $tag->items_count(); $offset = ($page-1) * $page_size; $max_pages = max(ceil($children_count / $page_size), 1); @@ -79,8 +79,8 @@ class Tags_Controller extends Controller { public function autocomplete() { $tags = array(); - $tag_parts = preg_split("#,#", $this->input->get("q")); - $limit = $this->input->get("limit"); + $tag_parts = preg_split("#,#", Input::instance()->get("q")); + $limit = Input::instance()->get("limit"); $tag_part = end($tag_parts); $tag_list = ORM::factory("tag") ->where("name", "LIKE", "{$tag_part}%") -- cgit v1.2.3 From 07a9ef2276a421fe3b8ebad4c4ff845b147be847 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 25 Dec 2009 13:24:38 -0800 Subject: Convert some database calls --- modules/organize/controllers/organize.php | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'modules/organize') diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php index 03dea13d..201ced30 100644 --- a/modules/organize/controllers/organize.php +++ b/modules/organize/controllers/organize.php @@ -75,7 +75,11 @@ class Organize_Controller extends Controller { $i = 0; foreach ($album->children() as $child) { // Do this directly in the database to avoid sending notifications - Database::Instance()->update("items", array("weight" => ++$i), array("id" => $child->id)); + db::build() + ->update("items") + ->set("weight", ++$i) + ->where("id", "=", $child->id) + ->execute(); } $album->sort_column = "weight"; $album->sort_order = "ASC"; @@ -91,15 +95,20 @@ class Organize_Controller extends Controller { // Make a hole $count = count($source_ids); - Database::Instance()->query( - "UPDATE {items} " . - "SET `weight` = `weight` + $count " . - "WHERE `weight` >= $target_weight AND `parent_id` = {$album->id}"); + db::build() + ->update("items") + ->set("weight", new Database_Expression("`weight` + $count")) + ->where("weight", ">=", $target_weight) + ->where("parent_id", "=", $album->id) + ->execute(); // Insert source items into the hole foreach ($source_ids as $source_id) { - Database::Instance()->update( - "items", array("weight" => $target_weight++), array("id" => $source_id)); + db::build() + ->update("items") + ->set("weight", $target_weight++) + ->where("id", "=", $source_id) + ->execute(); } module::event("album_rearrange", $album); -- cgit v1.2.3 From da7ee6ab30d8f2545781910d7ef1f573c5dfee93 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 25 Dec 2009 13:24:47 -0800 Subject: Fix over-targetting in CSS --- modules/organize/js/organize.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/organize') diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js index a7fe1ad2..afa9e17a 100644 --- a/modules/organize/js/organize.js +++ b/modules/organize/js/organize.js @@ -149,7 +149,7 @@ window.location.reload(); }); - $("#g-dialog #g-organize-close").click(function(event) { + $("#g-organize-close").click(function(event) { $("#g-dialog").dialog("close"); }); -- cgit v1.2.3 From 55f9408d509b6ee34e62948d311d6d963e3ffa6d Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 26 Dec 2009 15:08:14 -0800 Subject: Fix the scrollbar in the organize panel by restricting drag-to-select to #g-organize-microthumb-grid. --- modules/organize/js/organize.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/organize') diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js index afa9e17a..9164d143 100644 --- a/modules/organize/js/organize.js +++ b/modules/organize/js/organize.js @@ -162,7 +162,7 @@ }, set_handlers: function() { - $("#g-organize-microthumb-panel") + $("#g-organize-microthumb-grid") .selectable({filter: ".g-organize-microthumb-grid-cell"}) .droppable($.organize.content_droppable); $(".g-organize-microthumb-grid-cell") -- cgit v1.2.3