Exemplo n.º 1
0
Arquivo: people.py Projeto: zagy/karl
 def form_widgets(self, fields):
     page_title = self.request.layout_manager.layout.page_title
     api = TemplateAPI(self.context, self.request, page_title)
     default_icon = '%s/images/defaultUser.gif' % api.static_url
     show_remove_checkbox = self.photo is not None
     widgets = {'firstname': formish.Input(empty=''),
                'lastname': formish.Input(empty=''),
                'email': formish.Input(),
                'phone': formish.Input(empty=''),
                'extension': formish.Input(empty=''),
                'fax': formish.Input(empty=''),
                'department': formish.Input(empty=''),
                'position': formish.Input(empty=''),
                'organization': formish.Input(empty=''),
                'location': formish.Input(empty=''),
                'country': formish.SelectChoice(options=countries),
                'websites': formish.TextArea(
                         rows=3,
                         converter_options={'delimiter':'\n'}),
                'languages': formish.Input(empty=''),
                'photo': karlwidgets.PhotoImageWidget(
                    filestore=self.filestore,
                    url_base=resource_url(self.context, self.request),
                    image_thumbnail_default=default_icon,
                    show_remove_checkbox=show_remove_checkbox),
                'biography': karlwidgets.RichTextWidget(empty=''),
                'date_format': karlwidgets.VerticalRadioChoice(
                    options=cultures,
                    none_option=None),
                }
     return widgets
Exemplo n.º 2
0
 def form_widgets(self, fields):
     tagdata = get_tags_client_data(self.context, self.request)
     widgets = {
         'title':
         formish.Input(empty=''),
         'tags':
         karlwidgets.TagsEditWidget(tagdata=tagdata),
         'text':
         karlwidgets.RichTextWidget(empty=''),
         'attachments':
         karlwidgets.AttachmentsSequence(sortable=False,
                                         min_start_fields=0),
         'attachments.*':
         karlwidgets.FileUpload2(filestore=self.filestore),
         'photo':
         karlwidgets.PhotoImageWidget(filestore=self.filestore,
                                      url_base=resource_url(
                                          self.context, self.request),
                                      show_image_thumbnail=True,
                                      show_remove_checkbox=self.photo
                                      is not None),
         'caption':
         formish.Input(empty=''),
         'publication_date':
         karlwidgets.DateTime(
             converter_options={'datetime_format': self.datetime_format},
             js_date_format=self.js_date_format,
         ),
     }
     return widgets
Exemplo n.º 3
0
Arquivo: members.py Projeto: zagy/karl
    def form_widgets(self, fields):
        default_icon = self.api.static_url + '/images/defaultUser.gif'
        system_name = get_setting(self.context, 'system_name', 'KARL')
        widgets = {
            'biography':
            karlwidgets.RichTextWidget(),
            'password':
            formish.Password(),
            'password_confirm':
            formish.Password(),
            'country':
            formish.SelectChoice(countries),
            'photo':
            karlwidgets.PhotoImageWidget(filestore=self.filestore,
                                         url_base=resource_url(
                                             self.context, self.request,
                                             'photo'),
                                         image_thumbnail_default=default_icon),
            'date_format':
            formish.SelectChoice(cultures),
            'websites':
            formish.TextArea(rows=3, converter_options={'delimiter': '\n'}),
        }

        r = queryMultiAdapter((self.context, self.request),
                              IInvitationBoilerplate)
        if r is None:
            r = DefaultInvitationBoilerplate(self.context)
        terms_text = r.terms_and_conditions
        if terms_text:
            widgets['terms_and_conditions'] = (karlwidgets.AcceptFieldWidget(
                terms_text, 'the %s Terms and Conditions' % system_name))
        privacy_text = r.privacy_statement
        if privacy_text:
            widgets['accept_privacy_policy'] = (karlwidgets.AcceptFieldWidget(
                privacy_text, 'the %s Privacy Policy' % system_name))
        return widgets