Esempio n. 1
0
class CommentsForm(ListForm):
    template = 'admin/box-form.html'
    id = 'settings-form'
    css_class = 'form'
    submit_text = None

    fields = [
       RadioButtonList('comments_engine',
            label_text=N_('Comment Engine'),
            options=comments_enable_disable,
            validator=comments_enable_validator,
        ),
        ListFieldSet('builtin', suppress_label=True, legend=N_('Built-in Comments:'), css_classes=['details_fieldset'], children=[

            CheckBox('req_comment_approval',
                label_text=N_('Moderation'),
                help_text=N_('Require comments to be approved by an admin'),
                css_classes=['checkbox-inline-help'],
                validator=Bool(if_missing='')),
            TextField('akismet_key', label_text=N_('Akismet Key')),
            TextField('akismet_url', label_text=N_('Akismet URL')),
            TextArea('vulgarity_filtered_words', label_text=N_('Filtered Words'),
                attrs=dict(rows=3, cols=15),
                help_text=N_('Enter words to be filtered separated by a comma.')),
        ]),
        ListFieldSet('facebook', suppress_label=True, legend=N_('Facebook Comments:'), css_classes=['details_fieldset'], children=[
            TextField('facebook_appid', label_text=N_('Application ID'),
                help_text=N_('See: http://www.facebook.com/developers/createapp.php')),
        ]),
        SubmitButton('save', default=N_('Save'), css_classes=['btn', 'btn-save', 'blue', 'f-rgt']),
    ]
Esempio n. 2
0
class SiteMapsForm(ListForm):
    template = 'admin/box-form.html'
    id = 'settings-form'
    css_class = 'form'
    submit_text = None

    event = events.Admin.Settings.SiteMapsForm

    fields = [
        ListFieldSet('rss',
                     suppress_label=True,
                     legend='',
                     css_classes=['details_fieldset'],
                     children=[
                         CheckBox('sitemaps_display',
                                  css_classes=['checkbox-left'],
                                  label_text=N_('Site Maps'),
                                  validator=Bool(if_missing='')),
                         CheckBox('rss_display',
                                  css_classes=['checkbox-left'],
                                  label_text=N_('RSS Feeds'),
                                  validator=Bool(if_missing='')),
                     ]),
        ListFieldSet(
            'feeds',
            suppress_label=True,
            css_classes=['details_fieldset'],
            legend=N_('RSS Feed Defaults:'),
            children=[
                TextField(
                    u'default_feed_results',
                    validator=Int(not_empty=True, min=1, if_missing=30),
                    label_text=N_(u'number of items'),
                    help_text=N_(
                        u'The number of items in the feed can be overriden per request '
                        U'if you add "?limit=X" to the feed URL. If the "limit" parameter '
                        u'is absent, the default above is used.'),
                ),
            ]),
        SubmitButton('save',
                     default=N_('Save'),
                     css_classes=['btn', 'btn-save', 'blue', 'f-rgt']),
    ]
Esempio n. 3
0
class SiteMapsForm(ListForm):
    template = 'admin/box-form.html'
    id = 'settings-form'
    css_class = 'form'
    submit_text = None
    fields = [
        ListFieldSet('rss', suppress_label=True,
            legend='',
            css_classes=['details_fieldset'],
            children=[
                CheckBox('sitemaps_display',
                    css_classes=['checkbox-left'],
                    label_text=N_('Site Maps'),
                    validator=Bool(if_missing='')),
                CheckBox('rss_display',
                    css_classes=['checkbox-left'],
                    label_text=N_('RSS Feeds'),
                    validator=Bool(if_missing='')),
            ]
        ),
        SubmitButton('save', default=N_('Save'), css_classes=['btn', 'btn-save', 'blue', 'f-rgt']),
    ]
