Bug 2696: Fine payments should show what was paid for
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / koha-news.tt
1 [% USE Asset %]
2 [% USE KohaDates %]
3 [% USE Branches %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Tools &rsaquo; News</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 [% IF ( opac_news_count ) %]
9     [% Asset.css("css/datatables.css") %]
10 [% END %]
11 </head>
12
13 <body id="tools_koha-news" class="tools">
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'cat-search.inc' %]
16
17 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; [% IF ( add_form ) %]<a href="/cgi-bin/koha/tools/koha-news.pl">News</a> &rsaquo; [% IF ( id ) %]
18 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div>
19
20 [% IF ( add_form ) %]
21     <div class="main container-fluid">
22         <div class="row">
23             <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
24 [% ELSE %]
25     <div id="doc3" class="yui-t2">
26         <div id="bd">
27             <div id="yui-main">
28                 <div class="yui-b">
29 [% END %]
30
31 [% UNLESS ( add_form ) %]
32     [% IF error_message == 'title_missing' %]
33         <div class="dialog alert">Error: Required news title missing!</div>
34     [% END %]
35 <div id="toolbar" class="btn-toolbar">
36     <a class="btn btn-default btn-sm" id="newentry" href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&amp;lang=[% lang %]"><i class="fa fa-plus"></i> New entry</a>
37 </div>
38 [% END %]
39
40 [% IF ( add_form ) %]
41     [% IF ( op == 'add' ) %][% default_lang = lang %]
42     [% ELSE %][% default_lang = new_detail.lang %]
43     [% END %]
44         <form name="add_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" >
45             <input type="hidden" name="op" value="[% op %]" />
46             <input type="hidden" name="id" value="[% id %]" />
47                         <fieldset class="rows">
48             <legend>OPAC and Koha news</legend>
49            <ol> <li>
50             <label for="lang">Display location:</label>
51             <select id="lang" name="lang">
52                 [% IF ( default_lang == "" ) %]
53                 <option value="" selected="selected">All</option>
54                 [% ELSE %]
55                 <option value=""                    >All</option>
56                 [% END %]
57                 [% IF ( default_lang == "koha" ) %]
58                 <option value="koha" selected="selected">Librarian interface</option>
59                 [% ELSE %]
60                 <option value="koha"                    >Librarian interface</option>
61                 [% END %]
62                 [% IF ( default_lang == "slip" ) %]
63                 <option value="slip" selected="selected">Slip</option>
64                 [% ELSE %]
65                 <option value="slip"                    >Slip</option>
66                 [% END %]
67                 [% FOREACH lang_lis IN lang_list %]
68                 [% IF ( lang_lis.language == default_lang ) %]
69                     <option value="[% lang_lis.language %]" selected="selected">OPAC ([% lang_lis.language %])</option>
70                 [% ELSE %]
71                     <option value="[% lang_lis.language %]"                    >OPAC ([% lang_lis.language %])</option>
72                 [% END %]
73                 [% END %]
74             </select>
75             </li>
76             <li>
77                 <label for="branch">Library: </label>
78                 <select id="branch" name="branch">
79                     [% IF ( new_detail.branchcode == '' ) %]
80                         <option value="" selected="selected">All libraries</option>
81                     [% ELSE %]
82                         <option value=""         >All libraries</option>
83                     [% END %]
84                     [% PROCESS options_for_libraries libraries => Branches.all( selected => new_detail.branchcode, unfiltered => 1, ) %]
85                 </select>
86             </li>
87             <li>
88                 <label for="title" class="required">Title: </label>
89                 <input id="title" size="30" type="text" name="title" value="[% new_detail.title %]" required="required" class="required" /> <span class="required">Required</span>
90             </li>
91             <li>
92                 <label for="from">Publication date: </label>
93                 <input id="from" type="text" name="timestamp" size="15" value="[% new_detail.timestamp %]" class="datepickerfrom" />
94                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
95             </li>
96             <li>
97                 <label for="to">Expiration date: </label>
98                 <input id="to" type="text" name="expirationdate" size="15" value="[% new_detail.expirationdate %]" class="datepickerto" />
99                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
100             </li>
101             <li>
102                 <label for="number">Appear in position: </label>
103                 [% IF ( new_detail.number ) %]
104                     <input id="number" size="3" name="number" type="text" value="[% new_detail.number %]" />
105                 [% ELSE %]
106                     <input id="number" size="3" name="number" type="text" />
107                 [% END %]
108             </li>
109             <li><label for="content">News: </label>
110             <textarea name="content" id="content"  cols="75" rows="10">[% new_detail.content %]</textarea>
111             </li>
112             </ol>
113                         </fieldset>
114   
115                 <fieldset class="action"><input class="button" type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/tools/koha-news.pl">Cancel</a></fieldset>
116         </form>
117     [% ELSE %]
118         <div style="margin-bottom:5px;">
119         <form name="add_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" >
120             <label for="lang">Display location:</label>
121             <select name="lang" id="lang">
122             [% IF ( lang == "" ) %]
123             <option value=""     selected="selected">All</option>
124             [% ELSE %]
125             <option value=""             >All</option>
126             [% END %]
127             [% IF ( lang == "koha" ) %]
128             <option value="koha" selected="selected">Librarian interface</option>
129             [% ELSE %]
130             <option value="koha"         >Librarian interface</option>
131             [% END %]
132             [% IF ( lang == "slip" ) %]
133             <option value="slip" selected="selected">Slip</option>
134             [% ELSE %]
135             <option value="slip"         >Slip</option>
136             [% END %]
137                 [% FOREACH lang_lis IN lang_list %]
138                 [% IF ( lang_lis.language == lang ) %]
139                     <option value="[% lang_lis.language %]" selected="selected">OPAC ([% lang_lis.language %])</option>
140                 [% ELSE %]
141                     <option value="[% lang_lis.language %]"         >OPAC ([% lang_lis.language %])</option>
142                 [% END %]
143                 [% END %]
144             </select>
145             <label for="branch">Library: </label>
146             <select id="branch" name="branch">
147                 [% IF ( branchcode == "" ) %]
148                 <option value="" selected="selected">All libraries</option>
149                 [% ELSE %]
150                 <option value=""         >All libraries</option>
151                 [% END %]
152                 [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
153             </select>
154             <input type="submit" class="button" value="Filter" />
155         </form>
156         </div>
157         [% IF ( opac_news_count ) %]
158         <form id="del_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl">
159                 <table id="newst">
160                    <thead> <tr>
161                         <th>&nbsp;</th>
162                         <th>Location</th>
163                         <th>Library</th>
164                         <th>Number</th>
165                         <th class="title-string">Publication date</th>
166                         <th class="title-string">Expiration date</th>
167                         <th>Title</th>
168                         <th>Author</th>
169                         <th>News</th>
170                         <th>Actions</th>
171                     </tr></thead>
172                     <tbody>[% FOREACH opac_new IN opac_news %]
173                          [% IF ( opac_new.expired ) %]
174                             <tr class="expired">
175                             [% ELSE %]
176                             <tr>
177                             [% END %]
178                             <td>
179                                 <input type="checkbox" name="ids" value="[% opac_new.idnew %]" />
180                             </td>
181                             <td>[% SWITCH opac_new.lang %]
182                                 [%   CASE "koha" %]
183                                     Librarian interface
184                                 [%   CASE "slip" %]
185                                     Slip
186                                 [%   CASE "" %]
187                                     All
188                                 [%   CASE %]
189                                     OPAC ([% opac_new.lang %])
190                                 [% END %]
191                              </td>
192                             <td>[% IF ( opac_new.branchcode == "" ) -%]
193                                 All libraries
194                                 [% ELSE %][% opac_new.branchname %]
195                                 [% END %]</td>
196                             <td>[% opac_new.number %]</td>
197                             <td><span title="[% opac_new.newdate %]">[% opac_new.newdate | $KohaDates %]</span></td>
198                             <td><span title="[% opac_new.expirationdate %]">[% opac_new.expirationdate | $KohaDates %] [% IF ( opac_new.expired ) %](<span class="expired">expired</span>)[% END %]</span></td>
199                             <td>[% opac_new.title %]</td>
200                             <td>[% opac_new.author_title %] [% opac_new.author_firstname %] [% opac_new.author_surname %]</td>
201                            <td>
202                                 [% opac_new.content %]
203                             </td>
204                             <td class="actions">
205                                 <a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&amp;id=[% opac_new.idnew %]" class="btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
206                                 <a href="/cgi-bin/koha/tools/koha-news.pl?op=del&amp;ids=[% opac_new.idnew %]" class="delete_news btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</a>
207                             </td>
208                         </tr>
209                     [% END %]</tbody>
210                 </table>
211                 <input type="hidden" name="op" value="del" />
212                 <fieldset class="action"><input type="submit" class="button" value="Delete selected" /></fieldset>
213             </form>
214         [% ELSE %]
215             <div class="dialog message">There are no news items.</div>
216         [% END %]
217     [% END %]
218 </div>
219 </div>
220 [% UNLESS ( add_form ) %]
221     <div class="yui-b noprint">
222         [% INCLUDE 'tools-menu.inc' %]
223     </div>
224 [% END %]
225 </div>
226
227 [% MACRO jsinclude BLOCK %]
228     [% INCLUDE 'calendar.inc' %]
229     [% Asset.js("js/tools-menu.js") %]
230     [% IF ( opac_news_count ) %]
231         [% INCLUDE 'datatables.inc' %]
232         <script type="text/javascript">
233             $(document).ready(function() {
234                 $("#newst").dataTable($.extend(true, {}, dataTablesDefaults, {
235                     "aoColumnDefs": [
236                         { "aTargets": [ 0,-1,-2 ], "bSortable": false },
237                         { "aTargets": [ 0, -1 ], "bSearchable": false },
238                         { 'sType': "title-string", 'aTargets' : [ 'title-string'] }
239                     ],
240                     "sPaginationType": "full_numbers"
241                 }));
242                 $(".delete_news").on("click", function(){
243                     return confirmDelete( _("Are you sure you want to delete this news item? This cannot be undone.") );
244                 });
245
246                 function Checkbox(){
247                     var form = document.getElementById('del_form');
248                     var inputs = form.getElementsByTagName('input');
249                     var checked = false;
250                     for (var i=0; i<inputs.length; i++) {
251                         if (inputs[i].type == 'checkbox' && inputs[i].name == 'ids') {
252                             checked = inputs[i].checked;
253                             if (checked) return true;
254                         }
255                     }
256                 }
257
258                 $("#del_form").on("submit",function(){
259                     if ( Checkbox() ) {
260                         return confirmDelete( _("Are you sure you want to delete the selected news?") );
261                     } else {
262                         alert(_("Please select a news item to delete."));
263                         return false;
264                     }
265                 });
266             });
267         </script>
268     [% END %]
269     [% Asset.js("lib/tiny_mce/tiny_mce.js") %]
270     <script type="text/javascript">
271         tinyMCE.baseURL = "[% interface %]/lib/tiny_mce";
272         tinyMCE.init({
273             mode : "textareas",
274             theme : "advanced",
275             convert_urls : false,
276             relative_urls : false,
277             content_css : "[% interface %]/[% theme %]/css/tinymce.css",
278             plugins : "table,save,advhr,advlink,searchreplace,print,contextmenu",
279             theme_advanced_buttons1 : "save,|,bold,italic,|,cut,copy,paste,|,search,replace,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,link,unlink,anchor,cleanup,help,code,advhr,|,print",
280             theme_advanced_buttons2 : "tablecontrols,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,removeformat,|,visualaid,|,sub,sup,|,charmap",
281             theme_advanced_buttons3 : "",
282             theme_advanced_toolbar_location : "top",
283             theme_advanced_toolbar_align : "left",
284             theme_advanced_path_location : "bottom",
285             theme_advanced_resizing : true,
286             plugin_insertdate_dateFormat : "%Y-%m-%d",
287             plugin_insertdate_timeFormat : "%H:%M:%S",
288             apply_source_formatting : true,
289             height : "300",
290             width : "700"
291         });
292     </script>
293 [% END %]
294
295 [% INCLUDE 'intranet-bottom.inc' %]