Bug 30288: Provide links to OPACUserJS and OPACUserCSS in tools
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / additional-contents.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [% USE Branches %]
6 [% SET footerjs = 1 %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Additional contents &rsaquo; Tools &rsaquo; Koha</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 [% IF ( wysiwyg ) %]
11     [% SET editmode = "wysiwyg" %]
12 [% ELSE %]
13     [% SET editmode = "text" %]
14     [% Asset.css("lib/codemirror/codemirror.css") | $raw %]
15     [% Asset.css("lib/codemirror/lint.min.css") | $raw %]
16     <style>
17         .CodeMirror {
18             resize: vertical;
19             z-index: 0;
20         }
21     </style>
22 [% END %]
23 </head>
24
25 <body id="tools_additional-contents" class="tools">
26 [% INCLUDE 'header.inc' %]
27 [% INCLUDE 'cat-search.inc' %]
28
29 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
30     <ol>
31         <li>
32             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
33         </li>
34         <li>
35             <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
36         </li>
37
38         [% IF op == 'add_form' %]
39             <li>
40                 [% IF category == 'news' %]
41                     <a href="/cgi-bin/koha/tools/additional-contents.pl?category=news">News</a>
42                 [% ELSE %]
43                     <a href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations">HTML customizations</a>
44                 [% END %]
45             </li>
46             <li>
47                 <a href="#" aria-current="page">
48                     [% IF additional_content.idnew %]
49                         <span>Modify additional content</span>
50                     [% ELSE %]
51                         <span>Add additional content</span>
52                     [% END %]
53                     ([% IF category == 'news' %]<span>News</span>[% ELSE %]<span>HTML customizations</span>[% END %])
54                 </a>
55             </li>
56         [% ELSE %]
57             <li>
58                 <a href="#" aria-current="page">
59                     [% IF category == 'news' %]
60                         News
61                     [% ELSE %]
62                         HTML customizations
63                     [% END %]
64                 </a>
65             </li>
66         [% END %]
67
68     </ol>
69 </nav>
70
71 [% IF op == 'add_form' %]
72 <div class="main container-fluid">
73     <div class="row">
74         <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
75 [% ELSE %]
76 <div class="main container-fluid">
77     <div class="row">
78         <div class="col-sm-10 col-sm-push-2">
79 [% END %]
80
81 <main>
82
83     [% FOR m IN messages %]
84         <div class="dialog [% m.type | html %]">
85             [% SWITCH m.code %]
86             [% CASE 'error_on_update' %]
87                 <span>An error occurred when updating this content. Perhaps it already exists</span>
88             [% CASE 'error_on_insert' %]
89                 <span>An error occurred when adding this content. Check the logs</span>
90             [% CASE 'error_on_delete' %]
91                 <span>An error occurred when deleting this content. Check the logs</span>
92             [% CASE 'success_on_update' %]
93                 <span>Content updated successfully</span>
94             [% CASE 'success_on_insert' %]
95                 <span>Content added successfully</span>
96             [% CASE 'success_on_delete' %]
97                 <span>Content deleted successfully</span>
98             [% CASE %]
99                 <span>[% m.code | html %]</span>
100             [% END %]
101         </div>
102     [% END %]
103
104     [% IF op == 'add_form' %]
105         [% PROCESS add_form %]
106     [% ELSE %]
107         [% PROCESS list %]
108     [% END %]
109
110 </main>
111
112         [% IF op != 'add_form' %]
113             </div> <!-- /.col-sm-10.col-sm-push-2 -->
114
115             <div class="col-sm-2 col-sm-pull-10">
116                 <aside>
117
118                     <div id="news-filter">
119                         <form action="/cgi-bin/koha/tools/additional-contents.pl" method="get">
120                             <h4>Filter</h4>
121                             <fieldset class="brief">
122                                 <ol>
123                                     <li>
124                                         <label for="news_keyword">Keyword:</label>
125                                         <input type="text" name="news_keyword" id="news_keyword" />
126                                     </li>
127                                     <li>
128                                         <label for="news_display_location">Display location:</label>
129                                         <select name="news_display_location" id="news_display_location">
130                                             <option value="">All</option>
131                                             [% PROCESS locations_options category => category %]
132                                         </select>
133                                     </li>
134                                     <li>
135                                         <label for="news_library">Library: </label>
136                                         <select id="news_library" name="news_library">
137                                             <option value=""></option>
138                                             <option value="">All libraries</option>
139                                             [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
140                                         </select>
141                                     </li>
142                                     <li>
143                                         <label>
144                                             <input type="checkbox" name="show_expired" id="show_expired" /> Show expired
145                                         </label>
146                                     </li>
147                                 </ol>
148                             </fieldset>
149                         </form>
150                     </div>
151
152                     [% INCLUDE 'tools-menu.inc' %]
153                 </aside>
154             </div> <!-- /.col-sm-2.col-sm-pull-10 -->
155         [% END %]
156     </div> <!-- /.row -->
157 </div> <!-- /.main.container-fluid -->
158
159 [% BLOCK add_form %]
160     [% IF additional_content %]
161         <h1>Modify an additional content</h1>
162     [% ELSE %]
163         <h1>New additional content ([% IF category == 'news' %]News[% ELSE %]HTML customizations[% END %])</h1>
164     [% END %]
165
166     <div id="toolbar" class="btn-toolbar">
167         <div class="btn-group">
168             <button class="btn btn-default" id="submit_form"><i class="fa fa-save"></i> Save</button>
169         </div>
170         [% IF category == 'news' %]
171             <a class="btn btn-default cancel" href="/cgi-bin/koha/tools/additional-contents.pl"><i class="fa fa-remove"></i> Cancel</a>
172         [% ELSE %]
173             <a class="btn btn-default cancel" href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations"><i class="fa fa-remove"></i> Cancel</a>
174         [% END %]
175     </div>
176
177     <form id="add_additional_content" method="post" action="/cgi-bin/koha/tools/additional-contents.pl" class="validate">
178         <input type="hidden" name="op" value="add_validate" />
179         <input type="hidden" name="category" value="[% category | html %]" />
180         <input type="hidden" name="code" value="[% additional_content.code | html %]" />
181         <fieldset class="rows">
182             <ol>
183                 <li>
184                     <label for="location">Display location:</label>
185                     <select id="location" name="location">
186                         [% PROCESS locations_options location => additional_content.location %]
187                     </select>
188                 </li>
189                 <li>
190                     <label for="branchcode">Library: </label>
191                     <select id="branchcode" name="branchcode">
192                         [% IF additional_content.branchcode == '' %]
193                             <option value="" selected="selected">All libraries</option>
194                         [% ELSE %]
195                             <option value="">All libraries</option>
196                         [% END %]
197                         [% PROCESS options_for_libraries libraries => Branches.all( selected => additional_content.branchcode, unfiltered => 1, ) %]
198                     </select>
199                 </li>
200                 [% UNLESS languages.size %]
201                     <li>
202                         [% IF category == 'news' %]
203                             <label for="title" class="required">Title: </label>
204                             <input id="title" size="100" maxlength="250" type="text" name="title_default" value="[% additional_content.title | html %]" required="required" class="required" /> <span class="required">Required</span>
205                         [% ELSE %]
206                             <label for="title">Title: </label>
207                             <input id="title" size="100" maxlength="250" type="text" name="title_default" value="[% additional_content.title | html %]" />
208                         [% END %]
209                     </li>
210                 [% END %]
211                 <li>
212                     <label for="from">Publication date: </label>
213                     <input id="from" type="text" name="published_on" size="15" value="[% additional_content.published_on | $KohaDates %]" class="flatpickr" data-date_to="to" />
214                     <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
215                 </li>
216                 <li>
217                     <label for="to">Expiration date: </label>
218                     <input id="to" type="text" name="expirationdate" size="15" value="[% additional_content.expirationdate | $KohaDates %]" class="flatpickr" />
219                     <div class="hint">
220                         [% INCLUDE 'date-format.inc' %]
221                         [% IF category == 'news' %]
222                             <br>News will still be accessible by direct URL if expired.
223                         [% END %]
224                     </div>
225                 </li>
226                 <li>
227                     <label for="number">Appear in position: </label>
228                     [% IF ( additional_content.number ) %]
229                         <input id="number" size="3" name="number" type="text" value="[% additional_content.number | html %]" />
230                     [% ELSE %]
231                         <input id="number" size="3" name="number" type="text" />
232                     [% END %]
233                 </li>
234             </ol>
235         </fieldset>
236
237         [% IF languages.size %]
238             <div style="clear:both"></div>
239             <div id="tabs">
240                 <ul>
241                     [% FOR language IN languages %]
242                         [% IF language.lang == 'default' %]
243                             <li><a href="#lang_default">Default</a></li>
244                         [% ELSE %]
245                             <li><a href="#lang_[% language.lang | uri %]">[% language.description | html %]</a></li>
246                         [% END %]
247                     [% END %]
248                 </ul>
249
250                 [% FOR language IN languages %]
251                     <div id="lang_[% language.lang | uri %]" class="lang clearfix" data-lang="[% language.description | html %]">
252                         <fieldset class="rows">
253                             <ol>
254                                 <li style="list-style: none;">
255                                     <label for="title_[% language.lang | html %]">Title: </label>
256                                     <input id="title_[% language.lang| html %]" size="100" maxlength="250" type="text" name="title_[% language.lang | html %]" value="[% translated_contents.item(language.lang).title | html %]">
257                                 </li>
258                                 <li style="list-style: none;">
259                                     <label for="content_[% language.lang | html %]">Content: </label>
260                                     <textarea name="content_[% language.lang | html %]" id="content_[% language.lang | html %]" data-lang="[% language.lang | html%]" cols="75" rows="10">[% translated_contents.item(language.lang).content | html %]</textarea>
261                                     <input type="hidden" name="lang" value="[% language.lang | html %]" />
262                                 </li>
263                             </ol>
264                         </fieldset>
265                     </div>
266                 [% END %]
267             </div>
268         [% ELSE %]
269             <div id="lang_default">
270                 <div class="clearfix">
271                     <textarea name="content" id="content_default" data-lang="[% language.lang | html %]"  cols="75" rows="10">[% additional_content.content | html %]</textarea>
272                 </div>
273             </div>
274         [% END %]
275     </form>
276 [% END %]
277
278 [% BLOCK list %]
279
280     <div id="toolbar" class="btn-toolbar">
281         <div class="btn-group">
282             <a href="/cgi-bin/koha/tools/additional-contents.pl?op=add_form&category=[% category | uri %]&editmode=[% editmode | uri %]" class="btn btn-default" id="newentry"> <i class="fa fa-plus"></i> New entry</a><button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
283                 <span class="caret"></span>
284             </button>
285             <ul class="dropdown-menu pull-right">
286                 <li>
287                     [% IF ( wysiwyg ) %]
288                         <a href="/cgi-bin/koha/tools/additional-contents.pl?op=add_form&category=[% category | uri %]&editmode=text">New entry using text editor</a>
289                     [% ELSE %]
290                         <a href="/cgi-bin/koha/tools/additional-contents.pl?op=add_form&category=[% category | uri %]&editmode=wysiwyg">New entry using WYSIWYG editor</a>
291                     [% END %]
292                 </li>
293             </ul>
294         </div>
295     </div>
296
297     <h2>Additional contents ([% IF category == 'news' %]News[% ELSE %]HTML customizations[% END %])</h2>
298     [% IF category == 'news' %]
299         See <a href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations">HTML customizations</a>
300     [% ELSE %]
301         See <a href="/cgi-bin/koha/tools/additional-contents.pl?category=news">News</a>
302     [% END %]
303     [% IF ( CAN_user_parameters_manage_sysprefs ) %]
304         | <a href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACUserJS'>OPACUserJS</a>
305         | <a href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACUserCSS'>OPACUserCSS</a>
306     [% END %]
307
308     [% IF additional_contents.count %]
309         <form id="del_form" method="post" action="/cgi-bin/koha/tools/additional-contents.pl">
310             <table id="table_additional_contents">
311                 <thead>
312                     <tr>
313                         <th class="NoSort">&nbsp;</th>
314                         <th>Location</th>
315                         <th>Library</th>
316                         <th>Number</th>
317                         <th>Publication date</th>
318                         <th>Expiration date</th>
319                         <th class="anti-the">Title</th>
320                         <th>Author</th>
321                         <th class="anti-the">News</th>
322                         <th class="NoSort noExport">Actions</th>
323                     </tr>
324                 </thead>
325                 <tbody>
326                     [% FOREACH c IN additional_contents%]
327                         [% IF ( c.is_expired ) %]<tr class="expired">[% ELSE %]<tr>[% END %]
328                         <td>
329                             <input type="checkbox" name="ids" value="[% c.idnew | html %]" />
330                         </td>
331                         <td>
332                             [% IF c.category == 'news' %]
333                                 [% IF c.location == 'staff_and_opac' %]All
334                                 [% ELSIF c.location == 'staff_only' %]Librarian interface
335                                 [% ELSIF c.location == 'opac_only' %]OPAC
336                                 [% ELSIF c.location == 'slip' %]Slip
337                                 [% ELSE %]Unknown ('[% location | html %]')
338                                 [% END %]
339                             [% ELSE %]
340                                 [% c.location | html %]
341                             [% END %]
342                         </td>
343                         <td>
344                             [% IF ( c.branchcode == "" ) -%]
345                             All libraries
346                             [% ELSE %][% c.library.branchname | html %]
347                             [% END %]
348                         </td>
349                         <td>[% c.number | html %]</td>
350                         <td data-order="[% c.published_on | html %]">[% c.published_on | $KohaDates %]</td>
351                         <td data-order="[% c.expirationdate | html %]">[% c.expirationdate | $KohaDates %] [% IF ( c.is_expired ) %](<span class="expired">expired</span>)[% END %]</td>
352                         <td>[% c.title | html %]</td>
353                         <td>[% IF ( c.author) %][% INCLUDE 'patron-title.inc' patron=c.author %][% END %]</td>
354                         <td>
355                             <div class="btn-group">
356                                 <a class="preview_news btn btn-default btn-xs" data-number="[% loop.count | html %]"><i class="fa fa-eye" aria-hidden="true"></i> Preview content</a>
357                             </div>
358                             <div id="contentModal[% loop.count | html %]" class="modal" tabindex="-1" role="dialog" data-number="[% loop.count | html %]">
359                                 <div class="modal-dialog" role="document">
360                                     <div class="modal-content modal-lg">
361                                         <div class="modal-header">
362                                             <h5 class="modal-title">Preview of: "[% c.title | html %]"</h5>
363                                         </div>
364                                     <div class="modal-body">
365                                         [% c.content | $raw %]
366                                     </div>
367                                     <div class="modal-footer">
368                                         <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
369                                     </div>
370                                 </div>
371                             </div>
372                         </td>
373                         <td class="actions">
374                             <div class="btn-group dropup">
375                                 <a href="/cgi-bin/koha/tools/additional-contents.pl?op=add_form&amp;id=[% c.idnew | uri %]&editmode=[% editmode | uri %]" class="btn btn-default btn-xs"> <i class="fa fa-pencil"></i> Edit</a><button class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
376                                     <span class="caret"></span>
377                                 </button>
378                                 <ul class="dropdown-menu pull-right">
379                                     <li>
380                                         [% IF ( wysiwyg ) %]
381                                             <a href="/cgi-bin/koha/tools/additional-contents.pl?op=add_form&amp;id=[% c.idnew | uri %]&editmode=text"><i class="fa fa-pencil"></i> Edit with text editor</a>
382                                         [% ELSE %]
383                                             <a href="/cgi-bin/koha/tools/additional-contents.pl?op=add_form&amp;id=[% c.idnew | uri %]&editmode=wysiwyg"><i class="fa fa-pencil"></i> Edit with WYSIWYG editor</a>
384                                         [% END %]
385                                     </li>
386                                 </ul>
387                             </div>
388                             <div class="btn-group">
389                                 <a href="#" class="delete_news btn btn-default btn-xs" data-idnew="[% c.idnew | html %]"><i class="fa fa-trash"></i> Delete</a>
390                             </div>
391                         </td>
392                     </tr>
393                     [% END %]
394                 </tbody>
395             </table>
396             <input type="hidden" name="op" value="delete_confirmed" />
397             <input type="hidden" name="category" value="[% category | html %]" />
398             <fieldset class="action"><input type="submit" class="button" value="Delete selected" /></fieldset>
399         </form>
400         <form action="/cgi-bin/koha/tools/additional-contents.pl" method="post" id="delete_single">
401             <input type="hidden" id="del_op" name="op" value="delete_confirmed" />
402             <input type="hidden" id="del_category" name="category" value="[% category | html %]" />
403             <input type="hidden" id="del_ids" name="ids" />
404         </form>
405     [% ELSE %]
406         <div class="dialog message">There are no additional contents.</div>
407     [% END %]
408 [% END %]
409
410 [% BLOCK locations_options %]
411     [% IF category == 'news' %]
412         [% IF location == "staff_and_opac" %]
413             <option value="staff_and_opac" selected="selected">Librarian and OPAC interfaces</option>
414         [% ELSE %]
415             <option value="staff_and_opac">Librarian and OPAC interfaces</option>
416         [% END %]
417
418         [% IF location == "staff_only" %]
419             <option value="staff_only" selected="selected">Librarian interface</option>
420         [% ELSE %]
421             <option value="staff_only">Librarian interface</option>
422         [% END %]
423
424         [% IF location == "opac_only" %]
425             <option value="opac_only" selected="selected">OPAC</option>
426         [% ELSE %]
427             <option value="opac_only">OPAC</option>
428         [% END %]
429
430         [% IF location == "slip" %]
431             <option value="slip" selected="selected">Slip</option>
432         [% ELSE %]
433             <option value="slip">Slip</option>
434         [% END %]
435     [% ELSE %]
436         [% FOREACH l IN [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote' ] %]
437             [% IF l == location %]
438                 <option value="[% l | html %]" selected="selected">[% l | html %]</option>
439             [% ELSE %]
440                 <option value="[% l | html %]">[% l | html %]</option>
441             [% END %]
442         [% END %]
443     [% END %]
444 [% END %]
445
446 [% MACRO jsinclude BLOCK %]
447     [% INCLUDE 'calendar.inc' %]
448     [% Asset.js("js/tools-menu.js") | $raw %]
449     [% Asset.js("lib/hc-sticky.js") | $raw %]
450     [% IF additional_contents.count %]
451         [% INCLUDE 'datatables.inc' %]
452         <script>
453             $('.preview_news').click( function() {
454                 modalNumber = $(this).attr('data-number');
455                 $('.modal[data-number="'+modalNumber+'"]').modal('show');
456             })
457             function Checkbox(){
458                 var form = document.getElementById('del_form');
459                 var inputs = form.getElementsByTagName('input');
460                 var checked = false;
461                 for (var i=0; i<inputs.length; i++) {
462                     if (inputs[i].type == 'checkbox' && inputs[i].name == 'ids') {
463                         checked = inputs[i].checked;
464                         if (checked) return true;
465                     }
466                 }
467             }
468
469             function filterDataTable( table, column, term ){
470                 if( column ){
471                     table.column( column ).search( term ).draw();
472                 } else {
473                     table.search( term ).draw();
474                 }
475                 clearFilter( term );
476             }
477
478             function clearFilter( term ){
479                 if( term == "" ){
480                     $(".dt_button_clear_filter").addClass("disabled");
481                 } else {
482                     $(".dt_button_clear_filter").removeClass("disabled");
483                 }
484             }
485
486             /* Custom table search configuration: If a table row
487                has an "expired" class, hide it UNLESS the
488                show_expired checkbox is checked */
489             $.fn.dataTable.ext.search.push(
490                 function( settings, searchData, index, rowData, counter ) {
491                     var row = $(settings.aoData[index].nTr);
492                     if( row.hasClass("expired") && !$("#show_expired").prop("checked") ){
493                         return false;
494                     } else {
495                         return true;
496                     }
497                 }
498             );
499
500             $(document).ready(function() {
501
502                 var table = $("#table_additional_contents").DataTable($.extend(true, {}, dataTablesDefaults, {
503                     "order": [[ 4, "desc" ]],
504                     "aoColumnDefs": [
505                         { "sortable": false, "searchable": false, 'targets': [ 'NoSort' ] },
506                         { "type": "anti-the", "targets": [ "anti-the" ] }
507                     ],
508                     "sPaginationType": "full_numbers"
509                 }));
510
511                 $("#del_form").on("click", ".delete_news", function(e){
512                     e.preventDefault();
513                     if( confirmDelete( _("Are you sure you want to delete this content? This cannot be undone.") ) ){
514                         $("#del_ids").val( $(this).data("idnew") );
515                         $("#delete_single").submit();
516                     }
517                 });
518
519                 $("#del_form").on("submit",function(){
520                     if ( Checkbox() ) {
521                         return confirmDelete( _("Are you sure you want to delete the selected content?") );
522                     } else {
523                         alert(_("Please select content to delete."));
524                         return false;
525                     }
526                 });
527
528                 $("#show_expired").on("change", function(){
529                     /* redraw the DataTable according to the custom search function */
530                     table.draw();
531                 });
532
533                 table.on( 'search.dt', function () {
534                     var term = table.search();
535                     $("#news_keyword").val( term );
536                 });
537
538                 $("#news_keyword").on("keyup", function(){
539                     var term = $(this).val();
540                     filterDataTable( table, null, term );
541                 });
542
543                 $("#news_display_location").on("change", function(){
544                     var term = $(this).val();
545                     filterDataTable( table, 1, term );
546                 });
547
548                 $("#news_library").on("change", function(){
549                     // Table must be filtered by the <option>'s text, not its value
550                     var opt = $(this).find("option:selected").text();
551                     filterDataTable( table, 2, opt );
552                 });
553
554                 $(".dt_button_clear_filter").on("click", function(){
555                     table.search('').columns().search('').draw();
556                     $("#news-filter select").each(function(){
557                         $(this).val("");
558                     });
559                 });
560             });
561         </script>
562     [% ELSE %]
563         <script>
564             $(document).ready(function() {
565                 $("#tabs").tabs();
566                 [% IF category == 'news' %]
567                 $("#add_additional_content").validate({
568                     submitHandler: function(form){
569                         if ( ! $("#title_default").val().length > 0 ) {
570                             alert(__("Please specify a title for 'Default'"));
571                             return false;
572                         }
573
574                         form.submit();
575                     }
576                 });
577                 [% END %]
578
579                 $("#submit_form").on("click",function(){
580                     $("#add_additional_content").submit();
581                 });
582
583                 Sticky = $("#toolbar");
584                 Sticky.hcSticky({
585                     stickTo: ".main",
586                     stickyClass: "floating"
587                 });
588
589             });
590         </script>
591     [% END %]
592     [% UNLESS ( wysiwyg ) %]
593         [% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %]
594         [% Asset.js( "lib/codemirror/xml.min.js" ) | $raw %]
595         [% Asset.js( "lib/codemirror/lint.min.js" ) | $raw %]
596         [% Asset.js( "lib/linters/htmlhint.min.js" ) | $raw %]
597         [% Asset.js( "lib/codemirror/html-lint.min.js" ) | $raw %]
598         <script>
599             $("textarea[name^='content_']").each( function(index) {
600                 var this_lang = $(this).attr('data-lang');
601                 var editor = CodeMirror.fromTextArea(document.getElementById('content_' + this_lang), {
602                     lineNumbers: true,
603                     lineWrapping: true,
604                     lint: true,
605                     mode: "text/html",
606                     gutters: ["CodeMirror-lint-markers"],
607                     viewportMargin: Infinity,
608                 });
609             });
610         </script>
611     [% ELSE %]
612         [% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %]
613         [% INCLUDE 'str/tinymce_i18n.inc' %]
614         <script>
615             tinyMCE.init({
616                 verify_html: false,
617                 force_br_newlines : false,
618                 force_p_newlines : false,
619                 forced_root_block : '',
620                 branding : false,
621                 relative_urls : false,
622                 content_css : "[% interface | html %]/[% theme | html %]/css/tinymce.css",
623                 menubar : "file edit view insert format tools table",
624                 mode : "specific_textareas",
625                 plugins : "autoresize table hr link image charmap lists code emoticons",
626                 extended_valid_elements:"style,link[href|rel]",
627                 custom_elements:"style,link,~link",
628                 toolbar : [
629                     "formatselect | bold italic | cut copy paste | alignleft aligncenter alignright | outdent indent | image link unlink anchor cleanup hr",
630                     "table | bullist numlist | undo redo | removeformat | emoticons charmap | forecolor backcolor | code"
631                 ],
632             });
633         </script>
634     [% END # /UNLESS wysiwyg %]
635 [% END %]
636
637 [% INCLUDE 'intranet-bottom.inc' %]