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