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