コード例 #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']),
    ]
コード例 #2
0
class YoutubeFlashPlayerPrefsForm(PlayerPrefsForm):
    fields = [
        ListFieldSet('options',
            suppress_label=True,
            legend=N_('Player Options:'),
            children=[
                CheckBox('disablekb', label_text=N_('Disable the player keyboard controls.')),
                CheckBox('fs', label_text=N_('Enable fullscreen.')),
                CheckBox('hd', label_text=N_('Enable high-def quality by default.')),
                CheckBox('rel', label_text=N_('Allow the player to load related videos once playback of the initial video starts. Related videos are displayed in the "genie menu" when the menu button is pressed.')),
                CheckBox('showsearch', label_text=N_('Show the search box when the video is minimized. The above option must be enabled for this to work.')),
                CheckBox('showinfo', label_text=N_('Display information like the video title and rating before the video starts playing.')),
                CheckBox('autohide', label_text=N_('Autohide the controls after a video starts playng.')),
            ],
            css_classes=['options'],
        )
    ] + PlayerPrefsForm.buttons

    def display(self, value, player, **kwargs):
        newvalue = {}
        defaults = {'options': player.data}
        merge_dicts(newvalue, defaults, value)
        return PlayerPrefsForm.display(self, newvalue, player, **kwargs)

    def save_data(self, player, options, **kwargs):
        for field, value in options.iteritems():
            player.data[field] = int(value)
コード例 #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']),
    ]
コード例 #4
0
class ImportVideosForm(ListForm):
    template = 'admin/box-form.html'
    id = 'settings-form'
    css_class = 'form'
    submit_text = None
    fields = [
        ListFieldSet(
            'youtube',
            suppress_label=True,
            legend='',
            css_classes=['details_fieldset'],
            children=[
                TextArea(
                    'channel_names',
                    attrs=dict(rows=3, cols=20),
                    label_text=_('Channel Name(s)'),
                    help_text=
                    _('One or more channel names (separated by commas) to import. Please enter only the channel/user name, not the full URL. Please be aware that it may take several minutes for the import to complete. When all videos have been imported, you will be returned to the Media page to manage your new videos.'
                      ),
                    validator=NotEmpty),
                CheckBox(
                    'auto_publish',
                    label_text=_('Publish Videos'),
                    help_text=
                    _('When this is selected, videos are published automatically when they are imported. Otherwise the videos will be added, but will be waiting for review before being published.'
                      )),
                CategoryCheckBoxList('categories',
                                     label_text=_('Categories'),
                                     options=lambda: DBSession.query(
                                         Category.id, Category.name).all()),
                TextArea('tags',
                         label_text=_('Tags'),
                         attrs=dict(rows=3, cols=15),
                         help_text=_(u'e.g.: puppies, great dane, adorable')),
                SubmitButton('save',
                             default=_('Import'),
                             css_classes=['btn', 'btn-save', 'blue', 'f-rgt']),
            ])
    ]
コード例 #5
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']),
    ]
コード例 #6
0
ファイル: settings.py プロジェクト: MotorGrit/seo-plugin
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']),
    ]
コード例 #7
0
ファイル: players.py プロジェクト: z0x010/mediadrop
class YoutubePlayerPrefsForm(PlayerPrefsForm):
    event = events.Admin.Players.YoutubeFlashPlayerPrefsForm

    fields = [
        ListFieldSet(
            'options',
            suppress_label=True,
            legend=N_('Player Options:'),
            children=[
                RadioButtonList(
                    'version',
                    options=lambda: (
                        (2, _('Use the deprecated AS2 player.')),
                        (3, _('Use the AS3/HTML5 player.')),
                    ),
                    css_label_classes=['container-list-label'],
                    label_text=N_("YouTube player version"),
                    validator=Int,
                ),
                RadioButtonList(
                    'iv_load_policy',
                    options=lambda: (
                        (1, _('Show video annotations by default.')),
                        (3, _('Hide video annotations by default.')),
                    ),
                    css_label_classes=['container-list-label'],
                    label_text=N_("Video annotations"),
                    validator=Int,
                ),
                CheckBox(
                    'disablekb',
                    label_text=N_('Disable the player keyboard controls.'),
                    help_text=N_('Not supported by HTML5 player.')),
                CheckBox('autoplay',
                         label_text=N_(
                             'Autoplay the video when the player loads.')),
                CheckBox(
                    'modestbranding',
                    label_text=N_(
                        'Do not show YouTube logo in the player controls'),
                    help_text=N_('Not supported by AS2 player.')),
                CheckBox('fs', label_text=N_('Display fullscreen button.')),
                CheckBox(
                    'hd',
                    label_text=N_('Enable high-def quality by default.'),
                    help_text=N_(
                        'Applies only for the AS2 player, the AS3 player will choose the most appropriate version of the video version (e.g. considering the user\'s bandwidth)'
                    )),
                CheckBox(
                    'rel',
                    label_text=N_(
                        'Display related videos after playback of the initial video ends.'
                    )),
                CheckBox(
                    'showsearch',
                    label_text=N_(
                        'Show the search box when the video is minimized. The related videos option must be enabled for this to work.'
                    ),
                    help_text=N_('AS2 player only')),
                CheckBox(
                    'showinfo',
                    label_text=N_(
                        'Display information like the video title and uploader before the video starts playing.'
                    )),
                CheckBox(
                    'wmode',
                    label_text=N_('Enable window-less mode (wmode)'),
                    help_text=N_(
                        'wmode allows HTML/CSS elements to be placed over the actual Flash video but requires more CPU power.'
                    )),
                RadioButtonList(
                    'autohide',
                    options=lambda: (
                        (0, _('Always show player controls.')),
                        (1,
                         _('Autohide all player controls after a video starts playing.'
                           )),
                        (2,
                         _('Autohide only the progress bar after a video starts playing.'
                           )),
                    ),
                    css_label_classes=['container-list-label'],
                    label_text=N_("Player control hiding"),
                    validator=Int,
                ),
            ],
            css_classes=['options'],
        )
    ] + PlayerPrefsForm.buttons

    def display(self, value, player, **kwargs):
        newvalue = {}
        defaults = {'options': player.data}
        merge_dicts(newvalue, defaults, value)
        return PlayerPrefsForm.display(self, newvalue, player, **kwargs)

    def save_data(self, player, options, **kwargs):
        for field, value in options.iteritems():
            player.data[field] = int(value)