Esempio n. 4
0
class AppearanceForm(ListForm):
    template = 'admin/box-form.html'
    id = 'settings-form'
    css_class = 'form'
    submit_text = None
    fields = [
        ListFieldSet('general', suppress_label=True, legend=N_('General'),
            css_classes=['details_fieldset'],
            children=[
                FileField('appearance_logo', label_text=N_('Logo'),
                    validator=FieldStorageUploadConverter(not_empty=False,
                        label_text=N_('Upload Logo')),
                    css_classes=[],
                    default=lambda: app_globals.settings.get('appearance_logo', \
                                                             'logo.png'),
                    template='./admin/settings/appearance_input_field.html'),
                FileField('appearance_background_image', label_text=N_('Background Image'),
                    validator=FieldStorageUploadConverter(not_empty=False,
                        label_text=N_('Upload Background')),
                    css_classes=[],
                    default=lambda: app_globals.settings.get('appearance_background_image', \
                                                             'bg_image.png'),
                    template='./admin/settings/appearance_input_field.html'),
                TextField('appearance_background_color', maxlength=255,
                    label_text=N_('Background color'),
                    validator=Regex(hex_validation_regex, strip=True)),
                TextField('appearance_link_color', maxlength=255,
                    label_text=N_('Link color'),
                    validator=Regex(hex_validation_regex, strip=True)),
                TextField('appearance_visited_link_color', maxlength=255,
                    label_text=N_('Visited Link color'),
                    validator=Regex(hex_validation_regex, strip=True)),
                TextField('appearance_text_color', maxlength=255,
                    validator=Regex(hex_validation_regex, strip=True),
                    label_text=N_('Text color')),
                TextField('appearance_heading_color', maxlength=255,
                    label_text=N_('Heading color'),
                    validator=Regex(hex_validation_regex, strip=True)),
                SingleSelectField('appearance_navigation_bar_color',
                    label_text=N_('Color Scheme'),
                    options=navbar_colors),
            ]
        ),
        ListFieldSet('options', suppress_label=True, legend=N_('Options'),
            css_classes=['details_fieldset'],
            children=[
                CheckBox('appearance_enable_cooliris',
                    css_classes=['checkbox-left'],
                    label_text=N_('Enable Cooliris on the Explore Page'),
                    validator=Bool(if_missing='')),
                CheckBox('appearance_enable_featured_items',
                    label_text=N_('Enable Featured Items on the Explore Page'),
                    css_classes=['checkbox-left'],
                    validator=Bool(if_missing='')),
                CheckBox('appearance_enable_podcast_tab',
                    label_text=N_('Enable Podcast Tab'),
                    css_classes=['checkbox-left'],
                    validator=Bool(if_missing='')),
                CheckBox('appearance_enable_user_uploads',
                    label_text=N_('Enable User Uploads'),
                    css_classes=['checkbox-left'],
                    validator=Bool(if_missing='')),
                CheckBox('appearance_enable_widescreen_view',
                    label_text=N_('Enable widescreen media player by default'),
                    css_classes=['checkbox-left'],
                    validator=Bool(if_missing='')),
                CheckBox('appearance_display_logo',
                    label_text=N_('Display Logo'),
                    css_classes=['checkbox-left'],
                    validator=Bool(if_missing='')),
                CheckBox('appearance_display_background_image',
                    label_text=N_('Display Background Image'),
                    css_classes=['checkbox-left'],
                    validator=Bool(if_missing='')),
                CheckBox('appearance_display_mediacore_footer',
                    label_text=N_('Display MediaCore Footer'),
                    css_classes=['checkbox-left'],
                    validator=Bool(if_missing='')),
                CheckBox('appearance_display_mediacore_credits',
                    label_text=N_('Display MediaCore Credits in Footer'),
                    css_classes=['checkbox-left'],
                    validator=Bool(if_missing='')),
            ],
            template='./admin/settings/appearance_list_fieldset.html',
        ),
        ListFieldSet('advanced', suppress_label=True, legend=N_('Advanced'),
            css_classes=['details_fieldset'],
            children=[
                TextArea('appearance_custom_css',
                    label_text=N_('Custom CSS'),
                    attrs=dict(rows=15, cols=25)),
                TextArea('appearance_custom_header_html',
                    label_text=N_('Custom Header HTML'),
                    attrs=dict(rows=15, cols=25)),
                TextArea('appearance_custom_footer_html',
                    label_text=N_('Custom Footer HTML'),
                    attrs=dict(rows=15, cols=25)),
            ],
        ),
        SubmitButton('save', default=N_('Save'), css_classes=['btn', 'btn-save', 'blue', 'f-rgt']),
        SubmitButton('reset', default=N_('Reset to Defaults'),
            css_classes=['btn', 'btn-cancel', 'reset-confirm']),
    ]
