Bug 7567 - Correct Filtering and Default dropdown values
[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">([% new_detail.lang %])([% 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="title">Title: </label>
109                 <input id="title" size="30" type="text" name="title" value="[% new_detail.title %]" />
110             </li>
111             <li>
112                 <label for="from">Publication date: </label>
113                 <input id="from" type="text" name="timestamp" size="15" value="[% new_detail.timestamp %]" class="datepickerfrom" />
114                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
115             </li>
116             <li>
117                 <label for="to">Expiration date: </label>
118                 <input id="to" type="text" name="expirationdate" size="15" value="[% new_detail.expirationdate %]" class="datepickerto" />
119                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
120             </li>
121             <li>
122                 <label for="number">Appear in position: </label>
123                 [% IF ( new_detail.number ) %]
124                     <input id="number" size="3" name="number" type="text" checked="checked" value="[% new_detail.number %]" />
125                 [% ELSE %]
126                     <input id="number" size="3" name="number" type="text" />
127                 [% END %]
128             </li>
129             <li><label for="new">News: </label>
130             <textarea name="new" id="new"  cols="75" rows="10">[% new_detail.new %]</textarea></li>
131             </ol>
132                         </fieldset>
133   
134                 <fieldset class="action"><input class="button" type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/tools/koha-news.pl">Cancel</a></fieldset>
135         </form>
136     [% ELSE %]
137         <div style="margin-bottom:5px;">
138         <form name="add_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" >
139             <label for="lang">Display location:</label>
140             <select name="lang" id="lang">
141             [% IF ( lang == "" ) %]
142             <option value=""     selected>All</option>
143             [% ELSE %]
144             <option value=""             >All</option>
145             [% END %]
146             [% IF ( lang == "koha" ) %]
147             <option value="koha" selected>Librarian interface</option>
148             [% ELSE %]
149             <option value="koha"         >Librarian interface</option>
150             [% END %]
151             [% IF ( lang == "slip" ) %]
152             <option value="slip" selected>Slip</option>
153             [% ELSE %]
154             <option value="slip"         >Slip</option>
155             [% END %]
156                 [% FOREACH lang_lis IN lang_list %]
157                 [% IF ( lang_lis.language == lang ) %]
158                     <option value="[% lang_lis.language %]" selected>OPAC ([% lang_lis.language %])</option>
159                 [% ELSE %]
160                     <option value="[% lang_lis.language %]">OPAC ([% lang_lis.language %])</option>
161                 [% END %]
162                 [% END %]
163             </select>
164             <input type="submit" class="button" value="Filter" />
165         </form>
166         </div>
167         [% IF ( opac_news_count ) %]
168         <form name="del_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" onsubmit='return confirm(MSG_CONFIRM_DELETE_NEWS)'>
169                 <table id="newst">
170                    <thead> <tr>
171                         <th>&nbsp;</th>
172                         <th>Location</th>
173                         <th>Number</th>
174                         <th>Creation date</th>
175                         <th>Expiration date</th>
176                         <th>Title</th>
177                         <th>News</th>
178                         <th>&nbsp;</th>
179                     </tr></thead>
180                     <tbody>[% FOREACH opac_new IN opac_news %]
181                          [% IF ( opac_new.expired ) %]
182                             <tr class="expired">
183                             [% ELSE %]
184                             <tr>
185                             [% END %]
186                             <td>
187                                 <input type="checkbox" name="ids" value="[% opac_new.idnew %]" />
188                             </td>
189                             <td>[% SWITCH opac_new.lang %]
190                                 [%   CASE "koha" %]
191                                     Librarian interface
192                                 [%   CASE "slip" %]
193                                     Slip
194                                 [%   CASE "" %]
195                                     All
196                                 [%   CASE %]
197                                     OPAC ([% opac_new.lang %])
198                                 [% END %]
199                              </td>
200
201                             <td>[% opac_new.number %]</td>
202                             <td><span title="[% opac_new.newdate %]">[% opac_new.newdate | $KohaDates %]</span></td>
203                             <td><span title="[% opac_new.expirationdate %]">[% opac_new.expirationdate | $KohaDates %] [% IF ( opac_new.expired ) %](<span class="expired">expired</span>)[% END %]</span></td>
204                             <td>[% opac_new.title %]</td>
205                            <td>
206                                 [% opac_new.new %]
207                             </td>
208                             <td><a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&amp;id=[% opac_new.idnew %]">Edit</a></td>
209                         </tr>
210                     [% END %]</tbody>
211                 </table>
212                 <input type="hidden" name="op" value="del" />
213                 <fieldset class="action"><input type="submit" class="button" value="Delete selected" /></fieldset>
214             </form>
215         [% ELSE %]
216             <p>No news loaded</p>
217         [% END %]
218     [% END %]
219 </div>
220 </div>
221 [% UNLESS ( add_form ) %]
222     <div class="yui-b noprint">
223         [% INCLUDE 'tools-menu.inc' %]
224     </div>
225 [% END %]
226 </div>
227 [% INCLUDE 'intranet-bottom.inc' %]