More work on global resident search, toolbars, and menus.
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / authorities / authorities.tmpl
1 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2 <Title>Koha -- Authority details</title>
3 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
4 <script type="text/javascript">
5 function _(s) { return s } // dummy function for gettext
6 function active(numlayer)
7 {
8         for (i=0; i < 10 ; i++ ) {
9                 ong = i+"XX";
10                 link = "link"+i;
11                 if (numlayer==i) {
12                         document.getElementById(ong).style.visibility="visible";
13                 } else {
14                         document.getElementById(ong).style.visibility="hidden";
15                 }
16         }
17 }
18 function Check(f) {
19         // Scan for nonempty fields
20         var field_is_nonempty_p = new Array();
21         for (i=0 ; i<f.field_value.length ; i++) {
22             field_is_nonempty_p[f.tag[i].value] = 0;
23         }
24         for (i=0 ; i<f.field_value.length ; i++) {
25             if (f.field_value[i].value.length != 0) {
26                 field_is_nonempty_p[f.tag[i].value] += 1;
27             }
28         }
29
30         // Scan for missing mandatory subfields
31         var total_missing_mandatory_subfields = 0;
32         for (i=0 ; i<f.field_value.length-2 ; i++) {
33                 if (f.field_value[i].value.length==0 && f.mandatory[i].value==1) {
34                     // We should not flag an error unless the tag is also
35                     // mandatory, or if something else in the tag is entered
36
37                     if (f.tag_mandatory[i].value == 1 || field_is_nonempty_p[f.tag[i].value]) {
38                         document.getElementById("error"+i).style.backgroundColor="#FF0000";
39                         total_missing_mandatory_subfields++;
40                     }
41                 } else {
42                         document.getElementById("error"+i).style.backgroundColor="#FFFFFF";
43                 }
44         }
45
46         // Scan for missing mandatory tags
47         var total_missing_mandatory_tags = 0;
48         var seen_mandatory_tag_p = new Array();
49         for (i=0 ; i<f.field_value.length ; i++) {
50             var j = f.tag[i].value;
51             if (!field_is_nonempty_p[j] && f.tag_mandatory[i].value == 1) {
52                 if (seen_mandatory_tag_p[j] != 1) {
53                     seen_mandatory_tag_p[j] = 1;
54                     total_missing_mandatory_tags++;
55                 }
56                 document.getElementById("error"+i).style.backgroundColor="#ffff00";
57             }
58         }
59
60         var total_errors = total_missing_mandatory_tags + total_missing_mandatory_subfields;
61         var alertString2;
62         if (total_errors!=0) {
63                 alertString2  = _("Form not submitted because of the following problem(s)");
64                 alertString2 += "\n------------------------------------------------------------------------------------\n";
65                 alertString2 += "\n- "+ total_missing_mandatory_tags +_(" mandatory tags empty");
66                 alertString2 += "\n- "+ total_missing_mandatory_subfields +_(" mandatory fields empty (see bold subfields)");
67                 alert(alertString2);
68         } else {
69                 document.forms['f'].submit();
70         }
71 }
72 function Dopop(link,i) {
73         defaultvalue=document.forms['f'].field_value[i].value;
74         newin=window.open(link+"&result="+defaultvalue,"value builder",'width=550,height=550,toolbar=false,scrollbars=yes');
75 }
76
77 function PopupZ3950() {
78     var strQuery="";
79         for (i=0 ; i<document.forms['f'].field_value.length ; i++) {
80                 if (document.forms['f'].kohafield[i].value == "biblioitems.isbn" && document.forms['f'].field_value[i].value.length>0) {
81                     strQuery += "&isbn="+document.forms['f'].field_value[i].value;
82                 }
83                 if (document.forms['f'].kohafield[i].value == "biblio.title" && document.forms['f'].field_value[i].value.length>0) {
84                     strQuery += "&title="+document.forms['f'].field_value[i].value;
85                 }
86                 if (document.forms['f'].kohafield[i].value == "biblio.author" &&document.forms['f'].field_value[i].value.length>0) {
87                     strQuery += "&author="+document.forms['f'].field_value[i].value;
88                 }
89                 if (document.forms['f'].kohafield[i].value == "biblioitems.issn" && document.forms['f'].field_value[i].value.length>0) {
90                     strQuery += "&issn="+document.forms['f'].field_value[i].value;
91                 }
92         }
93         newin=window.open("../z3950/search.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->"+strQuery,"z3950search",'width=500,height=400,toolbar=false,scrollbars=yes');
94 }
95
96 function AddField(field,cntrepeatfield) {
97         document.forms['f'].op.value = "addfield";
98         document.forms['f'].addfield_field.value=field;
99         document.forms['f'].repeat_field.value=cntrepeatfield;
100         document.f.submit();
101 }
102
103 function cloneSubfield(index) {
104     var original = document.getElementById(index); //original <div>
105     var clone = original.cloneNode(true);
106
107     // set the attribute for the new 'div' subfields
108     clone.setAttribute('id',index + index);//set another id.
109     var NumTabIndex;
110     NumTabIndex = parseInt(original.getAttribute('tabindex'));
111     if(isNaN(NumTabIndex)) NumTabIndex = 0;
112     clone.setAttribute('tabindex',NumTabIndex+1);
113     
114     var CloneButtonPlus;
115     try{
116         CloneButtonPlus = clone.getElementsByTagName('a')[0];
117         CloneButtonPlus.setAttribute('onclick',"cloneSubfield('" + index + index + "')");
118     }
119     catch(e){
120         // do nothing if ButtonPlus & CloneButtonPlus don't exist.
121     }
122
123     // insert this line on the page
124     original.parentNode.insertBefore(clone,original.nextSibling);
125 }
126
127 function upSubfield(index) {
128         try{
129                 var line = document.getElementById(index); // get the line where the user has clicked.
130         } catch(e) {
131                 return;
132         }
133         var tag = line.parentNode; // get the dad of this line. (should be "<div tag=XXX>")
134         
135         // getting all subfields for this tag
136         var subfields = tag.getElementsByTagName('div');
137         var subfieldsLength = subfields.length;
138         if(subfieldsLength<=1) return; // nothing to do if there is just one subfield.
139         // among all subfields 
140         for(var i=0;i<subfieldsLength;i++){ 
141                 if(subfields[i].getAttribute('id') == index){ //looking for the subfield which is clicked :
142                         if(i==0){ // if the clicked subfield is on the top
143                                 tag.appendChild(subfields[0]);
144                                 return;
145                         }else{
146                                 var lineAbove = subfields[i-1];
147                                 tag.insertBefore(line,lineAbove);
148                                 return;
149                         }
150                 }
151         }
152 }
153
154 function unHideSubfield(index,labelindex) {
155         subfield = document.getElementById(index);
156         subfield.style.display = 'block';
157         label = document.getElementById(labelindex);
158         label.style.display='none';     
159 }
160
161 function addauthority() {
162     X = document.forms[0].authtype.value;
163     window.location="/cgi-bin/koha/authorities/authorities.pl?authtypecode="+X;
164 }
165 function searchauthority() {
166     X = document.forms[0].authtype2.value;
167     Y = document.forms[0].value.value;
168     window.location="/cgi-bin/koha/authorities/authorities-home.pl?op=do_search&type=intranet&authtypecode="+X+"&value="+Y+"&marclist=&and_or=and&excluding=&operator=contains";
169 }
170 </script>
171 </head>
172 <body>
173 <!-- TMPL_INCLUDE NAME="header.inc" -->
174
175 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/authorities/authorities-home.pl">Authorities</a> &rsaquo; <!-- TMPL_IF name="authid" -->Modify authority #<!-- TMPL_VAR NAME="authid" --> (<!-- TMPL_VAR name="authtypetext" -->)<!-- TMPL_ELSE -->Adding authority (<!-- TMPL_VAR name="authtypetext" -->)<!-- /TMPL_IF -->  </div>
176
177 <div id="doc" class="yui-t7">
178    
179    <div id="bd">
180         <div id="yui-main">
181         <div class="yui-g">
182
183 <!-- TMPL_IF name="authid" -->
184   <h1>Modify authority #<!-- TMPL_VAR NAME="authid" --> (<!-- TMPL_VAR name="authtypetext" -->)</h1>
185 <!-- TMPL_ELSE -->
186   <h1>Adding authority (<!-- TMPL_VAR name="authtypetext" -->)</h1>
187 <!-- /TMPL_IF -->  
188   <form method="post" name="f">
189     <input type="hidden" name="op" value="add" />
190     <input type="hidden" name="addfield_field" value="" />
191     <input type="hidden" name="repeat_field" value="" />
192     <input type="hidden" name="authtypecode" value="<!-- TMPL_VAR NAME="authtypecode" -->" />
193     <input type="hidden" name="authid" value="<!-- TMPL_VAR NAME="authid" -->" />
194
195     <div id="action">
196 <!-- TMPL_IF name="authid" -->
197       <input type="button" value="Save" onclick="Check(this.form)" accesskey="w" />
198 <!-- TMPL_ELSE -->
199       <input type="button" value="Add authority" onclick="Check(this.form)" accesskey="w" />
200 <!-- /TMPL_IF -->
201     </div>
202
203 <!-- TMPL_IF name="duplicateauthid" -->
204         <div class="problem">
205                 <p>Duplicate suspected with <a href="javascript:openWindow("detail.pl?authid=<!-- TMPL_VAR name="duplicateauthid" -->&amp;popup=1", "Duplicate Authority");" class="button"><!-- TMPL_VAR name="duplicateauthvalue" --></a></p>
206                 <p>You must either :</p>
207                 <ul>
208                         <p><input type="checkbox" value="1" name="confirm_not_duplicate" />confirm it's not a duplicate (and click on <input type="button" value="Add authority" onclick="Check(this.form)" accesskey="w" class="button" /> again)</p>
209                         <p>Go to <a href="authorities.pl?authid=<!-- TMPL_VAR name="duplicateauthid" -->" >original authority</a></p>
210                 </ul>
211         </div>
212 <!-- /TMPL_IF -->
213
214 <!-- TMPL_LOOP NAME="0XX" -->
215     <!-- TMPL_IF name="tag" -->
216         <p class="tag">
217             <input type="hidden" name="ind_tag" value="<!-- TMPL_VAR NAME="tag" -->" />
218             <!-- TMPL_UNLESS name="hide_marc" -->
219                 <a title="<!-- TMPL_VAR NAME="tag_lib" -->"><!-- TMPL_VAR NAME="tag" --></a>
220                 <input tabindex="1" onblur="this.style.backgroundColor='#ffffff';" onfocus="this.style.backgroundColor='#ffffff;'" type="text" <!-- TMPL_IF NAME="fixedfield" --> style="display:none;" <!-- /TMPL_IF --> name="indicator" size="2" maxlength="2" value="<!-- TMPL_VAR NAME="indicator" -->" class="flat" /> -
221             <!-- TMPL_ELSE -->
222                 <input tabindex="1" type="hidden" <!-- TMPL_IF NAME="fixedfield" --> style="display:none;" <!-- /TMPL_IF --> name="indicator" value="<!-- TMPL_VAR NAME="indicator" -->" />
223             <!-- /TMPL_UNLESS -->
224             <!-- TMPL_UNLESS NAME="advancedMARCEditor" --><!-- TMPL_VAR NAME="tag_lib" --><!-- /TMPL_UNLESS -->
225             <!-- TMPL_IF name="repeatable" -->
226                 <a href="#<!-- TMPL_VAR NAME="tag" -->" onclick="this.nextSibling.type='text';this.nextSibling.focus()">+</a><input type="hidden" value="" size="2" onchange="AddField('<!-- TMPL_VAR NAME="tag" -->',this.value)" />
227             <!-- /TMPL_IF -->
228         </p>
229     <!-- /TMPL_IF -->
230
231     <!-- TMPL_LOOP NAME="subfield_loop" -->
232         <p class="subfield">
233         <!-- TMPL_IF NAME="visibility" -->
234             <a tabindex="1" style="color: grey; font-size: 80%; cursor: se-resize;" id="label<!-- TMPL_VAR name="index" -->" onclick="unHideSubfield('subfield<!-- TMPL_VAR NAME="tag" --><!-- TMPL_VAR name="index" -->','label<!-- TMPL_VAR name="index" -->')">
235                 <!-- TMPL_VAR NAME="subfield" -->
236             </a>
237         <!-- /TMPL_IF -->
238         <div style="<!-- TMPL_VAR NAME='visibility' -->;" id="subfield<!-- TMPL_VAR NAME='tag' --><!-- TMPL_VAR NAME='index' -->">
239             <p>
240             <!-- TMPL_UNLESS NAME="advancedMARCEditor" -->
241                 <label <!-- TMPL_IF NAME="fixedfield" --> style="display:none;" <!-- /TMPL_IF --> class="labelsubfield"> 
242             <!-- /TMPL_UNLESS -->
243             <!-- TMPL_UNLESS name="hide_marc" -->
244                     <img <!-- TMPL_IF NAME="fixedfield" --> style="display:none;" <!-- /TMPL_IF --> src="<!-- TMPL_VAR NAME="themelang" -->/../img/up.png" onclick="upSubfield('subfield<!-- TMPL_VAR NAME="tag" --><!-- TMPL_VAR name="index" -->')" />
245                     <input title="<!-- TMPL_VAR NAME="marc_lib_plain" -->" style=" <!-- TMPL_IF NAME="fixedfield" -->display:none; <!-- /TMPL_IF -->border:0;" type="text" name="subfield" value="<!-- TMPL_VAR NAME="subfield" -->" size="1" maxlength="1" class="flat" disabled="disabled" readonly="readonly" tabindex="-1" />
246                 <!-- TMPL_ELSE -->
247                     <input type="hidden" name="subfield" value="<!-- TMPL_VAR NAME="subfield" -->" />
248                 <!-- /TMPL_UNLESS -->
249                 <!-- TMPL_UNLESS NAME="advancedMARCEditor" -->
250                     <!-- TMPL_IF name="mandatory" --><b><!-- /TMPL_IF -->
251                     <!-- TMPL_VAR NAME="marc_lib" -->
252                     <!-- TMPL_IF name="mandatory" --> *</b><!-- /TMPL_IF -->
253                     </label>
254                 <!-- /TMPL_UNLESS -->
255                     <!-- TMPL_VAR NAME="marc_value" -->
256                     <!-- TMPL_IF NAME="repeatable" -->
257                         <a style="cursor: crosshair; color: grey; font-size: 80%;" onclick="cloneSubfield('subfield<!-- TMPL_VAR NAME="tag" --><!-- TMPL_VAR name="index" -->')">+</a>
258                     <!-- /TMPL_IF -->
259                     <input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="tag" -->" />
260                     <input type="hidden" name="subfieldYYY" value="<!-- TMPL_VAR NAME="subfield" -->" size="2" maxlength="1" />
261                     <input type="hidden" name="mandatory" value="<!-- TMPL_VAR NAME="mandatory" -->" />
262                     <input type="hidden" name="kohafield" value="<!-- TMPL_VAR NAME="kohafield" -->" />
263                     <input type="hidden" name="tag_mandatory" value="<!-- TMPL_VAR NAME="tag_mandatory" -->" />
264                 </p>
265 </div>
266     <!-- /TMPL_LOOP -->
267
268 <!-- /TMPL_LOOP -->
269
270                 <div name="hidden" id="hidden" class="tab">
271                 <!-- TMPL_LOOP NAME="hidden_loop" -->
272                                 <input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="tag" -->" />
273                                 <input type="hidden" name="subfield" value="<!-- TMPL_VAR NAME="subfield" -->" />
274                                 <input type="hidden" name="mandatory" value="<!-- TMPL_VAR NAME="mandatory" -->" />
275                                 <input type="hidden" name="kohafield" value="<!-- TMPL_VAR NAME="kohafield" -->" />
276                                 <input type="hidden" name="tag_mandatory" value="<!-- TMPL_VAR NAME="tag_mandatory" -->" />
277                 <!-- /TMPL_LOOP -->
278                 </div>
279                 <!-- TMPL_IF name="oldauthnumtagfield" -->
280                         <input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="oldauthnumtagfield" -->" />
281                         <input type="hidden" name="subfield" value="<!-- TMPL_VAR NAME="oldauthnumtagsubfield" -->" />
282                         <input type="hidden" name="field_value" value="<!-- TMPL_VAR NAME="authid" -->" />
283                         <input type="hidden" name="mandatory" value="0" />
284                         <input type="hidden" name="kohafield" value="<!-- TMPL_VAR NAME="kohafield" -->" />
285                         <input type="hidden" name="tag_mandatory" value="<!-- TMPL_VAR NAME="tag_mandatory" -->" />
286                         <input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="oldauthtypetagfield" -->" />
287                         <input type="hidden" name="subfield" value="<!-- TMPL_VAR NAME="oldauthtypetagsubfield" -->" />
288                         <input type="hidden" name="field_value" value="<!-- TMPL_VAR NAME="authtypecode" -->" />
289                 <!-- /TMPL_IF -->
290     <div id="action">
291 <!-- TMPL_IF name="authid" -->
292       <input type="button" value="Save" onclick="Check(this.form)" accesskey="w" />
293 <!-- TMPL_ELSE -->
294       <input type="button" value="Add authority" onclick="Check(this.form)" accesskey="w" />
295 <!-- /TMPL_IF -->
296     </div>
297         </form>
298 </fieldset>
299
300 </div>
301 </div>
302
303 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->