| 1 | # -*- coding: utf-8 -*- |
|---|
| 2 | |
|---|
| 3 | #_____________________________________________________________________________ |
|---|
| 4 | # meta information |
|---|
| 5 | __author__ = "Jens Diemer" |
|---|
| 6 | __url__ = "http://www.PyLucid.org" |
|---|
| 7 | __description__ = \ |
|---|
| 8 | "File/Picture gallery (NOT USEABLE! UNDER CONSTRUCTION!)" |
|---|
| 9 | __long_description__ = """ |
|---|
| 10 | A universal file/picture gallery plugin. |
|---|
| 11 | """ |
|---|
| 12 | |
|---|
| 13 | from django import forms |
|---|
| 14 | from django.utils.translation import ugettext as _ |
|---|
| 15 | |
|---|
| 16 | from django.conf import settings |
|---|
| 17 | |
|---|
| 18 | #______________________________________________________________________________ |
|---|
| 19 | # Build a list and a dict from the basepaths |
|---|
| 20 | # The dict key is a string, not a integer. (GET/POST Data always returned |
|---|
| 21 | # numbers as strings) |
|---|
| 22 | |
|---|
| 23 | BASE_PATHS = [ |
|---|
| 24 | (str(no),unicode(path)) for no,path in enumerate(settings.FILEMANAGER_BASEPATHS) |
|---|
| 25 | ] |
|---|
| 26 | BASE_PATHS_DICT = dict(BASE_PATHS) |
|---|
| 27 | |
|---|
| 28 | #_____________________________________________________________________________ |
|---|
| 29 | # preferences |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | class PreferencesForm(forms.Form): |
|---|
| 33 | """ |
|---|
| 34 | Default settings for a new gallery. |
|---|
| 35 | Every gallery can have differend settings. These default values only used |
|---|
| 36 | if a new gallery would be created. After this you can edit the individual |
|---|
| 37 | gallery settings in the gallery themself. |
|---|
| 38 | """ |
|---|
| 39 | base_path = forms.ChoiceField( |
|---|
| 40 | initial = "0", # Use the first path in the BASE_PATHS choice list |
|---|
| 41 | choices = BASE_PATHS, |
|---|
| 42 | help_text = _( |
|---|
| 43 | "Index directory of the gallery." |
|---|
| 44 | " You can select a path from settings.FILEMANAGER_BASEPATHS" |
|---|
| 45 | ), |
|---|
| 46 | ) |
|---|
| 47 | |
|---|
| 48 | ext_whitelist = forms.CharField( |
|---|
| 49 | initial = ".jpg, .png, .mpg, .avi", |
|---|
| 50 | help_text = _("Witch filetypes should be included in the gallery?"), |
|---|
| 51 | ) |
|---|
| 52 | |
|---|
| 53 | dir_filter = forms.CharField( |
|---|
| 54 | initial = "", required=False, |
|---|
| 55 | help_text = _("Comma seperated list of direcories to skip."), |
|---|
| 56 | ) |
|---|
| 57 | file_filter = forms.CharField( |
|---|
| 58 | initial = "", required=False, |
|---|
| 59 | help_text = _("Comma seperated list of files to skip."), |
|---|
| 60 | ) |
|---|
| 61 | |
|---|
| 62 | allow_subdirs = forms.BooleanField( |
|---|
| 63 | initial = True, |
|---|
| 64 | help_text = _( |
|---|
| 65 | "include sub directories or hide them?" |
|---|
| 66 | ), |
|---|
| 67 | ) |
|---|
| 68 | |
|---|
| 69 | pic_ext = forms.CharField( |
|---|
| 70 | initial = ".jpg, .jpeg", |
|---|
| 71 | help_text = _( |
|---|
| 72 | "filetypes how displays as pictures and not as normal files?" |
|---|
| 73 | ), |
|---|
| 74 | ) |
|---|
| 75 | thumb_pic_filter = forms.CharField( |
|---|
| 76 | initial = "_WEB,_FULL,_BIG", |
|---|
| 77 | help_text = _( |
|---|
| 78 | "filename suffix for the pictures." |
|---|
| 79 | " (comma seperated list, spaces recognized!)" |
|---|
| 80 | ), |
|---|
| 81 | ) |
|---|
| 82 | thumb_suffix = forms.CharField( |
|---|
| 83 | initial = "_thumb,_small", |
|---|
| 84 | help_text = _( |
|---|
| 85 | "filename suffix for a thumbnail picture?" |
|---|
| 86 | " (comma seperated list, spaces recognized!)" |
|---|
| 87 | ), |
|---|
| 88 | ) |
|---|
| 89 | |
|---|
| 90 | default_thumb_width = forms.IntegerField( |
|---|
| 91 | initial = 100, |
|---|
| 92 | min_value = 10, |
|---|
| 93 | help_text = _( |
|---|
| 94 | "Default thumbnail width" |
|---|
| 95 | " (Scale picture, if no thumbnail exist)." |
|---|
| 96 | ), |
|---|
| 97 | ) |
|---|
| 98 | default_thumb_height = forms.IntegerField( |
|---|
| 99 | initial = 60, |
|---|
| 100 | min_value = 10, |
|---|
| 101 | help_text = _( |
|---|
| 102 | "Default thumbnail height" |
|---|
| 103 | " (Scale original picture, if no thumbnail exist)." |
|---|
| 104 | ), |
|---|
| 105 | ) |
|---|
| 106 | |
|---|
| 107 | robots = forms.CharField( |
|---|
| 108 | initial = "", |
|---|
| 109 | help_text = _( |
|---|
| 110 | "html meta information (e.g.: 'noindex,nofollow')" |
|---|
| 111 | " (If empty, used the default template robots entry)" |
|---|
| 112 | ), |
|---|
| 113 | required = False |
|---|
| 114 | ) |
|---|
| 115 | |
|---|
| 116 | verbose_level = forms.IntegerField( |
|---|
| 117 | initial = 0, min_value = 0, max_value = 3, |
|---|
| 118 | help_text = _( |
|---|
| 119 | "Display debug information (Only if a admin is logged in!)?" |
|---|
| 120 | ), |
|---|
| 121 | ) |
|---|
| 122 | |
|---|
| 123 | |
|---|
| 124 | |
|---|
| 125 | #_____________________________________________________________________________ |
|---|
| 126 | # plugin administration data |
|---|
| 127 | |
|---|
| 128 | plugin_manager_data = { |
|---|
| 129 | "lucidTag" : { |
|---|
| 130 | "must_login" : False, |
|---|
| 131 | "must_admin" : False, |
|---|
| 132 | }, |
|---|
| 133 | "admin": { |
|---|
| 134 | "must_login": True, |
|---|
| 135 | "must_admin": False, |
|---|
| 136 | "admin_sub_menu": { |
|---|
| 137 | "section" : _("multimedia"), # The sub menu section |
|---|
| 138 | "title" : _("gallery"), |
|---|
| 139 | "help_text" : _("Administrate the galleries."), |
|---|
| 140 | "open_in_window": False, # Should be create a new JavaScript window? |
|---|
| 141 | "weight" : 0, # sorting wieght for every section entry |
|---|
| 142 | }, |
|---|
| 143 | |
|---|
| 144 | }, |
|---|
| 145 | } |
|---|