6 [% INCLUDE 'doc-head-open.inc' %]
7 [% Asset.css("lib/codemirror/codemirror.css") | $raw %]
13 <title>Koha › Tools › News</title>
14 [% INCLUDE 'doc-head-close.inc' %]
15 [% IF ( opac_news_count ) %]
19 <body id="tools_koha-news" class="tools">
20 [% INCLUDE 'header.inc' %]
21 [% INCLUDE 'cat-search.inc' %]
23 <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 ) %]
24 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div>
27 <div class="main container-fluid">
29 <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
31 <div class="main container-fluid">
33 <div class="col-sm-10 col-sm-push-2">
37 [% UNLESS ( add_form ) %]
38 [% IF error_message == 'title_missing' %]
39 <div class="dialog alert">Error: Required news title missing!</div>
42 <div id="toolbar" class="btn-toolbar">
43 <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>
48 [% IF ( op == 'add' ) %]
49 [% default_lang = lang %]
51 [% default_lang = new_detail.lang %]
53 <form name="add_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" >
54 <input type="hidden" name="op" value="[% op | html %]" />
55 <input type="hidden" name="id" value="[% id | html %]" />
56 <fieldset class="rows">
57 <legend>OPAC and Koha news</legend>
59 <label for="lang">Display location:</label>
60 <select id="lang" name="lang">
61 [% PROCESS lang_locations language => default_lang %]
65 <label for="branch">Library: </label>
66 <select id="branch" name="branch">
67 [% IF ( new_detail.branchcode == '' ) %]
68 <option value="" selected="selected">All libraries</option>
70 <option value="" >All libraries</option>
72 [% PROCESS options_for_libraries libraries => Branches.all( selected => new_detail.branchcode, unfiltered => 1, ) %]
76 <label for="title" class="required">Title: </label>
77 <input id="title" size="30" type="text" name="title" value="[% new_detail.title | html %]" required="required" class="required" /> <span class="required">Required</span>
80 <label for="from">Publication date: </label>
81 <input id="from" type="text" name="timestamp" size="15" value="[% new_detail.timestamp | html %]" class="datepickerfrom" />
82 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
85 <label for="to">Expiration date: </label>
86 <input id="to" type="text" name="expirationdate" size="15" value="[% new_detail.expirationdate | html %]" class="datepickerto" />
88 [% INCLUDE 'date-format.inc' %]
89 <br>News will still be accessible by direct URL if expired.
93 <label for="number">Appear in position: </label>
94 [% IF ( new_detail.number ) %]
95 <input id="number" size="3" name="number" type="text" value="[% new_detail.number | html %]" />
97 <input id="number" size="3" name="number" type="text" />
100 <li><label for="content">News: </label>
101 <textarea name="content" id="content" cols="75" rows="10">[% new_detail.content | $raw %]</textarea>
106 <fieldset class="action"><input class="button" type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/tools/koha-news.pl">Cancel</a></fieldset>
109 [% IF ( opac_news_count ) %]
110 <form id="del_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl">
113 <th class="NoSort"> </th>
117 <th class="title-string">Publication date</th>
118 <th class="title-string">Expiration date</th>
119 <th class="anti-the">Title</th>
121 <th class="anti-the">News</th>
122 <th class="NoSort">Actions</th>
124 <tbody>[% FOREACH opac_new IN opac_news %]
125 [% IF ( opac_new.expired ) %]
131 <input type="checkbox" name="ids" value="[% opac_new.idnew | html %]" />
133 <td>[% SWITCH opac_new.lang %]
141 OPAC ([% opac_new.lang | html %])
144 <td>[% IF ( opac_new.branchcode == "" ) -%]
146 [% ELSE %][% opac_new.branchname | html %]
148 <td>[% opac_new.number | html %]</td>
149 <td><span title="[% opac_new.newdate | html %]">[% opac_new.newdate | $KohaDates %]</span></td>
150 <td><span title="[% opac_new.expirationdate | html %]">[% opac_new.expirationdate | $KohaDates %] [% IF ( opac_new.expired ) %](<span class="expired">expired</span>)[% END %]</span></td>
151 <td>[% opac_new.title | html %]</td>
152 <td>[% opac_new.author_title | html %] [% opac_new.author_firstname | html %] [% opac_new.author_surname | html %]</td>
154 [% opac_new.content | $raw %]
157 <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>
158 <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>
163 <input type="hidden" name="op" value="del" />
164 <fieldset class="action"><input type="submit" class="button" value="Delete selected" /></fieldset>
167 <div class="dialog message">There are no news items.</div>
172 [% UNLESS ( add_form ) %]
173 </div> <!-- /.col-sm-10.col-sm-push-2 -->
175 <div class="col-sm-2 col-sm-pull-10">
178 <div id="news-filter">
179 <form action="/cgi-bin/koha/tools/koha-news.pl" method="get">
181 <fieldset class="brief">
184 <label for="news_keyword">Keyword:</label>
185 <input type="text" name="news_keyword" id="news_keyword" />
188 <label for="news_display_location">Display location:</label>
189 <select name="news_display_location" id="news_display_location">
190 [% PROCESS lang_locations %]
194 <label for="news_library">Library: </label>
195 <select id="news_library" name="news_library">
196 <option value=""></option>
197 <option value="">All libraries</option>
198 [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
206 [% INCLUDE 'tools-menu.inc' %]
208 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
210 </div> <!-- /.row -->
212 [% MACRO jsinclude BLOCK %]
213 [% INCLUDE 'calendar.inc' %]
214 [% Asset.js("js/tools-menu.js") | $raw %]
215 [% Asset.js("lib/d3c3/d3.min.js") | $raw %]
216 [% Asset.js("lib/d3c3/c3.min.js") | $raw %]
217 [% IF ( opac_news_count ) %]
218 [% INCLUDE 'datatables.inc' %]
221 var form = document.getElementById('del_form');
222 var inputs = form.getElementsByTagName('input');
224 for (var i=0; i<inputs.length; i++) {
225 if (inputs[i].type == 'checkbox' && inputs[i].name == 'ids') {
226 checked = inputs[i].checked;
227 if (checked) return true;
232 function filterDataTable( table, column, term ){
234 table.column( column ).search( term ).draw();
236 table.search( term ).draw();
241 function clearFilter( term ){
243 $(".dt_button_clear_filter").addClass("disabled");
245 $(".dt_button_clear_filter").removeClass("disabled");
249 $(document).ready(function() {
250 var newst = $("#newst").DataTable($.extend(true, {}, dataTablesDefaults, {
251 "order": [[ 4, "desc" ]],
253 { "sortable": false, "searchable": false, 'targets': [ 'NoSort' ] },
254 { "type": "anti-the", "targets": [ "anti-the" ] },
255 { "type": "title-string", "targets" : [ "title-string"] }
257 "sPaginationType": "full_numbers"
260 $(".delete_news").on("click", function(){
261 return confirmDelete( _("Are you sure you want to delete this news item? This cannot be undone.") );
264 $("#del_form").on("submit",function(){
266 return confirmDelete( _("Are you sure you want to delete the selected news?") );
268 alert(_("Please select a news item to delete."));
273 newst.on( 'search.dt', function () {
274 var term = newst.search();
275 $("#news_keyword").val( term );
278 $("#news_keyword").on("keyup", function(){
279 var term = $(this).val();
280 filterDataTable( newst, null, term );
283 $("#news_display_location").on("change", function(){
284 var term = $(this).val();
285 filterDataTable( newst, 1, term );
288 $("#news_library").on("change", function(){
289 // Table must be filtered by the <option>'s text, not its value
290 var opt = $(this).find("option:selected").text();
291 filterDataTable( newst, 2, opt );
294 $(".dt_button_clear_filter").on("click", function(){
295 newst.search('').columns().search('').draw();
296 $("#news-filter select").each(function(){
303 [% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %]
304 [% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %]
305 [% INCLUDE 'str/tinymce_i18n.inc' %]
307 [% IF Koha.Preference('NewsToolEditor') == 'codemirror' %]
308 var editor = CodeMirror.fromTextArea(document.getElementById('content'), {
316 force_br_newlines : false,
317 force_p_newlines : false,
318 forced_root_block : '',
320 relative_urls : false,
321 content_css : "[% interface | html %]/[% theme | html %]/css/tinymce.css",
322 menubar : "file edit view insert format tools table",
323 mode : "specific_textareas",
324 plugins : "autoresize table hr link image charmap lists code emoticons",
326 "formatselect | bold italic | cut copy paste | alignleft aligncenter alignright | outdent indent | image link unlink anchor cleanup hr",
327 "table | bullist numlist | undo redo | removeformat | emoticons charmap | forecolor backcolor | code visualaid help"
334 [% BLOCK lang_locations %]
335 [% IF ( language == "" ) %]
336 <option value="" selected="selected"></option>
338 <option value="">All</option>
340 [% IF ( language == "koha" ) %]
341 <option value="koha" selected="selected">Librarian interface</option>
343 <option value="koha">Librarian interface</option>
345 [% IF ( language == "slip" ) %]
346 <option value="slip" selected="selected">Slip</option>
348 <option value="slip">Slip</option>
350 [% FOREACH lang_lis IN lang_list %]
351 <optgroup label="[% lang_lis.language | html %]">
352 [% FOREACH location IN [ '', 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions'] %]
353 [% IF ( location == '' ) %]
354 [% SET location_lang = lang_lis.language %]
355 [% location = BLOCK %]OPAC news[% END %]
357 [% SET location_lang = location _ "_" _ lang_lis.language %]
359 [% IF ( location_lang == language ) %]
360 <option value="[% location_lang | html %]" selected="selected">[% location | html %] ([% lang_lis.language | html %])</option>
362 <option value="[% location_lang | html %]">[% location | html %] ([% lang_lis.language | html %])</option>
369 [% INCLUDE 'intranet-bottom.inc' %]