summaryrefslogtreecommitdiffstats
path: root/askbot/conf/skin_general_settings.py
blob: f14b373382d4b74f1c98b889fb06c40b4d7d8176 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
"""
General skin settings
"""
from askbot.conf.settings_wrapper import settings
from askbot.deps.livesettings import ConfigurationGroup
from askbot.deps.livesettings import values
from django.utils.translation import ugettext_lazy as _
from django.conf import settings as django_settings
from askbot.skins import utils as skin_utils
from askbot import const
from askbot.conf.super_groups import CONTENT_AND_UI

GENERAL_SKIN_SETTINGS = ConfigurationGroup(
                    'GENERAL_SKIN_SETTINGS',
                    _('Skin, logos and HTML <head> parts'),
                    super_group = CONTENT_AND_UI
                )

settings.register(
    values.ImageValue(
        GENERAL_SKIN_SETTINGS,
        'SITE_LOGO_URL',
        description = _('Q&A site logo'),
        help_text = _(
                        'To change the logo, select new file, '
                        'then submit this whole form.'
                    ),
        default = '/images/logo.gif',
        url_resolver = skin_utils.get_media_url
    )
)

LANGUAGE_CHOICES = (
            ('en', _("English")),
            ('es', _("Spanish")),
            ('ca', _("Catalan")),
            ('de', _("German")),
            ('el', _("Greek")),
            ('fi', _("Finnish")),
            ('fr', _("French")),
            ('hi', _("Hindi")),
            ('hu', _("Hungarian")),
            ('it', _("Italian")),
            ('ja', _("Japanese")),
            ('ko', _("Korean")),
            ('pt', _("Portuguese")),
            ('pt_BR', _("Brazilian Portuguese")),
            ('ro', _("Romanian")),
            ('ru', _("Russian")),
            ('sr', _("Serbian")),
            ('tr', _("Turkish")),
            ('vi', _("Vietnamese")),
            ('zh_CN', _("Chinese")),
            ('zh_TW', _("Chinese (Taiwan)")),
        )

"""
settings.register(
    values.StringValue(
        GENERAL_SKIN_SETTINGS,
        'ASKBOT_LANGUAGE',
        default = 'en',
        choices =  LANGUAGE_CHOICES,
        description = _('Select Language'),
    )
)
"""

settings.register(
    values.BooleanValue(
        GENERAL_SKIN_SETTINGS,
        'SHOW_LOGO',
        description = _('Show logo'),
        help_text = _(
                        'Check if you want to show logo in the forum header '
                        'or uncheck in the case you do not want the logo to '
                        'appear in the default location'
                    ),
        default = False
    )
)

settings.register(
    values.ImageValue(
        GENERAL_SKIN_SETTINGS,
        'SITE_FAVICON',
        description = _('Site favicon'),
        help_text = _(
                        'A small 16x16 or 32x32 pixel icon image '
                        'used to distinguish your site in the browser '
                        'user interface. Please find more information '
                        'about favicon '
                        'at <a href="%(favicon_info_url)s">this page</a>.'
                    ) % {'favicon_info_url': const.DEPENDENCY_URLS['favicon']},
        allowed_file_extensions = ('ico',),#only allow .ico files
        default = '/images/favicon.gif',
        url_resolver = skin_utils.get_media_url
    )
)

settings.register(
    values.ImageValue(
        GENERAL_SKIN_SETTINGS,
        'LOCAL_LOGIN_ICON',
        description = _('Password login button'),
        help_text = _(
                        'An 88x38 pixel image that is used on the login screen '
                        'for the password login button.'
                    ),
        default = '/images/pw-login.gif',
        url_resolver = skin_utils.get_media_url
    )
)

settings.register(
    values.BooleanValue(
        GENERAL_SKIN_SETTINGS,
        'ALWAYS_SHOW_ALL_UI_FUNCTIONS',
        default = False,
        description = _('Show all UI functions to all users'),
        help_text = _(
                        'If checked, all forum functions '
                        'will be shown to users, regardless of their '
                        'reputation. However to use those functions, '
                        'moderation rules, reputation and other limits '
                        'will still apply.'
                    )
    )
)

settings.register(
    values.StringValue(
        GENERAL_SKIN_SETTINGS,
        'ASKBOT_DEFAULT_SKIN',
        default = 'default',
        choices = skin_utils.get_skin_choices(),
        description = _('Select skin'),
    )
)



settings.register(
    values.BooleanValue(
        GENERAL_SKIN_SETTINGS,
        'USE_CUSTOM_HTML_HEAD',
        default = False,
        description = _('Customize HTML <HEAD>')
    )
)

