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 <a href="#" aria-current="page">
41 [% IF additional_content.idnew %]
42 Modify additional content
44 Add additional content
50 <a href="#" aria-current="page">
52 ([% IF category == 'news' %]News[% ELSE %]HTML customizations[% END %])
59 [% IF op == 'add_form' %]
60 <div class="main container-fluid">
62 <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
64 <div class="main container-fluid">
66 <div class="col-sm-10 col-sm-push-2">
71 [% FOR m IN messages %]
72 <div class="dialog [% m.type | html %]">
74 [% CASE 'error_on_update' %]
75 An error occurred when updating this content. Perhaps it already exists.
76 [% CASE 'error_on_insert' %]
77 An error occurred when adding this content. Check the logs
78 [% CASE 'error_on_delete' %]
79 An error occurred when deleting this content. Check the logs.
80 [% CASE 'success_on_update' %]
81 Content updated successfully.
82 [% CASE 'success_on_insert' %]
83 Content added successfully.
84 [% CASE 'success_on_delete' %]
85 Content deleted successfully.
92 [% IF op == 'add_form' %]
93 [% PROCESS add_form %]
100 [% IF op != 'add_form' %]
101 </div> <!-- /.col-sm-10.col-sm-push-2 -->
103 <div class="col-sm-2 col-sm-pull-10">
106 <div id="news-filter">
107 <form action="/cgi-bin/koha/tools/additional-contents.pl" method="get">
109 <fieldset class="brief">
112 <label for="news_keyword">Keyword:</label>
113 <input type="text" name="news_keyword" id="news_keyword" />
116 <label for="news_display_location">Display location:</label>
117 <select name="news_display_location" id="news_display_location">
118 <option value="">All</option>
119 [% PROCESS locations_options category => category %]
123 <label for="news_library">Library: </label>
124 <select id="news_library" name="news_library">
125 <option value=""></option>
126 <option value="">All libraries</option>
127 [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
132 <input type="checkbox" name="show_expired" id="show_expired" /> Show expired
140 [% INCLUDE 'tools-menu.inc' %]
142 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
144 </div> <!-- /.row -->
145 </div> <!-- /.main.container-fluid -->
148 [% IF additional_content %]
149 <h1>Modify an additional content</h1>
151 <h1>New additional content ([% IF category == 'news' %]News[% ELSE %]HTML customizations[% END %])</h1>
154 <div id="toolbar" class="btn-toolbar">
155 <div class="btn-group">
156 <button class="btn btn-default" id="submit_form"><i class="fa fa-save"></i> Save</button>
158 <a class="btn btn-default cancel" href="/cgi-bin/koha/tools/additional-contents.pl"><i class="fa fa-remove"></i> Cancel</a>
161 <form id="add_additional_content" method="post" action="/cgi-bin/koha/tools/additional-contents.pl" class="validate">
162 <input type="hidden" name="op" value="add_validate" />
163 <input type="hidden" name="id" value="[% additional_content.idnew | html %]" />
164 <input type="hidden" name="category" value="[% category | html %]" />
165 <fieldset class="rows">
168 [% IF additional_content %]
169 <span class="label">Code:</span> [% additional_content.code | html %]
170 <input type="hidden" id="code" name="code" value="[% additional_content.code | html %]" />
172 <label for="code" class="required">Code:</label>
173 <input type="text" id="code" name="code" size="20" maxlength="20" value="" required="required"/>
174 <span class="required">Required</span>
178 <label for="location">Display location:</label>
179 <select id="location" name="location">
180 [% PROCESS locations_options location => additional_content.location %]
184 <label for="branchcode">Library: </label>
185 <select id="branchcode" name="branchcode">
186 [% IF additional_content.branchcode == '' %]
187 <option value="" selected="selected">All libraries</option>
189 <option value="">All libraries</option>
191 [% PROCESS options_for_libraries libraries => Branches.all( selected => additional_content.branchcode, unfiltered => 1, ) %]
194 [% UNLESS languages.size %]
196 <label for="title" class="required">Title: </label>
197 <input id="title" size="30" type="text" name="title" value="[% additional_content.title | html %]" required="required" class="required" /> <span class="required">Required</span>
201 <label for="from">Publication date: </label>
202 <input id="from" type="text" name="published_on" size="15" value="[% additional_content.published_on | html %]" class="datepickerfrom" />
203 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
206 <label for="to">Expiration date: </label>
207 <input id="to" type="text" name="expirationdate" size="15" value="[% additional_content.expirationdate | html %]" class="datepickerto" />
209 [% INCLUDE 'date-format.inc' %]
210 [% IF category == 'news' %]
211 <br>News will still be accessible by direct URL if expired.
216 <label for="number">Appear in position: </label>
217 [% IF ( additional_content.number ) %]
218 <input id="number" size="3" name="number" type="text" value="[% additional_content.number | html %]" />
220 <input id="number" size="3" name="number" type="text" />
226 [% IF languages.size %]
227 <div style="clear:both"></div>
230 [% FOR language IN languages %]
231 [% IF language.lang == 'default' %]
232 <li><a href="#lang_default">Default</a></li>
234 <li><a href="#lang_[% language.lang | uri %]">[% language.description | html %]</a></li>
239 [% FOR language IN languages %]
240 <div id="lang_[% language.lang | uri %]" class="lang" data-lang="[% language.description | html %]">
241 <div style="clear:both;">
243 <fieldset>[%# FIXME We should remove list-style:none; and use class="rows" here but it does not work. Owen please help! %]
245 <li style="list-style: none;">
246 <label for="title_[% language.lang | html %]">Title: </label>
247 <input id="title_[% language.lang| html %]" size="30" type="text" name="title" value="[% translated_contents.item(language.lang).title | html %]"></span>
249 <li style="list-style: none;">
250 <label for="content_[% language.lang | html %]">Content: </label>
251 <textarea name="content" id="content_[% language.lang | html %]" cols="75" rows="10">[% translated_contents.item(language.lang).content | html %]</textarea>
252 <input type="hidden" name="lang" value="[% language.lang | html %]" />
261 <div id="lang_default">
262 <div style="clear:both;">
263 <textarea name="content" id="content_default" cols="75" rows="10">[% additional_content.content | html %]</textarea>
272 <div id="toolbar" class="btn-toolbar">
273 <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>
276 <h2>Additional contents ([% IF category == 'news' %]News[% ELSE %]HTML customizations[% END %])</h2>
277 [% IF category == 'news' %]
278 See <a href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations">HTML customizations</a>
280 See <a href="/cgi-bin/koha/tools/additional-contents.pl?category=news">News</a>
283 [% IF additional_contents.count %]
284 <form id="del_form" method="post" action="/cgi-bin/koha/tools/additional-contents.pl">
285 <table id="table_additional_contents">
288 <th class="NoSort"> </th>
292 <th>Publication date</th>
293 <th>Expiration date</th>
294 <th class="anti-the">Title</th>
296 <th class="anti-the">News</th>
297 <th class="NoSort noExport">Actions</th>
301 [% FOREACH c IN additional_contents%]
302 [% IF ( c.is_expired ) %]<tr class="expired">[% ELSE %]<tr>[% END %]
304 <input type="checkbox" name="ids" value="[% c.idnew | html %]" />
307 [% IF c.category == 'news' %]
308 [% IF c.location == 'staff_and_opac' %]All
309 [% ELSIF c.location == 'staff_only' %]Librarian interface
310 [% ELSIF c.location == 'opac_only' %]OPAC
311 [% ELSIF c.location == 'slip' %]Slip
312 [% ELSE %]Unknown ('[% location | html %]')
315 [% c.location | html %]
319 [% IF ( c.branchcode == "" ) -%]
321 [% ELSE %][% c.library.branchname | html %]
324 <td>[% c.number | html %]</td>
325 <td data-order="[% c.published_on | html %]">[% c.published_on | $KohaDates %]</td>
326 <td data-order="[% c.expirationdate | html %]">[% c.expirationdate | $KohaDates %] [% IF ( c.is_expired ) %](<span class="expired">expired</span>)[% END %]</td>
327 <td>[% c.title | html %]</td>
328 <td>[% IF ( c.author) %][% INCLUDE 'patron-title.inc' patron=c.author %][% END %]</td>
330 <div class="btn-group">
331 <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>
333 <div id="contentModal[% loop.count | html %]" class="modal" tabindex="-1" role="dialog" data-number="[% loop.count | html %]">
334 <div class="modal-dialog" role="document">
335 <div class="modal-content modal-lg">
336 <div class="modal-header">
337 <h5 class="modal-title">Preview of: "[% c.title | html %]"</h5>
339 <div class="modal-body">
340 [% c.content | $raw %]
342 <div class="modal-footer">
343 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
350 [% SET editmode = "wysiwyg" %]
352 [% SET editmode = "text" %]
354 <div class="btn-group dropup">
355 <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">
356 <span class="caret"></span>
358 <ul class="dropdown-menu pull-right">
361 <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>
363 <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>
368 <div class="btn-group">
369 <a href="/cgi-bin/koha/tools/additional-contents.pl?op=del&ids=[% c.idnew | uri %]" class="delete_news btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</a>
376 <input type="hidden" name="op" value="del" />
377 <fieldset class="action"><input type="submit" class="button" value="Delete selected" /></fieldset>
380 <div class="dialog message">There are no additional contents.</div>
384 [% BLOCK locations_options %]
385 [% IF category == 'news' %]
386 [% IF location == "staff_and_opac" %]
387 <option value="staff_and_opac" selected="selected">Librarian and OPAC interfaces</option>
389 <option value="staff_and_opac">Librarian and OPAC interfaces</option>
392 [% IF location == "staff_only" %]
393 <option value="staff_only" selected="selected">Librarian interface</option>
395 <option value="staff_only">Librarian interface</option>
398 [% IF location == "opac_only" %]
399 <option value="opac_only" selected="selected">OPAC</option>
401 <option value="opac_only">OPAC</option>
404 [% IF location == "slip" %]
405 <option value="slip" selected="selected">Slip</option>
407 <option value="slip">Slip</option>
410 [% FOREACH l IN [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText' ] %]
411 [% IF l == location %]
412 <option value="[% l | html %]" selected="selected">[% l | html %]</option>
414 <option value="[% l | html %]">[% l | html %]</option>
420 [% MACRO jsinclude BLOCK %]
421 [% INCLUDE 'calendar.inc' %]
422 [% Asset.js("js/tools-menu.js") | $raw %]
423 [% Asset.js("lib/hc-sticky.js") | $raw %]
424 [% IF additional_contents.count %]
425 [% INCLUDE 'datatables.inc' %]
427 $('.preview_news').click( function() {
428 modalNumber = $(this).attr('data-number');
429 $('.modal[data-number="'+modalNumber+'"]').modal('show');
432 var form = document.getElementById('del_form');
433 var inputs = form.getElementsByTagName('input');
435 for (var i=0; i<inputs.length; i++) {
436 if (inputs[i].type == 'checkbox' && inputs[i].name == 'ids') {
437 checked = inputs[i].checked;
438 if (checked) return true;
443 function filterDataTable( table, column, term ){
445 table.column( column ).search( term ).draw();
447 table.search( term ).draw();
452 function clearFilter( term ){
454 $(".dt_button_clear_filter").addClass("disabled");
456 $(".dt_button_clear_filter").removeClass("disabled");
460 /* Custom table search configuration: If a table row
461 has an "expired" class, hide it UNLESS the
462 show_expired checkbox is checked */
463 $.fn.dataTable.ext.search.push(
464 function( settings, searchData, index, rowData, counter ) {
465 var row = $(settings.aoData[index].nTr);
466 if( row.hasClass("expired") && !$("#show_expired").prop("checked") ){
474 $(document).ready(function() {
476 var table = $("#table_additional_contents").DataTable($.extend(true, {}, dataTablesDefaults, {
477 "order": [[ 4, "desc" ]],
479 { "sortable": false, "searchable": false, 'targets': [ 'NoSort' ] },
480 { "type": "anti-the", "targets": [ "anti-the" ] }
482 "sPaginationType": "full_numbers"
485 $(".delete_news").on("click", function(){
486 return confirmDelete( _("Are you sure you want to delete this news item? This cannot be undone.") );
489 $("#del_form").on("submit",function(){
491 return confirmDelete( _("Are you sure you want to delete the selected news?") );
493 alert(_("Please select a news item to delete."));
498 $("#show_expired").on("change", function(){
499 /* redraw the DataTable according to the custom search function */
503 table.on( 'search.dt', function () {
504 var term = table.search();
505 $("#news_keyword").val( term );
508 $("#news_keyword").on("keyup", function(){
509 var term = $(this).val();
510 filterDataTable( table, null, term );
513 $("#news_display_location").on("change", function(){
514 var term = $(this).val();
515 filterDataTable( table, 1, term );
518 $("#news_library").on("change", function(){
519 // Table must be filtered by the <option>'s text, not its value
520 var opt = $(this).find("option:selected").text();
521 filterDataTable( table, 2, opt );
524 $(".dt_button_clear_filter").on("click", function(){
525 table.search('').columns().search('').draw();
526 $("#news-filter select").each(function(){
534 $(document).ready(function() {
536 $("#add_additional_content").validate({
537 submitHandler: function(form){
538 if ( ! $("#title_default").val().length > 0 ) {
539 alert(__("Please specify a title for 'Default'"));
547 $("#submit_form").on("click",function(){
548 $("#add_additional_content").submit();
551 Sticky = $("#toolbar");
554 stickyClass: "floating"
560 [% UNLESS ( wysiwyg ) %]
561 [% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %]
562 [% Asset.js( "lib/codemirror/xml.min.js" ) | $raw %]
563 [% Asset.js( "lib/codemirror/lint.min.js" ) | $raw %]
564 [% Asset.js( "lib/linters/htmlhint.min.js" ) | $raw %]
565 [% Asset.js( "lib/codemirror/html-lint.min.js" ) | $raw %]
567 var editor = CodeMirror.fromTextArea(document.getElementById('content'), {
572 gutters: ["CodeMirror-lint-markers"],
573 viewportMargin: Infinity,
577 [% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %]
578 [% INCLUDE 'str/tinymce_i18n.inc' %]
582 force_br_newlines : false,
583 force_p_newlines : false,
584 forced_root_block : '',
586 relative_urls : false,
587 content_css : "[% interface | html %]/[% theme | html %]/css/tinymce.css",
588 menubar : "file edit view insert format tools table",
589 mode : "specific_textareas",
590 plugins : "autoresize table hr link image charmap lists code emoticons",
591 extended_valid_elements:"style,link[href|rel]",
592 custom_elements:"style,link,~link",
594 "formatselect | bold italic | cut copy paste | alignleft aligncenter alignright | outdent indent | image link unlink anchor cleanup hr",
595 "table | bullist numlist | undo redo | removeformat | emoticons charmap | forecolor backcolor | code visualaid help"
599 [% END # /UNLESS wysiwyg %]
602 [% INCLUDE 'intranet-bottom.inc' %]