def __call__(self, context): MEDIA = { _(u"Book"): 'book', _(u"Magazine"): 'magazine', _(u"DVD/CD"): 'digital', } return SimpleVocabulary([SimpleTerm(value, title=title) for title, value in MEDIA.iteritems()])
def __call__(self, context): TYPES = { _(u"Global Culture"): 'global-culture', _(u"Solidarity"): 'solidarity', _(u"Philosophy"): 'philosophy', _(u"Contexts"): 'contexts', _(u"Munich Philosophy"): 'munich', _(u"Theology"): 'theology', _(u"Practical Philosophy"): 'practical-philosophy', } return SimpleVocabulary([SimpleTerm(value, title=title) for title, value in TYPES.iteritems()])
def render(self): context = aq_inner(self.context) faculty_member_uid = self.traverse_subpath[0] action = self.traverse_subpath[1] faculty_member = api.content.get(UID=faculty_member_uid) assignments = getattr(faculty_member, 'associatedPublications', None) if assignments is None: assignments = list() uuid = api.content.get_uuid(obj=context) if action == 'remove': if uuid in assignments: assignments.remove(uuid) else: assignments.append(uuid) # Store updated assignment list setattr(faculty_member, 'associatedPublications', assignments) modified(faculty_member) faculty_member.reindexObject(idxs='modified') next_url = '{0}/@@faculty-member-assignment?updated=true'.format( context.absolute_url()) api.portal.show_message( message=_(u"Faculty member successfully assigned"), request=self.request) return self.request.response.redirect(next_url)