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>
38 [% IF op == 'add_form' %]
40 [% IF category == 'news' %]
41 <a href="/cgi-bin/koha/tools/additional-contents.pl?category=news">News</a>
43 <a href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations">HTML customizations</a>
47 <a href="#" aria-current="page">
48 [% IF additional_content.idnew %]
49 <span>Modify additional content<span>
51 <span>Add additional content<span>
53 ([% IF category == 'news' %]<span>News</span>[% ELSE %]<span>HTML customizations</span>[% END %])
58 <a href="#" aria-current="page">
59 [% IF category == 'news' %]
71 [% IF op == 'add_form' %]
72 <div class="main container-fluid">
74 <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
76 <div class="main container-fluid">
78 <div class="col-sm-10 col-sm-push-2">
83 [% FOR m IN messages %]
84 <div class="dialog [% m.type | html %]">
86 [% CASE 'error_on_update' %]
87 An error occurred when updating this content. Perhaps it already exists.
88 [% CASE 'error_on_insert' %]
89 An error occurred when adding this content. Check the logs
90 [% CASE 'error_on_delete' %]
91 An error occurred when deleting this content. Check the logs.
92 [% CASE 'success_on_update' %]
93 Content updated successfully.
94 [% CASE 'success_on_insert' %]
95 Content added successfully.
96 [% CASE 'success_on_delete' %]
97 Content deleted successfully.
104 [% IF op == 'add_form' %]
105 [% PROCESS add_form %]
112 [% IF op != 'add_form' %]
113 </div> <!-- /.col-sm-10.col-sm-push-2 -->
115 <div class="col-sm-2 col-sm-pull-10">
118 <div id="news-filter">
119 <form action="/cgi-bin/koha/tools/additional-contents.pl" method="get">
121 <fieldset class="brief">
124 <label for="news_keyword">Keyword:</label>
125 <input type="text" name="news_keyword" id="news_keyword" />
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 %]
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, ) %]
144 <input type="checkbox" name="show_expired" id="show_expired" /> Show expired
152 [% INCLUDE 'tools-menu.inc' %]
154 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
156 </div> <!-- /.row -->
157 </div> <!-- /.main.container-fluid -->
160 [% IF additional_content %]
161 <h1>Modify an additional content</h1>
163 <h1>New additional content ([% IF category == 'news' %]News[% ELSE %]HTML customizations[% END %])</h1>
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>
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>
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>
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">
184 <label for="location">Display location:</label>
185 <select id="location" name="location">
186 [% PROCESS locations_options location => additional_content.location %]
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>
195 <option value="">All libraries</option>
197 [% PROCESS options_for_libraries libraries => Branches.all( selected => additional_content.branchcode, unfiltered => 1, ) %]
200 [% UNLESS languages.size %]
202 <label for="title" class="required">Title: </label>
203 <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>
207 <label for="from">Publication date: </label>
208 <input id="from" type="text" name="published_on" size="15" value="[% additional_content.published_on | $KohaDates %]" class="flatpickr" data-date_to="to" />
209 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
212 <label for="to">Expiration date: </label>
213 <input id="to" type="text" name="expirationdate" size="15" value="[% additional_content.expirationdate | $KohaDates %]" class="flatpickr" />
215 [% INCLUDE 'date-format.inc' %]
216 [% IF category == 'news' %]
217 <br>News will still be accessible by direct URL if expired.
222 <label for="number">Appear in position: </label>
223 [% IF ( additional_content.number ) %]
224 <input id="number" size="3" name="number" type="text" value="[% additional_content.number | html %]" />
226 <input id="number" size="3" name="number" type="text" />
232 [% IF languages.size %]
233 <div style="clear:both"></div>
236 [% FOR language IN languages %]
237 [% IF language.lang == 'default' %]
238 <li><a href="#lang_default">Default</a></li>
240 <li><a href="#lang_[% language.lang | uri %]">[% language.description | html %]</a></li>
245 [% FOR language IN languages %]
246 <div id="lang_[% language.lang | uri %]" class="lang clearfix" data-lang="[% language.description | html %]">
247 <fieldset class="rows">
249 <li style="list-style: none;">
250 <label for="title_[% language.lang | html %]">Title: </label>
251 <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 %]">
253 <li style="list-style: none;">
254 <label for="content_[% language.lang | html %]">Content: </label>
255 <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>
256 <input type="hidden" name="lang" value="[% language.lang | html %]" />
264 <div id="lang_default">
265 <div class="clearfix">
266 <textarea name="content" id="content_default" data-lang="[% language.lang | html %]" cols="75" rows="10">[% additional_content.content | html %]</textarea>
275 <div id="toolbar" class="btn-toolbar">
276 <div class="btn-group">
277 <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">
278 <span class="caret"></span>
280 <ul class="dropdown-menu pull-right">
283 <a href="/cgi-bin/koha/tools/additional-contents.pl?op=add_form&category=[% category | uri %]&editmode=text">New entry using text editor</a>
285 <a href="/cgi-bin/koha/tools/additional-contents.pl?op=add_form&category=[% category | uri %]&editmode=wysiwyg">New entry using WYSIWYG editor</a>
292 <h2>Additional contents ([% IF category == 'news' %]News[% ELSE %]HTML customizations[% END %])</h2>
293 [% IF category == 'news' %]
294 See <a href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations">HTML customizations</a>
296 See <a href="/cgi-bin/koha/tools/additional-contents.pl?category=news">News</a>
299 [% IF additional_contents.count %]
300 <form id="del_form" method="post" action="/cgi-bin/koha/tools/additional-contents.pl">
301 <table id="table_additional_contents">
304 <th class="NoSort"> </th>
308 <th>Publication date</th>
309 <th>Expiration date</th>
310 <th class="anti-the">Title</th>
312 <th class="anti-the">News</th>
313 <th class="NoSort noExport">Actions</th>
317 [% FOREACH c IN additional_contents%]
318 [% IF ( c.is_expired ) %]<tr class="expired">[% ELSE %]<tr>[% END %]
320 <input type="checkbox" name="ids" value="[% c.idnew | html %]" />
323 [% IF c.category == 'news' %]
324 [% IF c.location == 'staff_and_opac' %]All
325 [% ELSIF c.location == 'staff_only' %]Librarian interface
326 [% ELSIF c.location == 'opac_only' %]OPAC
327 [% ELSIF c.location == 'slip' %]Slip
328 [% ELSE %]Unknown ('[% location | html %]')
331 [% c.location | html %]
335 [% IF ( c.branchcode == "" ) -%]
337 [% ELSE %][% c.library.branchname | html %]
340 <td>[% c.number | html %]</td>
341 <td data-order="[% c.published_on | html %]">[% c.published_on | $KohaDates %]</td>
342 <td data-order="[% c.expirationdate | html %]">[% c.expirationdate | $KohaDates %] [% IF ( c.is_expired ) %](<span class="expired">expired</span>)[% END %]</td>
343 <td>[% c.title | html %]</td>
344 <td>[% IF ( c.author) %][% INCLUDE 'patron-title.inc' patron=c.author %][% END %]</td>
346 <div class="btn-group">
347 <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>
349 <div id="contentModal[% loop.count | html %]" class="modal" tabindex="-1" role="dialog" data-number="[% loop.count | html %]">
350 <div class="modal-dialog" role="document">
351 <div class="modal-content modal-lg">
352 <div class="modal-header">
353 <h5 class="modal-title">Preview of: "[% c.title | html %]"</h5>
355 <div class="modal-body">
356 [% c.content | $raw %]
358 <div class="modal-footer">
359 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
365 <div class="btn-group dropup">
366 <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">
367 <span class="caret"></span>
369 <ul class="dropdown-menu pull-right">
372 <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>
374 <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>
379 <div class="btn-group">
380 <a href="#" class="delete_news btn btn-default btn-xs" data-idnew="[% c.idnew | html %]"><i class="fa fa-trash"></i> Delete</a>
387 <input type="hidden" name="op" value="delete_confirmed" />
388 <input type="hidden" name="category" value="[% category | html %]" />
389 <fieldset class="action"><input type="submit" class="button" value="Delete selected" /></fieldset>
391 <form action="/cgi-bin/koha/tools/additional-contents.pl" method="post" id="delete_single">
392 <input type="hidden" id="del_op" name="op" value="delete_confirmed" />
393 <input type="hidden" id="del_category" name="category" value="[% category | html %]" />
394 <input type="hidden" id="del_ids" name="ids" />
397 <div class="dialog message">There are no additional contents.</div>
401 [% BLOCK locations_options %]
402 [% IF category == 'news' %]
403 [% IF location == "staff_and_opac" %]
404 <option value="staff_and_opac" selected="selected">Librarian and OPAC interfaces</option>
406 <option value="staff_and_opac">Librarian and OPAC interfaces</option>
409 [% IF location == "staff_only" %]
410 <option value="staff_only" selected="selected">Librarian interface</option>
412 <option value="staff_only">Librarian interface</option>
415 [% IF location == "opac_only" %]
416 <option value="opac_only" selected="selected">OPAC</option>
418 <option value="opac_only">OPAC</option>
421 [% IF location == "slip" %]
422 <option value="slip" selected="selected">Slip</option>
424 <option value="slip">Slip</option>
427 [% FOREACH l IN [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText' ] %]
428 [% IF l == location %]
429 <option value="[% l | html %]" selected="selected">[% l | html %]</option>
431 <option value="[% l | html %]">[% l | html %]</option>
437 [% MACRO jsinclude BLOCK %]
438 [% INCLUDE 'calendar.inc' %]
439 [% Asset.js("js/tools-menu.js") | $raw %]
440 [% Asset.js("lib/hc-sticky.js") | $raw %]
441 [% IF additional_contents.count %]
442 [% INCLUDE 'datatables.inc' %]
444 $('.preview_news').click( function() {
445 modalNumber = $(this).attr('data-number');
446 $('.modal[data-number="'+modalNumber+'"]').modal('show');
449 var form = document.getElementById('del_form');
450 var inputs = form.getElementsByTagName('input');
452 for (var i=0; i<inputs.length; i++) {
453 if (inputs[i].type == 'checkbox' && inputs[i].name == 'ids') {
454 checked = inputs[i].checked;
455 if (checked) return true;
460 function filterDataTable( table, column, term ){
462 table.column( column ).search( term ).draw();
464 table.search( term ).draw();
469 function clearFilter( term ){
471 $(".dt_button_clear_filter").addClass("disabled");
473 $(".dt_button_clear_filter").removeClass("disabled");
477 /* Custom table search configuration: If a table row
478 has an "expired" class, hide it UNLESS the
479 show_expired checkbox is checked */
480 $.fn.dataTable.ext.search.push(
481 function( settings, searchData, index, rowData, counter ) {
482 var row = $(settings.aoData[index].nTr);
483 if( row.hasClass("expired") && !$("#show_expired").prop("checked") ){
491 $(document).ready(function() {
493 var table = $("#table_additional_contents").DataTable($.extend(true, {}, dataTablesDefaults, {
494 "order": [[ 4, "desc" ]],
496 { "sortable": false, "searchable": false, 'targets': [ 'NoSort' ] },
497 { "type": "anti-the", "targets": [ "anti-the" ] }
499 "sPaginationType": "full_numbers"
502 $("#del_form").on("click", ".delete_news", function(e){
504 if( confirmDelete( _("Are you sure you want to delete this content? This cannot be undone.") ) ){
505 $("#del_ids").val( $(this).data("idnew") );
506 $("#delete_single").submit();
510 $("#del_form").on("submit",function(){
512 return confirmDelete( _("Are you sure you want to delete the selected content?") );
514 alert(_("Please select content to delete."));
519 $("#show_expired").on("change", function(){
520 /* redraw the DataTable according to the custom search function */
524 table.on( 'search.dt', function () {
525 var term = table.search();
526 $("#news_keyword").val( term );
529 $("#news_keyword").on("keyup", function(){
530 var term = $(this).val();
531 filterDataTable( table, null, term );
534 $("#news_display_location").on("change", function(){
535 var term = $(this).val();
536 filterDataTable( table, 1, term );
539 $("#news_library").on("change", function(){
540 // Table must be filtered by the <option>'s text, not its value
541 var opt = $(this).find("option:selected").text();
542 filterDataTable( table, 2, opt );
545 $(".dt_button_clear_filter").on("click", function(){
546 table.search('').columns().search('').draw();
547 $("#news-filter select").each(function(){
555 $(document).ready(function() {
557 $("#add_additional_content").validate({
558 submitHandler: function(form){
559 if ( ! $("#title_default").val().length > 0 ) {
560 alert(__("Please specify a title for 'Default'"));
568 $("#submit_form").on("click",function(){
569 $("#add_additional_content").submit();
572 Sticky = $("#toolbar");
575 stickyClass: "floating"
581 [% UNLESS ( wysiwyg ) %]
582 [% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %]
583 [% Asset.js( "lib/codemirror/xml.min.js" ) | $raw %]
584 [% Asset.js( "lib/codemirror/lint.min.js" ) | $raw %]
585 [% Asset.js( "lib/linters/htmlhint.min.js" ) | $raw %]
586 [% Asset.js( "lib/codemirror/html-lint.min.js" ) | $raw %]
588 $("textarea[name^='content_']").each( function(index) {
589 var this_lang = $(this).attr('data-lang');
590 var editor = CodeMirror.fromTextArea(document.getElementById('content_' + this_lang), {
595 gutters: ["CodeMirror-lint-markers"],
596 viewportMargin: Infinity,
601 [% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %]
602 [% INCLUDE 'str/tinymce_i18n.inc' %]
606 force_br_newlines : false,
607 force_p_newlines : false,
608 forced_root_block : '',
610 relative_urls : false,
611 content_css : "[% interface | html %]/[% theme | html %]/css/tinymce.css",
612 menubar : "file edit view insert format tools table",
613 mode : "specific_textareas",
614 plugins : "autoresize table hr link image charmap lists code emoticons",
615 extended_valid_elements:"style,link[href|rel]",
616 custom_elements:"style,link,~link",
618 "formatselect | bold italic | cut copy paste | alignleft aligncenter alignright | outdent indent | image link unlink anchor cleanup hr",
619 "table | bullist numlist | undo redo | removeformat | emoticons charmap | forecolor backcolor | code"
623 [% END # /UNLESS wysiwyg %]
626 [% INCLUDE 'intranet-bottom.inc' %]