Commit 697f9be4 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

support deleting selections.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17970 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 446ad5fb
......@@ -88,6 +88,17 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ):
, 'manage_configure' )
manage_configure = DTMLFile( 'SelectionTool_configure', _dtmldir )
security.declareProtected( ERP5Permissions.ManagePortal
, 'manage_deleteSelection' )
def manage_deleteSelection(self, selection_name, REQUEST=None):
"""
Relete a specified selection
"""
self._deleteSelectionFromContainer(selection_name)
if REQUEST is not None:
return REQUEST.RESPONSE.redirect('%s/%s' %
(self.absolute_url(), 'manage_viewSelections'))
# storages of SelectionTool
storage_list = ('Persistent Mapping', 'Memcached Tool')
......@@ -1276,6 +1287,14 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ):
else:
self._getPersistentContainer(user_id)[selection_name] = aq_base(selection)
def _deleteSelectionFromContainer(self, selection_name):
user_id = self._getUserId()
if user_id is None: return None
if self.isMemcachedUsed():
del(self._getMemcachedContainer()['%s-%s' % (user_id, selection_name)])
else:
del(self._getPersistentContainer(user_id)[selection_name])
def _getSelectionNameListFromContainer(self):
if self.isMemcachedUsed():
return []
......
......@@ -17,12 +17,14 @@ This page show the active selections for the current user.
<table cellspacing="0" cellpadding="2" border="1">
<tr>
<th> Action </th>
<th> Selection Name </th>
<th> Selection Parameters </th>
</tr>
<dtml-in getSelectionNameList>
<tr>
<td><a href="manage_deleteSelection?selection_name=<dtml-var sequence-item>">Delete</a></td>
<td> <dtml-var sequence-item></td>
<td> <dtml-var
expr="getSelectionParams(_['sequence-item'])" html_quote></td>
......
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