diff options
| author | Tim Almdal <tnalmdal@shaw.ca> | 2009-05-21 01:31:29 +0000 |
|---|---|---|
| committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-05-21 01:31:29 +0000 |
| commit | a9e3692027dc767b340242ed18fe7184cbfd883d (patch) | |
| tree | 125e9d3cdb28c5acdd34e1bc15fe80df030bf8e7 /core/helpers/item.php | |
| parent | f24c8f66ea9673d812c882dd7db6fbe49bd01dfb (diff) | |
1) This provides the editting functionality for albums and photos in the
organize feature.
2) Remove the tag functionality at this point
3) Added a callback to handle validating conflicting names (only used
by organize at this point.
4) Closes #231
Diffstat (limited to 'core/helpers/item.php')
| -rw-r--r-- | core/helpers/item.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/core/helpers/item.php b/core/helpers/item.php index 8ff09535..7daaf1e1 100644 --- a/core/helpers/item.php +++ b/core/helpers/item.php @@ -79,9 +79,27 @@ class item_Core { } } - static function validate_no_trailing_period($input) { + static function validate_no_trailing_period($input) { if (rtrim($input->value, ".") !== $input->value) { $input->add_error("no_trailing_period", 1); } } + + static function validate_no_name_conflict($input) { + $itemid = Input::instance()->post("item"); + if (is_array($itemid)) { + $itemid = $itemid[0]; + } + $item = ORM::factory("item") + ->in("id", $itemid) + ->find(); + if (Database::instance() + ->from("items") + ->where("parent_id", $item->parent_id) + ->where("id <>", $item->id) + ->where("name", $input->value) + ->count_records()) { + $input->add_error("conflict", 1); + } + } }
\ No newline at end of file |
