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="id" value="[% additional_content.idnew | html %]" />
182 <input type="hidden" name="category" value="[% category | html %]" />
183 <fieldset class="rows">
186 [% IF additional_content %]
187 <span class="label">Code:</span> [% additional_content.code | html %]
188 <input type="hidden" id="code" name="code" value="[% additional_content.code | html %]" />
190 <label for="code" class="required">Code:</label>
191 <input type="text" id="code" name="code" size="20" maxlength="20" value="" required="required"/>
192 <span class="required">Required</span>
196 <label for="location">Display location:</label>
197 <select id="location" name="location">
198 [% PROCESS locations_options location => additional_content.location %]
202 <label for="branchcode">Library: </label>
203 <select id="branchcode" name="branchcode">
204 [% IF additional_content.branchcode == '' %]
205 <option value="" selected="selected">All libraries</option>
207 <option value="">All libraries</option>
209 [% PROCESS options_for_libraries libraries => Branches.all( selected => additional_content.branchcode, unfiltered => 1, ) %]
212 [% UNLESS languages.size %]
214 <label for="title" class="required">Title: </label>
215 <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>
219 <label for="from">Publication date: </label>
220 <input id="from" type="text" name="published_on" size="15" value="[% additional_content.published_on | $KohaDates %]" class="flatpickr" data-date_to="to" />
221 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
224 <label for="to">Expiration date: </label>
225 <input id="to" type="text" name="expirationdate" size="15" value="[% additional_content.expirationdate | $KohaDates %]" class="flatpickr" />
227 [% INCLUDE 'date-format.inc' %]
228 [% IF category == 'news' %]
229 <br>News will still be accessible by direct URL if expired.
234 <label for="number">Appear in position: </label>
235 [% IF ( additional_content.number ) %]
236 <input id="number" size="3" name="number" type="text" value="[% additional_content.number | html %]" />
238 <input id="number" size="3" name="number" type="text" />
244 [% IF languages.size %]
245 <div style="clear:both"></div>
248 [% FOR language IN languages %]
249 [% IF language.lang == 'default' %]
250 <li><a href="#lang_default">Default</a></li>
252 <li><a href="#lang_[% language.lang | uri %]">[% language.description | html %]</a></li>
257 [% FOR language IN languages %]
258 <div id="lang_[% language.lang | uri %]" class="lang clearfix" data-lang="[% language.description | html %]">
259 <fieldset class="rows">
261 <li style="list-style: none;">
262 <label for="title_[% language.lang | html %]">Title: </label>
263 <input id="title_[% language.lang| html %]" size="100" maxlength="250" type="text" name="title" value="[% translated_contents.item(language.lang).title | html %]">
265 <li style="list-style: none;">
266 <label for="content_[% language.lang | html %]">Content: </label>
267 <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>
268 <input type="hidden" name="lang" value="[% language.lang | html %]" />
276 <div id="lang_default">
277 <div class="clearfix">
278 <textarea name="content" id="content_default" data-lang="[% language.lang | html %]" cols="75" rows="10">[% additional_content.content | html %]</textarea>
287 <div id="toolbar" class="btn-toolbar">
288 <div class="btn-group">
289 <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">
290 <span class="caret"></span>
292 <ul class="dropdown-menu pull-right">
295 <a href="/cgi-bin/koha/tools/additional-contents.pl?op=add_form&category=[% category | uri %]&editmode=text">New entry using text editor</a>
297 <a href="/cgi-bin/koha/tools/additional-contents.pl?op=add_form&category=[% category | uri %]&editmode=wysiwyg">New entry using WYSIWYG editor</a>
304 <h2>Additional contents ([% IF category == 'news' %]News[% ELSE %]HTML customizations[% END %])</h2>
305 [% IF category == 'news' %]
306 See <a href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations">HTML customizations</a>
308 See <a href="/cgi-bin/koha/tools/additional-contents.pl?category=news">News</a>
311 [% IF additional_contents.count %]
312 <form id="del_form" method="post" action="/cgi-bin/koha/tools/additional-contents.pl">
313 <table id="table_additional_contents">
316 <th class="NoSort"> </th>
320 <th>Publication date</th>
321 <th>Expiration date</th>
322 <th class="anti-the">Title</th>
324 <th class="anti-the">News</th>
325 <th class="NoSort noExport">Actions</th>
329 [% FOREACH c IN additional_contents%]
330 [% IF ( c.is_expired ) %]<tr class="expired">[% ELSE %]<tr>[% END %]
332 <input type="checkbox" name="ids" value="[% c.idnew | html %]" />
335 [% IF c.category == 'news' %]
336 [% IF c.location == 'staff_and_opac' %]All
337 [% ELSIF c.location == 'staff_only' %]Librarian interface
338 [% ELSIF c.location == 'opac_only' %]OPAC
339 [% ELSIF c.location == 'slip' %]Slip
340 [% ELSE %]Unknown ('[% location | html %]')
343 [% c.location | html %]
347 [% IF ( c.branchcode == "" ) -%]
349 [% ELSE %][% c.library.branchname | html %]
352 <td>[% c.number | html %]</td>
353 <td data-order="[% c.published_on | html %]">[% c.published_on | $KohaDates %]</td>
354 <td data-order="[% c.expirationdate | html %]">[% c.expirationdate | $KohaDates %] [% IF ( c.is_expired ) %](<span class="expired">expired</span>)[% END %]</td>
355 <td>[% c.title | html %]</td>
356 <td>[% IF ( c.author) %][% INCLUDE 'patron-title.inc' patron=c.author %][% END %]</td>
358 <div class="btn-group">
359 <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>
361 <div id="contentModal[% loop.count | html %]" class="modal" tabindex="-1" role="dialog" data-number="[% loop.count | html %]">
362 <div class="modal-dialog" role="document">
363 <div class="modal-content modal-lg">
364 <div class="modal-header">
365 <h5 class="modal-title">Preview of: "[% c.title | html %]"</h5>
367 <div class="modal-body">
368 [% c.content | $raw %]
370 <div class="modal-footer">
371 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
377 <div class="btn-group dropup">
378 <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">
379 <span class="caret"></span>
381 <ul class="dropdown-menu pull-right">
384 <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>
386 <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>
391 <div class="btn-group">
392 <a href="#" class="delete_news btn btn-default btn-xs" data-idnew="[% c.idnew | html %]"><i class="fa fa-trash"></i> Delete</a>
399 <input type="hidden" name="op" value="delete_confirmed" />
400 <input type="hidden" name="category" value="[% category | html %]" />
401 <fieldset class="action"><input type="submit" class="button" value="Delete selected" /></fieldset>
403 <form action="/cgi-bin/koha/tools/additional-contents.pl" method="post" id="delete_single">
404 <input type="hidden" id="del_op" name="op" value="delete_confirmed" />
405 <input type="hidden" id="del_category" name="category" value="[% category | html %]" />
406 <input type="hidden" id="del_ids" name="ids" />
409 <div class="dialog message">There are no additional contents.</div>
413 [% BLOCK locations_options %]
414 [% IF category == 'news' %]
415 [% IF location == "staff_and_opac" %]
416 <option value="staff_and_opac" selected="selected">Librarian and OPAC interfaces</option>
418 <option value="staff_and_opac">Librarian and OPAC interfaces</option>
421 [% IF location == "staff_only" %]
422 <option value="staff_only" selected="selected">Librarian interface</option>
424 <option value="staff_only">Librarian interface</option>
427 [% IF location == "opac_only" %]
428 <option value="opac_only" selected="selected">OPAC</option>
430 <option value="opac_only">OPAC</option>
433 [% IF location == "slip" %]
434 <option value="slip" selected="selected">Slip</option>
436 <option value="slip">Slip</option>
439 [% FOREACH l IN [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText' ] %]
440 [% IF l == location %]
441 <option value="[% l | html %]" selected="selected">[% l | html %]</option>
443 <option value="[% l | html %]">[% l | html %]</option>
449 [% MACRO jsinclude BLOCK %]
450 [% INCLUDE 'calendar.inc' %]
451 [% Asset.js("js/tools-menu.js") | $raw %]
452 [% Asset.js("lib/hc-sticky.js") | $raw %]
453 [% IF additional_contents.count %]
454 [% INCLUDE 'datatables.inc' %]
456 $('.preview_news').click( function() {
457 modalNumber = $(this).attr('data-number');
458 $('.modal[data-number="'+modalNumber+'"]').modal('show');
461 var form = document.getElementById('del_form');
462 var inputs = form.getElementsByTagName('input');
464 for (var i=0; i<inputs.length; i++) {
465 if (inputs[i].type == 'checkbox' && inputs[i].name == 'ids') {
466 checked = inputs[i].checked;
467 if (checked) return true;
472 function filterDataTable( table, column, term ){
474 table.column( column ).search( term ).draw();
476 table.search( term ).draw();
481 function clearFilter( term ){
483 $(".dt_button_clear_filter").addClass("disabled");
485 $(".dt_button_clear_filter").removeClass("disabled");
489 /* Custom table search configuration: If a table row
490 has an "expired" class, hide it UNLESS the
491 show_expired checkbox is checked */
492 $.fn.dataTable.ext.search.push(
493 function( settings, searchData, index, rowData, counter ) {
494 var row = $(settings.aoData[index].nTr);
495 if( row.hasClass("expired") && !$("#show_expired").prop("checked") ){
503 $(document).ready(function() {
505 var table = $("#table_additional_contents").DataTable($.extend(true, {}, dataTablesDefaults, {
506 "order": [[ 4, "desc" ]],
508 { "sortable": false, "searchable": false, 'targets': [ 'NoSort' ] },
509 { "type": "anti-the", "targets": [ "anti-the" ] }
511 "sPaginationType": "full_numbers"
514 $("#del_form").on("click", ".delete_news", function(e){
516 if( confirmDelete( _("Are you sure you want to delete this content? This cannot be undone.") ) ){
517 $("#del_ids").val( $(this).data("idnew") );
518 $("#delete_single").submit();
522 $("#del_form").on("submit",function(){
524 return confirmDelete( _("Are you sure you want to delete the selected content?") );
526 alert(_("Please select content to delete."));
531 $("#show_expired").on("change", function(){
532 /* redraw the DataTable according to the custom search function */
536 table.on( 'search.dt', function () {
537 var term = table.search();
538 $("#news_keyword").val( term );
541 $("#news_keyword").on("keyup", function(){
542 var term = $(this).val();
543 filterDataTable( table, null, term );
546 $("#news_display_location").on("change", function(){
547 var term = $(this).val();
548 filterDataTable( table, 1, term );
551 $("#news_library").on("change", function(){
552 // Table must be filtered by the <option>'s text, not its value
553 var opt = $(this).find("option:selected").text();
554 filterDataTable( table, 2, opt );
557 $(".dt_button_clear_filter").on("click", function(){
558 table.search('').columns().search('').draw();
559 $("#news-filter select").each(function(){
567 $(document).ready(function() {
569 $("#add_additional_content").validate({
570 submitHandler: function(form){
571 if ( ! $("#title_default").val().length > 0 ) {
572 alert(__("Please specify a title for 'Default'"));
580 $("#submit_form").on("click",function(){
581 $("#add_additional_content").submit();
584 Sticky = $("#toolbar");
587 stickyClass: "floating"
593 [% UNLESS ( wysiwyg ) %]
594 [% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %]
595 [% Asset.js( "lib/codemirror/xml.min.js" ) | $raw %]
596 [% Asset.js( "lib/codemirror/lint.min.js" ) | $raw %]
597 [% Asset.js( "lib/linters/htmlhint.min.js" ) | $raw %]
598 [% Asset.js( "lib/codemirror/html-lint.min.js" ) | $raw %]
600 $("textarea[name='content']").each( function(index) {
601 var this_lang = $(this).attr('data-lang');
602 var editor = CodeMirror.fromTextArea(document.getElementById('content_' + this_lang), {
607 gutters: ["CodeMirror-lint-markers"],
608 viewportMargin: Infinity,
613 [% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %]
614 [% INCLUDE 'str/tinymce_i18n.inc' %]
618 force_br_newlines : false,
619 force_p_newlines : false,
620 forced_root_block : '',
622 relative_urls : false,
623 content_css : "[% interface | html %]/[% theme | html %]/css/tinymce.css",
624 menubar : "file edit view insert format tools table",
625 mode : "specific_textareas",
626 plugins : "autoresize table hr link image charmap lists code emoticons",
627 extended_valid_elements:"style,link[href|rel]",
628 custom_elements:"style,link,~link",
630 "formatselect | bold italic | cut copy paste | alignleft aligncenter alignright | outdent indent | image link unlink anchor cleanup hr",
631 "table | bullist numlist | undo redo | removeformat | emoticons charmap | forecolor backcolor | code"
635 [% END # /UNLESS wysiwyg %]
638 [% INCLUDE 'intranet-bottom.inc' %]