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