From 4de98a76aed0d2a7831b9e5623cef98280ee276b Mon Sep 17 00:00:00 2001 From: Yoshinori Okuji <yo@nexedi.com> Date: Fri, 5 Mar 2004 10:32:30 +0000 Subject: [PATCH] New methods, getSelectionSelectedValueList, getSelectionCheckedValueList and getSelectionValueList. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@542 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Form/SelectionTool.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/product/ERP5Form/SelectionTool.py b/product/ERP5Form/SelectionTool.py index f2221f02faf..8ec6aedcee5 100755 --- a/product/ERP5Form/SelectionTool.py +++ b/product/ERP5Form/SelectionTool.py @@ -659,6 +659,32 @@ class SelectionTool( UniqueObject, SimpleItem ): return self.setListboxDisplayMode(REQUEST=REQUEST,listbox_display_mode='ReportTreeMode') + security.declareProtected(ERP5Permissions.View, 'getSelectionSelectedValueList') + def getSelectionSelectedValueList(self, selection_name, REQUEST=None, selection_method=None, context=None): + """ + Get the list of values selected for 'selection_name' + """ + selection = self.getSelectionFor(selection_name, REQUEST=REQUEST) + return selection(selection_method=selection_method, context=context, REQUEST=REQUEST) + security.declareProtected(ERP5Permissions.View, 'getSelectionCheckedValueList') + def getSelectionCheckedValueList(self, selection_name, REQUEST=None): + """ + Get the list of values checked for 'selection_name' + """ + selection = self.getSelectionFor(selection_name, REQUEST=REQUEST) + uid_list = selection.getSelectionCheckedUids() + value_list = self.portal_catalog.getObjectList(uid_list) + return value_list + + security.declareProtected(ERP5Permissions.View, 'getSelectionValueList') + def getSelectionValueList(self, selection_name, REQUEST=None, selection_method=None, context=None): + """ + Get the list of values checked or selected for 'selection_name' + """ + value_list = self.getSelectionCheckedValueList(selection_name, REQUEST=REQUEST) + if len(value_list) == 0: + value_list = self.getSelectionSelectedValueList(selection_name, REQUEST=REQUEST, selection_method=selection_method, context=context) + return value_list InitializeClass( SelectionTool ) -- 2.30.9