Permalink
Browse files

Show technicians in the responsible managers list in the search form.

Move getManagersVocab and getStrictManagersVocab from issue to tracker for this.

Fixes http://plone.org/products/poi/issues/266
  • Loading branch information...
1 parent 2e18aaf commit 388fa528b7e703f430c2785e686f905ba74ffa80 @mauritsvanrees mauritsvanrees committed Oct 18, 2013
View
5 CHANGES.rst
@@ -5,6 +5,11 @@ Changelog for Poi
2.2.6 (unreleased)
------------------
+- Show technicians in the responsible managers list in the search
+ form.
+ Fixes http://plone.org/products/poi/issues/266
+ [maurits]
+
- Sort the available releases of trackers in PloneSoftwareCenter by
id, which means: by version.
[maurits]
View
44 Products/Poi/content/PoiIssue.py
@@ -476,48 +476,6 @@ def getIssueTypesVocab(self):
field = tracker.getField('availableIssueTypes')
return field.getAsDisplayList(tracker)
- def getManagersVocab(self, strict=False):
- """
- Get the managers available as a DisplayList. The first item is 'None',
- with a key of '(UNASSIGNED)'.
-
- Note, we now also allow Technicians here, unless we are called
- with 'strict' is True.
- """
- tracker = self.getTracker()
- vocab = DisplayList()
- vocab.add('(UNASSIGNED)', _(u'None'))
- mtool = getToolByName(self, 'portal_membership')
- for item in tracker.getManagers():
- user = mtool.getMemberById(item)
- if user:
- fullname = user.getProperty('fullname', item) or item
- else:
- fullname = item
-
- vocab.add(item, fullname)
- if not strict:
- for item in tracker.getTechnicians():
- user = mtool.getMemberById(item)
- if user:
- fullname = user.getProperty('fullname', item) or item
- else:
- fullname = item
-
- vocab.add(item, fullname)
- return vocab
-
- def getStrictManagersVocab(self):
- """
- Get the managers available as a DisplayList. The first item is 'None',
- with a key of '(UNASSIGNED)'.
-
- Note, this vocabulary is strictly for TrackerManagers, so not
- for Technicians. It is not actually used by default, but can
- be handy for third parties.
- """
- return self.getManagersVocab(strict=True)
-
security.declareProtected(permissions.View, 'getTagsVocab')
def getTagsVocab(self):
"""
@@ -537,7 +495,7 @@ def getReleasesVocab(self):
(UNASSIGNED) to denote that a release is not yet assigned.
"""
vocab = DisplayList()
- vocab.add('(UNASSIGNED)', _(u'None'))
+ vocab.add('(UNASSIGNED)', _(u"not_assigned", default=u'(Not assigned)'))
tracker = self.getTracker()
trackerVocab = tracker.getReleasesVocab()
for k in trackerVocab.keys():
View
42 Products/Poi/content/PoiTracker.py
@@ -28,6 +28,7 @@
__docformat__ = 'plaintext'
from AccessControl import ClassSecurityInfo
+from Products.Archetypes.atapi import DisplayList
from Products.CMFCore.utils import getToolByName
from Products.CMFDynamicViewFTI.browserdefault import BrowserDefaultMixin
from Products.DataGridField.DataGridField import DataGridField
@@ -413,6 +414,47 @@ def _updateRolesField(self, field_name, new_values):
local_roles.append(role)
self.manage_setLocalRoles(user_id, local_roles)
+ def getManagersVocab(self, strict=False):
+ """
+ Get the managers available as a DisplayList. The first item is 'None',
+ with a key of '(UNASSIGNED)'.
+
+ Note, we now also allow Technicians here, unless we are called
+ with 'strict' is True.
+ """
+ vocab = DisplayList()
+ vocab.add('(UNASSIGNED)', _(u"not_assigned", default=u'(Not assigned)'))
+ mtool = getToolByName(self, 'portal_membership')
+ for item in self.getManagers():
+ user = mtool.getMemberById(item)
+ if user:
+ fullname = user.getProperty('fullname', item) or item
+ else:
+ fullname = item
+
+ vocab.add(item, fullname)
+ if not strict:
+ for item in self.getTechnicians():
+ user = mtool.getMemberById(item)
+ if user:
+ fullname = user.getProperty('fullname', item) or item
+ else:
+ fullname = item
+
+ vocab.add(item, fullname)
+ return vocab
+
+ def getStrictManagersVocab(self):
+ """
+ Get the managers available as a DisplayList. The first item is 'None',
+ with a key of '(UNASSIGNED)'.
+
+ Note, this vocabulary is strictly for TrackerManagers, so not
+ for Technicians. It is not actually used by default, but can
+ be handy for third parties.
+ """
+ return self.getManagersVocab(strict=True)
+
security.declareProtected(permissions.ModifyPortalContent, 'setManagers')
def setManagers(self, managers):
"""Set the list of tracker managers, and give them the
View
7 Products/Poi/skins/Poi/poi_issue_search_form.pt
@@ -226,13 +226,12 @@
size="5"
multiple="multiple"
name="responsible:list"
- tal:define="managers here/getManagers">
- <option i18n:translate="not_assigned"
- value="(UNASSIGNED)">(Not assigned)</option>
+ tal:define="managers here/getManagersVocab">
<option tal:repeat="item managers"
+ i18n:translate=""
tal:attributes="value item;
selected python:item in request.get('responsible', []) and 'selected' or None"
- tal:content="item" />
+ tal:content="python:managers.getValue(item)" />
</select>
</div>
View
8 Products/Poi/tests/responses.txt
@@ -211,19 +211,19 @@ available options for us now::
>>> view.available_transitions
['']
>>> view.available_releases
- <DisplayList [('(UNASSIGNED)', u'None')] at ...>
+ <DisplayList [('(UNASSIGNED)', u'not_assigned')] at ...>
>>> view.available_managers
- <DisplayList [('(UNASSIGNED)', u'None'), ('manager', 'manager')] at ...>
+ <DisplayList [('(UNASSIGNED)', u'not_assigned'), ('manager', 'manager')] at ...>
>>> view.upload_allowed
True
The view has some methods especially for displaying::
>>> view.transitions_for_display == [{'checked': 'checked', 'value': '', 'label': u'No change'}]
True
- >>> view.releases_for_display == [{'checked': 'checked', 'value': '(UNASSIGNED)', 'label': u'None'}]
+ >>> view.releases_for_display == [{'checked': 'checked', 'value': '(UNASSIGNED)', 'label': u'not_assigned'}]
True
- >>> view.managers_for_display == [{'checked': 'checked', 'value': '(UNASSIGNED)', 'label': u'None'}, {'checked': '', 'value': 'manager', 'label': 'manager'}]
+ >>> view.managers_for_display == [{'checked': 'checked', 'value': '(UNASSIGNED)', 'label': u'not_assigned'}, {'checked': '', 'value': 'manager', 'label': 'manager'}]
True
And of course the responses are visible. Well, no response has been

0 comments on commit 388fa52

Please sign in to comment.