Esempio n. 5
0
class SEOSettingsForm(ListForm):
    template = 'admin/box-form.html'
    id = 'settings-form'
    css_class = 'form'
    submit_text = None
    fields = [
        ListFieldSet(
            'general',
            suppress_label=True,
            legend=N_('General', domain='mediacore_seo'),
            css_classes=['details_fieldset'],
            children=[
                TextField(
                    'seo_general_meta_description',
                    label_text=N_('Site Meta Description',
                                  domain='mediacore_seo'),
                ),
                TextField(
                    'seo_general_meta_keywords',
                    label_text=N_('Site Meta Keywords',
                                  domain='mediacore_seo'),
                    help_text=N_('Comma Separated)', domain='mediacore_seo'),
                ),
            ],
        ),
        ListFieldSet(
            'explore',
            suppress_label=True,
            legend=N_('Explore Page', domain='mediacore_seo'),
            css_classes=['details_fieldset'],
            children=[
                TextField(
                    'seo_explore_page_title',
                    label_text=N_('Page Title', domain='mediacore_seo'),
                ),
                TextField(
                    'seo_explore_meta_description',
                    label_text=N_('Meta Description', domain='mediacore_seo'),
                ),
                TextField(
                    'seo_explore_meta_keywords',
                    label_text=N_('Meta Keywords', domain='mediacore_seo'),
                    help_text=N_('(Comma Separated)', domain='mediacore_seo'),
                )
            ],
        ),
        ListFieldSet(
            'podcast',
            suppress_label=True,
            legend=N_('Podcast Page', domain='mediacore_seo'),
            css_classes=['details_fieldset'],
            children=[
                TextField(
                    'seo_podcast_page_title',
                    label_text=N_('Page Title', domain='mediacore_seo'),
                ),
                TextField(
                    'seo_podcast_meta_description',
                    label_text=N_('Meta Description', domain='mediacore_seo'),
                ),
                TextField(
                    'seo_podcast_meta_keywords',
                    label_text=N_('Meta Keywords', domain='mediacore_seo'),
                    help_text=N_('(Comma Separated)', domain='mediacore_seo'),
                )
            ],
        ),
        ListFieldSet(
            'category',
            suppress_label=True,
            legend=N_('Category Page', domain='mediacore_seo'),
            css_classes=['details_fieldset'],
            children=[
                TextField(
                    'seo_category_page_title',
                    label_text=N_('Page Title', domain='mediacore_seo'),
                ),
                TextField(
                    'seo_category_meta_description',
                    label_text=N_('Meta Description', domain='mediacore_seo'),
                ),
                TextField(
                    'seo_category_meta_keywords',
                    label_text=N_('Meta Keywords', domain='mediacore_seo'),
                    help_text=N_('(Comma Separated)', domain='mediacore_seo'),
                )
            ],
        ),
        ListFieldSet(
            'upload',
            suppress_label=True,
            legend=N_('Upload Page', domain='mediacore_seo'),
            css_classes=['details_fieldset'],
            children=[
                TextField(
                    'seo_upload_page_title',
                    label_text=N_('Page Title', domain='mediacore_seo'),
                ),
                TextField(
                    'seo_upload_meta_description',
                    label_text=N_('Meta Description', domain='mediacore_seo'),
                ),
                TextField(
                    'seo_upload_meta_keywords',
                    label_text=N_('Meta Keywords', domain='mediacore_seo'),
                    help_text=N_('(Comma Separated)', domain='mediacore_seo'),
                )
            ],
        ),
        ListFieldSet(
            'options',
            suppress_label=True,
            legend=N_('Options', domain='mediacore_seo'),
            css_classes=['details_fieldset'],
            children=[
                CheckBox(
                    'seo_options_noindex_categories',
                    label_text=N_('Enable NOINDEX for Categories',
                                  domain='mediacore_seo'),
                    validator=Bool(if_missing=''),
                ),
                CheckBox(
                    'seo_options_noindex_rss',
                    label_text=N_('Enable NOINDEX for RSS',
                                  domain='mediacore_seo'),
                    validator=Bool(if_missing=''),
                ),
                # XXX: Argh toscawidgets will mark the fieldset as invalid (missing)
                #      when neither of the above checkboxes are checked, unless
                #      we ensure some 'options' value is always passed.
                HiddenField('dummy_field', default='1'),
            ],
        ),
        SubmitButton('save',
                     default=N_('Save', domain='mediacore_seo'),
                     named_button=True,
                     suppress_label=True,
                     css_classes=['btn', 'btn-save']),
    ]
