diff options
author | Nathan Kinkade <nath@nkinka.de> | 2013-02-14 14:28:46 +0000 |
---|---|---|
committer | Nathan Kinkade <nath@nkinka.de> | 2013-02-14 14:28:46 +0000 |
commit | 711651f727e093cc7357a6bbff6bd992fd6dfd80 (patch) | |
tree | 2dadc1c06acf1ab3d42d3ed5415568535db54416 /modules/organize/controllers/organize.php | |
parent | 0047af90bf4db08b22838e6ded22a7fa70cee98a (diff) | |
parent | e5ed05004f005bdccdbf68e199ae2324ad97e895 (diff) |
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/organize/controllers/organize.php')
-rw-r--r-- | modules/organize/controllers/organize.php | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php index b0c13e7d..ba73ae75 100644 --- a/modules/organize/controllers/organize.php +++ b/modules/organize/controllers/organize.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2012 Bharat Mediratta + * Copyright (C) 2000-2013 Bharat Mediratta * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -129,12 +129,8 @@ class Organize_Controller extends Controller { if ($album->sort_column != "weight") { // Force all the weights into the current order before changing the order to manual - $weight = 0; - foreach ($album->children() as $child) { - $child->weight = ++$weight; - $child->save(); - } - + // @todo: consider making this a trigger in the Item_Model. + item::resequence_child_weights($album); $album->sort_column = "weight"; $album->sort_order = "ASC"; $album->save(); @@ -158,7 +154,7 @@ class Organize_Controller extends Controller { // Move all the source items to the right spots. for ($i = 0; $i < count($source_ids); $i++) { $source = ORM::factory("item", $source_ids[$i]); - if ($source->parent_id = $album->id) { + if ($source->parent_id == $album->id) { $source->weight = $base_weight + $i; $source->save(); } @@ -182,6 +178,28 @@ class Organize_Controller extends Controller { json::reply(null); } + function tag() { + access::verify_csrf(); + $input = Input::instance(); + + foreach (explode(",", $input->post("item_ids")) as $item_id) { + $item = ORM::factory("item", $item_id); + if (access::can("edit", $item)) { + // Assuming the user can view/edit the current item, loop + // through each tag that was submitted and apply it to + // the current item. + foreach (explode(",", $input->post("tag_names")) as $tag_name) { + $tag_name = trim($tag_name); + if ($tag_name) { + tag::add($item, $tag_name); + } + } + } + } + + json::reply(null); + } + private function _get_tree($item, $selected) { $tree = array(); $children = $item->viewable() |