From cb2171d0825251d619b53f6f80d217326fb6bab5 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 28 Aug 2009 14:27:37 -0700 Subject: Display the sort order in the Organize dialog, and allow users to change the sort order on the fly. --- modules/organize/controllers/organize.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'modules/organize/controllers') diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php index f56ad006..10b109f6 100644 --- a/modules/organize/controllers/organize.php +++ b/modules/organize/controllers/organize.php @@ -25,7 +25,7 @@ class Organize_Controller extends Controller { access::required("edit", $item); $v = new View("organize_dialog.html"); - $v->title = $item->title; + $v->album = $item; $parents = array(); foreach ($item->parents() as $parent) { $parents[$parent->id] = 1; @@ -84,6 +84,25 @@ class Organize_Controller extends Controller { "url" => url::site("organize/run/$task->id?csrf=" . access::csrf_token()))); } + function resort($target_id, $col, $dir) { + access::verify_csrf(); + + $album = ORM::factory("item", $target_id); + access::required("view", $album); + access::required("edit", $album); + + $options = album::get_sort_order_options(); + if (!isset($options[$col])) { + return; + } + + $album->sort_column = $col; + $album->sort_order = $dir; + $album->save(); + + print self::_get_micro_thumb_grid($album, 0); + } + private static function _get_micro_thumb_grid($item, $offset) { $v = new View("organize_thumb_grid.html"); $v->item = $item; -- cgit v1.2.3