Bug 11736 - Use new DataTables include in Koha news templates
[koha_fer] / 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     content_css : "[% themelang %]/css/tinymce.css",
33     plugins : "table,save,advhr,advlink,searchreplace,print,contextmenu",
34     theme_advanced_buttons1 : "save,|,bold,italic,|,cut,copy,paste,|,search,replace,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,link,unlink,anchor,cleanup,help,code,advhr,|,print",
35     theme_advanced_buttons2 : "tablecontrols,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,removeformat,|,visualaid,|,sub,sup,|,charmap",
36     theme_advanced_buttons3 : "",
37     theme_advanced_toolbar_location : "top",
38     theme_advanced_toolbar_align : "left",
39     theme_advanced_path_location : "bottom",
40     theme_advanced_resizing : true,
41     plugin_insertdate_dateFormat : "%Y-%m-%d",
42     plugin_insertdate_timeFormat : "%H:%M:%S",
43     apply_source_formatting : true,
44     height : "300",
45     width : "700"
46 //]]>
47 });
48 //]]>
49 </script>
50 </head>
51 <body id="tools_koha-news" class="tools">
52 [% INCLUDE 'header.inc' %]
53 [% INCLUDE 'cat-search.inc' %]
54
55 <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 ) %]
56 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div>
57
58 [% IF ( add_form ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
59    <div id="bd">
60         <div id="yui-main">
61         <div class="yui-b">
62
63 [% UNLESS ( add_form ) %]
64 <div id="toolbar" class="btn-toolbar">
65     <a class="btn btn-small" id="newentry" href="/cgi-bin/koha/tools/koha-news.pl?op=add_form"><i class="icon-plus"></i> New entry</a>
66 </div>
67 [% END %]
68
69 [% IF ( add_form ) %]
70         <form name="add_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" >
71             <input type="hidden" name="op" value="[% op %]" />
72             <input type="hidden" name="id" value="[% id %]" />
73                         <fieldset class="rows">
74             <legend>OPAC and Koha news</legend>
75            <ol> <li>
76             <label for="lang">Display location</label>
77             <select id="lang" name="lang">
78                 <option value="koha">Librarian interface</option>
79                 [% IF ( slip ) %]<option value="slip" selected="selected">Slip</option>[% ELSE %]<option value="slip">Slip</option>[% END %]
80                 [% FOREACH lang_lis IN lang_list %]
81                     [% 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 %]
82                 [% END %]
83             </select>
84             </li>
85             <li>
86                 <label for="title">Title: </label>
87                 <input id="title" size="30" type="text" name="title" value="[% new_detail.title %]" />
88             </li>
89             <li>
90                 <label for="from">Publication date: </label>
91                 <input id="from" type="text" name="timestamp" size="15" value="[% new_detail.timestamp %]" class="datepickerfrom" />
92                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
93             </li>
94             <li>
95                 <label for="to">Expiration date: </label>
96                 <input id="to" type="text" name="expirationdate" size="15" value="[% new_detail.expirationdate %]" class="datepickerto" />
97                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
98             </li>
99             <li>
100                 <label for="number">Appear in position: </label>
101                 [% IF ( new_detail.number ) %]
102                     <input id="number" size="3" name="number" type="text" checked="checked" value="[% new_detail.number %]" />
103                 [% ELSE %]
104                     <input id="number" size="3" name="number" type="text" />
105                 [% END %]
106             </li>
107             <li><label for="new">News: </label>
108             <textarea name="new" id="new"  cols="75" rows="10">[% new_detail.new %]</textarea></li>
109             </ol>
110                         </fieldset>
111   
112                 <fieldset class="action"><input class="button" type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/tools/koha-news.pl">Cancel</a></fieldset>
113         </form>
114     [% ELSE %]
115         <div style="margin-bottom:5px;">
116         <form name="add_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" >
117             <label for="lang">Display location:</label>
118             <select name="lang" id="lang">
119             <option value="">All</option>
120             <option value="koha">Librarian interface</option>
121             <option value="slip">Slip</option>
122                 [% FOREACH lang_lis IN lang_list %]
123                     [% IF ( lang_lis.selected ) %]
124                         <option value="[% lang_lis.language %]" selected="selected">
125                     [% ELSE %]
126                         <option value="[% lang_lis.language %]">
127                     [% END %]
128                         OPAC ([% lang_lis.language %])
129                     </option>
130                 [% END %]
131             </select>
132             <input type="submit" class="button" value="Filter" />
133         </form>
134         </div>
135         [% IF ( opac_news_count ) %]
136         <form name="del_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" onsubmit='return confirm(MSG_CONFIRM_DELETE_NEWS)'>
137                 <table id="newst">
138                    <thead> <tr>
139                         <th>&nbsp;</th>
140                         <th>Location</th>
141                         <th>Number</th>
142                         <th>Creation date</th>
143                         <th>Expiration date</th>
144                         <th>Title</th>
145                         <th>News</th>
146                         <th>&nbsp;</th>
147                     </tr></thead>
148                     <tbody>[% FOREACH opac_new IN opac_news %]
149                          [% IF ( opac_new.expired ) %]
150                             <tr class="expired">
151                             [% ELSE %]
152                             <tr>
153                             [% END %]
154                             <td>
155                                 <input type="checkbox" name="ids" value="[% opac_new.idnew %]" />
156                             </td>
157                             <td>[% IF ( opac_new.lang == 'koha' ) %]
158                                     Librarian interface
159                                  [% ELSE %]
160                                     [% IF ( opac_new.lang == 'slip' ) %]
161                                         Slip
162                                     [% ELSE %]
163                                         OPAC
164                                     [% END %]
165                                  [% END %]
166                              </td>
167
168                             <td>[% opac_new.number %]</td>
169                             <td><span title="[% opac_new.newdate %]">[% opac_new.newdate | $KohaDates %]</span></td>
170                             <td><span title="[% opac_new.expirationdate %]">[% opac_new.expirationdate | $KohaDates %] [% IF ( opac_new.expired ) %](<span class="expired">expired</span>)[% END %]</span></td>
171                             <td>[% opac_new.title %]</td>
172                            <td>
173                                 [% opac_new.new %]
174                             </td>
175                             <td><a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&amp;id=[% opac_new.idnew %]">Edit</a></td>
176                         </tr>
177                     [% END %]</tbody>
178                 </table>
179                 <input type="hidden" name="op" value="del" />
180                 <fieldset class="action"><input type="submit" class="button" value="Delete selected" /></fieldset>
181             </form>
182         [% ELSE %]
183             <p>No news loaded</p>
184         [% END %]
185     [% END %]
186 </div>
187 </div>
188 [% UNLESS ( add_form ) %]
189     <div class="yui-b noprint">
190         [% INCLUDE 'tools-menu.inc' %]
191     </div>
192 [% END %]
193 </div>
194 [% INCLUDE 'intranet-bottom.inc' %]