From 1d2a19a1c6e411ba563ddc7076b865f1bffc81ff Mon Sep 17 00:00:00 2001 From: Gaetan Delannay Date: Tue, 9 Apr 2013 10:57:21 +0200 Subject: [PATCH] [gen] Minor updates. --- gen/mixins/ToolMixin.py | 21 +++++++++++++++++---- gen/ui/result.pt | 7 ++++--- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/gen/mixins/ToolMixin.py b/gen/mixins/ToolMixin.py index 78d1acc..4a0fd51 100644 --- a/gen/mixins/ToolMixin.py +++ b/gen/mixins/ToolMixin.py @@ -288,7 +288,14 @@ class ToolMixin(BaseMixin): '''Gets, for the currently logged user, the value for index "Allowed".''' user = self.getUser() - res = ['user:%s' % user.getId(), 'Anonymous'] + user.getRoles() + # Get the user roles + res = user.getRoles() + # Add role "Anonymous" + if 'Anonymous' not in res: res.append('Anonymous') + # Add the user id if not anonymous + userId = user.getId() + if userId: res.append('user:%s' % userId) + # Add group ids try: res += ['user:%s' % g for g in user.groups.keys()] except AttributeError, ae: @@ -602,9 +609,9 @@ class ToolMixin(BaseMixin): transformMethods = {'uppercase': 'upper', 'lowercase': 'lower', 'capitalize': 'capitalize'} - def onSearchObjects(self): - '''This method is called when the user triggers a search from - search.pt.''' + def storeSearchCriteria(self): + '''Stores the search criteria coming from the request into the + session.''' rq = self.REQUEST # Store the search criteria in the session criteria = self._getDefaultSearchCriteria() @@ -665,6 +672,12 @@ class ToolMixin(BaseMixin): refInfo = rq.get('ref', None) if refInfo: criteria['_ref'] = refInfo rq.SESSION['searchCriteria'] = criteria + + def onSearchObjects(self): + '''This method is called when the user triggers a search from + search.pt.''' + rq = self.REQUEST + self.storeSearchCriteria() # Go to the screen that displays search results backUrl = '%s/ui/query?className=%s&&search=customSearch' % \ (self.absolute_url(), rq['className']) diff --git a/gen/ui/result.pt b/gen/ui/result.pt index 5414195..0541db5 100644 --- a/gen/ui/result.pt +++ b/gen/ui/result.pt @@ -109,7 +109,8 @@ navBaseCall python: 'askQueryResult(\'%s\',\'%s\',\'%s\',\'%s\',**v**)' % (ajaxHookId, tool.absolute_url(), className, searchName); newSearchUrl python: '%s/ui/search?className=%s%s' % (tool.absolute_url(), className, refUrlPart); showSubTitles python: request.get('showSubTitles', 'true') == 'true'; - resultMode python: tool.getResultMode(className)"> + resultMode python: tool.getResultMode(className); + showNewSearch showNewSearch|python:True"> Display here POD templates if required. @@ -128,7 +129,7 @@

() - +  —  @@ -164,7 +165,7 @@ - +