settings.register(
    values.LongStringValue(
        GENERAL_SKIN_SETTINGS,
        'CUSTOM_HTML_HEAD',
        default = '',
        description = _('Custom portion of the HTML <HEAD>'),
        help_text = _(
                    '<strong>To use this option</strong>, '
                    'check "Customize HTML &lt;HEAD&gt;" '
                    'above. Contents of this box will be inserted '
                    'into the &lt;HEAD&gt; portion of the HTML '
                    'output, where elements such as &lt;script&gt;, '
                    '&lt;link&gt;, &lt;meta&gt; may be added. '
                    'Please, keep in mind that adding external '
                    'javascript to the &lt;HEAD&gt; is not recommended '
                    'because it slows loading of the pages. '
                    'Instead, it will be more efficient to place '
                    'links to the javascript files into the footer. '
                    '<strong>Note:</strong> if you do use this setting, '
                    'please test the site with the W3C HTML validator service.'
                    )
    )
)

settings.register(
    values.LongStringValue(
        GENERAL_SKIN_SETTINGS,
        'CUSTOM_HEADER',
        default = '',
        description = _('Custom header additions'),
        help_text = _(
                    'Header is the bar at the top of the content '
                    'that contains user info and site links, '
                    'and is common to all pages. '
                    'Use this area to enter contents of the header'
                    'in the HTML format.   When customizing the site header '
                    '(as well as footer and the HTML &lt;HEAD&gt;), '
                    'use the HTML validation service to make sure that '
                    'your input is valid and works well in all browsers.'
                    )
    )
)

settings.register(
    values.StringValue( GENERAL_SKIN_SETTINGS,
        'FOOTER_MODE',
        description = _('Site footer mode'),
        help_text = _(
                    'Footer is the bottom portion of the content, '
                    'which is common to all pages. '
                    'You can disable, customize, or use the default footer.'
                ),
        choices = (
                    ('default', 'default'),
                    ('customize', 'customize'),
                    ('disable', 'disable')
                ),
        default = 'default',
    )
)

settings.register(
    values.LongStringValue(
        GENERAL_SKIN_SETTINGS,
        'CUSTOM_FOOTER',
        description = _('Custom footer (HTML format)'),
        help_text = _(
                    '<strong>To enable this function</strong>, please select '
                    'option \'customize\' in the "Site footer mode" above. '
                    'Use this area to enter contents of the footer '
                    'in the HTML format. When customizing the site footer '
                    '(as well as the header and HTML &lt;HEAD&gt;), '
                    'use the HTML validation service to make sure that '
                    'your input is valid and works well in all browsers.'
                    )
    )
)

settings.register(
    values.BooleanValue(
        GENERAL_SKIN_SETTINGS,
        'USE_CUSTOM_CSS',
        description = _('Apply custom style sheet (CSS)'),
        help_text = _(
                    'Check if you want to change appearance '
                    'of your form by adding custom style sheet rules '
                    '(please see the next item)'
                    ),
        default = False
    )
)

settings.register(
    values.LongStringValue(
        GENERAL_SKIN_SETTINGS,
        'CUSTOM_CSS',
        description = _('Custom style sheet (CSS)'),
        help_text = _(
                    '<strong>To use this function</strong>, check '
                    '"Apply custom style sheet" option above. '
                    'The CSS rules added in this window will be applied '
                    'after the default style sheet rules. '
                    'The custom style sheet will be served dynamically at '
                    'url "&lt;forum url&gt;/custom.css", where '
                    'the "&lt;forum url&gt; part depends (default is '
                    'empty string) on the url configuration in your urls.py.'
                    )
    )
)

settings.register(
    values.BooleanValue(
        GENERAL_SKIN_SETTINGS,
        'USE_CUSTOM_JS',
        description = _('Add custom javascript'),
        default = False,
        help_text = _(
            'Check to enable javascript that you can enter '
            'in the next field'
        )
    )
)

settings.register(
    values.LongStringValue(
        GENERAL_SKIN_SETTINGS,
        'CUSTOM_JS',
        description = _('Custom javascript'),
        help_text = _(
            'Type or paste plain javascript that you would like '
            'to run on your site. Link to the script will be inserted '
            'at the bottom of the HTML output and will be served '
            'at the url "&lt;forum url&gt;/custom.js". Please, '
            'bear in mind that your javascript code may break other '
            'functionalities of the site and that the behavior may '
            'not be consistent across different browsers '
            '(<strong>to enable your custom code</strong>, check '
            '"Add custom javascript" option above).'
        )
    )
)

settings.register(
    values.IntegerValue(
        GENERAL_SKIN_SETTINGS,
        'MEDIA_RESOURCE_REVISION',
        default = 1,
        description = _('Skin media revision number'),
        help_text = _(
            'Will be set automatically '
            'but you can modify it if necessary.'
       )
    )
)

settings.register(
    values.StringValue(
        GENERAL_SKIN_SETTINGS,
        'MEDIA_RESOURCE_REVISION_HASH',
        description = _(
            'Hash to update the media revision number automatically.'
        ),
        default='',
        help_text = _(
            'Will be set automatically, it is not necesary to modify manually.'
        )
    )
)