Esempio n. 6
0
class AppearanceForm(ListForm):
    template = 'admin/box-form.html'
    id = 'settings-form'
    css_class = 'form'
    submit_text = None

    event = events.Admin.Settings.AppearanceForm

    fields = [
        ListFieldSet('general', suppress_label=True, legend=N_('General'),
            css_classes=['details_fieldset'],
            children=[
                FileField('appearance_logo', label_text=N_('Logo'),
                    validator=FieldStorageUploadConverter(not_empty=False,
                        label_text=N_('Upload Logo')),
                    css_classes=[],
                    default=lambda: request.settings.get('appearance_logo', \
                                                             'logo.png'),
                    template='./admin/settings/appearance_input_field.html'),
                FileField('appearance_background_image', label_text=N_('Background Image'),
                    validator=FieldStorageUploadConverter(not_empty=False,
                        label_text=N_('Upload Background')),
                    css_classes=[],
                    default=lambda: request.settings.get('appearance_background_image', \
                                                             'bg_image.png'),
                    template='./admin/settings/appearance_input_field.html'),
                TextField('appearance_background_color', maxlength=255,
                    label_text=N_('Background color'),
                    validator=Regex(hex_validation_regex, strip=True)),
                TextField('appearance_link_color', maxlength=255,
                    label_text=N_('Link color'),
                    validator=Regex(hex_validation_regex, strip=True)),
                TextField('appearance_visited_link_color', maxlength=255,
                    label_text=N_('Visited Link color'),
                    validator=Regex(hex_validation_regex, strip=True)),
                TextField('appearance_text_color', maxlength=255,
                    validator=Regex(hex_validation_regex, strip=True),
                    label_text=N_('Text color')),
                TextField('appearance_heading_color', maxlength=255,
                    label_text=N_('Heading color'),
                    validator=Regex(hex_validation_regex, strip=True)),
                SingleSelectField('appearance_navigation_bar_color',
                    label_text=N_('Color Scheme'),
                    options=navbar_colors),
            ]
        ),
        ListFieldSet('options', suppress_label=True, legend=N_('Options'),
            css_classes=['details_fieldset'],
            children=[
                CheckBox('appearance_enable_cooliris',
                    css_classes=['checkbox-left'],
                    label_text=N_('Enable Cooliris on the Explore Page'),
                    help_text=N_('Cooliris support is deprecated and will be ' + \
                        'removed in the next major version of MediaDrop ' + \
                        'unless someone is interested in maintaining it.'),
                    validator=Bool(if_missing='')),
                CheckBox(u'appearance_display_login',
                    css_classes=['checkbox-left'],
                    label_text=N_('Display login link for all users'),
                    validator=Bool(if_missing='')),
                CheckBox('appearance_enable_featured_items',
                    label_text=N_('Enable Featured Items on the Explore Page'),
                    css_classes=['checkbox-left'],
                    validator=Bool(if_missing='')),
                CheckBox('appearance_enable_podcast_tab',
                    label_text=N_('Enable Podcast Tab'),
                    css_classes=['checkbox-left'],
                    validator=Bool(if_missing='')),
                CheckBox('appearance_enable_user_uploads',
                    label_text=N_('Enable User Uploads'),
                    css_classes=['checkbox-left'],
                    validator=Bool(if_missing='')),
                CheckBox('appearance_enable_widescreen_view',
                    label_text=N_('Enable widescreen media player by default'),
                    css_classes=['checkbox-left'],
                    validator=Bool(if_missing='')),
                CheckBox('appearance_display_logo',
                    label_text=N_('Display Logo'),
                    css_classes=['checkbox-left'],
                    validator=Bool(if_missing='')),
                CheckBox('appearance_display_background_image',
                    label_text=N_('Display Background Image'),
                    css_classes=['checkbox-left'],
                    validator=Bool(if_missing='')),
                CheckBox('appearance_display_mediadrop_footer',
                    label_text=N_('Display MediaDrop Footer'),
                    css_classes=['checkbox-left'],
                    validator=Bool(if_missing='')),
                CheckBox('appearance_display_mediadrop_credits',
                    label_text=N_('Display MediaDrop Credits in Footer'),
                    css_classes=['checkbox-left'],
                    validator=Bool(if_missing='')),
            ],
            template='./admin/settings/appearance_list_fieldset.html',
        ),
        ListFieldSet('player', suppress_label=True, legend=N_('Player Menu Options'),
            css_classes=['details_fieldset'],
            children=[
                CheckBox('appearance_show_download',
                    css_classes=['checkbox-left'],
                    label_text=N_('Enable Download button on player menu bar.'),
                    validator=Bool(if_missing='')),
                CheckBox('appearance_show_share',
                    css_classes=['checkbox-left'],
                    label_text=N_('Enable Share button on player menu bar.'),
                    validator=Bool(if_missing='')),
                CheckBox('appearance_show_embed',
                    css_classes=['checkbox-left'],
                    label_text=N_('Enable Embed button on player menu bar.'),
                    validator=Bool(if_missing='')),
                CheckBox('appearance_show_widescreen',
                    css_classes=['checkbox-left'],
                    label_text=N_('Enable Widescreen toggle button on player menu bar.'),
                    validator=Bool(if_missing='')),
                CheckBox('appearance_show_popout',
                    css_classes=['checkbox-left'],
                    label_text=N_('Enable Popout button on player menu bar.'),
                    validator=Bool(if_missing='')),
                CheckBox('appearance_show_like',
                    css_classes=['checkbox-left'],
                    label_text=N_('Enable Like button on player menu bar.'),
                    validator=Bool(if_missing='')),
                CheckBox('appearance_show_dislike',
                    css_classes=['checkbox-left'],
                    label_text=N_('Enable Dislike button on player menu bar.'),
                    validator=Bool(if_missing='')),
            ],
            template='./admin/settings/appearance_list_fieldset.html',
        ),
        ListFieldSet('advanced', suppress_label=True, legend=N_('Advanced'),
            css_classes=['details_fieldset'],
            children=[
                TextArea('appearance_custom_css',
                    label_text=N_('Custom CSS'),
                    attrs=dict(rows=15, cols=25)),
                TextArea('appearance_custom_header_html',
                    label_text=N_('Custom Header HTML'),
                    attrs=dict(rows=15, cols=25)),
                TextArea('appearance_custom_footer_html',
                    label_text=N_('Custom Footer HTML'),
                    attrs=dict(rows=15, cols=25)),
                TextArea('appearance_custom_head_tags',
                    label_text=N_('Custom <head> Tags'),
                    help_text=N_('These HTML tags are inserted into the HTML '
                        '<head> section. Bad input can cause ugly rendering of '
                        'your site. You can always restore your page by '
                        'the box above.'),
                    attrs=dict(rows=15, cols=25)),
            ],
        ),
        SubmitButton('save', default=N_('Save'), css_classes=['btn', 'btn-save', 'blue', 'f-rgt']),
        SubmitButton('reset', default=N_('Reset to Defaults'),
            css_classes=['btn', 'btn-cancel', 'reset-confirm']),
    ]