Commit 91aab1ce authored by Fabien Morin's avatar Fabien Morin

add a workflow on attachments. Now, if an agent delete an attachment, the...

add a workflow on attachments. Now, if an agent delete an attachment, the attachment just pass the transition delete_action and he's not deleted as it was before.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24674 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c808e1d6
<workflow_chain>
<chain>
<type>File</type>
<workflow>validation_workflow</workflow>
</chain>
</workflow_chain>
\ No newline at end of file
...@@ -53,7 +53,9 @@ ...@@ -53,7 +53,9 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>request=context.REQUEST\n <value> <string encoding="cdata"><![CDATA[
request=context.REQUEST\n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
N_ = portal.Base_translateString\n N_ = portal.Base_translateString\n
\n \n
...@@ -65,11 +67,20 @@ if id_list == None:\n ...@@ -65,11 +67,20 @@ if id_list == None:\n
if not same_type(id_list, []):\n if not same_type(id_list, []):\n
id_list=[id_list,]\n id_list=[id_list,]\n
\n \n
context.manage_delObjects(id_list)\n if len(id_list) >1:\n
message = N_("Please+select+only+one+item+to+delete.")\n
qs = \'?portal_status_message=%s\' % message\n
return request.RESPONSE.redirect( context.absolute_url() + \'/\' + form_id + qs )\n
\n
object = getattr(context, id_list[0], None)\n
portal.portal_workflow.doActionFor(object, \'delete_action\')\n
#context.manage_delObjects(id_list)\n
message = N_(\'Attachment ${file_name} has been deleted\', mapping = { \'file_name\': \'"%s"\' % file_name})\n message = N_(\'Attachment ${file_name} has been deleted\', mapping = { \'file_name\': \'"%s"\' % file_name})\n
qs = \'?portal_status_message=%s\' % message\n qs = \'?portal_status_message=%s\' % message\n
return request.RESPONSE.redirect( context.absolute_url() + \'/\' + form_id + qs )\n return request.RESPONSE.redirect( context.absolute_url() + \'/\' + form_id + qs )\n
</string> </value>
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
...@@ -123,6 +134,10 @@ return request.RESPONSE.redirect( context.absolute_url() + \'/\' + form_id + qs ...@@ -123,6 +134,10 @@ return request.RESPONSE.redirect( context.absolute_url() + \'/\' + form_id + qs
<string>message</string> <string>message</string>
<string>qs</string> <string>qs</string>
<string>same_type</string> <string>same_type</string>
<string>len</string>
<string>getattr</string>
<string>_getitem_</string>
<string>object</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -67,6 +67,8 @@ sub_form_type_list = filter(lambda x: x not in file_type_list, type_list)\n ...@@ -67,6 +67,8 @@ sub_form_type_list = filter(lambda x: x not in file_type_list, type_list)\n
viewable_content_list = context.contentValues(portal_type=file_type_list, checked_permission=\'View\')\n viewable_content_list = context.contentValues(portal_type=file_type_list, checked_permission=\'View\')\n
content_group_dict = {}\n content_group_dict = {}\n
for content in viewable_content_list:\n for content in viewable_content_list:\n
if content.getValidationState() != \'draft\':\n
continue\n
title = content.getTitle()\n title = content.getTitle()\n
content_group_dict.setdefault(title, [])\n content_group_dict.setdefault(title, [])\n
content_group_dict[title].append(content)\n content_group_dict[title].append(content)\n
......
455 456
\ No newline at end of file \ No newline at end of file
File | validation_workflow
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment