diff options
Diffstat (limited to 'modules/organize/controllers')
| -rw-r--r-- | modules/organize/controllers/organize.php | 32 | 
1 files changed, 25 insertions, 7 deletions
diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php index f090b8a9..ba73ae75 100644 --- a/modules/organize/controllers/organize.php +++ b/modules/organize/controllers/organize.php @@ -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()  | 
