7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>News › Tools › Koha</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 [% IF ( opac_news_count ) %]
12 [% UNLESS ( wysiwyg ) %]
13 [% Asset.css("lib/codemirror/codemirror.css") | $raw %]
14 [% Asset.css("lib/codemirror/lint.min.css") | $raw %]
24 <body id="tools_koha-news" class="tools">
25 [% INCLUDE 'header.inc' %]
26 [% INCLUDE 'cat-search.inc' %]
28 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
31 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
34 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
39 <a href="/cgi-bin/koha/tools/koha-news.pl">News</a>
42 <a href="#" aria-current="page">
52 <a href="#" aria-current="page">
61 <div class="main container-fluid">
63 <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
65 <div class="main container-fluid">
67 <div class="col-sm-10 col-sm-push-2">
71 [% UNLESS ( add_form ) %]
72 [% IF error_message == 'title_missing' %]
73 <div class="dialog alert">Error: Required news title missing!</div>
76 <div id="toolbar" class="btn-toolbar">
77 <a class="btn btn-default" id="newentry" href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&lang=[% lang | html %]"><i class="fa fa-plus"></i> New entry</a>
82 [% IF ( op == 'add' ) %]
83 [% default_lang = lang %]
85 [% default_lang = new_detail.lang %]
87 <form name="add_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" >
88 <input type="hidden" name="op" value="[% op | html %]" />
89 <input type="hidden" name="id" value="[% id | html %]" />
90 <fieldset class="rows">
91 <legend>OPAC and Koha news</legend>
93 <label for="lang">Display location:</label>
94 <select id="lang" name="lang">
95 [% PROCESS lang_locations language => default_lang %]
99 <label for="branch">Library: </label>
100 <select id="branch" name="branch">
101 [% IF ( new_detail.branchcode == '' ) %]
102 <option value="" selected="selected">All libraries</option>
104 <option value="" >All libraries</option>
106 [% PROCESS options_for_libraries libraries => Branches.all( selected => new_detail.branchcode, unfiltered => 1, ) %]
110 <label for="title" class="required">Title: </label>
111 <input id="title" size="30" type="text" name="title" value="[% new_detail.title | html %]" required="required" class="required" /> <span class="required">Required</span>
114 <label for="from">Publication date: </label>
115 <input id="from" type="text" name="published_on" size="15" value="[% new_detail.published_on | html %]" class="datepickerfrom" />
116 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
119 <label for="to">Expiration date: </label>
120 <input id="to" type="text" name="expirationdate" size="15" value="[% new_detail.expirationdate | html %]" class="datepickerto" />
122 [% INCLUDE 'date-format.inc' %]
123 <br>News will still be accessible by direct URL if expired.
127 <label for="number">Appear in position: </label>
128 [% IF ( new_detail.number ) %]
129 <input id="number" size="3" name="number" type="text" value="[% new_detail.number | html %]" />
131 <input id="number" size="3" name="number" type="text" />
134 <li><label for="content">News: </label>
135 <textarea name="content" id="content" cols="75" rows="10">[% new_detail.content | html %]</textarea>
140 <fieldset class="action"><input class="button" type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/tools/koha-news.pl">Cancel</a></fieldset>
143 [% IF ( opac_news_count ) %]
144 <form id="del_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl">
147 <th class="NoSort"> </th>
151 <th>Publication date</th>
152 <th>Expiration date</th>
153 <th class="anti-the">Title</th>
155 <th class="anti-the">News</th>
156 <th class="NoSort noExport">Actions</th>
158 <tbody>[% FOREACH opac_new IN opac_news %]
159 [% IF ( opac_new.expired ) %]
165 <input type="checkbox" name="ids" value="[% opac_new.idnew | html %]" />
167 <td>[% SWITCH opac_new.lang %]
175 OPAC ([% opac_new.lang | html %])
178 <td>[% IF ( opac_new.branchcode == "" ) -%]
180 [% ELSE %][% opac_new.branchname | html %]
182 <td>[% opac_new.number | html %]</td>
183 <td data-order="[% opac_new.newdate | html %]">[% opac_new.newdate | $KohaDates %]</td>
184 <td data-order="[% opac_new.expirationdate | html %]">[% opac_new.expirationdate | $KohaDates %] [% IF ( opac_new.expired ) %](<span class="expired">expired</span>)[% END %]</td>
185 <td>[% opac_new.title | html %]</td>
186 <td>[% opac_new.author_title | html %] [% opac_new.author_firstname | html %] [% opac_new.author_surname | html %]</td>
188 <div class="btn-group">
189 <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>
191 <div id="contentModal[% loop.count | html %]" class="modal" tabindex="-1" role="dialog" data-number="[% loop.count | html %]">
192 <div class="modal-dialog" role="document">
193 <div class="modal-content modal-lg">
194 <div class="modal-header">
195 <h5 class="modal-title">Preview of: "[% opac_new.title | html %]"</h5>
197 <div class="modal-body">
198 [% opac_new.content | $raw %]
200 <div class="modal-footer">
201 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
208 [% SET editmode = "wysiwyg" %]
210 [% SET editmode = "text" %]
212 <div class="btn-group dropup">
213 <a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&id=[% opac_new.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">
214 <span class="caret"></span>
216 <ul class="dropdown-menu pull-right">
219 <a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&id=[% opac_new.idnew | uri %]&editmode=text"><i class="fa fa-pencil"></i> Edit with text editor</a>
221 <a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&id=[% opac_new.idnew | uri %]&editmode=wysiwyg"><i class="fa fa-pencil"></i> Edit with WYSIWYG editor</a>
226 <div class="btn-group">
227 <a href="/cgi-bin/koha/tools/koha-news.pl?op=del&ids=[% opac_new.idnew | uri %]" class="delete_news btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</a>
233 <input type="hidden" name="op" value="del" />
234 <fieldset class="action"><input type="submit" class="button" value="Delete selected" /></fieldset>
237 <div class="dialog message">There are no news items.</div>
242 [% UNLESS ( add_form ) %]
243 </div> <!-- /.col-sm-10.col-sm-push-2 -->
245 <div class="col-sm-2 col-sm-pull-10">
248 <div id="news-filter">
249 <form action="/cgi-bin/koha/tools/koha-news.pl" method="get">
251 <fieldset class="brief">
254 <label for="news_keyword">Keyword:</label>
255 <input type="text" name="news_keyword" id="news_keyword" />
258 <label for="news_display_location">Display location:</label>
259 <select name="news_display_location" id="news_display_location">
260 [% PROCESS lang_locations %]
264 <label for="news_library">Library: </label>
265 <select id="news_library" name="news_library">
266 <option value=""></option>
267 <option value="">All libraries</option>
268 [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
273 <input type="checkbox" name="show_expired" id="show_expired" /> Show expired
281 [% INCLUDE 'tools-menu.inc' %]
283 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
285 </div> <!-- /.row -->
286 </div> <!-- /.main.container-fluid -->
289 [% MACRO jsinclude BLOCK %]
290 [% INCLUDE 'calendar.inc' %]
291 [% Asset.js("js/tools-menu.js") | $raw %]
292 [% IF ( opac_news_count ) %]
293 [% INCLUDE 'datatables.inc' %]
295 $('.preview_news').click( function() {
296 modalNumber = $(this).attr('data-number');
297 $('.modal[data-number="'+modalNumber+'"]').modal('show');
300 var form = document.getElementById('del_form');
301 var inputs = form.getElementsByTagName('input');
303 for (var i=0; i<inputs.length; i++) {
304 if (inputs[i].type == 'checkbox' && inputs[i].name == 'ids') {
305 checked = inputs[i].checked;
306 if (checked) return true;
311 function filterDataTable( table, column, term ){
313 table.column( column ).search( term ).draw();
315 table.search( term ).draw();
320 function clearFilter( term ){
322 $(".dt_button_clear_filter").addClass("disabled");
324 $(".dt_button_clear_filter").removeClass("disabled");
328 /* Custom table search configuration: If a table row
329 has an "expired" class, hide it UNLESS the
330 show_expired checkbox is checked */
331 $.fn.dataTable.ext.search.push(
332 function( settings, searchData, index, rowData, counter ) {
333 var row = $(settings.aoData[index].nTr);
334 if( row.hasClass("expired") && !$("#show_expired").prop("checked") ){
342 $(document).ready(function() {
343 var newst = $("#newst").DataTable($.extend(true, {}, dataTablesDefaults, {
344 "order": [[ 4, "desc" ]],
346 { "sortable": false, "searchable": false, 'targets': [ 'NoSort' ] },
347 { "type": "anti-the", "targets": [ "anti-the" ] }
349 "sPaginationType": "full_numbers"
352 $(".delete_news").on("click", function(){
353 return confirmDelete( _("Are you sure you want to delete this news item? This cannot be undone.") );
356 $("#del_form").on("submit",function(){
358 return confirmDelete( _("Are you sure you want to delete the selected news?") );
360 alert(_("Please select a news item to delete."));
365 $("#show_expired").on("change", function(){
366 /* redraw the DataTable according to the custom search function */
370 newst.on( 'search.dt', function () {
371 var term = newst.search();
372 $("#news_keyword").val( term );
375 $("#news_keyword").on("keyup", function(){
376 var term = $(this).val();
377 filterDataTable( newst, null, term );
380 $("#news_display_location").on("change", function(){
381 var term = $(this).val();
382 filterDataTable( newst, 1, term );
385 $("#news_library").on("change", function(){
386 // Table must be filtered by the <option>'s text, not its value
387 var opt = $(this).find("option:selected").text();
388 filterDataTable( newst, 2, opt );
391 $(".dt_button_clear_filter").on("click", function(){
392 newst.search('').columns().search('').draw();
393 $("#news-filter select").each(function(){
400 [% UNLESS ( wysiwyg ) %]
401 [% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %]
402 [% Asset.js( "lib/codemirror/xml.min.js" ) | $raw %]
403 [% Asset.js( "lib/codemirror/lint.min.js" ) | $raw %]
404 [% Asset.js( "lib/linters/htmlhint.min.js" ) | $raw %]
405 [% Asset.js( "lib/codemirror/html-lint.min.js" ) | $raw %]
407 var editor = CodeMirror.fromTextArea(document.getElementById('content'), {
412 gutters: ["CodeMirror-lint-markers"],
413 viewportMargin: Infinity,
417 [% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %]
418 [% INCLUDE 'str/tinymce_i18n.inc' %]
422 force_br_newlines : false,
423 force_p_newlines : false,
424 forced_root_block : '',
426 relative_urls : false,
427 content_css : "[% interface | html %]/[% theme | html %]/css/tinymce.css",
428 menubar : "file edit view insert format tools table",
429 mode : "specific_textareas",
430 plugins : "autoresize table hr link image charmap lists code emoticons",
431 extended_valid_elements:"style,link[href|rel]",
432 custom_elements:"style,link,~link",
434 "formatselect | bold italic | cut copy paste | alignleft aligncenter alignright | outdent indent | image link unlink anchor cleanup hr",
435 "table | bullist numlist | undo redo | removeformat | emoticons charmap | forecolor backcolor | code visualaid help"
439 [% END # /IF NewsToolEditor %]
442 [% BLOCK lang_locations %]
443 [% IF ( language == "" ) %]
444 <option value="" selected="selected"></option>
446 <option value="">All</option>
448 [% IF ( language == "koha" ) %]
449 <option value="koha" selected="selected">Librarian interface</option>
451 <option value="koha">Librarian interface</option>
453 [% IF ( language == "slip" ) %]
454 <option value="slip" selected="selected">Slip</option>
456 <option value="slip">Slip</option>
458 [% FOREACH lang_lis IN lang_list %]
459 <optgroup label="[% lang_lis.language | html %]">
460 [% FOREACH location IN [ '', 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacSuggestionInstructions'] %]
461 [% IF ( location == '' ) %]
462 [% SET location_lang = lang_lis.language %]
463 [% location = BLOCK %]OPAC news[% END %]
465 [% SET location_lang = location _ "_" _ lang_lis.language %]
467 [% IF ( location_lang == language ) %]
468 <option value="[% location_lang | html %]" selected="selected">[% location | html %] ([% lang_lis.language | html %])</option>
470 <option value="[% location_lang | html %]">[% location | html %] ([% lang_lis.language | html %])</option>
477 [% INCLUDE 'intranet-bottom.inc' %]