Bug 9476: Use Datatables on Koha news page
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / koha-news.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Tools &rsaquo; News</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4 [% INCLUDE 'calendar.inc' %]
5 [% IF ( opac_news_count ) %]
6     <link rel="stylesheet" type="text/css" href="/intranet-tmpl/prog/en/css/datatables.css" />
7     <script type="text/javascript" src="/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.dataTables.min.js"></script>
8     [% INCLUDE 'datatables-strings.inc' %]
9     <script type="text/javascript" src="/intranet-tmpl/prog/en/js/datatables.js"></script>
10     <script type="text/javascript">//<![CDATA[
11     [% IF (dateformat == 'metric') %]dt_add_type_uk_date();[% END %]
12     $(document).ready(function() {
13         $("#newst").dataTable($.extend(true, {}, dataTablesDefaults, {
14             "sDom": 't',
15             "aoColumnDefs": [
16                 { "aTargets": [ 0,-1,-2 ], "bSortable": false, "bSearchable": false }
17             ],
18             "bPaginate": false
19         }));
20     });
21     //]]>
22     </script>
23 [% END %]
24 <script type="text/javascript" src="[% themelang %]/js/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
25 <script type="text/javascript">//<![CDATA[
26 tinyMCE.init({
27     mode : "textareas",
28     theme : "advanced",
29     content_css : "[% themelang %]/css/tinymce.css",
30     plugins : "table,save,advhr,advlink,iespell,searchreplace,print,contextmenu",
31     theme_advanced_buttons1 : "save,|,bold,italic,|,cut,copy,paste,|,search,replace,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,link,unlink,anchor,cleanup,help,code,advhr,|,print",
32     theme_advanced_buttons2 : "tablecontrols,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,removeformat,|,visualaid,|,sub,sup,|,charmap",
33     theme_advanced_buttons3 : "",
34     theme_advanced_toolbar_location : "top",
35     theme_advanced_toolbar_align : "left",
36     theme_advanced_path_location : "bottom",
37     theme_advanced_resizing : true,
38     plugin_insertdate_dateFormat : "%Y-%m-%d",
39     plugin_insertdate_timeFormat : "%H:%M:%S",
40     apply_source_formatting : true,
41     height : "300",
42     width : "700"
43 //]]>
44 });
45 </script>
46 </head>
47 <body id="tools_koha-news" class="tools">
48 [% INCLUDE 'header.inc' %]
49 [% INCLUDE 'cat-search.inc' %]
50
51 <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 ) %]
52 Edit News Item[% ELSE %]Add News Item[% END %][% ELSE %]News[% END %]</div>
53
54 [% IF ( add_form ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
55    <div id="bd">
56         <div id="yui-main">
57         <div class="yui-b">
58  
59 [% UNLESS ( add_form ) %]
60 <div id="toolbar">
61         <script type="text/javascript">
62         //<![CDATA[
63         // prepare DOM for YUI Toolbar
64          $(document).ready(function() {
65             yuiToolbar();
66          });
67         // YUI Toolbar Functions
68         function yuiToolbar() {
69             new YAHOO.widget.Button("newentry");
70         }
71         //]]>
72         </script>
73         <ul class="toolbar">
74         <li><a id="newentry" href="/cgi-bin/koha/tools/koha-news.pl?op=add_form">New Entry</a></li>
75 </ul></div>
76 [% END %]
77
78 [% IF ( add_form ) %]
79         <form name="add_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" >
80             <input type="hidden" name="op" value="[% op %]" />
81             <input type="hidden" name="id" value="[% id %]" />
82                         <fieldset class="rows">
83             <legend>OPAC and Koha news</legend>
84            <ol> <li>
85             <label for="lang">Display location</label>
86             <select id="lang" name="lang">
87                 <option value="koha">Librarian interface</option>
88                 [% IF ( slip ) %]<option value="slip" selected="selected">Slip</option>[% ELSE %]<option value="slip">Slip</option>[% END %]
89                 [% FOREACH lang_lis IN lang_list %]
90                     [% IF ( lang_lis.selected ) %]<option value="[% lang_lis.language %]" selected="selected">OPAC ([% lang_lis.language %])</option>[% ELSE %]<option value="[% lang_lis.language %]">OPAC ([% lang_lis.language %])</option>[% END %]
91                 [% END %]
92             </select>
93             </li>
94             <li>
95                 <label for="title">Title</label>
96                 <input id="title" size="30" type="text" name="title" value="[% new_detail.title %]" />
97             </li>
98             <li>
99                 <label for="from">Publication date</label>
100                 <input id="from" type="text" name="timestamp" size="15" value="[% new_detail.timestamp %]" class="datepickerfrom" />
101                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
102             </li>
103             <li>
104                 <label for="to">Expiration date</label>
105                 <input id="to" type="text" name="expirationdate" size="15" value="[% new_detail.expirationdate %]" class="datepickerto" />
106                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
107             </li>
108             <li>
109                 <label for="number">Appear in position </label>
110                 [% IF ( new_detail.number ) %]
111                     <input id="number" size="3" name="number" type="text" checked="checked" value="[% new_detail.number %]" />
112                 [% ELSE %]
113                     <input id="number" size="3" name="number" type="text" />
114                 [% END %]
115             </li>
116             <li><label for="new">News</label>
117             <textarea name="new" id="new"  cols="75" rows="10">[% new_detail.new %]</textarea></li>
118             </ol>
119                         </fieldset>
120   
121                 <fieldset class="action"><input class="button" type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/tools/koha-news.pl">Cancel</a></fieldset>
122         </form>
123     [% ELSE %]
124         <div style="margin-bottom:5px;">
125         <form name="add_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" >
126             <label for="lang">Display location:</label>
127             <select name="lang" id="lang">
128             <option value="">All</option>
129             <option value="koha">Librarian interface</option>
130             <option value="slip">Slip</option>
131                 [% FOREACH lang_lis IN lang_list %]
132                     [% IF ( lang_lis.selected ) %]
133                         <option value="[% lang_lis.language %]" selected="selected">
134                     [% ELSE %]
135                         <option value="[% lang_lis.language %]">
136                     [% END %]
137                         OPAC ([% lang_lis.language %])
138                     </option>
139                 [% END %]
140             </select>
141             <input type="submit" class="button" value="Filter" />
142         </form>
143         </div>
144         [% IF ( opac_news_count ) %]
145         <form name="del_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" onsubmit="return confirm('Are you sure you want to delete the selected news?')">
146                 <table id="newst">
147                    <thead> <tr>
148                         <th>&nbsp;</th>
149                         <th>Location</th>
150                         <th>Number</th>
151                         <th>Creation date</th>
152                         <th>Expiration date</th>
153                         <th>Title</th>
154                         <th>News</th>
155                         <th>&nbsp;</th>
156                     </tr></thead>
157                     <tbody>[% FOREACH opac_new IN opac_news %]
158                          [% IF ( opac_new.expired ) %]
159                             <tr class="expired">
160                             [% ELSE %]
161                             <tr>
162                             [% END %]
163                             <td>
164                                 <input type="checkbox" name="ids" value="[% opac_new.idnew %]" />
165                             </td>
166                             <td>[% IF ( opac_new.lang == 'koha' ) %]
167                                     Librarian interface
168                                  [% ELSE %]
169                                     [% IF ( opac_new.lang == 'slip' ) %]
170                                         Slip
171                                     [% ELSE %]
172                                         OPAC
173                                     [% END %]
174                                  [% END %]
175                              </td>
176
177                             <td>[% opac_new.number %]</td>
178                             <td>[% opac_new.newdate %]</td>
179                             <td>[% opac_new.expirationdate %] [% IF ( opac_new.expired ) %](<span class="expired">expired</span>)[% END %]</td>
180                             <td>[% opac_new.title %]</td>
181                            <td>
182                                 [% opac_new.new %]
183                             </td>
184                             <td><a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&amp;id=[% opac_new.idnew %]">Edit</a></td>
185                         </tr>
186                     [% END %]</tbody>
187                 </table>
188                 <input type="hidden" name="op" value="del" />
189                 <fieldset class="action"><input type="submit" class="button" value="Delete selected" /></fieldset>
190             </form>
191         [% ELSE %]
192             <p>No news loaded</p>
193         [% END %]
194     [% END %]
195 </div>
196 </div>
197 [% UNLESS ( add_form ) %]
198     <div class="yui-b noprint">
199         [% INCLUDE 'tools-menu.inc' %]
200     </div>
201 [% END %]
202 </div>
203 [% INCLUDE 'intranet-bottom.inc' %]