7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Additional contents › Tools › Koha</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 [% UNLESS ( wysiwyg ) %]
11 [% Asset.css("lib/codemirror/codemirror.css") | $raw %]
12 [% Asset.css("lib/codemirror/lint.min.css") | $raw %]
22 <body id="tools_additional-contents" class="tools">
23 [% INCLUDE 'header.inc' %]
24 [% INCLUDE 'cat-search.inc' %]
26 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
29 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
32 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
35 [% IF op == 'add_form' %]
37 <a href="/cgi-bin/koha/tools/additional-contents.pl">Additional contents</a>
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 Modify additional content
51 Add additional content
57 <a href="#" aria-current="page">
59 ([% IF category == 'news' %]News[% ELSE %]HTML customizations[% END %])
66 [% IF op == 'add_form' %]
67 <div class="main container-fluid">
69 <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
71 <div class="main container-fluid">
73 <div class="col-sm-10 col-sm-push-2">
78 [% FOR m IN messages %]
79 <div class="dialog [% m.type | html %]">
81 [% CASE 'error_on_update' %]
82 An error occurred when updating this content. Perhaps it already exists.
83 [% CASE 'error_on_insert' %]
84 An error occurred when adding this content. Check the logs
85 [% CASE 'error_on_delete' %]
86 An error occurred when deleting this content. Check the logs.
87 [% CASE 'success_on_update' %]
88 Content updated successfully.
89 [% CASE 'success_on_insert' %]
90 Content added successfully.
91 [% CASE 'success_on_delete' %]
92 Content deleted successfully.
99 [% IF op == 'add_form' %]
100 [% PROCESS add_form %]
107 [% IF op != 'add_form' %]
108 </div> <!-- /.col-sm-10.col-sm-push-2 -->
110 <div class="col-sm-2 col-sm-pull-10">
113 <div id="news-filter">
114 <form action="/cgi-bin/koha/tools/additional-contents.pl" method="get">
116 <fieldset class="brief">
119 <label for="news_keyword">Keyword:</label>
120 <input type="text" name="news_keyword" id="news_keyword" />
123 <label for="news_display_location">Display location:</label>
124 <select name="news_display_location" id="news_display_location">
125 <option value="">All</option>
126 [% PROCESS locations_options category => category %]
130 <label for="news_library">Library: </label>
131 <select id="news_library" name="news_library">
132 <option value=""></option>
133 <option value="">All libraries</option>
134 [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
139 <input type="checkbox" name="show_expired" id="show_expired" /> Show expired
147 [% INCLUDE 'tools-menu.inc' %]
149 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
151 </div> <!-- /.row -->
152 </div> <!-- /.main.container-fluid -->
155 [% IF additional_content %]
156 <h1>Modify an additional content</h1>
158 <h1>New additional content ([% IF category == 'news' %]News[% ELSE %]HTML customizations[% END %])</h1>
161 <div id="toolbar" class="btn-toolbar">
162 <div class="btn-group">
163 <button class="btn btn-default" id="submit_form"><i class="fa fa-save"></i> Save</button>
165 <a class="btn btn-default cancel" href="/cgi-bin/koha/tools/additional-contents.pl"><i class="fa fa-remove"></i> Cancel</a>
168 <form id="add_additional_content" method="post" action="/cgi-bin/koha/tools/additional-contents.pl" class="validate">
169 <input type="hidden" name="op" value="add_validate" />
170 <input type="hidden" name="id" value="[% additional_content.idnew | html %]" />
171 <input type="hidden" name="category" value="[% category | html %]" />
172 <fieldset class="rows">
175 [% IF additional_content %]
176 <span class="label">Code:</span> [% additional_content.code | html %]
177 <input type="hidden" id="code" name="code" value="[% additional_content.code | html %]" />
179 <label for="code" class="required">Code:</label>
180 <input type="text" id="code" name="code" size="20" maxlength="20" value="" required="required"/>
181 <span class="required">Required</span>
185 <label for="location">Display location:</label>
186 <select id="location" name="location">
187 [% PROCESS locations_options location => additional_content.location %]
191 <label for="branchcode">Library: </label>
192 <select id="branchcode" name="branchcode">
193 [% IF additional_content.branchcode == '' %]
194 <option value="" selected="selected">All libraries</option>
196 <option value="">All libraries</option>
198 [% PROCESS options_for_libraries libraries => Branches.all( selected => additional_content.branchcode, unfiltered => 1, ) %]
201 [% UNLESS languages.size %]
203 <label for="title" class="required">Title: </label>
204 <input id="title" size="30" type="text" name="title" value="[% additional_content.title | html %]" required="required" class="required" /> <span class="required">Required</span>
208 <label for="from">Publication date: </label>
209 <input id="from" type="text" name="published_on" size="15" value="[% additional_content.published_on | html %]" class="flatpickrfrom" />
210 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
213 <label for="to">Expiration date: </label>
214 <input id="to" type="text" name="expirationdate" size="15" value="[% additional_content.expirationdate | html %]" class="flatpickrto" />
216 [% INCLUDE 'date-format.inc' %]
217 [% IF category == 'news' %]
218 <br>News will still be accessible by direct URL if expired.
223 <label for="number">Appear in position: </label>
224 [% IF ( additional_content.number ) %]
225 <input id="number" size="3" name="number" type="text" value="[% additional_content.number | html %]" />
227 <input id="number" size="3" name="number" type="text" />
233 [% IF languages.size %]
234 <div style="clear:both"></div>
237 [% FOR language IN languages %]
238 [% IF language.lang == 'default' %]
239 <li><a href="#lang_default">Default</a></li>
241 <li><a href="#lang_[% language.lang | uri %]">[% language.description | html %]</a></li>
246 [% FOR language IN languages %]
247 <div id="lang_[% language.lang | uri %]" class="lang" data-lang="[% language.description | html %]">
248 <div style="clear:both;">
250 <fieldset>[%# FIXME We should remove list-style:none; and use class="rows" here but it does not work. Owen please help! %]
252 <li style="list-style: none;">
253 <label for="title_[% language.lang | html %]">Title: </label>
254 <input id="title_[% language.lang| html %]" size="30" type="text" name="title" value="[% translated_contents.item(language.lang).title | html %]"></span>
256 <li style="list-style: none;">
257 <label for="content_[% language.lang | html %]">Content: </label>
258 <textarea name="content" id="content_[% language.lang | html %]" cols="75" rows="10">[% translated_contents.item(language.lang).content | html %]</textarea>
259 <input type="hidden" name="lang" value="[% language.lang | html %]" />
268 <div id="lang_default">
269 <div style="clear:both;">
270 <textarea name="content" id="content_default" cols="75" rows="10">[% additional_content.content | html %]</textarea>
279 <div id="toolbar" class="btn-toolbar">
280 <a class="btn btn-default" id="newentry" href="/cgi-bin/koha/tools/additional-contents.pl?op=add_form&category=[% category | html %]"><i class="fa fa-plus"></i> New entry</a>
283 <h2>Additional contents ([% IF category == 'news' %]News[% ELSE %]HTML customizations[% END %])</h2>
284 [% IF category == 'news' %]
285 See <a href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations">HTML customizations</a>
287 See <a href="/cgi-bin/koha/tools/additional-contents.pl?category=news">News</a>
290 [% IF additional_contents.count %]
291 <form id="del_form" method="post" action="/cgi-bin/koha/tools/additional-contents.pl">
292 <table id="table_additional_contents">
295 <th class="NoSort"> </th>
299 <th>Publication date</th>
300 <th>Expiration date</th>
301 <th class="anti-the">Title</th>
303 <th class="anti-the">News</th>
304 <th class="NoSort noExport">Actions</th>
308 [% FOREACH c IN additional_contents%]
309 [% IF ( c.is_expired ) %]<tr class="expired">[% ELSE %]<tr>[% END %]
311 <input type="checkbox" name="ids" value="[% c.idnew | html %]" />
314 [% IF c.category == 'news' %]
315 [% IF c.location == 'staff_and_opac' %]All
316 [% ELSIF c.location == 'staff_only' %]Librarian interface
317 [% ELSIF c.location == 'opac_only' %]OPAC
318 [% ELSIF c.location == 'slip' %]Slip
319 [% ELSE %]Unknown ('[% location | html %]')
322 [% c.location | html %]
326 [% IF ( c.branchcode == "" ) -%]
328 [% ELSE %][% c.library.branchname | html %]
331 <td>[% c.number | html %]</td>
332 <td data-order="[% c.published_on | html %]">[% c.published_on | $KohaDates %]</td>
333 <td data-order="[% c.expirationdate | html %]">[% c.expirationdate | $KohaDates %] [% IF ( c.is_expired ) %](<span class="expired">expired</span>)[% END %]</td>
334 <td>[% c.title | html %]</td>
335 <td>[% IF ( c.author) %][% INCLUDE 'patron-title.inc' patron=c.author %][% END %]</td>
337 <div class="btn-group">
338 <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>
340 <div id="contentModal[% loop.count | html %]" class="modal" tabindex="-1" role="dialog" data-number="[% loop.count | html %]">
341 <div class="modal-dialog" role="document">
342 <div class="modal-content modal-lg">
343 <div class="modal-header">
344 <h5 class="modal-title">Preview of: "[% c.title | html %]"</h5>
346 <div class="modal-body">
347 [% c.content | $raw %]
349 <div class="modal-footer">
350 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
357 [% SET editmode = "wysiwyg" %]
359 [% SET editmode = "text" %]
361 <div class="btn-group dropup">
362 <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">
363 <span class="caret"></span>
365 <ul class="dropdown-menu pull-right">
368 <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>
370 <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>
375 <div class="btn-group">
376 <a href="#" class="delete_news btn btn-default btn-xs" data-idnew="[% c.idnew | html %]"><i class="fa fa-trash"></i> Delete</a>
383 <input type="hidden" name="op" value="delete_confirmed" />
384 <input type="hidden" name="category" value="[% category | html %]" />
385 <fieldset class="action"><input type="submit" class="button" value="Delete selected" /></fieldset>
387 <form action="/cgi-bin/koha/tools/additional-contents.pl" method="post" id="delete_single">
388 <input type="hidden" id="del_op" name="op" value="delete_confirmed" />
389 <input type="hidden" id="del_category" name="category" value="[% category | html %]" />
390 <input type="hidden" id="del_ids" name="ids" />
393 <div class="dialog message">There are no additional contents.</div>
397 [% BLOCK locations_options %]
398 [% IF category == 'news' %]
399 [% IF location == "staff_and_opac" %]
400 <option value="staff_and_opac" selected="selected">Librarian and OPAC interfaces</option>
402 <option value="staff_and_opac">Librarian and OPAC interfaces</option>
405 [% IF location == "staff_only" %]
406 <option value="staff_only" selected="selected">Librarian interface</option>
408 <option value="staff_only">Librarian interface</option>
411 [% IF location == "opac_only" %]
412 <option value="opac_only" selected="selected">OPAC</option>
414 <option value="opac_only">OPAC</option>
417 [% IF location == "slip" %]
418 <option value="slip" selected="selected">Slip</option>
420 <option value="slip">Slip</option>
423 [% FOREACH l IN [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText' ] %]
424 [% IF l == location %]
425 <option value="[% l | html %]" selected="selected">[% l | html %]</option>
427 <option value="[% l | html %]">[% l | html %]</option>
433 [% MACRO jsinclude BLOCK %]
434 [% INCLUDE 'calendar.inc' %]
435 [% Asset.js("js/tools-menu.js") | $raw %]
436 [% Asset.js("lib/hc-sticky.js") | $raw %]
437 [% IF additional_contents.count %]
438 [% INCLUDE 'datatables.inc' %]
440 $('.preview_news').click( function() {
441 modalNumber = $(this).attr('data-number');
442 $('.modal[data-number="'+modalNumber+'"]').modal('show');
445 var form = document.getElementById('del_form');
446 var inputs = form.getElementsByTagName('input');
448 for (var i=0; i<inputs.length; i++) {
449 if (inputs[i].type == 'checkbox' && inputs[i].name == 'ids') {
450 checked = inputs[i].checked;
451 if (checked) return true;
456 function filterDataTable( table, column, term ){
458 table.column( column ).search( term ).draw();
460 table.search( term ).draw();
465 function clearFilter( term ){
467 $(".dt_button_clear_filter").addClass("disabled");
469 $(".dt_button_clear_filter").removeClass("disabled");
473 /* Custom table search configuration: If a table row
474 has an "expired" class, hide it UNLESS the
475 show_expired checkbox is checked */
476 $.fn.dataTable.ext.search.push(
477 function( settings, searchData, index, rowData, counter ) {
478 var row = $(settings.aoData[index].nTr);
479 if( row.hasClass("expired") && !$("#show_expired").prop("checked") ){
487 $(document).ready(function() {
489 var table = $("#table_additional_contents").DataTable($.extend(true, {}, dataTablesDefaults, {
490 "order": [[ 4, "desc" ]],
492 { "sortable": false, "searchable": false, 'targets': [ 'NoSort' ] },
493 { "type": "anti-the", "targets": [ "anti-the" ] }
495 "sPaginationType": "full_numbers"
498 $("#del_form").on("click", ".delete_news", function(e){
500 if( confirmDelete( _("Are you sure you want to delete this content? This cannot be undone.") ) ){
501 $("#del_ids").val( $(this).data("idnew") );
502 $("#delete_single").submit();
506 $("#del_form").on("submit",function(){
508 return confirmDelete( _("Are you sure you want to delete the selected content?") );
510 alert(_("Please select content to delete."));
515 $("#show_expired").on("change", function(){
516 /* redraw the DataTable according to the custom search function */
520 table.on( 'search.dt', function () {
521 var term = table.search();
522 $("#news_keyword").val( term );
525 $("#news_keyword").on("keyup", function(){
526 var term = $(this).val();
527 filterDataTable( table, null, term );
530 $("#news_display_location").on("change", function(){
531 var term = $(this).val();
532 filterDataTable( table, 1, term );
535 $("#news_library").on("change", function(){
536 // Table must be filtered by the <option>'s text, not its value
537 var opt = $(this).find("option:selected").text();
538 filterDataTable( table, 2, opt );
541 $(".dt_button_clear_filter").on("click", function(){
542 table.search('').columns().search('').draw();
543 $("#news-filter select").each(function(){
551 $(document).ready(function() {
553 $("#add_additional_content").validate({
554 submitHandler: function(form){
555 if ( ! $("#title_default").val().length > 0 ) {
556 alert(__("Please specify a title for 'Default'"));
564 $("#submit_form").on("click",function(){
565 $("#add_additional_content").submit();
568 Sticky = $("#toolbar");
571 stickyClass: "floating"
577 [% UNLESS ( wysiwyg ) %]
578 [% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %]
579 [% Asset.js( "lib/codemirror/xml.min.js" ) | $raw %]
580 [% Asset.js( "lib/codemirror/lint.min.js" ) | $raw %]
581 [% Asset.js( "lib/linters/htmlhint.min.js" ) | $raw %]
582 [% Asset.js( "lib/codemirror/html-lint.min.js" ) | $raw %]
584 var editor = CodeMirror.fromTextArea(document.getElementById('content'), {
589 gutters: ["CodeMirror-lint-markers"],
590 viewportMargin: Infinity,
594 [% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %]
595 [% INCLUDE 'str/tinymce_i18n.inc' %]
599 force_br_newlines : false,
600 force_p_newlines : false,
601 forced_root_block : '',
603 relative_urls : false,
604 content_css : "[% interface | html %]/[% theme | html %]/css/tinymce.css",
605 menubar : "file edit view insert format tools table",
606 mode : "specific_textareas",
607 plugins : "autoresize table hr link image charmap lists code emoticons",
608 extended_valid_elements:"style,link[href|rel]",
609 custom_elements:"style,link,~link",
611 "formatselect | bold italic | cut copy paste | alignleft aligncenter alignright | outdent indent | image link unlink anchor cleanup hr",
612 "table | bullist numlist | undo redo | removeformat | emoticons charmap | forecolor backcolor | code"
616 [% END # /UNLESS wysiwyg %]
619 [% INCLUDE 'intranet-bottom.inc' %]