Bug 10855: interface configuration for adding new fields to subscriptions
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / serials / add_fields.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Serials &rsaquo; Manage new fields for subscriptions
3   [% IF op == "list" %] &rsaquo; List of fields
4   [% ELSIF op == "add_form" %]
5     [% IF field %] &rsaquo; Modify field
6     [% ELSE %] &rsaquo; Add field
7     [% END %]
8   [% END %]
9 </title>
10 [% INCLUDE 'doc-head-close.inc' %]
11 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
12 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
13 [% INCLUDE 'datatables-strings.inc' %]
14 <script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
15 <script type="text/javascript">
16 //<![CDATA[
17   $(document).ready(function(){
18
19     $("#fieldst").dataTable($.extend(true, {}, dataTablesDefaults, {
20         'bAutoWidth': false,
21         'sDom': 't<"bottom pager"ilpf>',
22         'sPaginationType': 'four_button',
23         'aLengthMenu': [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
24         'iDisplayLength': 20,
25         'aaSorting': [[ 0, "asc" ]],
26     }));
27
28     $(".confirmdelete").click(function(){
29       return confirm(_("Are you sure you want to delete this field?"));
30     });
31
32     $("#add_field").on('submit', function(){
33         if ( $("#marcfield").val().length > 0
34             && $("select[name='authorised_value_category']" ).val().length > 0 ) {
35             alert("You cannot select an authorised value category and a marcfield");
36             return false;
37         }
38         return true;
39     });
40   });
41 //]]>
42 </script>
43 </head>
44
45 <body id="ser_add_fields" class="ser">
46   [% INCLUDE 'header.inc' %]
47   [% INCLUDE 'serials-search.inc' %]
48
49   <div id="breadcrumbs">
50     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> &rsaquo; Manage new fields for subscriptions
51   </div>
52
53   <div id="doc3" class="yui-t2">
54   <div id="bd">
55   <div id="yui-main">
56   <div class="yui-b">
57   [% IF op == 'list' %]
58     <div id="toolbar" class="btn-toolbar">
59       <a class="btn btn-small" id="newfields" href="/cgi-bin/koha/serials/add_fields.pl?op=add_form"><i class="icon-plus"></i> New fields</a>
60     </div>
61   [% END %]
62
63   [% IF messages %]
64     [% FOR message IN messages %]
65       [% IF message.code == 'insert' %]
66         [% IF message.number > 0 %]
67           <div class="dialog message">The field has been inserted</div>
68         [% ELSE %]
69           <div class="dialog alert">The field has not been inserted (name still exist?)</div>
70         [% END %]
71       [% ELSIF message.code == 'update' %]
72         [% IF message.number > 0 %]
73           <div class="dialog message">The field has been updated</div>
74         [% ELSE %]
75           <div class="dialog alert">The field has not been updated (name still exist?)</div>
76         [% END %]
77       [% ELSIF message.code == 'delete' %]
78         [% IF message.number > 0 %]
79           <div class="dialog message">The field has been deleted</div>
80         [% ELSE %]
81           <div class="dialog alert">The field has not been deleted</div>
82         [% END %]
83       [% END %]
84     [% END %]
85   [% END %]
86
87   [% IF op == 'list' %]
88     <h3>Additional fields for subscriptions</h3>
89     [% IF fields %]
90       <table id="fieldst">
91         <thead>
92           <tr>
93             <th>Name</th>
94             <th>Authorised value category</th>
95             <th>Marc field</th>
96             <th>Searchable</th>
97             <th>Actions</th>
98           </tr>
99         </thead>
100         <tbody>
101           [% FOR field IN fields %]
102             <tr>
103               <td>[% field.name %]</td>
104               <td>[% field.authorised_value_category %]</td>
105               <td>[% field.marcfield %]</td>
106               <td>
107                 [% IF field.searchable %]Yes[% ELSE %]No[% END %]
108               </td>
109               <td>
110                 <a href="/cgi-bin/koha/serials/add_fields.pl?op=add_form&amp;field_id=[% field.id %]" title="Edit this field">Edit</a>
111                 <a class="confirmdelete" href="/cgi-bin/koha/serials/add_fields.pl?op=delete&amp;field_id=[% field.id %]" title="Delete this field">Delete</a>
112               </td>
113             </tr>
114           [% END %]
115         </tbody>
116       </table>
117     [% ELSE %]
118       There is no field defined.
119     [% END %]
120   [% ELSIF op == 'add_form' %]
121     [% IF field %]
122       <h3>Modify field</h3>
123     [% ELSE %]
124       <h3>Add field</h3>
125     [% END %]
126     <form action="/cgi-bin/koha/serials/add_fields.pl" name="add_form" id="add_field" method="post">
127       <fieldset class="rows">
128         <ol>
129           <li>
130             <label for="name" class="required">Name: </label>
131             <input type="text" name="name" id="name" value="[% field.name | html %]" />
132           </li>
133           <li>
134             <label for="av">Authorised value category: </label>
135             <select name="authorised_value_category">
136               <option value="">None</option>
137               [% FOR category IN categories %]
138                 [% IF field.authorised_value_category == category %]
139                   <option value="[% category %]" selected="selected">[% category %]</option>
140                 [% ELSE %]
141                   <option value="[% category %]">[% category %]</option>
142                 [% END %]
143               [% END %]
144             </select>
145           </li>
146           <li>
147             <label for="marcfield">Marc field: </label>
148             <input type="text" name="marcfield" id="marcfield" value="[% field.marcfield| html %]" />
149           </li>
150           <li>
151             <label for="searchable">Searchable: </label>
152             [% IF field.searchable %]
153               <input type="checkbox" name="searchable" id="searchable" checked="checked" />
154             [% ELSE %]
155               <input type="checkbox" name="searchable" id="searchable" />
156             [% END %]
157           </li>
158         </ol>
159       </fieldset>
160       <fieldset class="action">
161         [% IF field %]
162           <input type="hidden" name="field_id" value="[% field.id %]" />
163         [% END %]
164         <input type="hidden" name="op" value="add" />
165         <input type="submit" value="Save" />
166         <a href="/cgi-bin/koha/serials/add_fields.pl" class="cancel">Cancel</a>
167       </fieldset>
168     </form>
169   [% END %]
170
171   </div>
172   </div>
173
174 <div class="yui-b">
175 [% INCLUDE 'serials-menu.inc' %]
176 </div>
177 </div>
178 [% INCLUDE 'intranet-bottom.inc' %]