Skip to content

Commit

Permalink
added ZMSAction Recursive Commit (req by MINERVA)
Browse files Browse the repository at this point in the history
svn path=/ZMS/branches/zms4/; revision=5555
  • Loading branch information
Dr. Frank Hoffmann committed Apr 23, 2020
1 parent 5b2428e commit 5d679fb
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions Products/zms/import/manage_commit_recursive-4.0.0.metacmd.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>

<list>
<item type="dictionary">
<dictionary>
<item key="data"><![CDATA[## Script (Python) "manage_commit_recursive"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=Commits rekursivly all document changes beginning with this node
##
request = container.REQUEST
RESPONSE = request.RESPONSE
request.set('count',0)
request.set('doc_container_id','e0')
def commit_tree(node):
for ob in node.getChildNodes(request):
doc_containers = [ e for e in ob.breadcrumbs_obj_path() if e.meta_id in ['ZMS','ZMSDocument','ZMSFolder'] ]
doc_container = doc_containers[-1]
if ob.isObjModified(request) and doc_container.getId()!=request.get('doc_container_id'):
# Document Container of Object Change
doc_container.commitObj(request)
request.set('count',request['count']+1)
request.set('doc_container_id',doc_container.getId())
commit_tree(ob)
# Init
commit_tree(context)
request.set('message','%i Changes committed.'%(request['count']))
return request['message']
]]>
</item>
<item key="description"><![CDATA[Really want to commit rekursivley all objects of the document tree starting from here?]]></item>
<item key="execution" type="int">1</item>
<item key="icon_clazz"><![CDATA[icon-cogs fas fa-cogs]]></item>
<item key="id">manage_commit_recursive</item>
<item key="meta_type"><![CDATA[Script (Python)]]></item>
<item key="meta_types" type="list">
<list>
<item>ZMSDocument</item>
<item>ZMSFolder</item>
<item>ZMSTeaserContainer</item>
<item>ZMS</item>
</list>
</item>
<item key="name"><![CDATA[Commit Rekursively]]></item>
<item key="revision">4.0.0</item>
<item key="roles" type="list">
<list>
<item>ZMSAdministrator</item>
</list>
</item>
<item key="title"><![CDATA[Commits rekursivley all document changes starting with this node]]></item>
</dictionary>
</item>
</list>

0 comments on commit 5d679fb

Please sign in to comment.