7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Additional contents › Tools › Koha</title>
9 [% INCLUDE 'doc-head-close.inc' %]
11 [% SET editmode = "wysiwyg" %]
13 [% SET editmode = "text" %]
14 [% Asset.css("lib/codemirror/codemirror.css") | $raw %]
15 [% Asset.css("lib/codemirror/lint.min.css") | $raw %]
25 <body id="tools_additional-contents" class="tools">
26 [% INCLUDE 'header.inc' %]
27 [% INCLUDE 'cat-search.inc' %]
29 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
32 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
35 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
39 <a href="/cgi-bin/koha/tools/additional-contents.pl">Additional contents</a>
41 [% IF op == 'add_form' %]
43 [% IF category == 'news' %]
44 <a href="/cgi-bin/koha/tools/additional-contents.pl?category=news">News</a>
46 <a href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations">HTML customizations</a>
50 <a href="#" aria-current="page">
51 [% IF additional_content.idnew %]
52 Modify additional content
54 Add additional content
60 <a href="#" aria-current="page">
61 [% IF category == 'news' %]
73 [% IF op == 'add_form' %]
74 <div class="main container-fluid">
76 <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
78 <div class="main container-fluid">
80 <div class="col-sm-10 col-sm-push-2">
85 [% FOR m IN messages %]
86 <div class="dialog [% m.type | html %]">
88 [% CASE 'error_on_update' %]
89 An error occurred when updating this content. Perhaps it already exists.
90 [% CASE 'error_on_insert' %]
91 An error occurred when adding this content. Check the logs
92 [% CASE 'error_on_delete' %]
93 An error occurred when deleting this content. Check the logs.
94 [% CASE 'success_on_update' %]
95 Content updated successfully.
96 [% CASE 'success_on_insert' %]
97 Content added successfully.
98 [% CASE 'success_on_delete' %]
99 Content deleted successfully.
106 [% IF op == 'add_form' %]
107 [% PROCESS add_form %]
114 [% IF op != 'add_form' %]
115 </div> <!-- /.col-sm-10.col-sm-push-2 -->
117 <div class="col-sm-2 col-sm-pull-10">
120 <div id="news-filter">
121 <form action="/cgi-bin/koha/tools/additional-contents.pl" method="get">
123 <fieldset class="brief">
126 <label for="news_keyword">Keyword:</label>
127 <input type="text" name="news_keyword" id="news_keyword" />
130 <label for="news_display_location">Display location:</label>
131 <select name="news_display_location" id="news_display_location">
132 <option value="">All</option>
133 [% PROCESS locations_options category => category %]
137 <label for="news_library">Library: </label>
138 <select id="news_library" name="news_library">
139 <option value=""></option>
140 <option value="">All libraries</option>
141 [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
146 <input type="checkbox" name="show_expired" id="show_expired" /> Show expired
154 [% INCLUDE 'tools-menu.inc' %]
156 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
158 </div> <!-- /.row -->
159 </div> <!-- /.main.container-fluid -->
162 [% IF additional_content %]
163 <h1>Modify an additional content</h1>
165 <h1>New additional content ([% IF category == 'news' %]News[% ELSE %]HTML customizations[% END %])</h1>
168 <div id="toolbar" class="btn-toolbar">
169 <div class="btn-group">
170 <button class="btn btn-default" id="submit_form"><i class="fa fa-save"></i> Save</button>
172 [% IF category == 'news' %]
173 <a class="btn btn-default cancel" href="/cgi-bin/koha/tools/additional-contents.pl"><i class="fa fa-remove"></i> Cancel</a>
175 <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 <form id="add_additional_content" method="post" action="/cgi-bin/koha/tools/additional-contents.pl" class="validate">
180 <input type="hidden" name="op" value="add_validate" />
181 <input type="hidden" name="category" value="[% category | html %]" />
182 <input type="hidden" name="code" value="[% additional_content.code | html %]" />
183 <fieldset class="rows">
186 <label for="location">Display location:</label>
187 <select id="location" name="location">
188 [% PROCESS locations_options location => additional_content.location %]
192 <label for="branchcode">Library: </label>
193 <select id="branchcode" name="branchcode">
194 [% IF additional_content.branchcode == '' %]
195 <option value="" selected="selected">All libraries</option>
197 <option value="">All libraries</option>
199 [% PROCESS options_for_libraries libraries => Branches.all( selected => additional_content.branchcode, unfiltered => 1, ) %]
202 [% UNLESS languages.size %]
204 <label for="title" class="required">Title: </label>
205 <input id="title" size="100" maxlength="250" type="text" name="title" value="[% additional_content.title | html %]" required="required" class="required" /> <span class="required">Required</span>
209 <label for="from">Publication date: </label>
210 <input id="from" type="text" name="published_on" size="15" value="[% additional_content.published_on | $KohaDates %]" class="flatpickr" data-date_to="to" />
211 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
214 <label for="to">Expiration date: </label>
215 <input id="to" type="text" name="expirationdate" size="15" value="[% additional_content.expirationdate | $KohaDates %]" class="flatpickr" />
217 [% INCLUDE 'date-format.inc' %]
218 [% IF category == 'news' %]
219 <br>News will still be accessible by direct URL if expired.
224 <label for="number">Appear in position: </label>
225 [% IF ( additional_content.number ) %]
226 <input id="number" size="3" name="number" type="text" value="[% additional_content.number | html %]" />
228 <input id="number" size="3" name="number" type="text" />
234 [% IF languages.size %]
235 <div style="clear:both"></div>
238 [% FOR language IN languages %]
239 [% IF language.lang == 'default' %]
240 <li><a href="#lang_default">Default</a></li>
242 <li><a href="#lang_[% language.lang | uri %]">[% language.description | html %]</a></li>
247 [% FOR language IN languages %]
248 <div id="lang_[% language.lang | uri %]" class="lang clearfix" data-lang="[% language.description | html %]">
249 <fieldset class="rows">
251 <li style="list-style: none;">
252 <label for="title_[% language.lang | html %]">Title: </label>
253 <input id="title_[% language.lang| html %]" size="100" maxlength="250" type="text" name="title" value="[% translated_contents.item(language.lang).title | html %]">
255 <li style="list-style: none;">
256 <label for="content_[% language.lang | html %]">Content: </label>
257 <textarea name="content" id="content_[% language.lang | html %]" data-lang="[% language.lang | html%]" cols="75" rows="10">[% translated_contents.item(language.lang).content | html %]</textarea>
258 <input type="hidden" name="lang" value="[% language.lang | html %]" />
266 <div id="lang_default">
267 <div class="clearfix">
268 <textarea name="content" id="content_default" data-lang="[% language.lang | html %]" cols="75" rows="10">[% additional_content.content | html %]</textarea>
277 <div id="toolbar" class="btn-toolbar">
278 <div class="btn-group">
279 <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">
280 <span class="caret"></span>
282 <ul class="dropdown-menu pull-right">
285 <a href="/cgi-bin/koha/tools/additional-contents.pl?op=add_form&category=[% category | uri %]&editmode=text">New entry using text editor</a>
287 <a href="/cgi-bin/koha/tools/additional-contents.pl?op=add_form&category=[% category | uri %]&editmode=wysiwyg">New entry using WYSIWYG editor</a>
294 <h2>Additional contents ([% IF category == 'news' %]News[% ELSE %]HTML customizations[% END %])</h2>
295 [% IF category == 'news' %]
296 See <a href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations">HTML customizations</a>
298 See <a href="/cgi-bin/koha/tools/additional-contents.pl?category=news">News</a>
301 [% IF additional_contents.count %]
302 <form id="del_form" method="post" action="/cgi-bin/koha/tools/additional-contents.pl">
303 <table id="table_additional_contents">
306 <th class="NoSort"> </th>
310 <th>Publication date</th>
311 <th>Expiration date</th>
312 <th class="anti-the">Title</th>
314 <th class="anti-the">News</th>
315 <th class="NoSort noExport">Actions</th>
319 [% FOREACH c IN additional_contents%]
320 [% IF ( c.is_expired ) %]<tr class="expired">[% ELSE %]<tr>[% END %]
322 <input type="checkbox" name="ids" value="[% c.idnew | html %]" />
325 [% IF c.category == 'news' %]
326 [% IF c.location == 'staff_and_opac' %]All
327 [% ELSIF c.location == 'staff_only' %]Librarian interface
328 [% ELSIF c.location == 'opac_only' %]OPAC
329 [% ELSIF c.location == 'slip' %]Slip
330 [% ELSE %]Unknown ('[% location | html %]')
333 [% c.location | html %]
337 [% IF ( c.branchcode == "" ) -%]
339 [% ELSE %][% c.library.branchname | html %]
342 <td>[% c.number | html %]</td>
343 <td data-order="[% c.published_on | html %]">[% c.published_on | $KohaDates %]</td>
344 <td data-order="[% c.expirationdate | html %]">[% c.expirationdate | $KohaDates %] [% IF ( c.is_expired ) %](<span class="expired">expired</span>)[% END %]</td>
345 <td>[% c.title | html %]</td>
346 <td>[% IF ( c.author) %][% INCLUDE 'patron-title.inc' patron=c.author %][% END %]</td>
348 <div class="btn-group">
349 <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>
351 <div id="contentModal[% loop.count | html %]" class="modal" tabindex="-1" role="dialog" data-number="[% loop.count | html %]">
352 <div class="modal-dialog" role="document">
353 <div class="modal-content modal-lg">
354 <div class="modal-header">
355 <h5 class="modal-title">Preview of: "[% c.title | html %]"</h5>
357 <div class="modal-body">
358 [% c.content | $raw %]
360 <div class="modal-footer">
361 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
367 <div class="btn-group dropup">
368 <a href="/cgi-bin/koha/tools/additional-contents.pl?op=add_form&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">
369 <span class="caret"></span>
371 <ul class="dropdown-menu pull-right">
374 <a href="/cgi-bin/koha/tools/additional-contents.pl?op=add_form&id=[% c.idnew | uri %]&editmode=text"><i class="fa fa-pencil"></i> Edit with text editor</a>
376 <a href="/cgi-bin/koha/tools/additional-contents.pl?op=add_form&id=[% c.idnew | uri %]&editmode=wysiwyg"><i class="fa fa-pencil"></i> Edit with WYSIWYG editor</a>
381 <div class="btn-group">
382 <a href="#" class="delete_news btn btn-default btn-xs" data-idnew="[% c.idnew | html %]"><i class="fa fa-trash"></i> Delete</a>
389 <input type="hidden" name="op" value="delete_confirmed" />
390 <input type="hidden" name="category" value="[% category | html %]" />
391 <fieldset class="action"><input type="submit" class="button" value="Delete selected" /></fieldset>
393 <form action="/cgi-bin/koha/tools/additional-contents.pl" method="post" id="delete_single">
394 <input type="hidden" id="del_op" name="op" value="delete_confirmed" />
395 <input type="hidden" id="del_category" name="category" value="[% category | html %]" />
396 <input type="hidden" id="del_ids" name="ids" />
399 <div class="dialog message">There are no additional contents.</div>
403 [% BLOCK locations_options %]
404 [% IF category == 'news' %]
405 [% IF location == "staff_and_opac" %]
406 <option value="staff_and_opac" selected="selected">Librarian and OPAC interfaces</option>
408 <option value="staff_and_opac">Librarian and OPAC interfaces</option>
411 [% IF location == "staff_only" %]
412 <option value="staff_only" selected="selected">Librarian interface</option>
414 <option value="staff_only">Librarian interface</option>
417 [% IF location == "opac_only" %]
418 <option value="opac_only" selected="selected">OPAC</option>
420 <option value="opac_only">OPAC</option>
423 [% IF location == "slip" %]
424 <option value="slip" selected="selected">Slip</option>
426 <option value="slip">Slip</option>
429 [% FOREACH l IN [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText' ] %]
430 [% IF l == location %]
431 <option value="[% l | html %]" selected="selected">[% l | html %]</option>
433 <option value="[% l | html %]">[% l | html %]</option>
439 [% MACRO jsinclude BLOCK %]
440 [% INCLUDE 'calendar.inc' %]
441 [% Asset.js("js/tools-menu.js") | $raw %]
442 [% Asset.js("lib/hc-sticky.js") | $raw %]
443 [% IF additional_contents.count %]
444 [% INCLUDE 'datatables.inc' %]
446 $('.preview_news').click( function() {
447 modalNumber = $(this).attr('data-number');
448 $('.modal[data-number="'+modalNumber+'"]').modal('show');
451 var form = document.getElementById('del_form');
452 var inputs = form.getElementsByTagName('input');
454 for (var i=0; i<inputs.length; i++) {
455 if (inputs[i].type == 'checkbox' && inputs[i].name == 'ids') {
456 checked = inputs[i].checked;
457 if (checked) return true;
462 function filterDataTable( table, column, term ){
464 table.column( column ).search( term ).draw();
466 table.search( term ).draw();
471 function clearFilter( term ){
473 $(".dt_button_clear_filter").addClass("disabled");
475 $(".dt_button_clear_filter").removeClass("disabled");
479 /* Custom table search configuration: If a table row
480 has an "expired" class, hide it UNLESS the
481 show_expired checkbox is checked */
482 $.fn.dataTable.ext.search.push(
483 function( settings, searchData, index, rowData, counter ) {
484 var row = $(settings.aoData[index].nTr);
485 if( row.hasClass("expired") && !$("#show_expired").prop("checked") ){
493 $(document).ready(function() {
495 var table = $("#table_additional_contents").DataTable($.extend(true, {}, dataTablesDefaults, {
496 "order": [[ 4, "desc" ]],
498 { "sortable": false, "searchable": false, 'targets': [ 'NoSort' ] },
499 { "type": "anti-the", "targets": [ "anti-the" ] }
501 "sPaginationType": "full_numbers"
504 $("#del_form").on("click", ".delete_news", function(e){
506 if( confirmDelete( _("Are you sure you want to delete this content? This cannot be undone.") ) ){
507 $("#del_ids").val( $(this).data("idnew") );
508 $("#delete_single").submit();
512 $("#del_form").on("submit",function(){
514 return confirmDelete( _("Are you sure you want to delete the selected content?") );
516 alert(_("Please select content to delete."));
521 $("#show_expired").on("change", function(){
522 /* redraw the DataTable according to the custom search function */
526 table.on( 'search.dt', function () {
527 var term = table.search();
528 $("#news_keyword").val( term );
531 $("#news_keyword").on("keyup", function(){
532 var term = $(this).val();
533 filterDataTable( table, null, term );
536 $("#news_display_location").on("change", function(){
537 var term = $(this).val();
538 filterDataTable( table, 1, term );
541 $("#news_library").on("change", function(){
542 // Table must be filtered by the <option>'s text, not its value
543 var opt = $(this).find("option:selected").text();
544 filterDataTable( table, 2, opt );
547 $(".dt_button_clear_filter").on("click", function(){
548 table.search('').columns().search('').draw();
549 $("#news-filter select").each(function(){
557 $(document).ready(function() {
559 $("#add_additional_content").validate({
560 submitHandler: function(form){
561 if ( ! $("#title_default").val().length > 0 ) {
562 alert(__("Please specify a title for 'Default'"));
570 $("#submit_form").on("click",function(){
571 $("#add_additional_content").submit();
574 Sticky = $("#toolbar");
577 stickyClass: "floating"
583 [% UNLESS ( wysiwyg ) %]
584 [% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %]
585 [% Asset.js( "lib/codemirror/xml.min.js" ) | $raw %]
586 [% Asset.js( "lib/codemirror/lint.min.js" ) | $raw %]
587 [% Asset.js( "lib/linters/htmlhint.min.js" ) | $raw %]
588 [% Asset.js( "lib/codemirror/html-lint.min.js" ) | $raw %]
590 $("textarea[name='content']").each( function(index) {
591 var this_lang = $(this).attr('data-lang');
592 var editor = CodeMirror.fromTextArea(document.getElementById('content_' + this_lang), {
597 gutters: ["CodeMirror-lint-markers"],
598 viewportMargin: Infinity,
603 [% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %]
604 [% INCLUDE 'str/tinymce_i18n.inc' %]
608 force_br_newlines : false,
609 force_p_newlines : false,
610 forced_root_block : '',
612 relative_urls : false,
613 content_css : "[% interface | html %]/[% theme | html %]/css/tinymce.css",
614 menubar : "file edit view insert format tools table",
615 mode : "specific_textareas",
616 plugins : "autoresize table hr link image charmap lists code emoticons",
617 extended_valid_elements:"style,link[href|rel]",
618 custom_elements:"style,link,~link",
620 "formatselect | bold italic | cut copy paste | alignleft aligncenter alignright | outdent indent | image link unlink anchor cleanup hr",
621 "table | bullist numlist | undo redo | removeformat | emoticons charmap | forecolor backcolor | code"
625 [% END # /UNLESS wysiwyg %]
628 [% INCLUDE 'intranet-bottom.inc' %]