Пример #1
0
 def phone_call_preferences(self):
     schema = PhoneCallViewOptionsSchema()
     choices = _view_choices
     for key in PhoneCallViews:
         schema[key].widget = make_select_widget(choices)
     form = deform.Form(schema, buttons=('submit',))
     self.layout.resources.deform_auto_need(form)
     if 'submit' in self.request.POST:
         self._phone_call_pref_form_submitted(form)
     else:
         user = self.get_current_user()
         cfg = user.config.get_config()
         data = dict(cfg.items('phonecall_views'))
         data = dict(((k, ViewChoiceLookup[data[k]]) for k in data))
         self.layout.content = form.render(data)
Пример #2
0
 def case_preferences(self):
     schema = CaseViewOptionsSchema()
     choices = _view_choices
     for key in CaseViews:
         schema[key].widget = make_select_widget(choices)
     form = deform.Form(schema, buttons=('submit',))
     self.layout.resources.deform_auto_need(form)
     if 'submit' in self.request.POST:
         self._case_pref_form_submitted(form)
     else:
         user = self.get_current_user()
         cfg = user.config.get_config()
         try:
             data = dict(cfg.items('case_views'))
         except NoSectionError:
             data = dict(((k, 'month') for k in TicketViews))
         data = dict(((k, ViewChoiceLookup[data[k]]) for k in data))
         self.layout.content = form.render(data)