6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha › Tools › News</title>
8 [% INCLUDE 'doc-head-close.inc' %]
9 [% IF ( opac_news_count ) %]
13 <body id="tools_koha-news" class="tools">
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'cat-search.inc' %]
17 <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 ) %]
18 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div>
21 <div class="main container-fluid">
23 <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
25 <div class="main container-fluid">
27 <div class="col-sm-10 col-sm-push-2">
31 [% UNLESS ( add_form ) %]
32 [% IF error_message == 'title_missing' %]
33 <div class="dialog alert">Error: Required news title missing!</div>
36 <div id="toolbar" class="btn-toolbar">
37 <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>
42 [% IF ( op == 'add' ) %]
43 [% default_lang = lang %]
45 [% default_lang = new_detail.lang %]
47 <form name="add_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" >
48 <input type="hidden" name="op" value="[% op | html %]" />
49 <input type="hidden" name="id" value="[% id | html %]" />
50 <fieldset class="rows">
51 <legend>OPAC and Koha news</legend>
53 <label for="lang">Display location:</label>
54 <select id="lang" name="lang">
55 [% PROCESS lang_locations language => default_lang %]
59 <label for="branch">Library: </label>
60 <select id="branch" name="branch">
61 [% IF ( new_detail.branchcode == '' ) %]
62 <option value="" selected="selected">All libraries</option>
64 <option value="" >All libraries</option>
66 [% PROCESS options_for_libraries libraries => Branches.all( selected => new_detail.branchcode, unfiltered => 1, ) %]
70 <label for="title" class="required">Title: </label>
71 <input id="title" size="30" type="text" name="title" value="[% new_detail.title | html %]" required="required" class="required" /> <span class="required">Required</span>
74 <label for="from">Publication date: </label>
75 <input id="from" type="text" name="timestamp" size="15" value="[% new_detail.timestamp | html %]" class="datepickerfrom" />
76 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
79 <label for="to">Expiration date: </label>
80 <input id="to" type="text" name="expirationdate" size="15" value="[% new_detail.expirationdate | html %]" class="datepickerto" />
82 [% INCLUDE 'date-format.inc' %]
83 <br>News will still be accessible by direct URL if expired.
87 <label for="number">Appear in position: </label>
88 [% IF ( new_detail.number ) %]
89 <input id="number" size="3" name="number" type="text" value="[% new_detail.number | html %]" />
91 <input id="number" size="3" name="number" type="text" />
94 <li><label for="content">News: </label>
95 <textarea name="content" id="content" cols="75" rows="10">[% new_detail.content | $raw %]</textarea>
100 <fieldset class="action"><input class="button" type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/tools/koha-news.pl">Cancel</a></fieldset>
103 [% IF ( opac_news_count ) %]
104 <form id="del_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl">
111 <th class="title-string">Publication date</th>
112 <th class="title-string">Expiration date</th>
118 <tbody>[% FOREACH opac_new IN opac_news %]
119 [% IF ( opac_new.expired ) %]
125 <input type="checkbox" name="ids" value="[% opac_new.idnew | html %]" />
127 <td>[% SWITCH opac_new.lang %]
135 OPAC ([% opac_new.lang | html %])
138 <td>[% IF ( opac_new.branchcode == "" ) -%]
140 [% ELSE %][% opac_new.branchname | html %]
142 <td>[% opac_new.number | html %]</td>
143 <td><span title="[% opac_new.newdate | html %]">[% opac_new.newdate | $KohaDates %]</span></td>
144 <td><span title="[% opac_new.expirationdate | html %]">[% opac_new.expirationdate | $KohaDates %] [% IF ( opac_new.expired ) %](<span class="expired">expired</span>)[% END %]</span></td>
145 <td>[% opac_new.title | html %]</td>
146 <td>[% opac_new.author_title | html %] [% opac_new.author_firstname | html %] [% opac_new.author_surname | html %]</td>
148 [% opac_new.content | $raw %]
151 <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>
152 <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>
157 <input type="hidden" name="op" value="del" />
158 <fieldset class="action"><input type="submit" class="button" value="Delete selected" /></fieldset>
161 <div class="dialog message">There are no news items.</div>
166 [% UNLESS ( add_form ) %]
167 </div> <!-- /.col-sm-10.col-sm-push-2 -->
169 <div class="col-sm-2 col-sm-pull-10">
172 <div id="news-filter">
173 <form action="/cgi-bin/koha/tools/koha-news.pl" method="get">
175 <fieldset class="brief">
178 <label for="news_keyword">Keyword:</label>
179 <input type="text" name="news_keyword" id="news_keyword" />
182 <label for="news_display_location">Display location:</label>
183 <select name="news_display_location" id="news_display_location">
184 [% PROCESS lang_locations %]
188 <label for="news_library">Library: </label>
189 <select id="news_library" name="news_library">
190 <option value=""></option>
191 <option value="">All libraries</option>
192 [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
200 [% INCLUDE 'tools-menu.inc' %]
202 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
204 </div> <!-- /.row -->
206 [% MACRO jsinclude BLOCK %]
207 [% INCLUDE 'calendar.inc' %]
208 [% Asset.js("js/tools-menu.js") | $raw %]
209 [% IF ( opac_news_count ) %]
210 [% INCLUDE 'datatables.inc' %]
213 var form = document.getElementById('del_form');
214 var inputs = form.getElementsByTagName('input');
216 for (var i=0; i<inputs.length; i++) {
217 if (inputs[i].type == 'checkbox' && inputs[i].name == 'ids') {
218 checked = inputs[i].checked;
219 if (checked) return true;
224 function filterDataTable( table, column, term ){
226 table.column( column ).search( term ).draw();
228 table.search( term ).draw();
233 function clearFilter( term ){
235 $(".dt_button_clear_filter").addClass("disabled");
237 $(".dt_button_clear_filter").removeClass("disabled");
241 $(document).ready(function() {
242 var newst = $("#newst").DataTable($.extend(true, {}, dataTablesDefaults, {
244 { "aTargets": [ 0,-1,-2 ], "bSortable": false },
245 { "aTargets": [ 0, -1 ], "bSearchable": false },
246 { 'sType': "title-string", 'aTargets' : [ 'title-string'] }
248 "sPaginationType": "full_numbers"
251 $(".delete_news").on("click", function(){
252 return confirmDelete( _("Are you sure you want to delete this news item? This cannot be undone.") );
255 $("#del_form").on("submit",function(){
257 return confirmDelete( _("Are you sure you want to delete the selected news?") );
259 alert(_("Please select a news item to delete."));
264 newst.on( 'search.dt', function () {
265 var term = newst.search();
266 $("#news_keyword").val( term );
269 $("#news_keyword").on("keyup", function(){
270 var term = $(this).val();
271 filterDataTable( newst, null, term );
274 $("#news_display_location").on("change", function(){
275 var term = $(this).val();
276 filterDataTable( newst, 1, term );
279 $("#news_library").on("change", function(){
280 // Table must be filtered by the <option>'s text, not its value
281 var opt = $(this).find("option:selected").text();
282 filterDataTable( newst, 2, opt );
285 $(".dt_button_clear_filter").on("click", function(){
286 newst.search('').columns().search('').draw();
287 $("#news-filter select").each(function(){
294 [% Asset.js("lib/tiny_mce/tiny_mce.js") | $raw %]
296 tinyMCE.baseURL = "[% interface | html %]/lib/tiny_mce";
300 convert_urls : false,
301 relative_urls : false,
302 content_css : "[% interface | html %]/[% theme | html %]/css/tinymce.css",
303 plugins : "table,save,advhr,advlink,searchreplace,print,contextmenu",
304 theme_advanced_buttons1 : "save,|,bold,italic,|,cut,copy,paste,|,search,replace,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,link,unlink,anchor,cleanup,help,code,advhr,|,print",
305 theme_advanced_buttons2 : "tablecontrols,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,removeformat,|,visualaid,|,sub,sup,|,charmap",
306 theme_advanced_buttons3 : "",
307 theme_advanced_toolbar_location : "top",
308 theme_advanced_toolbar_align : "left",
309 theme_advanced_path_location : "bottom",
310 theme_advanced_resizing : true,
311 plugin_insertdate_dateFormat : "%Y-%m-%d",
312 plugin_insertdate_timeFormat : "%H:%M:%S",
313 apply_source_formatting : true,
320 [% BLOCK lang_locations %]
321 [% IF ( language == "" ) %]
322 <option value="" selected="selected"></option>
324 <option value="">All</option>
326 [% IF ( language == "koha" ) %]
327 <option value="koha" selected="selected">Librarian interface</option>
329 <option value="koha">Librarian interface</option>
331 [% IF ( language == "slip" ) %]
332 <option value="slip" selected="selected">Slip</option>
334 <option value="slip">Slip</option>
336 [% FOREACH lang_lis IN lang_list %]
337 <optgroup label="[% lang_lis.language | html %]">
338 [% FOREACH location IN [ '', 'OpacNavRight' ] %]
339 [% IF ( location == '' ) %]
340 [% SET location_lang = lang_lis.language %]
341 [% location = BLOCK %]OPAC news[% END %]
343 [% SET location_lang = location _ "_" _ lang_lis.language %]
345 [% IF ( location_lang == language ) %]
346 <option value="[% location_lang | html %]" selected="selected">[% location | html %] ([% lang_lis.language | html %])</option>
348 <option value="[% location_lang | html %]">[% location | html %] ([% lang_lis.language | html %])</option>
355 [% INCLUDE 'intranet-bottom.inc' %]