Commit b14e59e7 authored by Tristan Cavelier's avatar Tristan Cavelier Committed by Sebastien Robin

Portal Activities Improved + Activity tool live test

parent 181914da
......@@ -1298,21 +1298,45 @@ class ActivityTool (Folder, UniqueObject):
(self.absolute_url(), 'manageActivities'))
security.declareProtected( CMFCorePermissions.ManagePortal, 'manageRestart')
def manageRestart(self, message_uid, activity, REQUEST=None):
def manageRestart(self, message_uid_list, activity, REQUEST=None):
"""
Restart one or several messages
"""
if activity == 'SQLQueue':
self.SQLQueue_restartMessage(message_uid=message_uid)
for message_uid in message_uid_list:
self.SQLQueue_restartMessage(message_uid=message_uid)
else:
self.SQLDict_restartMessage(message_uid=message_uid)
for message_uid in message_uid_list:
self.SQLDict_restartMessage(message_uid=message_uid)
if REQUEST is not None:
return REQUEST.RESPONSE.redirect('%s/%s' % (
self.absolute_url(), 'view'))
security.declareProtected( CMFCorePermissions.ManagePortal, 'manageCancel' )
def manageCancel(self, message_uid, activity, REQUEST=None):
def manageCancel(self, object_path, method_id, REQUEST=None):
"""
Cancel all methods for object "object_path"
"""
LOG('ActivityTool', WARNING,
'"manageCancel" method is deprecated, use "manageDelete" instead.')
if type(object_path) is type(''):
object_path = tuple(object_path.split('/'))
self.flush(object_path,method_id=method_id,invoke=0)
if REQUEST is not None:
return REQUEST.RESPONSE.redirect('%s/%s' % (
self.absolute_url(), 'view'))
security.declareProtected( CMFCorePermissions.ManagePortal, 'manageDelete' )
def manageDelete(self, message_uid_list, activity, REQUEST=None):
"""
Delete one or several messages
"""
if activity == 'SQLQueue':
self.SQLQueue_deleteMessage(message_uid=message_uid)
for message_uid in message_uid_list:
self.SQLQueue_deleteMessage(message_uid=message_uid)
else:
self.SQLDict_deleteMessage(message_uid=message_uid)
for message_uid in message_uid_list:
self.SQLDict_deleteMessage(message_uid=message_uid)
if REQUEST is not None:
return REQUEST.RESPONSE.redirect('%s/%s' % (
self.absolute_url(), 'view'))
......@@ -1382,8 +1406,21 @@ class ActivityTool (Folder, UniqueObject):
'%s/manageActivitiesAdvanced?manage_tabs_message=%s' % (
self.absolute_url(), message))
security.declarePublic('getMessageTempObjectList')
def getMessageTempObjectList(self, **kw):
"""
Get object list of messages waiting in queues
"""
message_list = self.getMessageList(**kw)
object_list = []
for sql_message in message_list:
message = self.newContent(temp_object=1)
message.edit (**sql_message.__dict__)
object_list.append(message)
return object_list
security.declarePublic('getMessageList')
def getMessageList(self, activity=None, temp_object=0, **kw):
def getMessageList(self, activity=None, **kw):
"""
List messages waiting in queues
"""
......@@ -1393,15 +1430,6 @@ class ActivityTool (Folder, UniqueObject):
if activity:
return activity_dict[activity].getMessageList(aq_inner(self), **kw)
if temp_object == 1:
message_list = self.getMessageList()
object_list = []
for sql_message in message_list:
message = self.newContent(temp_object=1)
message.edit(**sql_message.__dict__)
object_list.append(message)
return object_list
message_list = []
for activity in activity_dict.itervalues():
try:
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_report</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_report</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>watch_report</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Show Activity Watcher</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/ActivityTool_viewWatcher</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -52,7 +52,7 @@
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
return \'ActivityTool_manageCancel?uid=%s&activity=%s\' % (context.uid, context.activity)\n
return \'ActivityTool_manageDelete?uid=%s&activity=%s\' % (context.uid, context.activity)\n
]]></string> </value>
......@@ -63,7 +63,7 @@ return \'ActivityTool_manageCancel?uid=%s&activity=%s\' % (context.uid, context.
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ActivityTool_cancelMessage</string> </value>
<value> <string>ActivityTool_deleteMessage</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -50,16 +50,41 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string># from Products.ERP5Type.Log import log\n
# log("getMessageList", context.getMessageList(temp_object=1))\n
message_list = context.getMessageList(temp_object=1)\n
for message in message_list:\n
message.edit(cancel = \'[Cancel]\')\n
message.edit(restart = \'[Restart]\')\n
<value> <string encoding="cdata"><![CDATA[
#from Products.ERP5Type.Log import log\n
#log("getMessageList", context.getMessageTempObjectList())\n
\n
# searching\n
# processing_node column is manage by methods called by getMessageTempObjectList\n
if kw[\'processing_node\'] == \'\':\n
del kw[\'processing_node\']\n
\n
#key_list_to_search = [x for (x,y) in [(k,kw[k]) for k in [\'uid_activity\',\'str_object_path\',\'method_id\',\'retry\',\'processing\']] if y != \'\']\n
\n
message_list = context.getMessageTempObjectList(**kw)\n
message_list_to_show = []\n
while len(message_list) > 0:\n
message = message_list.pop(0)\n
message.edit(str_object_path = \'/\'.join(str(i) for i in message.object_path))\n
message.edit(uid_activity = str(message.uid) + \' (\'+ message.activity[3:] +\')\')\n
return message_list\n
</string> </value>
# # search filter\n
# try:\n
# for k in key_list_to_search:\n
# str(getattr(message,k,None)).index(kw[k])\n
# except ValueError:\n
# continue\n
message.edit(delete = \'[Delete]\')\n
message.edit(restart = \'[Restart]\')\n
message_list_to_show.append(message)\n
\n
## sort\n
## XXX\n
\n
return message_list_to_show\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
......
......@@ -50,10 +50,7 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>request = container.REQUEST\n
response = request.response\n
\n
return context.manageCancel(uid,activity,REQUEST=request)\n
<value> <string>return context.manageDelete([uid],activity,REQUEST=container.REQUEST)\n
</string> </value>
</item>
<item>
......@@ -62,7 +59,7 @@ return context.manageCancel(uid,activity,REQUEST=request)\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ActivityTool_manageCancel</string> </value>
<value> <string>ActivityTool_manageDelete</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -50,10 +50,7 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>request = container.REQUEST\n
response = request.response\n
\n
return context.manageRestart(uid,activity,REQUEST=request)\n
<value> <string>return context.manageRestart([uid],activity,REQUEST=container.REQUEST)\n
</string> </value>
</item>
<item>
......
......@@ -73,7 +73,6 @@
<value>
<list>
<string>listbox</string>
<string>listbox_modification_date</string>
</list>
</value>
</item>
......
......@@ -378,8 +378,8 @@
<value>
<list>
<tuple>
<string>cancel</string>
<string>Cancel</string>
<string>delete</string>
<string>Delete</string>
</tuple>
<tuple>
<string>restart</string>
......@@ -479,8 +479,8 @@
<value>
<list>
<tuple>
<string>cancel</string>
<string>Cancel</string>
<string>delete</string>
<string>Delete</string>
</tuple>
<tuple>
<string>restart</string>
......@@ -597,12 +597,37 @@
</item>
<item>
<key> <string>search</string> </key>
<value> <int>0</int> </value>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>search_columns</string> </key>
<value>
<list/>
<list>
<tuple>
<string>uid_activity</string>
<string>UID</string>
</tuple>
<tuple>
<string>str_object_path</string>
<string>Object</string>
</tuple>
<tuple>
<string>method_id</string>
<string>Method ID</string>
</tuple>
<tuple>
<string>processing_node</string>
<string>Processing Node</string>
</tuple>
<tuple>
<string>retry</string>
<string>Retry</string>
</tuple>
<tuple>
<string>processing</string>
<string>Processing</string>
</tuple>
</list>
</value>
</item>
<item>
......@@ -616,13 +641,43 @@
<item>
<key> <string>sort</string> </key>
<value>
<list/>
<list>
<tuple>
<string>uid_activity</string>
<string>ascending</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>sort_columns</string> </key>
<value>
<list/>
<list>
<tuple>
<string>uid_activity</string>
<string>UID</string>
</tuple>
<tuple>
<string>str_object_path</string>
<string>Object</string>
</tuple>
<tuple>
<string>method_id</string>
<string>Method ID</string>
</tuple>
<tuple>
<string>processing_node</string>
<string>Processing Node</string>
</tuple>
<tuple>
<string>retry</string>
<string>Retry</string>
</tuple>
<tuple>
<string>processing</string>
<string>Processing</string>
</tuple>
</list>
</value>
</item>
<item>
......@@ -675,7 +730,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [(\'cancel\', \'ActivityTool_cancelMessage\'),(\'restart\', \'ActivityTool_restartMessage\')]</string> </value>
<value> <string>python: [(\'delete\', \'ActivityTool_deleteMessage\'),(\'restart\', \'ActivityTool_restartMessage\')]</string> </value>
</item>
</dictionary>
</pickle>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_modification_date</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>listbox_modification_date</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5Form" module="Products.ERP5Form.Form"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>my_listbox</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ActivityTool_viewCurrentActivities</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>ActivityTool_viewCurrentActivities</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ListBox" module="Products.ERP5Form.ListBox"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>my_listbox</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>all_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>anchor</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>count_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default_display_style</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_style_list</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>domain_root_list</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>domain_tree</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>global_attributes</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>global_search_column</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hide_rows_on_no_search_criterion</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>list_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>list_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>meta_types</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>page_navigation_template</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>page_template</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>portal_types</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>report_root_list</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>report_tree</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>row_css_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>search</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>search_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>select</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>sort</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>sort_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>stat_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>stat_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>style_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>untranslatable_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>url_columns</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>all_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>anchor</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>count_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default_display_style</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_style_list</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>domain_root_list</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>domain_tree</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>global_attributes</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>global_search_column</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hide_rows_on_no_search_criterion</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>list_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>list_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>meta_types</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>page_navigation_template</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>page_template</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>portal_types</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>report_root_list</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>report_tree</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>row_css_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>search</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>search_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>select</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>sort</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>sort_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>stat_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>stat_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>style_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>untranslatable_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>url_columns</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>all_columns</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>anchor</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>columns</string> </key>
<value>
<list>
<tuple>
<string>uid</string>
<string>Message</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>count_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default_display_style</string> </key>
<value> <string>table</string> </value>
</item>
<item>
<key> <string>default_params</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_style_list</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>domain_root_list</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>domain_tree</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>editable_columns</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>global_attributes</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>global_search_column</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>hide_rows_on_no_search_criterion</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>lines</string> </key>
<value> <int>20</int> </value>
</item>
<item>
<key> <string>list_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>list_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>meta_types</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>page_navigation_template</string> </key>
<value> <string>ListBox_viewSliderPageNavigationRenderer</string> </value>
</item>
<item>
<key> <string>page_template</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>portal_types</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>report_root_list</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>report_tree</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>row_css_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>search</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>search_columns</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>select</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>sort</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>sort_columns</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>stat_columns</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>stat_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>style_columns</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Activities</string> </value>
</item>
<item>
<key> <string>untranslatable_columns</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>url_columns</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -37,6 +37,16 @@
<key> <string>action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
......@@ -71,7 +81,7 @@
<key> <string>center</string> </key>
<value>
<list>
<string>my_gadget</string>
<string>activity_watcher_gadget</string>
</list>
</value>
</item>
......@@ -108,6 +118,10 @@
<key> <string>name</string> </key>
<value> <string>ActivityTool_viewWatcher</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_view_dialog</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
......@@ -124,6 +138,14 @@
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
......
......@@ -8,7 +8,7 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>my_gadget</string> </value>
<value> <string>activity_watcher_gadget</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -222,11 +222,11 @@
</item>
<item>
<key> <string>gadget_html</string> </key>
<value> <string>ActivityTool_watcher</string> </value>
<value> <string>ActivityWatcherGadget_view</string> </value>
</item>
<item>
<key> <string>gadget_id</string> </key>
<value> <string>activity_watcher</string> </value>
<value> <string>activity_watcher_gadget</string> </value>
</item>
<item>
<key> <string>gadget_property</string> </key>
......
......@@ -36,23 +36,11 @@
<key> <string>_text</string> </key>
<value> <unicode encoding="cdata"><![CDATA[
<html>\n
<head>\n
<title tal:content="template/title">The title</title>\n
<meta http-equiv="content-type" content="text/html;charset=utf-8">\n
</head>\n
<body>\n
\n
<h2><span tal:replace="here/title_or_id">content title or id</span>\n
<span tal:condition="template/title"\n
tal:replace="template/title">optional template title</span></h2>\n
\n
This is Page Template <em tal:content="template/id">template id</em>.\n
<div id="activity_watcher"></div>\n
<script src="../erp5_jquery/jquery/core/jquery.js"></script>\n
<script src="activity_watcher.js"></script>\n
</body>\n
</html>
<div>\n
<div id="activity_watcher_gadget"></div>\n
<script src="../erp5_jquery/jquery/core/jquery.js"></script>\n
<script src="activity-watcher-gadget.js"></script>\n
</div>
]]></unicode> </value>
</item>
......@@ -66,7 +54,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ActivityTool_watcher</string> </value>
<value> <string>ActivityWatcherGadget_view</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="DTMLDocument" module="OFS.DTMLDocument"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>activity-watcher-gadget.js</string> </value>
</item>
<item>
<key> <string>_vars</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>globals</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>raw</string> </key>
<value> <string encoding="cdata"><![CDATA[
/*\n
This script generate a lot of html tags inside a div.\n
It would be better to use templates (like mustache)\n
*/\n
(function () {\n
var interval = 1000,\n
div = \'#activity_watcher_gadget\',\n
html_content = \'\',\n
basedir = location.pathname.split(\'/\').slice(0,-1).join(\'/\') + \'/\',\n
fillMessageList = function (data,messagetype,string) {\n
if (data[string] && data[string].line_list) {\n
for (i = 0; i < data[string].line_list.length; i++) {\n
var key_list = [\'message\',\'method_id\',\'node\',\'min_pri\',\'max_pri\'], j;\n
html_content +=\n
\'<tr>\' +\n
\'<td>\' + messagetype + \'</td>\';\n
for (j = 0; j < key_list.length; j++) {\n
html_content +=\n
\'<td>\' + data[string].line_list[i][key_list[j]] + \'</td>\';\n
}\n
html_content +=\n
\'</tr>\';\n
}\n
}\n
},\n
fillMessagePri = function (data,messagetype,string) {\n
if (data[string] && data[string].line_list) {\n
for (i = 0; i < data[string].line_list.length; i++) {\n
var key_list = [\'min\',\'avg\',\'max\'], j;\n
html_content +=\n
\'<tr>\' +\n
\'<td>\' + messagetype + \'</td>\' +\n
\'<td>\' + data[string].line_list[i].pri + \'</td>\';\n
for (j = 0; j < key_list.length; j++) {\n
html_content +=\n
\'<td>\' + data[string].line_list[i][key_list[j]] + \'</td>\';\n
}\n
html_content +=\n
\'</tr>\';\n
}\n
}\n
},\n
watcher = function () {\n
$.ajax({\n
url: basedir + \'ActivityTool_getSqlStatisticList\',\n
type: \'POST\',\n
timeout: 10000,\n
success: function (response) {\n
var i, data;\n
data = JSON.parse(response);\n
html_content =\n
\'<table>\' +\n
\' <tr>\' +\n
\' <th>Type</th>\'+\n
\' <th>Message</th>\'+\n
\' <th>Method Id</th>\'+\n
\' <th>Processing Node</th>\'+\n
\' <th>Min pri</th>\'+\n
\' <th>Max pri</th>\' +\n
\' </tr>\';\n
fillMessageList (data,\'dict\',\'SQLDict\');\n
fillMessageList (data,\'queue\',\'SQLQueue\');\n
html_content +=\n
\' </table>\' +\n
\'<table>\'+\n
\' <tr>\'+\n
\' <th>Type</th>\'+\n
\' <th>Pri</th>\'+\n
\' <th>Min</th>\'+\n
\' <th>Avg</th>\'+\n
\' <th>Max</th>\'+\n
\' </tr>\';\n
fillMessagePri (data,\'dict\',\'SQLDict2\');\n
fillMessagePri (data,\'queue\',\'SQLQueue2\');\n
html_content +=\n
\' </table>\';\n
$(div).html(html_content);\n
setTimeout(watcher,interval);\n
},\n
error: function (type) {\n
if (!html_content) {\n
$(div).html(\'ERROR \' + type.status + \': \' + type.statusText);\n
} else {\n
$(div).html(\'ERROR \' + type.status + \': \' + type.statusText +\n
\'<br />\' + html_content);\n
}\n
if (type.status < 400) {\n
setTimeout(watcher,interval);\n
}\n
}\n
});\n
};\n
watcher();\n
}());\n
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="DTMLDocument" module="OFS.DTMLDocument"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>activity_watcher.js</string> </value>
</item>
<item>
<key> <string>_vars</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>globals</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>raw</string> </key>
<value> <string encoding="cdata"><![CDATA[
(function () {\n
var interval = 1000,\n
div = \'#activity_watcher\',\n
html_content = \'\',\n
basedir = location.pathname.split(\'/\').slice(0,-1).join(\'/\') + \'/\',\n
fillhtml = function (data,messagetype,string) {\n
if (data[string] && data[string].line_list) {\n
for (i = 0; i < data[string].line_list.length; i++) {\n
var key_list = [\'message\',\'method_id\',\'node\',\'min_pri\',\'max_pri\'], j;\n
html_content += \'<tr><td>\' + messagetype + \'</td>\';\n
for (j = 0; j < key_list.length; j++) {\n
html_content += \'<td>\' + data[string].line_list[i][key_list[j]] + \'</td>\';\n
}\n
html_content += \'</tr>\';\n
}\n
}\n
},\n
fillhtml2 = function (data,messagetype,string) {\n
if (data[string] && data[string].line_list) {\n
for (i = 0; i < data[string].line_list.length; i++) {\n
var key_list = [\'min\',\'avg\',\'max\'], j;\n
html_content += \'<tr><td>\' + messagetype + \'</td>\' +\n
\'<td>\' + data[string].line_list[i].pri + \'</td>\';\n
for (j = 0; j < key_list.length; j++) {\n
// if (typeof data[string].line_list[i][key_list[j]] == \'number\') {\n
// var d = new Date(data[string].line_list[i][key_list[j]]);\n
// html_content += \'<td>\' + d.getTime() + \'</td>\';\n
// } else {\n
html_content += \'<td>\' + data[string].line_list[i][key_list[j]] + \'</td>\';\n
// }\n
}\n
html_content += \'</tr>\';\n
}\n
}\n
},\n
watcher = function () {\n
$.ajax({\n
url: basedir + \'ActivityTool_getSqlStatisticList\',\n
type: \'POST\',\n
timeout: 10000,\n
success: function (response) {\n
var i, data;\n
data = JSON.parse(response);\n
html_content = \'<table><tr><th>Type</th><th>Message</th><th>Method Id</th><th>Processing Node</th><th>Min pri</th><th>Max pri</th></tr>\';\n
fillhtml(data,\'dict\',\'SQLDict\');\n
fillhtml(data,\'queue\',\'SQLQueue\');\n
html_content += \'</table>\' +\n
\'<table><tr><th>Type</th><th>Pri</th><th>Min</th><th>Avg</th><th>Max</th></tr>\';\n
fillhtml2(data,\'dict\',\'SQLDict2\');\n
fillhtml2(data,\'queue\',\'SQLQueue2\');\n
html_content += \'</table>\';\n
$(div).html(html_content);\n
setTimeout(watcher,interval);\n
},\n
error: function (type) {\n
if (!html_content) {\n
$(div).html(\'ERROR \' + type.status + \': \' + type.statusText);\n
} else {\n
$(div).html(\'ERROR \' + type.status + \': \' + type.statusText + \'<br />\' + html_content);\n
}\n
if (type.status < 400) {\n
setTimeout(watcher,interval);\n
}\n
}\n
});\n
};\n
watcher();\n
}());\n
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
##############################################################################
#
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
class Test(ERP5TypeTestCase):
"""
A Sample Test Class
"""
def getTitle(self):
return "TestActivityTool"
def getBusinessTemplateList(self):
"""
Tuple of Business Templates we need to install
"""
return ('erp5_base',)
def afterSetUp(self):
"""
This is ran before anything, used to set the environment
"""
# here, you can create the categories and objects your test will depend on
self.activity_tool = self.getPortalObject().portal_activities
if not(hasattr(self.portal,'test_activity_tool_module')):
self.portal.newContent(portal_type='Organisation Module',
id='test_activity_tool_module')
self.test_activity_tool_module = getattr(self.getPortal(), 'test_activity_tool_module', None)
if not(self.test_activity_tool_module.hasContent('untitled')):
self.test_activity_tool_module.newContent(id='untitled')
self.test_activity_tool_object = self.test_activity_tool_module._getOb('untitled')
self.tic()
def RestartAndDeleteActivity(self, activity):
self.test_activity_tool_object._setTitle('title1')
self.assertEquals('title1',self.test_activity_tool_object.getTitle())
self.test_activity_tool_object.activate(activity=activity)._setTitle('title2')
# Needed so that the message are commited into the queue
self.commit()
message_list = self.activity_tool.getMessageTempObjectList()
self.assertEquals(len(message_list),1)
self.activity_tool.manageDelete([message_list[0].uid],activity)
# Needed so that the message are removed from the queue
self.commit()
self.tic()
self.assertEquals('title1',self.test_activity_tool_object.getTitle())
message_list = self.activity_tool.getMessageTempObjectList()
self.assertEquals(len(message_list),0)
self.test_activity_tool_object.activate(activity=activity)._setTitle('title2')
# Needed so that the message are commited into the queue
self.commit()
message_list = self.activity_tool.getMessageTempObjectList()
self.assertEquals(len(message_list),1)
self.activity_tool.manageRestart([message_list[0].uid],activity)
self.commit()
self.tic()
self.assertEquals('title2',self.test_activity_tool_object.getTitle())
message_list = self.activity_tool.getMessageTempObjectList()
self.assertEquals(len(message_list),0)
def test_manageDelete(self):
self.RestartAndDeleteActivity('SQLQueue')
self.RestartAndDeleteActivity('SQLDict')
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