summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2010-05-18 06:16:47 -0700
committerTim Almdal <tnalmdal@shaw.ca>2010-06-04 14:05:25 -0700
commit686da5a3e069d180e198fcc8dc3e2ed422f725b9 (patch)
tree23dc6ea1be05d809e4dd01f1e161728f2db132e8 /modules
parenta600185b605a37ca1b60cb6d9814d5441f54cd88 (diff)
Save the item before updating the order of the children. Also always increment the weight count (even if it is equal to the weight of the current child)
Diffstat (limited to 'modules')
-rw-r--r--modules/gallery/helpers/item_rest.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/gallery/helpers/item_rest.php b/modules/gallery/helpers/item_rest.php
index 36d2ca62..298c2f4a 100644
--- a/modules/gallery/helpers/item_rest.php
+++ b/modules/gallery/helpers/item_rest.php
@@ -126,18 +126,19 @@ class item_rest_Core {
}
}
}
+ $item->save();
- $weight = 0;
if (isset($request->params->members)) {
+ $weight = 0;
foreach ($request->params->members as $url) {
$child = rest::resolve($url);
if ($child->parent_id == $item->id && $child->weight != $weight) {
- $child->weight = $weight++;
+ $child->weight = $weight;
$child->save();
}
+ $weight++;
}
}
- $item->save();
}
static function post($request) {