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