lib/fiona7/builder/obj_updater.rb in infopark_fiona7-1.5.5.5.1 vs lib/fiona7/builder/obj_updater.rb in infopark_fiona7-1.6.1.1.0
- old
+ new
@@ -18,15 +18,16 @@
@obj = WriteObj.find(obj_id)
@path = @values.delete(:_path)
@widget_pool = @values.delete(:_widget_pool)
@permalink = @values.key?(:_permalink) ? (@values.delete(:_permalink) || "") : nil
-
- # revert command sends this info. which is silly.
+ # revert command sends this info. we cannot do anything useful with it.
@values.delete(:_last_changed)
- @name, parent_path = name_and_parent_path_from_path(@path) if (@path)
+ @name, parent_path = name_and_parent_path_from_path(@path) if (@path)
+ old_name, old_parent_path = name_and_parent_path_from_path(@obj.path)
+
if obj_class = @values.delete(:_obj_class)
@obj_class = obj_class
@real_obj_class = Fiona7::ObjClassNameMangler.new(@obj_class).mangle
else
@real_obj_class = @obj.obj_class
@@ -40,10 +41,17 @@
# but changing the name attribute requires permissionRoot
#
# setting the name without changing the value counts
# as changing the name attribute for the CM
@obj.name = @name if !@name.blank? && @name != @obj.name
- # TODO: move (parent change)
+
+ # this is a obj move operation
+ if parent_path && old_parent_path != parent_path
+ # we first have to make sure that the new parent exists
+ # FIXME: moving the object and changing the obj class
+ # will not move the object
+ @obj.parent = ContainerChainBuilder.new(parent_path).call
+ end
end
end
end
end