7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha › Tools › News</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 [% IF ( opac_news_count ) %]
12 [% IF Koha.Preference('NewsToolEditor') == 'codemirror' %]
13 [% Asset.css("lib/codemirror/codemirror.css") | $raw %]
14 [% Asset.css("lib/codemirror/lint.min.css") | $raw %]
23 <body id="tools_koha-news" class="tools">
24 [% INCLUDE 'header.inc' %]
25 [% INCLUDE 'cat-search.inc' %]
27 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › [% IF ( add_form ) %]<a href="/cgi-bin/koha/tools/koha-news.pl">News</a> › [% IF ( id ) %]
28 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div>
31 <div class="main container-fluid">
33 <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
35 <div class="main container-fluid">
37 <div class="col-sm-10 col-sm-push-2">
41 [% UNLESS ( add_form ) %]
42 [% IF error_message == 'title_missing' %]
43 <div class="dialog alert">Error: Required news title missing!</div>
46 <div id="toolbar" class="btn-toolbar">
47 <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>
52 [% IF ( op == 'add' ) %]
53 [% default_lang = lang %]
55 [% default_lang = new_detail.lang %]
57 <form name="add_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" >
58 <input type="hidden" name="op" value="[% op | html %]" />
59 <input type="hidden" name="id" value="[% id | html %]" />
60 <fieldset class="rows">
61 <legend>OPAC and Koha news</legend>
63 <label for="lang">Display location:</label>
64 <select id="lang" name="lang">
65 [% PROCESS lang_locations language => default_lang %]
69 <label for="branch">Library: </label>
70 <select id="branch" name="branch">
71 [% IF ( new_detail.branchcode == '' ) %]
72 <option value="" selected="selected">All libraries</option>
74 <option value="" >All libraries</option>
76 [% PROCESS options_for_libraries libraries => Branches.all( selected => new_detail.branchcode, unfiltered => 1, ) %]
80 <label for="title" class="required">Title: </label>
81 <input id="title" size="30" type="text" name="title" value="[% new_detail.title | html %]" required="required" class="required" /> <span class="required">Required</span>
84 <label for="from">Publication date: </label>
85 <input id="from" type="text" name="timestamp" size="15" value="[% new_detail.timestamp | html %]" class="datepickerfrom" />
86 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
89 <label for="to">Expiration date: </label>
90 <input id="to" type="text" name="expirationdate" size="15" value="[% new_detail.expirationdate | html %]" class="datepickerto" />
92 [% INCLUDE 'date-format.inc' %]
93 <br>News will still be accessible by direct URL if expired.
97 <label for="number">Appear in position: </label>
98 [% IF ( new_detail.number ) %]
99 <input id="number" size="3" name="number" type="text" value="[% new_detail.number | html %]" />
101 <input id="number" size="3" name="number" type="text" />
104 <li><label for="content">News: </label>
105 <textarea name="content" id="content" cols="75" rows="10">[% new_detail.content | $raw %]</textarea>
110 <fieldset class="action"><input class="button" type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/tools/koha-news.pl">Cancel</a></fieldset>
113 [% IF ( opac_news_count ) %]
114 <form id="del_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl">
117 <th class="NoSort"> </th>
121 <th class="title-string">Publication date</th>
122 <th class="title-string">Expiration date</th>
123 <th class="anti-the">Title</th>
125 <th class="anti-the">News</th>
126 <th class="NoSort">Actions</th>
128 <tbody>[% FOREACH opac_new IN opac_news %]
129 [% IF ( opac_new.expired ) %]
135 <input type="checkbox" name="ids" value="[% opac_new.idnew | html %]" />
137 <td>[% SWITCH opac_new.lang %]
145 OPAC ([% opac_new.lang | html %])
148 <td>[% IF ( opac_new.branchcode == "" ) -%]
150 [% ELSE %][% opac_new.branchname | html %]
152 <td>[% opac_new.number | html %]</td>
153 <td><span title="[% opac_new.newdate | html %]">[% opac_new.newdate | $KohaDates %]</span></td>
154 <td><span title="[% opac_new.expirationdate | html %]">[% opac_new.expirationdate | $KohaDates %] [% IF ( opac_new.expired ) %](<span class="expired">expired</span>)[% END %]</span></td>
155 <td>[% opac_new.title | html %]</td>
156 <td>[% opac_new.author_title | html %] [% opac_new.author_firstname | html %] [% opac_new.author_surname | html %]</td>
158 [% opac_new.content | $raw %]
161 <a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&id=[% opac_new.idnew | uri %]" class="btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
162 <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>
167 <input type="hidden" name="op" value="del" />
168 <fieldset class="action"><input type="submit" class="button" value="Delete selected" /></fieldset>
171 <div class="dialog message">There are no news items.</div>
176 [% UNLESS ( add_form ) %]
177 </div> <!-- /.col-sm-10.col-sm-push-2 -->
179 <div class="col-sm-2 col-sm-pull-10">
182 <div id="news-filter">
183 <form action="/cgi-bin/koha/tools/koha-news.pl" method="get">
185 <fieldset class="brief">
188 <label for="news_keyword">Keyword:</label>
189 <input type="text" name="news_keyword" id="news_keyword" />
192 <label for="news_display_location">Display location:</label>
193 <select name="news_display_location" id="news_display_location">
194 [% PROCESS lang_locations %]
198 <label for="news_library">Library: </label>
199 <select id="news_library" name="news_library">
200 <option value=""></option>
201 <option value="">All libraries</option>
202 [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
210 [% INCLUDE 'tools-menu.inc' %]
212 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
214 </div> <!-- /.row -->
215 </div> <!-- /.main.container-fluid -->
218 [% MACRO jsinclude BLOCK %]
219 [% INCLUDE 'calendar.inc' %]
220 [% Asset.js("js/tools-menu.js") | $raw %]
221 [% IF ( opac_news_count ) %]
222 [% INCLUDE 'datatables.inc' %]
225 var form = document.getElementById('del_form');
226 var inputs = form.getElementsByTagName('input');
228 for (var i=0; i<inputs.length; i++) {
229 if (inputs[i].type == 'checkbox' && inputs[i].name == 'ids') {
230 checked = inputs[i].checked;
231 if (checked) return true;
236 function filterDataTable( table, column, term ){
238 table.column( column ).search( term ).draw();
240 table.search( term ).draw();
245 function clearFilter( term ){
247 $(".dt_button_clear_filter").addClass("disabled");
249 $(".dt_button_clear_filter").removeClass("disabled");
253 $(document).ready(function() {
254 var newst = $("#newst").DataTable($.extend(true, {}, dataTablesDefaults, {
255 "order": [[ 4, "desc" ]],
257 { "sortable": false, "searchable": false, 'targets': [ 'NoSort' ] },
258 { "type": "anti-the", "targets": [ "anti-the" ] },
259 { "type": "title-string", "targets" : [ "title-string"] }
261 "sPaginationType": "full_numbers"
264 $(".delete_news").on("click", function(){
265 return confirmDelete( _("Are you sure you want to delete this news item? This cannot be undone.") );
268 $("#del_form").on("submit",function(){
270 return confirmDelete( _("Are you sure you want to delete the selected news?") );
272 alert(_("Please select a news item to delete."));
277 newst.on( 'search.dt', function () {
278 var term = newst.search();
279 $("#news_keyword").val( term );
282 $("#news_keyword").on("keyup", function(){
283 var term = $(this).val();
284 filterDataTable( newst, null, term );
287 $("#news_display_location").on("change", function(){
288 var term = $(this).val();
289 filterDataTable( newst, 1, term );
292 $("#news_library").on("change", function(){
293 // Table must be filtered by the <option>'s text, not its value
294 var opt = $(this).find("option:selected").text();
295 filterDataTable( newst, 2, opt );
298 $(".dt_button_clear_filter").on("click", function(){
299 newst.search('').columns().search('').draw();
300 $("#news-filter select").each(function(){
307 [% IF Koha.Preference('NewsToolEditor') == 'codemirror' %]
308 [% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %]
309 [% Asset.js( "lib/codemirror/xml.min.js" ) | $raw %]
310 [% Asset.js( "lib/codemirror/lint.min.js" ) | $raw %]
311 [% Asset.js( "lib/linters/htmlhint.min.js" ) | $raw %]
312 [% Asset.js( "lib/codemirror/html-lint.min.js" ) | $raw %]
314 var editor = CodeMirror.fromTextArea(document.getElementById('content'), {
319 gutters: ["CodeMirror-lint-markers"],
320 viewportMargin: Infinity,
324 [% INCLUDE 'str/tinymce_i18n.inc' %]
325 [% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %]
329 force_br_newlines : false,
330 force_p_newlines : false,
331 forced_root_block : '',
333 relative_urls : false,
334 content_css : "[% interface | html %]/[% theme | html %]/css/tinymce.css",
335 menubar : "file edit view insert format tools table",
336 mode : "specific_textareas",
337 plugins : "autoresize table hr link image charmap lists code emoticons",
339 "formatselect | bold italic | cut copy paste | alignleft aligncenter alignright | outdent indent | image link unlink anchor cleanup hr",
340 "table | bullist numlist | undo redo | removeformat | emoticons charmap | forecolor backcolor | code visualaid help"
344 [% END # /IF NewsToolEditor %]
347 [% BLOCK lang_locations %]
348 [% IF ( language == "" ) %]
349 <option value="" selected="selected"></option>
351 <option value="">All</option>
353 [% IF ( language == "koha" ) %]
354 <option value="koha" selected="selected">Librarian interface</option>
356 <option value="koha">Librarian interface</option>
358 [% IF ( language == "slip" ) %]
359 <option value="slip" selected="selected">Slip</option>
361 <option value="slip">Slip</option>
363 [% FOREACH lang_lis IN lang_list %]
364 <optgroup label="[% lang_lis.language | html %]">
365 [% FOREACH location IN [ '', 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions'] %]
366 [% IF ( location == '' ) %]
367 [% SET location_lang = lang_lis.language %]
368 [% location = BLOCK %]OPAC news[% END %]
370 [% SET location_lang = location _ "_" _ lang_lis.language %]
372 [% IF ( location_lang == language ) %]
373 <option value="[% location_lang | html %]" selected="selected">[% location | html %] ([% lang_lis.language | html %])</option>
375 <option value="[% location_lang | html %]">[% location | html %] ([% lang_lis.language | html %])</option>
382 [% INCLUDE 'intranet-bottom.inc' %]