Commit e65dcbb9 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Make a UI to clear activities.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4195 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 22919a70
...@@ -35,7 +35,7 @@ from Products.PythonScripts.Utility import allow_class ...@@ -35,7 +35,7 @@ from Products.PythonScripts.Utility import allow_class
from App.ApplicationManager import ApplicationManager from App.ApplicationManager import ApplicationManager
from AccessControl import ClassSecurityInfo, Permissions from AccessControl import ClassSecurityInfo, Permissions
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from Products.CMFCore.utils import UniqueObject, _checkPermission, _getAuthenticatedUser from Products.CMFCore.utils import UniqueObject, _checkPermission, _getAuthenticatedUser, getToolByName
from Globals import InitializeClass, DTMLFile, get_request from Globals import InitializeClass, DTMLFile, get_request
from Acquisition import aq_base from Acquisition import aq_base
from DateTime.DateTime import DateTime from DateTime.DateTime import DateTime
...@@ -234,12 +234,16 @@ class ActivityTool (Folder, UniqueObject): ...@@ -234,12 +234,16 @@ class ActivityTool (Folder, UniqueObject):
[ { 'label' : 'Overview', 'action' : 'manage_overview' } [ { 'label' : 'Overview', 'action' : 'manage_overview' }
, { 'label' : 'Activities', 'action' : 'manageActivities' } , { 'label' : 'Activities', 'action' : 'manageActivities' }
, { 'label' : 'LoadBalancing', 'action' : 'manageLoadBalancing'} , { 'label' : 'LoadBalancing', 'action' : 'manageLoadBalancing'}
, { 'label' : 'Advanced', 'action' : 'manageActivitiesAdvanced' }
, ,
] + list(Folder.manage_options)) ] + list(Folder.manage_options))
security.declareProtected( CMFCorePermissions.ManagePortal , 'manageActivities' ) security.declareProtected( CMFCorePermissions.ManagePortal , 'manageActivities' )
manageActivities = DTMLFile( 'dtml/manageActivities', globals() ) manageActivities = DTMLFile( 'dtml/manageActivities', globals() )
security.declareProtected( CMFCorePermissions.ManagePortal , 'manageActivitiesAdvanced' )
manageActivitiesAdvanced = DTMLFile( 'dtml/manageActivitiesAdvanced', globals() )
security.declareProtected( CMFCorePermissions.ManagePortal , 'manage_overview' ) security.declareProtected( CMFCorePermissions.ManagePortal , 'manage_overview' )
manage_overview = DTMLFile( 'dtml/explainActivityTool', globals() ) manage_overview = DTMLFile( 'dtml/explainActivityTool', globals() )
...@@ -646,6 +650,7 @@ class ActivityTool (Folder, UniqueObject): ...@@ -646,6 +650,7 @@ class ActivityTool (Folder, UniqueObject):
if not hasattr(self, '_v_activity_buffer'): self._v_activity_buffer = ActivityBuffer() if not hasattr(self, '_v_activity_buffer'): self._v_activity_buffer = ActivityBuffer()
activity_dict[activity].queueMessage(self, Message(path, active_process, activity_kw, method_id, args, kw)) activity_dict[activity].queueMessage(self, Message(path, active_process, activity_kw, method_id, args, kw))
security.declareProtected( CMFCorePermissions.ManagePortal, 'manageInvoke' )
def manageInvoke(self, object_path, method_id, REQUEST=None): def manageInvoke(self, object_path, method_id, REQUEST=None):
""" """
Invokes all methods for object "object_path" Invokes all methods for object "object_path"
...@@ -656,6 +661,7 @@ class ActivityTool (Folder, UniqueObject): ...@@ -656,6 +661,7 @@ class ActivityTool (Folder, UniqueObject):
if REQUEST is not None: if REQUEST is not None:
return REQUEST.RESPONSE.redirect('%s/%s' % (self.absolute_url(), 'manageActivities')) return REQUEST.RESPONSE.redirect('%s/%s' % (self.absolute_url(), 'manageActivities'))
security.declareProtected( CMFCorePermissions.ManagePortal, 'manageCancel' )
def manageCancel(self, object_path, method_id, REQUEST=None): def manageCancel(self, object_path, method_id, REQUEST=None):
""" """
Cancel all methods for object "object_path" Cancel all methods for object "object_path"
...@@ -666,6 +672,40 @@ class ActivityTool (Folder, UniqueObject): ...@@ -666,6 +672,40 @@ class ActivityTool (Folder, UniqueObject):
if REQUEST is not None: if REQUEST is not None:
return REQUEST.RESPONSE.redirect('%s/%s' % (self.absolute_url(), 'manageActivities')) return REQUEST.RESPONSE.redirect('%s/%s' % (self.absolute_url(), 'manageActivities'))
security.declareProtected( CMFCorePermissions.ManagePortal, 'manageClearActivities' )
def manageClearActivities(self, REQUEST=None):
"""
Clear all activities and recreate tables.
"""
folder = getToolByName(self, 'portal_skins').activity
if hasattr(folder, 'SQLDict_createMessageTable'):
try:
folder.SQLDict_dropMessageTable()
except ConflictError:
raise
except:
LOG('CMFActivities',
0,
'WARNING: could not drop the message table',
error=sys.exc_info())
folder.SQLDict_createMessageTable()
if hasattr(folder, 'SQLQueue_createMessageTable'):
try:
folder.SQLQueue_dropMessageTable()
except ConflictError:
raise
except:
LOG('CMFActivities',
0,
'WARNING: could not drop the message queue table',
error=sys.exc_info())
folder.SQLQueue_createMessageTable()
if REQUEST is not None:
return REQUEST.RESPONSE.redirect('%s/%s' % (self.absolute_url(), 'manageActivitiesAdvanced?manage_tabs_message=Activities%20Cleared'))
security.declarePublic('getMessageList') security.declarePublic('getMessageList')
def getMessageList(self): def getMessageList(self):
""" """
......
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<br />
<table width="100%" cellspacing="0" cellpadding="2" border="0">
<tr class="section-bar">
<td colspan="2" align="left">
<div class="form-label">
Activities Maintenance
</div>
</td>
</tr>
<tr>
<td align="left" valign="top">
<p class="form-help">Clearing the activities will remove all entries and
create new tables if necessary.
</p>
</td>
<td align="right" valign="top">
<form action="<dtml-var URL1>">
<input class="form-element" type="submit"
name="manageClearActivities:method" value=" Clear Activities ">
</form>
</td>
</tr>
</table>
<dtml-var manage_page_footer>
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