Updating editor metadata config
[redakcja.git] / apps / wiki / templates / wiki / bootstrap.html
1 {% load staticfiles %}
2 {% load i18n %}
3
4 <!DOCTYPE html>
5 <html>
6     <head>
7         {% if RAVEN_CONFIG %}
8             <script src="http://cdn.ravenjs.com/1.1.7/jquery,native/raven.min.js"></script>
9             <script>
10                 Raven.config('{{RAVEN_CONFIG.SENTRY_URL}}', {{RAVEN_CONFIG.SETTINGS|default:'{}'}}).install();
11                 {% if request.user.is_authenticated %}
12                     Raven.setUser({
13                         name: '{{request.user.username}}',
14                         email: '{{request.user.email}}',
15                         id: {{request.user.id}}
16                     });
17                 {% endif %}
18             </script>
19         {% endif %}
20         <script src="{% url 'django.views.i18n.javascript_catalog' %}"></script>
21         <script src="http://cdnjs.cloudflare.com/ajax/libs/ace/1.1.01/ace.js" type="text/javascript" charset="utf-8"></script>
22         
23         {% if DEBUG %}
24             <link rel="stylesheet/less" type="text/css" href="{% static 'wiki/editor/src/editor/styles/main.less' %}"/>
25             <script type="text/javascript">less = {relativeUrls: true};</script>
26             <script src="{% static 'wiki/editor/libs/less-1.3.3.min.js' %}"></script>
27             <script src="{% static 'wiki/editor/libs/require.js' %}" data-main="{% static 'wiki/editor/src/editor/entrypoint.js' %}" ></script>
28         {% else %}
29             <link href="{% static 'wiki/build/rng.css' %}" rel="stylesheet">
30             <script src="{% static 'wiki/build/rng.js' %}"></script>
31         {% endif %}
32     </head>
33     <body>
34         <script type="text/javascript">
35
36             var config = {
37                 rootSelector: '#editor_root',
38                 jsonifySentPayload: false,
39
40                 {% if request.user.is_authenticated %}
41                 user: {
42                     name: '{{request.user.username}}',
43                     email: '{{request.user.email}}',
44                     id: {{request.user.id}}
45                 },
46                 {% endif %}
47
48                 logging: {
49                     handlers: {
50                         'sentry': {
51                             level: 'info',
52                             handler: 'raven',
53                             formatter: 'noop'
54                         },
55                         'console': {
56                             level: 'debug',
57                             handler: 'console'
58                         }
59                     },
60                     loggers: {
61                         '': {
62                             level: 'debug',
63                             handlers: ['sentry', 'console']
64                         }
65                     }
66                 },
67               
68                 metadata: [
69                     {key: 'audience', values: [
70                         'Wych. przedszkolne',
71                         'Szkoła podstawowa 1-3',
72                         'Szkoła podstawowa 4-6',
73                         'Gimnazjum',
74                         'Szkoła ponadgimnazjalna',
75                         'Szkolnictwo wyższe',
76                         'Poziom minimum',
77                         'Poziom optimum',
78                         'Poziom mistrzowski'
79                     ]},
80                     {key: 'creator.scenario'},
81                     {key: 'creator.methodologist'},
82                     {key: 'description'},
83                     {key: 'type', values: ['cource', 'synthetic', 'project']},
84                     {key: 'subject.curriculum', values: [
85                         '2012/III/ETYKA/c4',
86                         '2012/III/ETYKA/t5',
87                         '2012/III/ETYKA/t9',
88                         '2012/III/ETYKA/t11',
89                         '2012/IV/WOS/c4',
90                         '2012/IV/WOS/c6',
91                         '2012/IV/WOS/t1',
92                         '2012/IV/WOS/t2',
93                         '2012/IV/WOS/t5',
94                         '2012/IV/INFORMATYKA/c5',
95                         '2012/II/POLSKI/C3',
96                         '2012/II/POLSKI/C2',
97                         '2012/II/POLSKI/C1',
98                         '2012/II/PLASTYKA/C1',
99                         '2012/II/PLASTYKA/C2',
100                         '2012/II/PLASTYKA/C3',
101                         '2012/II/ETYKA/C4',
102                         '2012/IV/WOS/c6/roz',
103                         '2012/II/WYCHOWANIE_DO_ZYCIA_W_RODZINIE/T11',
104                         '2012/II/POLSKI/T3',
105                         '2012/II/POLSKI/T5',
106                         '2012/II/POLSKI/T4',
107                         '2012/II/POLSKI/T7',
108                         '2012/II/POLSKI/T9',
109                         '2012/II/POLSKI/T10',
110                         '2012/II/POLSKI/T11',
111                         '2012/II/POLSKI/T12',
112                         '2012/II/POLSKI/T13',
113                         '2012/II/POLSKI/T14',
114                         '2012/II/POLSKI/T15',
115                         '2012/II/POLSKI/T16',
116                         '2012/II/POLSKI/T17',
117                         '2012/II/POLSKI/T18',
118                         '2012/II/PLASTYKA/T1',
119                         '2012/II/PLASTYKA/T2',
120                         '2012/II/PLASTYKA/T3',
121                         '2012/II/POLSKI/T6',
122                         '2012/II/ZAJECIA_KOMPUTEROWE/T6',
123                         '2012/II/ZAJECIA_KOMPUTEROWE/T7',
124                         '2012/II/POLSKI/t1',
125                         '2012/II/ZAJECIA_KOMPUTEROWE/T4',
126                         '2012/II/WYCHOWANIE_DO_ZYCIA_W_RODZINIE/T13',
127                         '2012/II/WYCHOWANIE_DO_ZYCIA_W_RODZINIE/T10',
128                         '2012/IV/WOS/t3',
129                         '2012/IV/WOS/t2/roz',
130                         '2012/IV/INFORMATYKA/t1',
131                         '2012/IV/INFORMATYKA/t7',
132                         '2012/IV/ETYKA/c2',
133                         '2012/IV/ETYKA/t4',
134                         '2012/IV/WOS/t8/roz',
135                         '2012/IV/WOS/c3',
136                         '2012/IV/ETYKA/c1',
137                         '2012/III/POLSKI/c1',
138                         '2012/III/POLSKI/c2',
139                         '2012/III/POLSKI/c3',
140                         '2012/III/PLASTYKA/c1',
141                         '2012/III/PLASTYKA/c2',
142                         '2012/III/PLASTYKA/c3',
143                         '2012/III/WOS/c1',
144                         '2012/III/WOS/c2',
145                         '2012/III/WOS/c3',
146                         '2012/III/WOS/c4',
147                         '2012/III/WOS/c5',
148                         '2012/III/WOS/t1',
149                         '2012/III/WOS/t2',
150                         '2012/III/WOS/t3',
151                         '2012/III/WOS/t4',
152                         '2012/III/WOS/t5',
153                         '2012/III/WOS/t6',
154                         '2012/III/WOS/t9',
155                         '2012/III/WOS/t10',
156                         '2012/III/WOS/t11',
157                         '2012/III/WOS/t24',
158                         '2012/III/WOS/t25',
159                         '2012/III/WOS/t26',
160                         '2012/III/INFORMATYKA/c1',
161                         '2012/III/INFORMATYKA/c2',
162                         '2012/III/INFORMATYKA/c5',
163                         '2012/III/ETYKA/c1',
164                         '2012/III/ETYKA/t1',
165                         '2012/IV/INFORMATYKA/c2',
166                         '2012/IV/INFORMATYKA/c4',
167                         '2012/IV/INFORMATYKA/t2',
168                         '2012/IV/INFORMATYKA/t3',
169                         '2012/IV/INFORMATYKA/t4',
170                         '2012/IV/POLSKI/c1',
171                         '2012/IV/POLSKI/c2',
172                         '2012/IV/POLSKI/c3',
173                         '2012/IV/INFORMATYKA/c2',
174                         '2012/IV/INFORMATYKA/c4',
175                         '2012/IV/INFORMATYKA/t2',
176                         '2012/IV/INFORMATYKA/t3',
177                         '2012/IV/INFORMATYKA/t4',
178                         '2012/IV/POLSKI/c1',
179                         '2012/IV/POLSKI/c2',
180                         '2012/IV/POLSKI/c3',
181                         '2012/IV/WOK/c1',
182                         '2012/IV/WOK/c2',
183                         '2012/IV/WOK/c3',
184                         '2012/IV/ETYKA/t11',
185                         '2012/IV/WOS/c1',
186                         '2012/IV/WOS/t13/roz',
187                         '2012/IV/WOS/c2',
188                         '2012/IV/ETYKA/t6',
189                         '2012/IV/ETYKA/t8',
190                         '2012/II/ZAJECIA_KOMPUTEROWE/c1',
191                         '2012/II/ZAJECIA_KOMPUTEROWE/c2',
192                         '2012/II/ZAJECIA_KOMPUTEROWE/c3',
193                         '2012/II/ZAJECIA_KOMPUTEROWE/c5',
194                         '2012/II/HISTORIA_I_SPOLECZENSTWO/c4',
195                         '2012/II/HISTORIA_I_SPOLECZENSTWO/t1',
196                         '2012/II/HISTORIA_I_SPOLECZENSTWO/t4',
197                         '2012/II/HISTORIA_I_SPOLECZENSTWO/t5',
198                         '2012/II/ETYKA/c1',
199                         '2012/II/ETYKA/c3',
200                         '2012/II/ETYKA/c5',
201                         '2012/II/ETYKA/t2',
202                         '2012/II/ETYKA/t3',
203                         '2012/II/ETYKA/t4',
204                         '2012/II/ETYKA/t5',
205                         '2012/II/ETYKA/t6',
206                         '2012/II/ETYKA/t7',
207                         '2012/IV/WOS/t6',
208                         '2012/IV/WOS/t10/roz',
209                         '2012/IV/WOS/t14/roz',
210                         '2012/IV/WOS/t15/roz',
211                         '2012/IV/WOS/t27/roz',
212                         '2012/IV/WOS/t32/roz',
213                         '2012/IV/WOS/t36/roz',
214                         '2012/IV/INFORMATYKA/c1',
215                         '2012/II/HISTORIA_I_SPOLECZENSTWO/t7'
216                     ]},
217                     {key: 'subject.competence', values: [
218                         'Źródła informacji',
219                         'Wyszukiwanie informacji',
220                         'Podejście krytyczne do informacji',
221                         'Wykorzystanie informacji',
222                         'Komunikacja',
223                         'Otoczenie',
224                         'Wizerunek',
225                         'Kultura komunikacji medialnej',
226                         'Funkcje komunikatów medialnych',
227                         'Językowa natura mediów',
228                         'Tworzenie',
229                         'Przetwarzanie',
230                         'Prezentowanie',
231                         'Wyzwania etyczne a normy prawa w mediach i komunikacji',
232                         'Wyzwania etyczne a treści mediów i komunikacji',
233                         'Komunikacja i media jako przedmiot refleksji etycznej',
234                         'Wyzwania etyczne w relacjach przez media',
235                         'Bezpieczeństwo komunikacji, pracy i transakcji',
236                         'Uzależnienia i higiena korzystania z mediów',
237                         'Anonimowość',
238                         'Ochrona prywatności i wizerunku',
239                         'Nadzór nad siecią',
240                         'Rodzaje, źródła i praktyka stosowania prawa w kontekście mediów',
241                         'Prawa osób niepełnosprawnych',
242                         'Prawo mediów i media publiczne',
243                         'Ochrona danych osobowych',
244                         'Prawa wyłączne i monopole intelektualne',
245                         'Prawo telekomunikacyjne',
246                         'Media a prawa człowieka, obywatela i dziecka',
247                         'Rynek mediów',
248                         'Informacja jako dobro ekonomiczne',
249                         'Finansowanie mediów i wybrane sposoby zarabiania w nowych mediach'
250                     ]}
251                 ],
252
253                 documentSummaryView: {
254                     title: '{% trans 'Informations about lesson' %}',
255                     properties: [
256                         {name: 'stage', label: '{% trans 'Stage' %}'},
257                         {name: 'assignment', label: '{% trans 'Assignment' %}'}
258                     ]
259                 },
260                 
261                 documentSaveUrl: function(id) { return '/editor/text/' + id + '/'; },
262                 documentHistoryUrl: function(id) { return '/editor/history/' + id + '/'},
263                 documentDiffUrl: function(id) { return '/editor/diff/' + id + '/'; },
264                 documentRestoreUrl: function(id) { return '/editor/revert/' + id + '/'},
265
266                 documentSaveForm: {
267                     fields: [
268                         {label: '{{forms.text_save.comment.label}}', name: '{{forms.text_save.comment.html_name}}', type: 'textarea'},
269                         {label: '{{forms.text_save.stage_completed.label}}', name: '{{forms.text_save.stage_completed.html_name}}', type: 'select', options: [
270                             {% for value,text in tags %}
271                                 {value:'{{value|default:''}}', text:'{{text}}'} {% if not forloop.last %}, {% endif %}
272                             {% endfor %}
273                         ], description: '{{forms.text_save.stage_completed.help_text}}'},
274                     ],
275                     content_field_name: '{{forms.text_save.text.html_name}}',
276                     version_field_name: '{{forms.text_save.parent_revision.html_name}}'
277                 },
278
279                 documentRestoreForm: {
280                     fields: [
281                         {label: '{{forms.text_revert.comment.label}}', name: '{{forms.text_revert.comment.html_name}}', type: 'textarea'}
282                     ],
283                     version_field_name: '{{forms.text_revert.revision.html_name}}'
284                 }
285             };
286
287             {% if can_pubmark %}
288                 config.documentSaveForm.fields.push(
289                     {label: '{{forms.text_save.publishable.label}}', name: '{{forms.text_save.publishable.html_name}}', type: 'checkbox', description: '{{forms.text_save.publishable.help_text}}'}
290                 );
291             {% endif %}
292
293             {% if not request.user.is_authenticated %}
294                 config.documentSaveForm.fields.push(
295                     {label: '{{forms.text_save.author_name.label}}', name: '{{forms.text_save.author_name.html_name}}', type: 'input', description: '{{forms.text_save.author_name.help_text}}'},
296                     {label: '{{forms.text_save.author_email.label}}', name: '{{forms.text_save.author_email.html_name}}', type: 'input', description: '{{forms.text_save.author_email.help_text}}'}
297                 );
298
299                 config.documentRestoreForm.fields.push(
300                     {label: '{{forms.text_revert.author_name.label}}', name: '{{forms.text_revert.author_name.html_name}}', type: 'input', description: '{{forms.text_revert.author_name.help_text}}'},
301                     {label: '{{forms.text_revert.author_email.label}}', name: '{{forms.text_revert.author_email.html_name}}', type: 'input', description: '{{forms.text_revert.author_email.help_text}}'}
302                 );
303             {% endif %}
304
305             {% autoescape off%}
306             var data = {{serialized_document_data}},
307                 templates = {{serialized_templates}}
308             {%endautoescape%}
309
310             var editor_init = function(Editor) {            
311                 Editor.setBootstrappedData('data', data);
312                 Editor.setBootstrappedData('documentToolbar', templates);
313                 Editor.start(config);
314             };
315         </script>
316         <div id="editor_root"></div>
317     </body>
318 </html>