def __call__(self, context):
     site = getSite()
     try:
         request = site.REQUEST
     except AttributeError:
         request = None
     return SimpleVocabulary.fromItems((
                   (translate(_(u"Collapsed"), context=request), "collapsed"),
                   (translate(_(u"Expanded"), context=request), "expanded"),))
 def handleSave(self, action):
     data, errors = self.extractData()
     if errors:
         self.status = self.formErrorsMessage
         return
     changes = self.applyChanges(data)
     IStatusMessage(self.request).addStatusMessage(_(u"Changes saved"),
                                                   "info")
     self.context.REQUEST.RESPONSE.redirect("@@portletcollapser-settings")
 def handleSaveAndInvalidate(self, action):
     PortletCollapserEditForm.handleSave(self, action)
     portal_js = getToolByName(self.context, 'portal_javascripts')
     portal_js.cookResources()
     IStatusMessage(self.request).addStatusMessage(_(u"JavaScript registry invalidated"),
                                                   "info")
 def handleCancel(self, action):
     IStatusMessage(self.request).addStatusMessage(_(u"Edit cancelled"),
                                                   "info")
     self.request.response.redirect("%s/%s" % (self.context.absolute_url(),
                                               self.control_panel_view))