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