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