Bug 12138 - Use placeholders in translatable Javascript strings
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / serials / subscription-add.tt
1 [% USE KohaDates %]
2
3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Koha &rsaquo; Serials &rsaquo; [% IF ( modify ) %][% bibliotitle |html %] &rsaquo; Modify subscription[% ELSE %]New subscription[% END %]</title>
5 [% INCLUDE 'doc-head-close.inc' %]
6 [% INCLUDE 'calendar.inc' %]
7 <style type="text/css">
8 fieldset.rows li.radio { width: 100%; } /* override staff-global.css */
9 .yui-u li p label.widelabel {
10     width: 300px;  /* not enough for IE7 apparently */
11 }
12 </style>
13 <script type="text/javascript">
14 //<![CDATA[
15
16 var globalnumpatterndata;
17 var globalfreqdata;
18 var advancedpatternlocked;
19 var patternneedtobetested = 0;
20
21 function check_issues(){
22     if (globalfreqdata.unit.length >0) {
23         if (document.f.subtype.value == globalfreqdata.unit){
24             document.f.issuelengthcount.value=(document.f.sublength.value*globalfreqdata.issuesperunit)/globalfreqdata.unitsperissue;
25         } else if (document.f.subtype.value != "issues"){
26             alert(_("Frequency and subscription length provided doesn't combine well. Please consider entering an issue count rather than a time period."));
27         }
28     }
29 }
30
31 function addbiblioPopup(biblionumber) {
32     var destination = "/cgi-bin/koha/cataloguing/addbiblio.pl?mode=popup";
33     if(biblionumber){
34         destination += "&biblionumber="+biblionumber;
35     }
36     window.open(destination,'AddBiblioPopup','width=1024,height=768,toolbar=no,scrollbars=yes');
37 }
38
39 function Plugin(f)
40 {
41     window.open('subscription-bib-search.pl','FindABibIndex','width=800,height=400,toolbar=no,scrollbars=yes');
42 }
43
44 function FindAcqui(f)
45 {
46     window.open('acqui-search.pl','FindASupplier','width=800,height=400,toolbar=no,scrollbars=yes');
47 }
48
49 function Find_ISSN(f)
50 {
51     window.open('issn-search.pl','FindABibIndex','width=800,height=400,toolbar=no,scrollbars=yes');
52 }
53
54 function Clear(id) {
55     $("#"+id).val('');
56 }
57
58 function Check_page1() {
59     if ( $("#aqbooksellerid").val().length == 0) {
60         input_box = confirm(_("If you wish to claim late or missing issues you must link this subscription to a vendor. Click OK to ignore or Cancel to return and enter a vendor"));
61         if (input_box==false) {
62             return false;
63         }
64     }
65     if ($("#biblionumber").val().length == 0) {
66         alert(_("You must choose or create a biblio"));
67         return false;
68     }
69
70     return true;
71 }
72
73 function Check_page2(){
74     [% UNLESS (more_than_one_serial) %]
75       if($("#acqui_date").val().length == 0){
76           alert(_("You must choose a first publication date"));
77           return false;
78       }
79     [% END %]
80     if($("#sublength").val().length == 0 && $("input[name='enddate']").val().length == 0){
81         alert(_("You must choose a subscription length or an end date."));
82         return false;
83     }
84     if(advancedpatternlocked == 0){
85         alert(_("You have modified the advanced prediction pattern. Please save your work or cancel modifications."));
86         return false;
87     }
88     if(patternneedtobetested){
89         alert(_("Please click on 'Test prediction pattern' before saving subscription."));
90         return false;
91     }
92
93     return true;
94 }
95
96 function frequencyload(){
97     $.getJSON("subscription-frequency.pl",{"frequency_id":document.f.frequency.value,ajax:'true'},
98         function(freqdata){
99             globalfreqdata=freqdata;
100             if ( globalfreqdata.unit && globalfreqdata.unit.length == 0 ) {
101                 var option = $("#subtype option[value='issues']");
102                 $(option).attr('selected', 'selected');
103                 $("#subtype option[value!='issues']").attr('disabled', 'disabled')
104             } else {
105                 $("#subtype option").attr('disabled', false)
106             }
107         }
108     )
109 }
110
111 function numberpatternload(){
112     $.getJSON("subscription-numberpattern.pl",{"numberpattern_id":document.f.numbering_pattern.value,ajax:'true'},
113         function(numpatterndata){
114             globalnumpatterndata=numpatterndata;
115             if (globalnumpatterndata==undefined){
116                 return false;
117             }
118             displaymoreoptions();
119             restoreAdvancedPattern();
120         }
121     );
122 }
123
124 function displaymoreoptions() {
125     if(globalnumpatterndata == undefined){
126         $("#moreoptionst").hide();
127         return false;
128     }
129
130     var X = 0, Y = 0, Z = 0;
131     var numberingmethod = unescape(globalnumpatterndata.numberingmethod);
132     if(numberingmethod.match(/{X}/)) X = 1;
133     if(numberingmethod.match(/{Y}/)) Y = 1;
134     if(numberingmethod.match(/{Z}/)) Z = 1;
135
136     if(X || Y || Z) {
137         $("#moreoptionst").show();
138     } else {
139         $("#moreoptionst").hide();
140     }
141
142     if(X) {
143         if(globalnumpatterndata.label1) {
144             $("#headerX").html(unescape(globalnumpatterndata.label1));
145         } else {
146             $("#headerX").html("X");
147         }
148         $("#headerX").show();
149         $("#beginsX").show();
150         $("#innerX").show();
151     } else {
152         $("#headerX").hide();
153         $("#beginsX").hide();
154         $("#innerX").hide();
155         $("#lastvaluetemp1").val('');
156         $("#innerlooptemp1").val('');
157     }
158     if(Y) {
159         if(globalnumpatterndata.label2) {
160             $("#headerY").html(unescape(globalnumpatterndata.label2));
161         } else {
162             $("#headerY").html("Y");
163         }
164         $("#headerY").show();
165         $("#beginsY").show();
166         $("#innerY").show();
167     } else {
168         $("#headerY").hide();
169         $("#beginsY").hide();
170         $("#innerY").hide();
171         $("#lastvaluetemp2").val('');
172         $("#innerlooptemp2").val('');
173     }
174     if(Z) {
175         if(globalnumpatterndata.label3) {
176             $("#headerZ").html(unescape(globalnumpatterndata.label3));
177         } else {
178             $("#headerZ").html("Z");
179         }
180         $("#headerZ").show();
181         $("#beginsZ").show();
182         $("#innerZ").show();
183     } else {
184         $("#headerZ").hide();
185         $("#beginsZ").hide();
186         $("#innerZ").hide();
187         $("#lastvaluetemp3").val('');
188         $("#innerlooptemp3").val('');
189     }
190 }
191
192 function toggleAdvancedPattern() {
193     $("#advancedpredictionpattern").toggle();
194 }
195
196 function modifyAdvancedPattern() {
197     $("#patternname").attr("readonly", false).val('');
198     $("#numberingmethod").attr("readonly", false);
199
200     $("#advancedpredictionpatternt input").each(function() {
201         $(this).attr("readonly", false);
202     });
203     $("#advancedpredictionpatternt select").each(function() {
204         $(this).attr("disabled", false);
205     });
206
207     $("#restoreadvancedpatternbutton").show();
208     $("#saveadvancedpatternbutton").show();
209     $("#modifyadvancedpatternbutton").hide();
210
211     advancedpatternlocked = 0;
212 }
213
214 function restoreAdvancedPattern() {
215     $("#patternname").attr("readonly", true).val(unescape(globalnumpatterndata.label));
216     $("#numberingmethod").attr("readonly", true).val(unescape(globalnumpatterndata.numberingmethod));
217
218     $("#advancedpredictionpatternt input").each(function() {
219         $(this).attr("readonly", true);
220         var id = $(this).attr('id');
221         if(id.match(/lastvalue/) || id.match(/innerloop/)) {
222             var tempid = id.replace(/(\d)/, "temp$1");
223             $(this).val($("#"+tempid).val());
224         } else {
225             $(this).val(unescape(globalnumpatterndata[id]));
226         }
227     });
228     $("#advancedpredictionpatternt select").each(function() {
229         $(this).attr("disabled", true);
230         var id = $(this).attr('id');
231         $(this).val(unescape(globalnumpatterndata[id]));
232     });
233
234     $("#restoreadvancedpatternbutton").hide();
235     $("#saveadvancedpatternbutton").hide();
236     $("#modifyadvancedpatternbutton").show();
237
238     advancedpatternlocked = 1;
239 }
240
241 function testPredictionPattern() {
242     var frequencyid = $("#frequency").val();
243     var acquidate;
244     var error = 0;
245     var error_msg = "";
246     if(frequencyid == undefined || frequencyid == ""){
247         error_msg += _("- Frequency is not defined") + "\n";
248         error ++;
249     }
250     acquidate = $("#acqui_date").val();
251     if(acquidate == undefined || acquidate == ""){
252         error_msg += _("- First publication date is not defined") + "\n";
253         error ++;
254     }
255     [% IF (more_than_one_serial) %]
256       var nextacquidate = $("#nextacquidate").val();
257       if(nextacquidate == undefined || nextacquidate == ""){
258         error_msg += _("- Next issue publication date is not defined") + "\n";
259         error ++;
260       }
261     [% END %]
262
263     if(error){
264         alert(_("Cannot test prediction pattern for the following reason(s): %s").format(error_msg));
265         return false;
266     }
267
268     var custompattern = 0;
269     if(advancedpatternlocked == 0) {
270         custompattern = 1;
271     }
272
273     var ajaxData = {
274         'custompattern': custompattern,
275         [% IF (subscriptionid) %]
276             'subscriptionid': [% subscriptionid %],
277         [% END %]
278         [% IF (more_than_one_serial) %]
279           'nextacquidate': nextacquidate,
280         [% END %]
281         'firstacquidate': acquidate
282     };
283     var ajaxParams = [
284         'to', 'subtype', 'sublength', 'frequency', 'numberingmethod',
285         'lastvalue1', 'lastvalue2', 'lastvalue3', 'add1', 'add2', 'add3',
286         'every1', 'every2', 'every3', 'innerloop1', 'innerloop2', 'innerloop3',
287         'setto1', 'setto2', 'setto3', 'numbering1', 'numbering2', 'numbering3',
288         'whenmorethan1', 'whenmorethan2', 'whenmorethan3', 'locale'
289     ];
290     for(i in ajaxParams) {
291         var param = ajaxParams[i];
292         var value = $("#"+param).val();
293         if(value.length > 0)
294             ajaxData[param] = value;
295     }
296
297     $.ajax({
298         url:"/cgi-bin/koha/serials/showpredictionpattern.pl",
299         data: ajaxData,
300         success: function(data) {
301             $("#displayexample").html(data);
302             patternneedtobetested = 0;
303         }
304     });
305 }
306
307 function saveAdvancedPattern() {
308     if ($("#patternname").val().length == 0) {
309         alert(_("Please enter a name for this pattern"));
310         return false;
311     }
312
313     // Check if patternname already exists, and modify pattern
314     // instead of creating it if so
315     var found = 0;
316     $("#numberpattern option").each(function(){
317         if($(this).text() == $("#patternname").val()){
318             found = 1;
319             return false;
320         }
321     });
322     var cnfrm = 1;
323     if(found){
324         var msg = _("This pattern name already exists. Do you want to modify it?")
325             + "\n" + _("Warning: it will modify the pattern for all subscriptions that are using it.");
326         cnfrm = confirm(msg);
327     }
328
329     if(cnfrm) {
330         var ajaxData = {};
331         var ajaxParams = [
332             'patternname', 'numberingmethod', 'label1', 'label2', 'label3',
333             'add1', 'add2', 'add3', 'every1', 'every2', 'every3',
334             'setto1', 'setto2', 'setto3', 'numbering1', 'numbering2', 'numbering3',
335             'whenmorethan1', 'whenmorethan2', 'whenmorethan3', 'locale'
336         ];
337         for(i in ajaxParams) {
338             var param = ajaxParams[i];
339             var value = $("#"+param).val();
340             if(value.length > 0)
341                 ajaxData[param] = value;
342         }
343
344         $.getJSON(
345             "/cgi-bin/koha/serials/create-numberpattern.pl",
346             ajaxData,
347             function(data){
348                 if (data.numberpatternid) {
349                     if(found == 0){
350                         $("#numberpattern").append("<option value=\""+data.numberpatternid+"\">"+$("#patternname").val()+"</option>");
351                     }
352                     $("#numberpattern").val(data.numberpatternid);
353                     numberpatternload();
354                 } else {
355                     alert(_("Something went wrong. Unable to create a new numbering pattern."));
356                 }
357             }
358         );
359     }
360 }
361
362 function show_page_1() {
363     $("#page_1").show();
364     $("#page_2").hide();
365     $("#page_number").text("1/2");
366 }
367
368 function show_page_2() {
369     $("#page_1").hide();
370     $("#page_2").show();
371     $("#page_number").text("2/2");
372     displaymoreoptions();
373 }
374
375
376 $(document).ready(function() {
377     $("select#frequency").change(function(){
378         patternneedtobetested = 1;
379         $("input[name='enddate']").val('');
380         frequencyload();
381     });
382     $("select#numberpattern").change(function(){
383         patternneedtobetested = 1;
384         numberpatternload();
385     });
386     $("#subtype").change(function(){
387         $("input[name='enddate']").val('');
388     });
389     $("#sublength").change(function(){
390         $("input[name='enddate']").val('');
391     });
392     $("#lastvaluetemp1").keyup(function(){
393         $("#lastvalue1").val($(this).val());
394     });
395     $("#lastvaluetemp2").keyup(function(){
396         $("#lastvalue2").val($(this).val());
397     });
398     $("#lastvaluetemp3").keyup(function(){
399         $("#lastvalue3").val($(this).val());
400     });
401     $("#lastvalue1").keyup(function(){
402         $("#lastvaluetemp1").val($(this).val());
403     });
404     $("#lastvalue2").keyup(function(){
405         $("#lastvaluetemp2").val($(this).val());
406     });
407     $("#lastvalue3").keyup(function(){
408         $("#lastvaluetemp3").val($(this).val());
409     });
410
411     $("#innerlooptemp1").keyup(function(){
412         $("#innerloop1").val($(this).val());
413     });
414     $("#innerlooptemp2").keyup(function(){
415         $("#innerloop2").val($(this).val());
416     });
417     $("#innerlooptemp3").keyup(function(){
418         $("#innerloop3").val($(this).val());
419     });
420     $("#innerloop1").keyup(function(){
421         $("#innerlooptemp1").val($(this).val());
422     });
423     $("#innerloop2").keyup(function(){
424         $("#innerlooptemp2").val($(this).val());
425     });
426     $("#innerloop3").keyup(function(){
427         $("#innerlooptemp3").val($(this).val());
428     });
429
430     if($("#frequency").val() != ""){
431         frequencyload();
432     }
433     if($("#numberpattern").val() != ""){
434         numberpatternload();
435     }
436
437     var node;
438     [% FOREACH field IN dont_export_field_loop %]
439         node = $("#[% field.fieldid %]");
440         if ( $(node).is('input') || $(node).is('textarea') ) {
441             $(node).val("");
442         } else if ( $(node).is('select') ) {
443             $(node).find("option:first").attr('selected','selected');
444         }
445     [% END %]
446
447     show_page_1();
448 });
449 //]]>
450 </script>
451 </head>
452 <body id="ser_subscription-add" class="ser">
453 [% INCLUDE 'header.inc' %]
454 [% INCLUDE 'serials-search.inc' %]
455
456 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> &rsaquo; [% IF ( modify ) %]<a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% subscriptionid %]"><i>[% bibliotitle |html %]</i></a> &rsaquo; Modify subscription[% ELSE %]New subscription[% END %]</div>
457
458 <div id="doc3" class="yui-t7">
459     <div id="bd">
460         <div class="yui-g">
461             <h1>[% IF ( modify ) %] Modify subscription for <i>[% bibliotitle |html %]</i>[% ELSE %]Add a new subscription[% END %] (<span id="page_number">1/2</span>)</h1>
462             <form method="post" name="f" action="/cgi-bin/koha/serials/subscription-add.pl" class="validated" onsubmit="return Check_page2();" >
463                 [% IF ( modify ) %]
464                     <input type="hidden" name="op" value="modsubscription" />
465                     <input type="hidden" name="subscriptionid" value="[% subscriptionid %]" />
466                 [% ELSE %]
467                         <input type="hidden" name="op" value="addsubscription" />
468                 [% END %]
469                 <input type="hidden" name="user" value="[% loggedinusername %]" />
470                 <input type="hidden" name="irreg_check" value="0" />
471
472                 <div id="page_1">
473                     <div class="yui-u first">
474                         <fieldset id="subscription_add_information" class="rows">
475                             <legend>Subscription details</legend>
476                             <ol>
477                                 [% IF ( subscriptionid ) %]
478                                     <li><span class="label">Subscription #</span> [% subscriptionid %]</li>
479                                 [% END %]
480                                 <li>
481                                     <label for="aqbooksellerid">Vendor: </label>
482                                     <input type="text" name="aqbooksellerid" id="aqbooksellerid" value="[% aqbooksellerid %]" size="8" /> (<input type="text" name="aqbooksellername" value="[% aqbooksellername %]" disabled="disabled" readonly="readonly" />) <a href="#" onclick="FindAcqui(f)">Search for a vendor</a>
483                                 </li>
484                                 <li>
485                                     <label for="biblionumber" class="required" title="Subscriptions must be associated with a bibliographic record">Biblio:</label>
486                                     <input type="text" name="biblionumber" id="biblionumber" value="[% bibnum %]" size="8" />
487                                     (<input type="text" name="title" value="[% bibliotitle %]" disabled="disabled" readonly="readonly" />) <span class="required" title="Subscriptions must be associated with a bibliographic record">Required</span>
488                                     <div class="inputnote"> <a href="#" onclick="Plugin(f)">Search for Biblio</a>
489                                         [% IF ( CAN_user_editcatalogue ) %]
490                                             [% IF ( modify ) %]
491                                             | <a href="#" onclick="addbiblioPopup([% bibnum %]); return false;">Edit biblio</a>
492                                             [% ELSE %]
493                                             | <a href="#" onclick="addbiblioPopup(); return false;">Create Biblio</a>
494                                             [% END %]
495                                         [% END %]
496                                     </div>
497                                 </li>
498                                 <li class="radio">
499                                     [% IF ( serialsadditems ) %]
500                                         <p><input type="radio" id="serialsadditems-yes" name="serialsadditems" value="1" checked="checked" /><label class="widelabel" for="serialsadditems-yes">create an item record when receiving this serial</label></p>
501                                         <p><input type="radio" id="serialsadditems-no" name="serialsadditems" value="0" /><label class="widelabel" for="serialsadditems-no">do not create an item record when receiving this serial </label></p>
502                                     [% ELSE %]
503                                         <p><input type="radio" id="serialsadditems-yes" name="serialsadditems" value="1"/><label class="widelabel" for="serialsadditems-yes">create an item record when receiving this serial</label></p>
504                                         <p><input type="radio" id="serialsadditems-no" name="serialsadditems" value="0" checked="checked" /><label class="widelabel" for="serialsadditems-no">do not create an item record when receiving this serial</label></p>
505                                     [% END %]
506                                 </li>
507                                 <li class="radio">
508                                   <p>When there is an irregular issue:</p>
509                                   [% IF (skip_serialseq) %]
510                                     <p>
511                                       <input type="radio" id="skip_serialseq_yes" name="skip_serialseq" value="1" checked="checked" />
512                                       <label for="skip_serialseq_yes">Skip issue number</label>
513                                     </p>
514                                     <p>
515                                       <input type="radio" id="skip_serialseq_no" name="skip_serialseq" value="0" />
516                                       <label for="skip_serialseq_no">Keep issue number</label>
517                                     </p>
518                                   [% ELSE %]
519                                     <p>
520                                       <input type="radio" id="skip_serialseq_yes" name="skip_serialseq" value="1" />
521                                       <label for="skip_serialseq_yes">Skip issue number</label>
522                                     </p>
523                                     <p>
524                                       <input type="radio" id="skip_serialseq_no" name="skip_serialseq" value="0" checked="checked" />
525                                       <label for="skip_serialseq_no">Keep issue number</label>
526                                     </p>
527                                   [% END %]
528                                 </li>
529                                 <li>
530                                     <label for="manualhistory">Manual history</label>
531                                     [% IF (manualhistory) %]
532                                         <input type="checkbox" id="manualhistory" name="manualhist" checked="checked" />
533                                     [% ELSE %]
534                                         <input type="checkbox" id="manualhistory" name="manualhist" />
535                                     [% END %]
536                                 </li>
537                                 <li>
538                                     <label for="callnumber">Call number</label>
539                                     <input type="text" name="callnumber" id="callnumber" value="[% callnumber %]" size="20" />
540                                 </li>
541                                 <li>
542                                     <label for="branchcode">Library:</label>
543                                     <select name="branchcode" id="branchcode" style="width: 20em;">
544                                         [% UNLESS ( Independentbranches ) %]
545                                             <option value="">None</option>
546                                         [% END %]
547                                         [% FOREACH branchloo IN branchloop %]
548                                             [% IF ( branchloo.selected ) %]
549                                                 <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
550                                             [% ELSE %]
551                                                 <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
552                                             [% END %]
553                                         [% END %]
554                                     </select> (select a library)
555                                 </li>
556                                 <li>
557                                     <label for="notes">Public note:</label>
558                                     <textarea name="notes" id="notes" cols="30" rows="2">[% notes %]</textarea>
559                                 </li>
560                                 <li>
561                                     <label for="internalnotes">Nonpublic note:</label>
562                                     <textarea name="internalnotes" id="internalnotes" cols="30" rows="2">[% internalnotes %]</textarea>
563                                 </li>
564                                 <li>
565                                     [% IF ( letterloop ) %]
566                                         <label for="letter">Patron notification: </label>
567                                         <select name="letter" id="letter">
568                                             <option value="">None</option>
569                                             [% FOREACH letterloo IN letterloop %]
570                                                 [% IF ( letterloo.selected ) %]
571                                                     <option value="[% letterloo.value %]" selected="selected">[% letterloo.lettername %]</option>
572                                                 [% ELSE %]
573                                                     <option value="[% letterloo.value %]">[% letterloo.lettername %]</option>
574                                                 [% END %]
575                                             [% END %]
576                                         </select>
577                                         <div class="hint">Selecting a notice will allow patrons to subscribe to notifications when a new issue is received.</div>
578                                     [% ELSE %]
579                                         <span class="label">Patron notification: </span>
580                                         <div class="hint">To notify patrons of new serial issues, you must <a href="/cgi-bin/koha/tools/letter.pl">define a notice</a>.</div>
581                                     [% END %]
582                                 </li>
583                                 <li>
584                                     <label for="location">Location:</label>
585                                     <select name="location" id="location">
586                                         <option value="">None</option>
587                                         [% FOREACH locations_loo IN locations_loop %]
588                                             [% IF ( locations_loo.selected ) %]
589                                                 <option value="[% locations_loo.authorised_value %]" selected="selected">[% locations_loo.lib %]</option>
590                                             [% ELSE %]
591                                                 <option value="[% locations_loo.authorised_value %]">[% locations_loo.lib %]</option>
592                                             [% END %]
593                                         [% END %]
594                                     </select>
595                                 </li>
596                                 <li>
597                                     <label for="graceperiod">Grace period:</label>
598                                     <input type="text" name="graceperiod" id="graceperiod" value="[% graceperiod %]" size="5"/> day(s)
599                                 </li>
600                                 <li>
601                                      <label class="widelabel" for="staffdisplaycount">Number of issues to display to staff: </label>
602                                      <input type="text" name="staffdisplaycount" id="staffdisplaycount" value="[% staffdisplaycount %]" size="4"/>
603                                  </li>
604                                  <li>
605                                     <label class="widelabel" for="opacdisplaycount">Number of issues to display to the public: </label>
606                                     <input type="text" name="opacdisplaycount" id="opacdisplaycount" value="[% opacdisplaycount %]" size="4"/>
607                                 </li>
608                             </ol>
609                         </fieldset>
610                         <fieldset class="action">
611                             <input type="button" value="Next >>" onclick="if ( Check_page1() ) show_page_2();" style="float:right;" />
612                         </fieldset>
613                     </div>
614                 </div>
615
616                 <div id="page_2">
617                     <div class="yui-u first">
618                         <div id="subscription_form_planning">
619                             <fieldset class="rows">
620                                 <legend>Serials planning</legend>
621                                 <ol>
622                                     <li>
623                                         <label for="firstacquidate" class="required">First issue publication date:</label>
624                                         [% UNLESS (more_than_one_serial) %]
625                                           <input type="text" size="10" id="acqui_date" name="firstacquidate" value="[% firstacquidate | $KohaDates %]" class="datepicker required" required="required" />
626                                         [% ELSE %]
627                                           [% firstacquidate | $KohaDates %]
628                                           <input type="hidden" size="10" id="acqui_date" name="firstacquidate" value="[% firstacquidate | $KohaDates %]"/>
629                                         [% END %]
630                                     </li>
631                                     [% IF (more_than_one_serial) %]
632                                       <li>
633                                         <label for="nextacquidate">Next issue publication date:</label>
634                                         <input type="text" size="10" id="nextacquidate" name="nextacquidate" value="[% nextacquidate | $KohaDates %]" class="datepicker" />
635                                       </li>
636                                     [% END %]
637                                     <li>
638                                         <label for="frequency" class="required">Frequency:</label>
639                                         <select name="frequency" size="1" id="frequency" class="required" required="required">
640                                             <option value="">-- please choose --</option>
641                                             [% FOREACH frequency IN frequencies %]
642                                                 [% IF (frequency.selected) %]
643                                                     <option value="[% frequency.id %]" selected="selected">
644                                                 [% ELSE %]
645                                                     <option value="[% frequency.id %]">
646                                                 [% END %]
647                                                     [% frequency.label %]
648                                                 </option>
649                                             [% END %]
650                                         </select>
651                                     </li>
652                                     <li>
653                                         <label for="subtype">Subscription length:</label>
654                                         <select name="subtype" id="subtype">
655                                             [% FOREACH subt IN subtype %]
656                                                 [% IF (subt.selected) %]
657                                                     <option value="[% subt.name %]" selected="selected">
658                                                 [% ELSE %]
659                                                     <option value="[% subt.name %]">
660                                                 [% END %]
661                                                     [% subt.name %]
662                                                 </option>
663                                             [% END %]
664                                         </select>
665                                         <input type="text" name="sublength" id="sublength" value="[% sublength %]" size="3" /> (enter amount in numerals)
666                                         <input type="hidden" name="issuelengthcount">
667                                     </li>
668                                     <li>
669                                         <label for="startdate" class="required"> Subscription start date:</label>
670                                         <input type="text" size="10" id="from" name="startdate" value="[% startdate | $KohaDates %]" class="datepickerfrom required" required="required" />
671                                     </li>
672                                     <li>
673                                         <label for="enddate">Subscription end date:</label>
674                                         <input type="text" size="10" id="to" name="enddate" value="[% enddate | $KohaDates %]" class="datepickerto" />
675                                     </li>
676                                     <li>
677                                         <label for="numberpattern" class="required">Numbering pattern:</label>
678                                         <select name="numbering_pattern" size="1" id="numberpattern" class="required" required="required">
679                                             <option value="">-- please choose --</option>
680                                             [% FOREACH numberpattern IN numberpatterns %]
681                                                 [% IF (numberpattern.selected) %]
682                                                     <option value="[% numberpattern.id %]" selected="selected">
683                                                 [% ELSE %]
684                                                     <option value="[% numberpattern.id %]">
685                                                 [% END %]
686                                                     [% numberpattern.label %]
687                                                 </option>
688                                             [% END %]
689                                         </select>
690                                     </li>
691                                     <li>
692                                         <label for="locale">Locale</label>
693                                         <select id="locale" name="locale">
694                                             <option value=""></option>
695                                             [% FOREACH l IN locales %]
696                                                 [% IF l == locale %]
697                                                     <option value="[% l %]" selected="selected">[% l %]</option>
698                                                 [% ELSE %]
699                                                     <option value="[% l %]">[% l %]</option>
700                                                 [% END %]
701                                             [% END %]
702                                         </select>
703                                         <span class="hint">If empty, system locale is used</span>
704                                     </li>
705                                     <li id="more_options">
706                                         <table id="moreoptionst">
707                                             <thead>
708                                                 <tr>
709                                                     <th>&nbsp;</th>
710                                                     <th id="headerX">&nbsp;</th>
711                                                     <th id="headerY">&nbsp;</th>
712                                                     <th id="headerZ">&nbsp;</th>
713                                                 </tr>
714                                             </thead>
715                                             <tbody>
716                                                 <tr>
717                                                     <td>
718                                                       [% IF (more_than_one_serial) %]
719                                                         Last value
720                                                       [% ELSE %]
721                                                         Begins with
722                                                       [% END %]
723                                                     </td>
724                                                     <td id="beginsX"><input type="text" id="lastvaluetemp1" name="lastvaluetemp1" value="[% lastvalue1 %]" /></td>
725                                                     <td id="beginsY"><input type="text" id="lastvaluetemp2" name="lastvaluetemp2" value="[% lastvalue2 %]" /></td>
726                                                     <td id="beginsZ"><input type="text" id="lastvaluetemp3" name="lastvaluetemp3" value="[% lastvalue3 %]" /></td>
727                                                 </tr>
728                                                 <tr>
729                                                     <td>Inner counter</td>
730                                                     <td id="innerX"><input type="text" id="innerlooptemp1" name="innerlooptemp1" value="[% innerloop1 %]" /></td>
731                                                     <td id="innerY"><input type="text" id="innerlooptemp2" name="innerlooptemp2" value="[% innerloop2 %]" /></td>
732                                                     <td id="innerZ"><input type="text" id="innerlooptemp3" name="innerlooptemp3" value="[% innerloop3 %]" /></td>
733                                                 </tr>
734                                             </tbody>
735                                         </table>
736                                     </li>
737                                     <li><a style="cursor:pointer" onclick="toggleAdvancedPattern();">Show/Hide advanced pattern</a></li>
738                                     <div id="advancedpredictionpattern" style="display:none">
739                                       <li>
740                                         <label for="patternname" class="required">Pattern name:</label>
741                                         <input id="patternname" name="patternname" type="text" readonly="readonly" class="required" required="required" />
742                                       </li>
743                                       <li>
744                                         <label for="numberingmethod">Numbering formula:</label>
745                                         <input readonly="readonly" type="text" name="numberingmethod" id="numberingmethod" size="50" value="[% numberingmethod %]" />
746                                       </li>
747                                         <table id="advancedpredictionpatternt">
748                                             <thead>
749                                                 <tr>
750                                                     <th colspan="4">Advanced prediction pattern</td>
751                                                 </tr>
752                                                 <tr>
753                                                     <th>&nbsp;</th>
754                                                     <th>X</th>
755                                                     <th>Y</th>
756                                                     <th>Z</th>
757                                                 </tr>
758                                             </thead>
759                                             <tbody>
760                                                 <tr>
761                                                     <td>Label</td>
762                                                     <td><input type="text" readonly="readonly" id="label1" name="label1" /></td>
763                                                     <td><input type="text" readonly="readonly" id="label2" name="label2" /></td>
764                                                     <td><input type="text" readonly="readonly" id="label3" name="label3" /></td>
765                                                 </tr>
766                                                 <tr>
767                                                     <td>Begins with</td>
768                                                     <td><input type="text" readonly="readonly" id="lastvalue1" name="lastvalue1" /></td>
769                                                     <td><input type="text" readonly="readonly" id="lastvalue2" name="lastvalue2" /></td>
770                                                     <td><input type="text" readonly="readonly" id="lastvalue3" name="lastvalue3" /></td>
771                                                 </tr>
772                                                 <tr>
773                                                     <td>Add</td>
774                                                     <td><input type="text" readonly="readonly" id="add1" name="add1" /></td>
775                                                     <td><input type="text" readonly="readonly" id="add2" name="add2" /></td>
776                                                     <td><input type="text" readonly="readonly" id="add3" name="add3" /></td>
777                                                 </tr>
778                                                 <tr>
779                                                     <td>Every</td>
780                                                     <td><input type="text" readonly="readonly" id="every1" name="every1" /></td>
781                                                     <td><input type="text" readonly="readonly" id="every2" name="every2" /></td>
782                                                     <td><input type="text" readonly="readonly" id="every3" name="every3" /></td>
783                                                 </tr>
784                                                 <tr>
785                                                     <td>Set back to</td>
786                                                     <td><input type="text" readonly="readonly" id="setto1" name="setto1" /></td>
787                                                     <td><input type="text" readonly="readonly" id="setto2" name="setto2" /></td>
788                                                     <td><input type="text" readonly="readonly" id="setto3" name="setto3" /></td>
789                                                 </tr>
790                                                 <tr>
791                                                     <td>When more than</td>
792                                                     <td><input type="text" readonly="readonly" id="whenmorethan1" name="whenmorethan1" /></td>
793                                                     <td><input type="text" readonly="readonly" id="whenmorethan2" name="whenmorethan2" /></td>
794                                                     <td><input type="text" readonly="readonly" id="whenmorethan3" name="whenmorethan3" /></td>
795                                                 </tr>
796                                                 <tr>
797                                                     <td>Inner counter</td>
798                                                     <td><input type="text" readonly="readonly" id="innerloop1" name="innerloop1" /></td>
799                                                     <td><input type="text" readonly="readonly" id="innerloop2" name="innerloop2" /></td>
800                                                     <td><input type="text" readonly="readonly" id="innerloop3" name="innerloop3" /></td>
801                                                 </tr>
802                                                 <tr>
803                                                     [% BLOCK numbering_select %]
804                                                         <select disabled="disabled" id="[% name %]" name="[% name %]" />
805                                                             <option value=""></option>
806                                                             <option value="dayname">Name of day</option>
807                                                             <option value="monthname">Name of month</option>
808                                                             <option value="season">Name of season</option>
809                                                         </select>
810                                                     [% END %]
811                                                     <td>Formatting</td>
812                                                     <td>[% PROCESS numbering_select name="numbering1" %]</td>
813                                                     <td>[% PROCESS numbering_select name="numbering2" %]</td>
814                                                     <td>[% PROCESS numbering_select name="numbering3" %]</td>
815                                                 </tr>
816                                             </tbody>
817                                         </table>
818                                         <input id="modifyadvancedpatternbutton" type="button" value="Modify pattern" onclick="modifyAdvancedPattern();" />
819                                         <input id="restoreadvancedpatternbutton" type="button" value="Cancel modifications" onclick="restoreAdvancedPattern();" style="display:none" />
820                                         <input id="saveadvancedpatternbutton" type="button" value="Save as new pattern" onclick="saveAdvancedPattern();" style="display:none" />
821                                     </div>
822                                 </ol>
823                             </fieldset>
824                             <fieldset class="action">
825                                 <input type="button" value="<< Previous" onclick="show_page_1();" style="float:left;"/>
826                                 <input id="testpatternbutton" type="button" value="Test prediction pattern" onclick="testPredictionPattern();" />
827                                 <input type="submit" value="Save subscription" style="float:right;" accesskey="w" />
828                             </fieldset>
829                         </div>
830                     </div>
831                     <div class="yui-u">
832                         <li id="displayexample"></li>
833                     </div>
834                 </div>
835             </form>
836         </div>
837     </div>
838 </div>
839
840 [% INCLUDE 'intranet-bottom.inc' %]