7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha › Tools › News</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 <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 ) %]
29 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div>
32 <div class="main container-fluid">
34 <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
36 <div class="main container-fluid">
38 <div class="col-sm-10 col-sm-push-2">
42 [% UNLESS ( add_form ) %]
43 [% IF error_message == 'title_missing' %]
44 <div class="dialog alert">Error: Required news title missing!</div>
47 <div id="toolbar" class="btn-toolbar">
48 <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>
53 [% IF ( op == 'add' ) %]
54 [% default_lang = lang %]
56 [% default_lang = new_detail.lang %]
58 <form name="add_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" >
59 <input type="hidden" name="op" value="[% op | html %]" />
60 <input type="hidden" name="id" value="[% id | html %]" />
61 <fieldset class="rows">
62 <legend>OPAC and Koha news</legend>
64 <label for="lang">Display location:</label>
65 <select id="lang" name="lang">
66 [% PROCESS lang_locations language => default_lang %]
70 <label for="branch">Library: </label>
71 <select id="branch" name="branch">
72 [% IF ( new_detail.branchcode == '' ) %]
73 <option value="" selected="selected">All libraries</option>
75 <option value="" >All libraries</option>
77 [% PROCESS options_for_libraries libraries => Branches.all( selected => new_detail.branchcode, unfiltered => 1, ) %]
81 <label for="title" class="required">Title: </label>
82 <input id="title" size="30" type="text" name="title" value="[% new_detail.title | html %]" required="required" class="required" /> <span class="required">Required</span>
85 <label for="from">Publication date: </label>
86 <input id="from" type="text" name="published_on" size="15" value="[% new_detail.published_on | html %]" class="datepickerfrom" />
87 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
90 <label for="to">Expiration date: </label>
91 <input id="to" type="text" name="expirationdate" size="15" value="[% new_detail.expirationdate | html %]" class="datepickerto" />
93 [% INCLUDE 'date-format.inc' %]
94 <br>News will still be accessible by direct URL if expired.
98 <label for="number">Appear in position: </label>
99 [% IF ( new_detail.number ) %]
100 <input id="number" size="3" name="number" type="text" value="[% new_detail.number | html %]" />
102 <input id="number" size="3" name="number" type="text" />
105 <li><label for="content">News: </label>
106 <textarea name="content" id="content" cols="75" rows="10">[% new_detail.content | $raw %]</textarea>
111 <fieldset class="action"><input class="button" type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/tools/koha-news.pl">Cancel</a></fieldset>
114 [% IF ( opac_news_count ) %]
115 <form id="del_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl">
118 <th class="NoSort"> </th>
122 <th class="title-string">Publication date</th>
123 <th class="title-string">Expiration date</th>
124 <th class="anti-the">Title</th>
126 <th class="anti-the">News</th>
127 <th class="NoSort">Actions</th>
129 <tbody>[% FOREACH opac_new IN opac_news %]
130 [% IF ( opac_new.expired ) %]
136 <input type="checkbox" name="ids" value="[% opac_new.idnew | html %]" />
138 <td>[% SWITCH opac_new.lang %]
146 OPAC ([% opac_new.lang | html %])
149 <td>[% IF ( opac_new.branchcode == "" ) -%]
151 [% ELSE %][% opac_new.branchname | html %]
153 <td>[% opac_new.number | html %]</td>
154 <td><span title="[% opac_new.newdate | html %]">[% opac_new.newdate | $KohaDates %]</span></td>
155 <td><span title="[% opac_new.expirationdate | html %]">[% opac_new.expirationdate | $KohaDates %] [% IF ( opac_new.expired ) %](<span class="expired">expired</span>)[% END %]</span></td>
156 <td>[% opac_new.title | html %]</td>
157 <td>[% opac_new.author_title | html %] [% opac_new.author_firstname | html %] [% opac_new.author_surname | html %]</td>
159 <div class="btn-group">
160 <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>
162 <div id="contentModal[% loop.count | html %]" class="modal" tabindex="-1" role="dialog" data-number="[% loop.count | html %]">
163 <div class="modal-dialog" role="document">
164 <div class="modal-content">
165 <div class="modal-header">
166 <h5 class="modal-title">Preview of: "[% opac_new.title | html %]"</h5>
168 <div class="modal-body">
169 [% opac_new.content | $raw %]
171 <div class="modal-footer">
172 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
180 [% SET editmode = "wysiwyg" %]
182 [% SET editmode = "text" %]
184 <div class="btn-group dropup">
185 <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">
186 <span class="caret"></span>
188 <ul class="dropdown-menu pull-right">
191 <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>
193 <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>
198 <div class="btn-group">
199 <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>
205 <input type="hidden" name="op" value="del" />
206 <fieldset class="action"><input type="submit" class="button" value="Delete selected" /></fieldset>
209 <div class="dialog message">There are no news items.</div>
214 [% UNLESS ( add_form ) %]
215 </div> <!-- /.col-sm-10.col-sm-push-2 -->
217 <div class="col-sm-2 col-sm-pull-10">
220 <div id="news-filter">
221 <form action="/cgi-bin/koha/tools/koha-news.pl" method="get">
223 <fieldset class="brief">
226 <label for="news_keyword">Keyword:</label>
227 <input type="text" name="news_keyword" id="news_keyword" />
230 <label for="news_display_location">Display location:</label>
231 <select name="news_display_location" id="news_display_location">
232 [% PROCESS lang_locations %]
236 <label for="news_library">Library: </label>
237 <select id="news_library" name="news_library">
238 <option value=""></option>
239 <option value="">All libraries</option>
240 [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
248 [% INCLUDE 'tools-menu.inc' %]
250 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
252 </div> <!-- /.row -->
253 </div> <!-- /.main.container-fluid -->
256 [% MACRO jsinclude BLOCK %]
257 [% INCLUDE 'calendar.inc' %]
258 [% Asset.js("js/tools-menu.js") | $raw %]
259 [% IF ( opac_news_count ) %]
260 [% INCLUDE 'datatables.inc' %]
262 $('.preview_news').click( function() {
263 modalNumber = $(this).attr('data-number');
264 $('.modal[data-number="'+modalNumber+'"]').modal('show');
267 var form = document.getElementById('del_form');
268 var inputs = form.getElementsByTagName('input');
270 for (var i=0; i<inputs.length; i++) {
271 if (inputs[i].type == 'checkbox' && inputs[i].name == 'ids') {
272 checked = inputs[i].checked;
273 if (checked) return true;
278 function filterDataTable( table, column, term ){
280 table.column( column ).search( term ).draw();
282 table.search( term ).draw();
287 function clearFilter( term ){
289 $(".dt_button_clear_filter").addClass("disabled");
291 $(".dt_button_clear_filter").removeClass("disabled");
295 $(document).ready(function() {
296 var newst = $("#newst").DataTable($.extend(true, {}, dataTablesDefaults, {
297 "order": [[ 4, "desc" ]],
299 { "sortable": false, "searchable": false, 'targets': [ 'NoSort' ] },
300 { "type": "anti-the", "targets": [ "anti-the" ] },
301 { "type": "title-string", "targets" : [ "title-string"] }
303 "sPaginationType": "full_numbers"
306 $(".delete_news").on("click", function(){
307 return confirmDelete( _("Are you sure you want to delete this news item? This cannot be undone.") );
310 $("#del_form").on("submit",function(){
312 return confirmDelete( _("Are you sure you want to delete the selected news?") );
314 alert(_("Please select a news item to delete."));
319 newst.on( 'search.dt', function () {
320 var term = newst.search();
321 $("#news_keyword").val( term );
324 $("#news_keyword").on("keyup", function(){
325 var term = $(this).val();
326 filterDataTable( newst, null, term );
329 $("#news_display_location").on("change", function(){
330 var term = $(this).val();
331 filterDataTable( newst, 1, term );
334 $("#news_library").on("change", function(){
335 // Table must be filtered by the <option>'s text, not its value
336 var opt = $(this).find("option:selected").text();
337 filterDataTable( newst, 2, opt );
340 $(".dt_button_clear_filter").on("click", function(){
341 newst.search('').columns().search('').draw();
342 $("#news-filter select").each(function(){
349 [% UNLESS ( wysiwyg ) %]
350 [% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %]
351 [% Asset.js( "lib/codemirror/xml.min.js" ) | $raw %]
352 [% Asset.js( "lib/codemirror/lint.min.js" ) | $raw %]
353 [% Asset.js( "lib/linters/htmlhint.min.js" ) | $raw %]
354 [% Asset.js( "lib/codemirror/html-lint.min.js" ) | $raw %]
356 var editor = CodeMirror.fromTextArea(document.getElementById('content'), {
361 gutters: ["CodeMirror-lint-markers"],
362 viewportMargin: Infinity,
366 [% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %]
367 [% INCLUDE 'str/tinymce_i18n.inc' %]
371 force_br_newlines : false,
372 force_p_newlines : false,
373 forced_root_block : '',
375 relative_urls : false,
376 content_css : "[% interface | html %]/[% theme | html %]/css/tinymce.css",
377 menubar : "file edit view insert format tools table",
378 mode : "specific_textareas",
379 plugins : "autoresize table hr link image charmap lists code emoticons",
381 "formatselect | bold italic | cut copy paste | alignleft aligncenter alignright | outdent indent | image link unlink anchor cleanup hr",
382 "table | bullist numlist | undo redo | removeformat | emoticons charmap | forecolor backcolor | code visualaid help"
386 [% END # /IF NewsToolEditor %]
389 [% BLOCK lang_locations %]
390 [% IF ( language == "" ) %]
391 <option value="" selected="selected"></option>
393 <option value="">All</option>
395 [% IF ( language == "koha" ) %]
396 <option value="koha" selected="selected">Librarian interface</option>
398 <option value="koha">Librarian interface</option>
400 [% IF ( language == "slip" ) %]
401 <option value="slip" selected="selected">Slip</option>
403 <option value="slip">Slip</option>
405 [% FOREACH lang_lis IN lang_list %]
406 <optgroup label="[% lang_lis.language | html %]">
407 [% FOREACH location IN [ '', 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions'] %]
408 [% IF ( location == '' ) %]
409 [% SET location_lang = lang_lis.language %]
410 [% location = BLOCK %]OPAC news[% END %]
412 [% SET location_lang = location _ "_" _ lang_lis.language %]
414 [% IF ( location_lang == language ) %]
415 <option value="[% location_lang | html %]" selected="selected">[% location | html %] ([% lang_lis.language | html %])</option>
417 <option value="[% location_lang | html %]">[% location | html %] ([% lang_lis.language | html %])</option>
424 [% INCLUDE 'intranet-bottom.inc' %]