Bugzilla – Attachment 11908 Details for
Bug 7455
Authority subfields are cloned in the wrong field
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7455: Authority subfields are cloned in the wrong field
Bug-7455-Authority-subfields-are-cloned-in-the-wro.patch (text/plain), 108.28 KB, created by
Kyle M Hall (khall)
on 2012-08-31 12:28:19 UTC
(
hide
)
Description:
Bug 7455: Authority subfields are cloned in the wrong field
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2012-08-31 12:28:19 UTC
Size:
108.28 KB
patch
obsolete
>From fa02511b83e7fbee8e3df5e95daafc11ce44b067 Mon Sep 17 00:00:00 2001 >From: Fridolyn SOMERS <fridolyn.somers@biblibre.com> >Date: Fri, 13 Jul 2012 15:26:34 +0200 >Subject: [PATCH] Bug 7455: Authority subfields are cloned in the wrong field >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit >Content-Type: text/plain; charset="utf-8" > >Signed-off-by: Frédéric Demians <f.demians@tamil.fr> > >I can repeat the bug, and confirm the patch fix it. This patch >aggregate common JavaScript functions coming from various templates into >one place, which is valuable for maintainability. > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > cataloguing/additem.pl | 6 +- > koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css | 10 +- > koha-tmpl/intranet-tmpl/prog/en/js/cataloging.js | 463 ++++++++++++++ > .../prog/en/modules/authorities/authorities.tt | 656 +++++--------------- > .../authorities/blinddetail-biblio-search.tt | 2 +- > .../prog/en/modules/cataloguing/addbiblio.tt | 597 ++++-------------- > .../prog/en/modules/cataloguing/additem.tt | 77 +--- > .../prog/en/modules/serials/serials-edit.tt | 82 +--- > .../prog/en/modules/tools/batchMod-edit.tt | 5 +- > tools/batchMod.pl | 6 +- > 10 files changed, 773 insertions(+), 1131 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/cataloging.js > >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index 684e6f6..5fe8da3 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -244,7 +244,7 @@ sub generate_subfield_form { > my $change = index($javascript, 'function Change') > -1 ? > "return Change$function_name($subfield_data{random}, '$subfield_data{id}');" : > 'return 1;'; >- $subfield_data{marc_value} = qq[<input $attributes >+ $subfield_data{marc_value} = qq[<input type="text" $attributes > onfocus="Focus$function_name($subfield_data{random}, '$subfield_data{id}');" > onchange=" $change" > onblur=" Blur$function_name($subfield_data{random}, '$subfield_data{id}');" /> >@@ -252,7 +252,7 @@ sub generate_subfield_form { > $javascript]; > } else { > warn "Plugin Failed: $plugin"; >- $subfield_data{marc_value} = "<input $attributes />"; # supply default input form >+ $subfield_data{marc_value} = "<input type=\"text\" $attributes />"; # supply default input form > } > } > elsif ( $tag eq '' ) { # it's an hidden field >@@ -271,7 +271,7 @@ sub generate_subfield_form { > $subfield_data{marc_value} = "<textarea $attributes_no_value>$value</textarea>\n"; > } else { > # it's a standard field >- $subfield_data{marc_value} = "<input $attributes />"; >+ $subfield_data{marc_value} = "<input type=\"text\" $attributes />"; > } > > return \%subfield_data; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css b/koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css >index d2489b3..d35a471 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css >+++ b/koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css >@@ -50,8 +50,10 @@ div.tag { > } > > div.subfield_line { >- padding-bottom : .3em; >- clear: both; >+ padding-bottom: .3em; >+ float: left; >+ clear: left; >+ width: 100%; > } > > div.subfield_line label { >@@ -63,6 +65,10 @@ div.subfield_line label { > clear:left; > } > >+.subfieldcode img { >+ cursor: pointer; >+} >+ > .tag_title { > font-size : 90%; > padding : .2em 0; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/cataloging.js b/koha-tmpl/intranet-tmpl/prog/en/js/cataloging.js >new file mode 100644 >index 0000000..1baf794 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/cataloging.js >@@ -0,0 +1,463 @@ >+/* >+ * Unified file for catalogue edition >+ */ >+ >+/* Functions developed for addbiblio.tt and authorities.tt */ >+ >+// returns the fieldcode based upon tag div id >+function getFieldCode(tagDivId){ >+ // format : tag_<tagnumber>_... >+ return tagDivId.substr(3+1,3); >+} >+ >+//returns the field and subfieldcode based upon subfield div id >+function getFieldAndSubfieldCode(subfieldDivId){ >+ // format : subfield<tagnumber><subfieldnumber>... >+ return subfieldDivId.substr(8,3+1); >+} >+ >+//returns the subfieldcode based upon subfieldid writing >+function getSubfieldCode(tagsubfieldid){ >+ // 3 : tag +3 : tagnumber +4 : number of _ +8 subfield -1 begins at 0 >+ return tagsubfieldid.substr(3+3+4+8-1,1); >+} >+ >+// Take the base of tagsubfield information (removing the subfieldcodes and subfieldindexes) >+// returns the filter >+function getTagInputnameFilter(tagsubfieldid){ >+ var tagsubfield=tagsubfieldid.substr(0,tagsubfieldid.lastIndexOf("_")); >+ var tagcode=tagsubfield.substr(tagsubfield.lastIndexOf("_")); >+ tagsubfield=tagsubfield.substr(0,tagsubfield.lastIndexOf("_")); >+ tagsubfield=tagsubfield.substr(0,tagsubfield.lastIndexOf("_")); >+ tagsubfield=tagsubfield+"_."+tagcode; >+ return tagsubfield; >+} >+ >+function openAuth(tagsubfieldid,authtype) { >+ // let's take the base of tagsubfield information (removing the indexes and the codes >+ var element=document.getElementById(tagsubfieldid); >+ var tagsubfield=getTagInputnameFilter(tagsubfieldid); >+ var elementsubfcode=getSubfieldCode(element.name); >+ var mainmainstring=element.value; >+ var mainstring=""; >+ var inputs = element.parentNode.parentNode.getElementsByTagName("input"); >+ >+ for (var myindex =0; myindex<inputs.length;myindex++){ >+ if (inputs[myindex].name && inputs[myindex].name.match(tagsubfield)){ >+ var subfieldcode=getSubfieldCode(inputs[myindex].name); >+ if (isNaN(parseInt(subfieldcode)) && inputs[myindex].value != "" && subfieldcode!=elementsubfcode){ >+ mainstring=inputs[myindex].value+" "+mainstring; >+ } >+ } >+ } >+ newin=window.open("../authorities/auth_finder.pl?authtypecode="+ authtype+ "&index="+tagsubfieldid+"&value_mainstr="+encodeURI(mainmainstring)+"&value_main="+encodeURI(mainstring), "_blank",'width=700,height=550,toolbar=false,scrollbars=yes'); >+} >+ >+function ExpandField(index) { >+ var original = document.getElementById(index); //original <div> >+ var divs = original.getElementsByTagName('div'); >+ for(var i=0,divslen = divs.length ; i<divslen ; i++){ // foreach div >+ if(divs[i].getAttribute('id').match(/^subfield/)){ // if it s a subfield >+ if (!divs[i].style.display) { >+ // first time => show all subfields >+ divs[i].style.display = 'block'; >+ } else if (divs[i].style.display == 'none') { >+ // show >+ divs[i].style.display = 'block'; >+ } else { >+ // hide >+ divs[i].style.display = 'none'; >+ } >+ } >+ } >+} >+/** >+ * To clone a field >+ * @param hideMarc '0' for false, '1' for true >+ * @param advancedMARCEditor '0' for false, '1' for true >+ */ >+function CloneField(index, hideMarc, advancedMARCEditor) { >+ var original = document.getElementById(index); //original <div> >+ var clone = original.cloneNode(true); >+ var new_key = CreateKey(); >+ var new_id = original.getAttribute('id')+new_key; >+ >+ clone.setAttribute('id',new_id); // setting a new id for the parent div >+ >+ var divs = clone.getElementsByTagName('div'); >+ >+ if(hideMarc == '0') { >+ // No indicator if hide_marc >+ // setting a new name for the new indicator >+ for(var i=0; i < 2; i++) { >+ var indicator = clone.getElementsByTagName('input')[i]; >+ indicator.setAttribute('name',indicator.getAttribute('name')+new_key); >+ } >+ } >+ >+ // settings all subfields >+ for(var i=0,divslen = divs.length ; i<divslen ; i++){ // foreach div >+ if(divs[i].getAttribute("id").match(/^subfield/)){ // if it s a subfield >+ >+ // set the attribute for the new 'div' subfields >+ divs[i].setAttribute('id',divs[i].getAttribute('id')+new_key); >+ >+ var inputs = divs[i].getElementsByTagName('input'); >+ var id_input = ""; >+ >+ for( j = 0 ; j < inputs.length ; j++ ) { >+ if(inputs[j].getAttribute("id") && inputs[j].getAttribute("id").match(/^tag_/) ){ >+ inputs[j].value = ""; >+ } >+ } >+ >+ inputs[0].setAttribute('id',inputs[0].getAttribute('id')+new_key); >+ inputs[0].setAttribute('name',inputs[0].getAttribute('name')+new_key); >+ var id_input; >+ try { >+ id_input = inputs[1].getAttribute('id')+new_key; >+ inputs[1].setAttribute('id',id_input); >+ inputs[1].setAttribute('name',inputs[1].getAttribute('name')+new_key); >+ } catch(e) { >+ try{ // it s a select if it is not an input >+ var selects = divs[i].getElementsByTagName('select'); >+ id_input = selects[0].getAttribute('id')+new_key; >+ selects[0].setAttribute('id',id_input); >+ selects[0].setAttribute('name',selects[0].getAttribute('name')+new_key); >+ }catch(e2){ // it is a textarea if it s not a select or an input >+ var textaeras = divs[i].getElementsByTagName('textarea'); >+ id_input = textaeras[0].getAttribute('id')+new_key; >+ textaeras[0].setAttribute('id',id_input); >+ textaeras[0].setAttribute('name',textaeras[0].getAttribute('name')+new_key); >+ } >+ } >+ >+ if (advancedMARCEditor == '0') { >+ // when cloning a subfield, re set its label too. >+ var labels = divs[i].getElementsByTagName('label'); >+ labels[0].setAttribute('for',id_input); >+ } >+ >+ if(hideMarc == '0') { >+ // updating javascript parameters on button up >+ var imgs = divs[i].getElementsByTagName('img'); >+ imgs[0].setAttribute('onclick',"upSubfield(\'"+divs[i].getAttribute('id')+"\');"); >+ } >+ >+ // setting its '+' and '-' buttons >+ try { >+ var anchors = divs[i].getElementsByTagName('a'); >+ for (var j = 0; j < anchors.length; j++) { >+ if(anchors[j].getAttribute('class') == 'buttonPlus'){ >+ anchors[j].setAttribute('onclick',"CloneSubfield('" + divs[i].getAttribute('id') + "','" + advancedMARCEditor + "'); return false;"); >+ } else if (anchors[j].getAttribute('class') == 'buttonMinus') { >+ anchors[j].setAttribute('onclick',"UnCloneField('" + divs[i].getAttribute('id') + "'); return false;"); >+ } >+ } >+ } >+ catch(e){ >+ // do nothig if ButtonPlus & CloneButtonPlus don t exist. >+ } >+ >+ // button ... >+ var spans=0; >+ try { >+ spans = divs[i].getElementsByTagName('a'); >+ } catch(e) { >+ // no spans >+ } >+ if(spans){ >+ var buttonDot; >+ if(!CloneButtonPlus){ // it s impossible to have + ... (buttonDot AND buttonPlus) >+ buttonDot = spans[0]; >+ if(buttonDot){ >+ // 2 possibilities : >+ try{ >+ var buttonDotOnClick = buttonDot.getAttribute('onclick'); >+ if(buttonDotOnClick.match('Clictag')){ // -1- It s a plugin >+ var re = /\('.*'\)/i; >+ buttonDotOnClick = buttonDotOnClick.replace(re,"('"+inputs[1].getAttribute('id')+"')"); >+ if(buttonDotOnClick){ >+ buttonDot.setAttribute('onclick',buttonDotOnClick); >+ } >+ } else { >+ if(buttonDotOnClick.match('Dopop')) { // -2- It's a auth value >+ var re1 = /&index=.*',/; >+ var re2 = /,.*\)/; >+ >+ buttonDotOnClick = buttonDotOnClick.replace(re1,"&index="+inputs[1].getAttribute('id')+"',"); >+ buttonDotOnClick = buttonDotOnClick.replace(re2,",'"+inputs[1].getAttribute('id')+"')"); >+ >+ if(buttonDotOnClick){ >+ buttonDot.setAttribute('onclick',buttonDotOnClick); >+ } >+ } >+ } >+ try { >+ // do not copy the script section. >+ var script = spans[0].getElementsByTagName('script')[0]; >+ spans[0].removeChild(script); >+ } catch(e) { >+ // do nothing if there is no script >+ } >+ }catch(e){} >+ } >+ } >+ } >+ if(hideMarc == '0') { >+ var buttonUp = divs[i].getElementsByTagName('img')[0]; >+ buttonUp.setAttribute('onclick',"upSubfield('" + divs[i].getAttribute('id') + "')"); >+ } >+ >+ } else { // it's a indicator div >+ if(divs[i].getAttribute('id').match(/^div_indicator/)){ >+ var inputs = divs[i].getElementsByTagName('input'); >+ inputs[0].setAttribute('id',inputs[0].getAttribute('id')+new_key); >+ inputs[1].setAttribute('id',inputs[1].getAttribute('id')+new_key); >+ >+ var CloneButtonPlus; >+ try { >+ var anchors = divs[i].getElementsByTagName('a'); >+ for (var j = 0; j < anchors.length; j++) { >+ if (anchors[j].getAttribute('class') == 'buttonPlus') { >+ anchors[j].setAttribute('onclick',"CloneField('" + new_id + "','" + hideMarc + "','" + advancedMARCEditor + "'); return false;"); >+ } else if (anchors[j].getAttribute('class') == 'buttonMinus') { >+ anchors[j].setAttribute('onclick',"UnCloneField('" + new_id + "'); return false;"); >+ } else if (anchors[j].getAttribute('class') == 'expandfield') { >+ anchors[j].setAttribute('onclick',"ExpandField('" + new_id + "'); return false;"); >+ } >+ } >+ } >+ catch(e){ >+ // do nothig CloneButtonPlus doesn't exist. >+ } >+ >+ } >+ } >+ } >+ >+ // insert this line on the page >+ original.parentNode.insertBefore(clone,original.nextSibling); >+} >+ >+/** >+ * To clone a subfield >+ * @param index >+ * @param advancedMARCEditor '0' for false, '1' for true >+ */ >+function CloneSubfield(index, advancedMARCEditor){ >+ var original = document.getElementById(index); //original <div> >+ var clone = original.cloneNode(true); >+ var new_key = CreateKey(); >+ >+ // set the attribute for the new 'div' subfields >+ var inputs = clone.getElementsByTagName('input'); >+ var selects = clone.getElementsByTagName('select'); >+ var textareas = clone.getElementsByTagName('textarea'); >+ var linkid; >+ >+ // input >+ var id_input = ""; >+ for(var i=0,len=inputs.length; i<len ; i++ ){ >+ id_input = inputs[i].getAttribute('id')+new_key; >+ inputs[i].setAttribute('id',id_input); >+ inputs[i].setAttribute('name',inputs[i].getAttribute('name')+new_key); >+ linkid = id_input; >+ } >+ >+ // select >+ for(var i=0,len=selects.length; i<len ; i++ ){ >+ id_input = selects[i].getAttribute('id')+new_key; >+ selects[i].setAttribute('id',selects[i].getAttribute('id')+new_key); >+ selects[i].setAttribute('name',selects[i].getAttribute('name')+new_key); >+ } >+ >+ // textarea >+ for(var i=0,len=textareas.length; i<len ; i++ ){ >+ id_input = textareas[i].getAttribute('id')+new_key; >+ textareas[i].setAttribute('id',textareas[i].getAttribute('id')+new_key); >+ textareas[i].setAttribute('name',textareas[i].getAttribute('name')+new_key); >+ } >+ >+ // Changing the "..." link's onclick attribute for plugin callback >+ var links = clone.getElementsByTagName('a'); >+ var link = links[0]; >+ var buttonDotOnClick = link.getAttribute('onclick'); >+ if(buttonDotOnClick.match('Clictag')){ // -1- It s a plugin >+ var re = /\('.*'\)/i; >+ buttonDotOnClick = buttonDotOnClick.replace(re,"('"+linkid+"')"); >+ if(buttonDotOnClick){ >+ link.setAttribute('onclick',buttonDotOnClick); >+ } >+ } >+ >+ if(advancedMARCEditor == '0') { >+ // when cloning a subfield, reset its label too. >+ var label = clone.getElementsByTagName('label')[0]; >+ label.setAttribute('for',id_input); >+ } >+ >+ // setting a new id for the parent div >+ var new_id = original.getAttribute('id')+new_key; >+ clone.setAttribute('id',new_id); >+ >+ try { >+ var buttonUp = clone.getElementsByTagName('img')[0]; >+ buttonUp.setAttribute('onclick',"upSubfield('" + new_id + "')"); >+ var anchors = clone.getElementsByTagName('a'); >+ if(anchors.length){ >+ for(var i = 0 ,lenanchors = anchors.length ; i < lenanchors ; i++){ >+ if(anchors[i].getAttribute('class') == 'buttonPlus'){ >+ anchors[i].setAttribute('onclick',"CloneSubfield('" + new_id + "','" + advancedMARCEditor + "'); return false;"); >+ } else if (anchors[i].getAttribute('class') == 'buttonMinus') { >+ anchors[i].setAttribute('onclick',"UnCloneField('" + new_id + "'); return false;"); >+ } >+ } >+ } >+ } >+ catch(e){ >+ // do nothig if ButtonPlus & CloneButtonPlus don't exist. >+ } >+ // insert this line on the page >+ original.parentNode.insertBefore(clone,original.nextSibling); >+} >+ >+ /** >+ * This function removes or clears unwanted subfields >+ */ >+function UnCloneField(index) { >+ var original = document.getElementById(index); >+ var canUnclone = false; >+ if ($(original).hasClass("tag")) { >+ // unclone a field, check if there will remain one field >+ var fieldCode = getFieldCode(index); >+ // tag divs with id begining with original field code >+ var cloneFields = $('.tag[id^="tag_'+fieldCode+'"]'); >+ if (cloneFields.length > 1) { >+ canUnclone = true; >+ } >+ } else { >+ // unclone a subfield, check if there will remain one subfield >+ var subfieldCode = getFieldAndSubfieldCode(index); >+ // subfield divs with id begining with original field and subfield field code >+ var cloneSubfields = $('.subfield_line[id^="subfield'+subfieldCode+'"]'); >+ if (cloneSubfields.length > 1) { >+ canUnclone = true; >+ } >+ } >+ if (canUnclone) { >+ // remove clone >+ original.parentNode.removeChild(original); >+ } else { >+ // clear inputs, but don't delete >+ $(":input.input_marceditor", original).each(function(){ >+ // thanks to http://www.learningjquery.com/2007/08/clearing-form-data for >+ // hint about clearing selects correctly >+ var type = this.type; >+ var tag = this.tagName.toLowerCase(); >+ if (type == 'text' || type == 'password' || tag == 'textarea') { >+ this.value = ""; >+ } else if (type == 'checkbox' || type == 'radio') { >+ this.checked = false; >+ } else if (tag == 'select') { >+ this.selectedIndex = -1; >+ } >+ }); >+ $(":input.indicator", original).val(""); >+ } >+} >+ >+/** >+ * This function create a random number >+ */ >+function CreateKey(){ >+ return parseInt(Math.random() * 100000); >+} >+ >+/** >+ * This function allows to move a subfield up by clickink on the 'up' button . >+ */ >+function upSubfield(index) { >+ try{ >+ var line = document.getElementById(index); // get the line where the user has clicked. >+ } catch(e) { >+ return; // this line doesn't exist... >+ } >+ var tag = line.parentNode; // get the dad of this line. (should be "<div id='tag_...'>") >+ >+ // getting all subfields for this tag >+ var subfields = tag.getElementsByTagName('div'); >+ var subfieldsLength = subfields.length; >+ >+ if(subfieldsLength<=1) return; // nothing to do if there is just one subfield. >+ >+ // among all subfields >+ for(var i=0;i<subfieldsLength;i++){ >+ if(subfields[i].getAttribute('id') == index){ //looking for the subfield which is clicked : >+ if(i==1){ // if the clicked subfield is on the top >+ tag.appendChild(subfields[1]); >+ return; >+ } else { >+ var lineAbove = subfields[i-1]; >+ tag.insertBefore(line,lineAbove); >+ return; >+ } >+ } >+ } >+} >+ >+// FIXME :: is it used ? >+function unHideSubfield(index,labelindex) { >+ subfield = document.getElementById(index); >+ subfield.style.display = 'block'; >+ label = document.getElementById(labelindex); >+ label.style.display='none'; >+} >+ >+/* Functions developed for additem.tt */ >+ >+/** >+ * To clone a subfield.<br> >+ * @param original subfield div to clone >+ */ >+function CloneItemSubfield(original){ >+ var clone = original.cloneNode(true); >+ var new_key = CreateKey(); >+ >+ // set the attribute for the new 'div' subfields >+ var inputs = clone.getElementsByTagName('input'); >+ var selects = clone.getElementsByTagName('select'); >+ var textareas = clone.getElementsByTagName('textarea'); >+ >+ // input (except hidden type) >+ var id_input = ""; >+ for(var i=0,len=inputs.length; i<len ; i++ ){ >+ if (inputs[i].getAttribute('type') != 'hidden') { >+ id_input = inputs[i].getAttribute('id')+new_key; >+ inputs[i].setAttribute('id',id_input); >+ } >+ } >+ >+ // select >+ for(var i=0,len=selects.length; i<len ; i++ ){ >+ id_input = selects[i].getAttribute('id')+new_key; >+ selects[i].setAttribute('id',selects[i].getAttribute('id')+new_key); >+ } >+ >+ // textarea >+ for(var i=0,len=textareas.length; i<len ; i++ ){ >+ id_input = textareas[i].getAttribute('id')+new_key; >+ textareas[i].setAttribute('id',textareas[i].getAttribute('id')+new_key); >+ } >+ >+ // when cloning a subfield, reset its label too. >+ var label = clone.getElementsByTagName('label')[0]; >+ label.setAttribute('for',id_input); >+ >+ // setting a new if for the parent div >+ var new_id = original.getAttribute('id')+new_key; >+ clone.setAttribute('id',new_id); >+ >+ // insert this line on the page >+ original.parentNode.insertBefore(clone,original.nextSibling); >+} >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt >index 352d518..5c3d566 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt >@@ -2,36 +2,21 @@ > <title>Koha › Authorities › [% IF ( authid ) %]Modify authority #[% authid %] ([% authtypetext %])[% ELSE %]Adding authority ([% authtypetext %])[% END %]</title> > [% INCLUDE 'doc-head-close.inc' %] > <script type="text/javascript" src="[% themelang %]/lib/yui/plugins/bubbling-min.js"></script> >+<script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script> > > <script type="text/javascript"> > //<![CDATA[ > >- var fields_in_use = {}; > $(document).ready(function() { > $('#authoritytabs').tabs(); >- $('.tag').each(function() { >- var field_id = this.getAttribute('id').substring(0, 7); >- if (field_id in fields_in_use) { >- fields_in_use[field_id]++; >- } else { >- fields_in_use[field_id] = 1; >- } >- }); >- $('.subfield_line').each(function() { >- var field_id = this.getAttribute('id').substring(0, 12); >- if (field_id in fields_in_use) { >- fields_in_use[field_id]++; >- } else { >- fields_in_use[field_id] = 1; >- } >- }); >+ > $("#f").submit(function(){ > return $(this).Check(); > }); > }); > > /** >- * check if mandatory subfields are writed >+ * check if mandatory subfields are written > */ > function AreMandatoriesNotOk(){ > var mandatories = new Array(); >@@ -75,7 +60,6 @@ function AreMandatoriesNotOk(){ > for(var j=0,len2=eleminputs.length; j<len2; j++){ > > if(eleminputs[j].name.match(varegexp) && eleminputs[j].value){ >- /* tag_801_subfield_c_841304_545657 */ > inputregexp = new RegExp("^tag_" + arr[0] + "_subfield_" + eleminputs[j].value + "_" + arr[2]); > > for( var k=0; k<len2; k++){ >@@ -118,44 +102,6 @@ function Check(){ > } > } > >- >-// returns the subfieldcode based upon subfieldid writing >-function getSubfieldcode(tagsubfieldid){ >- // 3 : tag +3 : tagnumber +4 : number of _ +8 subfield -1 begins at 0 >- return tagsubfieldid.substr(3+3+4+8-1,1); >-} >- >-// Take the base of tagsubfield information (removing the subfieldcodes and subfieldindexes) >-// returns the filter >-function getTagInputnameFilter(tagsubfieldid){ >- var tagsubfield=tagsubfieldid.substr(0,tagsubfieldid.lastIndexOf("_")); >- var tagcode=tagsubfield.substr(tagsubfield.lastIndexOf("_")); >- tagsubfield=tagsubfield.substr(0,tagsubfield.lastIndexOf("_")); >- tagsubfield=tagsubfield.substr(0,tagsubfield.lastIndexOf("_")); >- tagsubfield=tagsubfield+"_."+tagcode; >- return tagsubfield; >-} >- >-function openAuth(tagsubfieldid,authtype) { >- // let's take the base of tagsubfield information (removing the indexes and the codes >- var element=document.getElementById(tagsubfieldid); >- var tagsubfield=getTagInputnameFilter(tagsubfieldid); >- var elementsubfcode=getSubfieldcode(element.name); >- var mainmainstring=element.value; >- var mainstring=""; >- var inputs = element.parentNode.parentNode.getElementsByTagName("input"); >- >- for (var myindex =0; myindex<inputs.length;myindex++){ >- if (inputs[myindex].name && inputs[myindex].name.match(tagsubfield)){ >- var subfieldcode=getSubfieldcode(inputs[myindex].name); >- if (isNaN(parseInt(subfieldcode)) && inputs[myindex].value != "" && subfieldcode!=elementsubfcode){ >- mainstring=inputs[myindex].value+" "+mainstring; >- } >- } >- } >- newin=window.open("../authorities/auth_finder.pl?authtypecode="+ authtype+ "&index="+tagsubfieldid+"&value_mainstr="+encodeURI(mainmainstring)+"&value_main="+encodeURI(mainstring), "_blank",'width=700,height=550,toolbar=false,scrollbars=yes'); >-} >- > function AddField(field,cntrepeatfield) { > document.forms['f'].op.value = "addfield"; > document.forms['f'].addfield_field.value=field; >@@ -163,335 +109,6 @@ function AddField(field,cntrepeatfield) { > document.f.submit(); > } > >- >-function ExpandField(index) { >- var original = document.getElementById(index); //original <div> >- var divs = original.getElementsByTagName('div'); >- for(var i=0,divslen = divs.length ; i<divslen ; i++){ // foreach div >- if(divs[i].getAttribute("name") == 'line'){ // if it s a subfield >- if (divs[i].style.display == 'block') { >- divs[i].style.display = 'none'; >- } else { >- divs[i].style.display = 'block'; >- } >- } >- } >-} >- >-/** >- * To clone a field or a subfield by clickink on '+' button >- */ >-function CloneField(index) { >- var original = document.getElementById(index); //original <div> >- fields_in_use[index.substr(0, 7)]++; >- var clone = original.cloneNode(true); >- var new_key = CreateKey(); >- var new_id = original.getAttribute('id')+new_key; >- >- clone.setAttribute('id',new_id); // setting a new id for the parent div >- >- var divs = clone.getElementsByTagName('div'); >- >- [% UNLESS ( hide_marc ) %] // No indicator if hide_marc >- // setting a new name for the new indicator >- for(var i=0; i < 2; i++) { >- var indicator = clone.getElementsByTagName('input')[i]; >- indicator.setAttribute('name',indicator.getAttribute('name')+new_key); >- } >- [% END %] >- >- // settings all subfields >- for(var i=0,divslen = divs.length ; i<divslen ; i++){ // foreach div >- if(divs[i].getAttribute("name") == 'line'){ // if it s a subfield >- >- // set the attribute for the new 'div' subfields >- divs[i].setAttribute('id',divs[i].getAttribute('id')+new_key); >- >- var inputs = divs[i].getElementsByTagName('input'); >- var id_input = ""; >- >- inputs[0].setAttribute('id',inputs[0].getAttribute('id')+new_key); >- inputs[0].setAttribute('name',inputs[0].getAttribute('name')+new_key); >- var id_input; >- try { >- id_input = inputs[1].getAttribute('id')+new_key; >- inputs[1].setAttribute('id',id_input); >- inputs[1].setAttribute('name',inputs[1].getAttribute('name')+new_key); >- } catch(e) { >- try{ // it s a select if it is not an input >- var selects = divs[i].getElementsByTagName('select'); >- id_input = selects[0].getAttribute('id')+new_key; >- selects[0].setAttribute('id',id_input); >- selects[0].setAttribute('name',selects[0].getAttribute('name')+new_key); >- }catch(e2){ // it is a textarea if it s not a select or an input >- var textaeras = divs[i].getElementsByTagName('textarea'); >- id_input = textaeras[0].getAttribute('id')+new_key; >- textaeras[0].setAttribute('id',id_input); >- textaeras[0].setAttribute('name',textaeras[0].getAttribute('name')+new_key); >- } >- } >- >- [% UNLESS ( advancedMARCEditor ) %] >- // when cloning a subfield, re set its label too. >- var labels = divs[i].getElementsByTagName('label'); >- labels[0].setAttribute('for',id_input); >- [% END %] >- >- [% UNLESS ( hide_marc ) %] >- // updating javascript parameters on button up >- var imgs = divs[i].getElementsByTagName('img'); >- imgs[0].setAttribute('onclick',"upSubfield(\'"+divs[i].getAttribute('id')+"\');"); >- [% END %] >- >- // setting its '+' and '-' buttons >- try { >- var spans = divs[i].getElementsByTagName('span'); >- for (var j = 0; j < spans.length; j++) { >- if(spans[j].getAttribute('class') == 'buttonPlus'){ >- spans[j].setAttribute('onclick',"CloneSubfield('" + divs[i].getAttribute('id') + "')"); >- } else if (spans[j].getAttribute('class') == 'buttonMinus') { >- spans[j].setAttribute('onclick',"UnCloneField('" + divs[i].getAttribute('id') + "')"); >- } >- } >- } >- catch(e){ >- // do nothig if ButtonPlus & CloneButtonPlus don t exist. >- } >- >- // button ... >- var spans=0; >- try { >- spans = divs[i].getElementsByTagName('span'); >- } catch(e) { >- // no spans >- } >- if(spans){ >- var buttonDot; >- if(!CloneButtonPlus){ // it s impossible to have + ... (buttonDot AND buttonPlus) >- buttonDot = spans[0]; >- if(buttonDot){ >- // 2 possibilities : >- try{ >- var buttonDotOnClick = buttonDot.getAttribute('onclick'); >- if(buttonDotOnClick.match('Clictag')){ // -1- It s a plugin >- var re = /\('.*'\)/i; >- buttonDotOnClick = buttonDotOnClick.replace(re,"('"+inputs[1].getAttribute('id')+"')"); >- if(buttonDotOnClick){ >- buttonDot.setAttribute('onclick',buttonDotOnClick); >- } >- } else { >- if(buttonDotOnClick.match('Dopop')) { // -2- It's a auth value >- >- var re1 = /&index=.*',/; >- var re2 = /,.*\)/; >- >- buttonDotOnClick = buttonDotOnClick.replace(re1,"&index="+inputs[1].getAttribute('id')+"',"); >- buttonDotOnClick = buttonDotOnClick.replace(re2,",'"+inputs[1].getAttribute('id')+"')"); >- >- if(buttonDotOnClick){ >- buttonDot.setAttribute('onclick',buttonDotOnClick); >- } >- } >- } >- try { >- // do not copy the script section. >- var script = spans[0].getElementsByTagName('script')[0]; >- spans[0].removeChild(script); >- } catch(e) { >- // do nothing if there is no script >- } >- }catch(e){} >- } >- } >- } >- [% UNLESS ( hide_marc ) %] >- var buttonUp = divs[i].getElementsByTagName('img')[0]; >- buttonUp.setAttribute('onclick',"upSubfield('" + divs[i].getAttribute('id') + "')"); >- [% END %] >- >- } else { // it's a indicator div >- if(divs[i].getAttribute('name') == 'div_indicator'){ >- var inputs = divs[i].getElementsByTagName('input'); >- inputs[0].setAttribute('id',inputs[0].getAttribute('id')+new_key); >- inputs[1].setAttribute('id',inputs[1].getAttribute('id')+new_key); >- >- var CloneButtonPlus; >- try { >- var anchors = divs[i].getElementsByTagName('span'); >- for (var j = 0; j < anchors.length; j++) { >- if (anchors[j].getAttribute('class') == 'buttonPlus') { >- anchors[j].setAttribute('onclick',"CloneField('" + new_id + "')"); >- } else if (anchors[j].getAttribute('class') == 'buttonMinus') { >- anchors[j].setAttribute('onclick',"UnCloneField('" + new_id + "')"); >- } >- } >- } >- catch(e){ >- // do nothig CloneButtonPlus doesn't exist. >- } >- >- // setting its 'Expand' property >- var ExpandFieldA=0; >- try { >- ExpandFieldA = divs[i].getElementsByTagName('a')[0]; >- ExpandFieldA.setAttribute('onclick',"ExpandField('" + divs[i].parentNode.getAttribute('id') + "')"); >- } >- catch(e){ >- // do nothig if ButtonPlus & CloneButtonPlus don t exist. >- } >- >- } >- } >- } >- >- // insert this line on the page >- original.parentNode.insertBefore(clone,original.nextSibling); >-} >- >-function CloneSubfield(index){ >- var original = document.getElementById(index); //original <div> >- fields_in_use[index.substr(0, 12)]++; >- var clone = original.cloneNode(true); >- var new_key = CreateKey(); >- var new_id = original.getAttribute('id')+new_key; >- >- // set the attribute for the new 'div' subfields >- var inputs = clone.getElementsByTagName('input'); >- var selects = clone.getElementsByTagName('select'); >- var textareas = clone.getElementsByTagName('textarea'); >- >- // input >- var id_input = ""; >- for(var i=0,len=inputs.length; i<len ; i++ ){ >- id_input = inputs[i].getAttribute('id')+new_key; >- inputs[i].setAttribute('id',id_input); >- inputs[i].setAttribute('name',inputs[i].getAttribute('name')+new_key); >- } >- >- // select >- for(var i=0,len=selects.length; i<len ; i++ ){ >- id_input = selects[i].getAttribute('id')+new_key; >- selects[i].setAttribute('id',selects[i].getAttribute('id')+new_key); >- selects[i].setAttribute('name',selects[i].getAttribute('name')+new_key); >- } >- >- // textarea >- for(var i=0,len=textareas.length; i<len ; i++ ){ >- id_input = textareas[i].getAttribute('id')+new_key; >- textareas[i].setAttribute('id',textareas[i].getAttribute('id')+new_key); >- textareas[i].setAttribute('name',textareas[i].getAttribute('name')+new_key); >- } >- >- [% UNLESS ( advancedMARCEditor ) %] >- // when cloning a subfield, reset its label too. >- var label = clone.getElementsByTagName('label')[0]; >- label.setAttribute('for',id_input); >- [% END %] >- >- // setting a new if for the parent div >- clone.setAttribute('id',new_id); >- >- try { >- var buttonUp = clone.getElementsByTagName('img')[0]; >- buttonUp.setAttribute('onclick',"upSubfield('" + new_id + "')"); >- var spans = clone.getElementsByTagName('span'); >- if(spans.length){ >- for(var i = 0 ,lenspans = spans.length ; i < lenspans ; i++){ >- if(spans[i].getAttribute('class') == 'buttonPlus'){ >- spans[i].setAttribute('onclick',"CloneSubfield('" + new_id + "')"); >- } else if (spans[i].getAttribute('class') == 'buttonMinus') { >- spans[i].setAttribute('onclick',"UnCloneField('" + new_id + "')"); >- } >- } >- } >- } >- catch(e){ >- // do nothig if ButtonPlus & CloneButtonPlus don't exist. >- } >- // insert this line on the page >- original.parentNode.insertBefore(clone,original.nextSibling); >-} >- >- /** >- * This function removes or clears unwanted subfields >- */ >-function UnCloneField(index) { >- var original = document.getElementById(index); >- var field_id; >- if (index.match("tag")) { >- field_id = index.substr(0, 7); >- } else { >- field_id = index.substr(0, 12); >- } >- if (1 == fields_in_use[field_id]) { >- // clear inputs, but don't delete >- $(":input.input_marceditor", original).each(function(){ >- // thanks to http://www.learningjquery.com/2007/08/clearing-form-data for >- // hint about clearing selects correctly >- var type = this.type; >- var tag = this.tagName.toLowerCase(); >- if (type == 'text' || type == 'password' || tag == 'textarea') { >- this.value = ""; >- } else if (type == 'checkbox' || type == 'radio') { >- this.checked = false; >- } else if (tag == 'select') { >- this.selectedIndex = -1; >- } >- }); >- $(":input.indicator", original).val(""); >- } else { >- original.parentNode.removeChild(original); >- fields_in_use[field_id]--; >- } >-} >- >- >-/** >- * This function create a random number >- */ >-function CreateKey(){ >- return parseInt(Math.random() * 100000); >-} >- >-/** >- * This function allows to move a subfield up by clickink on the 'up' button . >- */ >-function upSubfield(index) { >- try{ >- var line = document.getElementById(index); // get the line where the user has clicked. >- } catch(e) { >- return; // this line doesn't exist... >- } >- var tag = line.parentNode; // get the dad of this line. (should be "<div id='tag_...'>") >- >- // getting all subfields for this tag >- var subfields = tag.getElementsByTagName('div'); >- var subfieldsLength = subfields.length; >- >- if(subfieldsLength<=1) return; // nothing to do if there is just one subfield. >- >- // among all subfields >- for(var i=0;i<subfieldsLength;i++){ >- if(subfields[i].getAttribute('id') == index){ //looking for the subfield which is clicked : >- if(i==1){ // if the clicked subfield is on the top >- tag.appendChild(subfields[1]); >- return; >- } else { >- var lineAbove = subfields[i-1]; >- tag.insertBefore(line,lineAbove); >- return; >- } >- } >- } >-} >- >-function unHideSubfield(index,labelindex) { // FIXME :: is it used ? >- subfield = document.getElementById(index); >- subfield.style.display = 'block'; >- label = document.getElementById(labelindex); >- label.style.display='none'; >-} >- > function addauthority() { > X = document.forms[0].authtype.value; > window.location="/cgi-bin/koha/authorities/authorities.pl?authtypecode="+X; >@@ -591,150 +208,161 @@ function searchauthority() { > <ul class="toolbar"><li id="addauthc"><input id="addauth" type="submit" value="Save" accesskey="w" /></li></ul></div> > > <div id="authoritytabs" class="toptabs numbered"> >- <ul> [% FOREACH BIG_LOO IN BIG_LOOP %] >- <li>[% IF ( BIG_LOO.number ) %] >- <a href="#tab[% BIG_LOO.number %]XX">[% BIG_LOO.number %]</a> >- [% ELSE %] >- <a href="#tab[% BIG_LOO.number %]XX">[% BIG_LOO.number %]</a> >- [% END %]</li> >- [% END %]</ul> >+ <ul> >+ [% FOREACH BIG_LOO IN BIG_LOOP %] >+ <li><a href="#tab[% BIG_LOO.number %]XX">[% BIG_LOO.number %]</a></li> >+ [% END %] >+ </ul> > > [% FOREACH BIG_LOO IN BIG_LOOP %] >- <!-- hide every tab except the 1st --> >- [% IF ( BIG_LOO.number ) %] >- <div id="tab[% BIG_LOO.number %]XX"> >+ <div id="tab[% BIG_LOO.number %]XX"> >+ >+ [% FOREACH innerloo IN BIG_LOO.innerloop %] >+ [% IF ( innerloo.tag ) %] >+ <div class="tag" id="tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]"> >+ <div class="tag_title" id="div_indicator_tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]"> >+ [% UNLESS hide_marc %] >+ [% IF advancedMARCEditor %] >+ <a href="#" tabindex="1" class="tagnum" title="[% innerloo.tag_lib %] - Click to Expand this Tag" onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;">[% innerloo.tag %]</a> > [% ELSE %] >- <div id="tab[% BIG_LOO.number %]XX"> >+ <span title="[% innerloo.tag_lib %]">[% innerloo.tag %]</span> > [% END %] >- >- [% FOREACH innerloo IN BIG_LOO.innerloop %] >- [% IF ( innerloo.tag ) %] >- <div class="tag" id="tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]"> >- <div class="tag_title" name="div_indicator"> >- [% UNLESS ( innerloo.hide_marc ) %] >- [% IF ( innerloo.advancedMARCEditor ) %] >- <a class="tagnum" onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]')">[% innerloo.tag %]</a> >- [% ELSE %] >- <span title="[% innerloo.tag_lib %]">[% innerloo.tag %]</span> >- [% END %] >- [% IF ( innerloo.fixedfield ) %] >- <input class="indicator flat" >- type="text" >- style="display:none;" >- name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]" >- size="1" >- maxlength="1" >- value="[% innerloo.indicator1 %]" /> >- <input class="indicator flat" >- type="text" >- style="display:none;" >- name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]" >- size="1" >- maxlength="1" >- value="[% innerloo.indicator2 %]" /> >- [% ELSE %] >- <input class="indicator flat" >- type="text" >- name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]" >- size="1" >- maxlength="1" >- value="[% innerloo.indicator1 %]" /> >- <input class="indicator flat" >- type="text" >- name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]" >- size="1" >- maxlength="1" >- value="[% innerloo.indicator2 %]" /> >- [% END %] - >+ [% IF ( innerloo.fixedfield ) %] >+ <input type="text" >+ tabindex="1" >+ class="indicator flat" >+ style="display:none;" >+ name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]" >+ size="1" >+ maxlength="1" >+ value="[% innerloo.indicator1 %]" /> >+ <input type="text" >+ tabindex="1" >+ class="indicator flat" >+ style="display:none;" >+ name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]" >+ size="1" >+ maxlength="1" >+ value="[% innerloo.indicator2 %]" /> > [% ELSE %] >- [% IF ( innerloo.fixedfield ) %] >- <input type="hidden" >- name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %]" >- value="[% innerloo.indicator1 %][% innerloo.random %]" /> >- <input type="hidden" >- name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %]" >- value="[% innerloo.indicator2 %][% innerloo.random %]" /> >- [% ELSE %] >- <input type="hidden" >- name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %]" >- value="[% innerloo.indicator1 %][% innerloo.random %]" /> >- <input type="hidden" >- name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %]" >- value="[% innerloo.indicator2 %][% innerloo.random %]" /> >- [% END %] >- [% END %] >- >- [% UNLESS ( innerloo.advancedMARCEditor ) %] >- <a onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]')">[% innerloo.tag_lib %]</a> >+ <input type="text" >+ tabindex="1" >+ class="indicator flat" >+ name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]" >+ size="1" >+ maxlength="1" >+ value="[% innerloo.indicator1 %]" /> >+ <input type="text" >+ tabindex="1" >+ class="indicator flat" >+ name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]" >+ size="1" >+ maxlength="1" >+ value="[% innerloo.indicator2 %]" /> >+ [% END %] - >+ [% ELSE %] >+ [% IF ( innerloo.fixedfield ) %] >+ <input type="hidden" >+ tabindex="1" >+ name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]" >+ value="[% innerloo.indicator1 %]" /> >+ <input type="hidden" >+ tabindex="1" >+ name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]" >+ value="[% innerloo.indicator2 %]" /> >+ [% ELSE %] >+ <input type="hidden" >+ tabindex="1" >+ name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]" >+ value="[% innerloo.indicator1 %]" /> >+ <input type="hidden" >+ tabindex="1" >+ name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]" >+ value="[% innerloo.indicator2 %]" /> > [% END %] >+ [% END %] >+ >+ [% UNLESS advancedMARCEditor %] >+ <a href="#" tabindex="1" class="expandfield" onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;" title="Click to Expand this Tag">[% innerloo.tag_lib %]</a> >+ [% END %] >+ <span class="field_controls"> > [% IF ( innerloo.repeatable ) %] >- <span class="buttonPlus" onclick="CloneField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]')">+</span> >+ <a href="#" tabindex="1" class="buttonPlus" onclick="CloneField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]','[% hide_marc %]','[% advancedMARCEditor %]'); return false;" title="Repeat this Tag"> >+ <img src="/intranet-tmpl/prog/img/repeat-tag.png" alt="Repeat this Tag" /> >+ </a> > [% END %] >- [% UNLESS ( innerloo.mandatory ) %] >- <span class="buttonMinus" onclick="UnCloneField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]')">−</span> >+ <a href="#" tabindex="1" class="buttonMinus" onclick="UnCloneField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;" title="Delete this Tag"> >+ <img src="/intranet-tmpl/prog/img/delete-tag.png" alt="Delete this Tag" /> >+ </a> >+ </span> >+ >+ </div> >+ >+ [% FOREACH subfield_loo IN innerloo.subfield_loop %] >+ <!-- One line on the marc editor --> >+ <div class="subfield_line" style="[% subfield_loo.visibility %]" id="subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]"> >+ >+ [% UNLESS advancedMARCEditor %] >+ [% IF ( subfield_loo.fixedfield ) %]<label for="tag_[% subfield_loo.tag %]_subfield_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" style="display:none;" class="labelsubfield"> >+ [% ELSE %]<label for="tag_[% subfield_loo.tag %]_subfield_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" class="labelsubfield"> >+ [% END %] > [% END %] > >- </div> >- >- [% FOREACH subfield_loo IN innerloo.subfield_loop %] >- <!-- One line on the marc editor --> >- <div name="line" class="subfield_line" style="[% subfield_loo.visibility %];" id="subfield[% subfield_loo.tag %][% subfield_loo.subfield %]"> >- >- [% UNLESS ( subfield_loo.advancedMARCEditor ) %] >- [% IF ( subfield_loo.fixedfield ) %]<label for="tag_[% subfield_loo.tag %]_subfield_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" style="display:none;" class="labelsubfield" > >- [% ELSE %] <label for="tag_[% subfield_loo.tag %]_subfield_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" class="labelsubfield" >[% END %] >- [% END %] >- >- [% UNLESS ( subfield_loo.hide_marc ) %] >+ [% UNLESS hide_marc %] >+ <span class="subfieldcode"> > [% IF ( subfield_loo.fixedfield ) %] >- <img class="buttonUp" style="display:none;" src="[% themelang %]/../img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %]')" alt="Move Up" title="Move Up" /> >- [% ELSE %] >- <img class="buttonUp" src="[% themelang %]/../img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %]')" alt="Move Up" title="Move Up" /> >- [% END %] >- <input title="[% subfield_loo.marc_lib_plain %]" >- style=" [% IF ( subfield_loo.fixedfield ) %]display:none; [% END %]border:0;" type="text" >- name="tag_[% subfield_loo.tag %]_code_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" >- value="[% subfield_loo.subfield %]" >- size="1" >- maxlength="1" >- class="flat" >- tabindex="0" /> >+ <img class="buttonUp" style="display:none;" src="/intranet-tmpl/prog/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]')" alt="Move Up" title="Move Up" /> > [% ELSE %] >- <input type="hidden" >- name="tag_[% subfield_loo.tag %]_code_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" >- value="[% subfield_loo.subfield %]"/> >+ <img class="buttonUp" src="/intranet-tmpl/prog/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]')" alt="Move Up" title="Move Up" /> > [% END %] >+ <input type="text" >+ title="[% subfield_loo.marc_lib_plain %]" >+ style=" [% IF ( subfield_loo.fixedfield ) %]display:none; [% END %]border:0;" >+ name="tag_[% subfield_loo.tag %]_code_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" >+ value="[% subfield_loo.subfield %]" >+ size="1" >+ maxlength="1" >+ class="flat" >+ tabindex="0" /> >+ </span> >+ [% ELSE %] >+ <input type="hidden" >+ name="tag_[% subfield_loo.tag %]_code_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" >+ value="[% subfield_loo.subfield %]" /> >+ [% END %] >+ >+ [% UNLESS advancedMARCEditor %] >+ [% IF ( subfield_loo.mandatory ) %]<span class="subfield subfield_mandatory">[% ELSE %]<span class="subfield">[% END %] >+ [% subfield_loo.marc_lib_plain %] >+ [% IF ( subfield_loo.mandatory ) %]<span class="mandatory_marker" title="This field is mandatory">*</span>[% END %] >+ </span> >+ </label> >+ [% END %] > >- [% UNLESS ( subfield_loo.advancedMARCEditor ) %] >- [% IF ( subfield_loo.mandatory ) %]<span class="subfield_mandatory">[% END %] >- [% subfield_loo.marc_lib %] >- [% IF ( subfield_loo.mandatory ) %]</span>[% END %] >- </label> >- [% END %] >- >- [% subfield_loo.marc_value %] >- >- [% IF ( subfield_loo.repeatable ) %] >- <a href="#" onclick="CloneSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %]'); return false;"><img src="/intranet-tmpl/prog/img/clone-subfield.png" alt="Clone" title="Clone this subfield" /></a> >- [% END %] >- [% UNLESS ( subfield_loo.mandatory ) %] >- <a href="#" onclick="UnCloneField('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]'); return false;"><img src="/intranet-tmpl/prog/img/delete-subfield.png" alt="Delete" title="Delete this subfield" /></a> >- [% END %] >- >- </div> >- <!-- End of the line --> >+ [% subfield_loo.marc_value %] >+ >+ <span class="subfield_controls"> >+ [% IF ( subfield_loo.repeatable ) %] >+ <a href="#" class="buttonPlus" tabindex="1" onclick="CloneSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]','[% advancedMARCEditor %]'); return false;"> >+ <img src="/intranet-tmpl/prog/img/clone-subfield.png" alt="Clone" title="Clone this subfield" /> >+ </a> >+ <a href="#" class="buttonMinus" tabindex="1" onclick="UnCloneField('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]'); return false;"> >+ <img src="/intranet-tmpl/prog/img/delete-subfield.png" alt="Delete" title="Delete this subfield" /> >+ </a> >+ [% END %] >+ </span> > >- [% END %] > </div> >- [% END %]<!-- tag --> >+ <!-- End of the line --> > [% END %] >- </div> >-[% END %] > >-[% UNLESS ( singletab ) %] >- </div> >-[% END %] >-</div> >+ </div> >+ [% END %]<!-- if innerloo.tag --> >+ [% END %]<!-- BIG_LOO.innerloop --> >+ </div> >+[% END %]<!-- BIG_LOOP --> >+ >+</div><!-- tabs --> > > <div name="hidden" id="hidden" class="tab"> > [% FOREACH hidden_loo IN hidden_loop %] >@@ -756,10 +384,14 @@ function searchauthority() { > <input type="hidden" name="subfield" value="[% oldauthtypetagsubfield %]" /> > <input type="hidden" name="field_value" value="[% authtypecode %]" /> > [% END %] >+ > <fieldset class="action"> > <input type="button" id="addauth2" value="Save" onclick="Check(this.form)" accesskey="w" /> > </fieldset> >+ > </form> >+ >+</div> > </div> > </div> > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt >index 56ed94f..fc5db31 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt >@@ -49,7 +49,7 @@ > // Try to add as many clones as needed > try { > for(var i=0; i<nb-subfields.length; i++) { >- window.opener.opener.CloneSubfield(subfields[0].getAttribute('id')); >+ window.opener.opener.CloneSubfield(subfields[0].getAttribute('id'),'[% advancedMARCEditor %]'); > } > } > catch(err) { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >index f934fbe..d17baf1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >@@ -3,30 +3,15 @@ > [% INCLUDE 'doc-head-close.inc' %] > <script type="text/javascript" src="[% themelang %]/lib/yui/plugins/bubbling-min.js"></script> > <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.fixFloat.js"></script> >+<script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script> > <script type="text/javascript"> > //<![CDATA[ > >- var fields_in_use = {}; > $(document).ready(function() { > $('#addbibliotabs').tabs().bind('show.ui-tabs', function(e, ui) { > $("#"+ui.panel.id+" input:eq(0)").focus(); > }); >- $('.tag').each(function() { >- var field_id = this.getAttribute('id').substring(0, 7); >- if (field_id in fields_in_use) { >- fields_in_use[field_id]++; >- } else { >- fields_in_use[field_id] = 1; >- } >- }); >- $('.subfield_line').each(function() { >- var field_id = this.getAttribute('id').substring(0, 12); >- if (field_id in fields_in_use) { >- fields_in_use[field_id]++; >- } else { >- fields_in_use[field_id] = 1; >- } >- }); >+ > /* check cookie to hide/show marcdocs*/ > if($.cookie("marcdocs_[% borrowernumber %]") == 'false'){ > hideMARCdocLinks(); >@@ -48,21 +33,6 @@ function confirmnotdup(redirect){ > Check(); > } > >-/** >- * >- * >- */ >-function Check(){ >- var StrAlert = AreMandatoriesNotOk(); >- if( ! StrAlert ){ >- document.f.submit(); >- return true; >- } else { >- alert(StrAlert); >- return false; >- } >-} >- > function Dopop(link,i) { > defaultvalue = document.getElementById(i).value; > window.open(link+"&result="+defaultvalue,"valuebuilder",'width=700,height=550,toolbar=false,scrollbars=yes'); >@@ -235,6 +205,21 @@ function AreMandatoriesNotOk(){ > } > } > >+/** >+ * >+ * >+ */ >+function Check(){ >+ var StrAlert = AreMandatoriesNotOk(); >+ if( ! StrAlert ){ >+ document.f.submit(); >+ return true; >+ } else { >+ alert(StrAlert); >+ return false; >+ } >+} >+ > /** > * check if z3950 mandatories are set or not > */ >@@ -260,381 +245,6 @@ function Changefwk(FwkList) { > f.submit(); > } > >-// returns the subfieldcode based upon subfieldid writing >-function getSubfieldcode(tagsubfieldid){ >- // 3 : tag +3 : tagnumber +4 : number of _ +8 subfield -1 begins at 0 >- return tagsubfieldid.substr(3+3+4+8-1,1); >-} >- >-// Take the base of tagsubfield information (removing the subfieldcodes and subfieldindexes) >-// returns the filter >-function getTagInputnameFilter(tagsubfieldid){ >- var tagsubfield=tagsubfieldid.substr(0,tagsubfieldid.lastIndexOf("_")); >- var tagcode=tagsubfield.substr(tagsubfield.lastIndexOf("_")); >- tagsubfield=tagsubfield.substr(0,tagsubfield.lastIndexOf("_")); >- tagsubfield=tagsubfield.substr(0,tagsubfield.lastIndexOf("_")); >- tagsubfield=tagsubfield+"_."+tagcode; >- return tagsubfield; >-} >- >-function openAuth(tagsubfieldid,authtype) { >- // let's take the base of tagsubfield information (removing the indexes and the codes >- var element=document.getElementById(tagsubfieldid); >- var tagsubfield=getTagInputnameFilter(tagsubfieldid); >- var elementsubfcode=getSubfieldcode(element.name); >- var mainmainstring=element.value; >- var mainstring=""; >- var inputs = element.parentNode.parentNode.getElementsByTagName("input"); >- >- for (var myindex =0; myindex<inputs.length;myindex++){ >- if (inputs[myindex].name && inputs[myindex].name.match(tagsubfield)){ >- var subfieldcode=getSubfieldcode(inputs[myindex].name); >- if (isNaN(parseInt(subfieldcode)) && inputs[myindex].value != "" && subfieldcode!=elementsubfcode){ >- mainstring=inputs[myindex].value+" "+mainstring; >- } >- } >- } >- newin=window.open("../authorities/auth_finder.pl?authtypecode="+ authtype+ "&index="+tagsubfieldid+"&value_mainstr="+encodeURI(mainmainstring)+"&value_main="+encodeURI(mainstring), "_blank",'width=700,height=550,toolbar=false,scrollbars=yes'); >-} >- >- >-function ExpandField(index) { >- var original = document.getElementById(index); //original <div> >- var divs = original.getElementsByTagName('div'); >- for(var i=0,divslen = divs.length ; i<divslen ; i++){ // foreach div >- if(divs[i].getAttribute('id').match(/^subfield/)){ // if it s a subfield >- if (divs[i].style.display == 'block') { >- divs[i].style.display = 'none'; >- } else { >- divs[i].style.display = 'block'; >- } >- } >- } >-} >- >-/** >- * To clone a field or a subfield by clicking on '+' button >- */ >-function CloneField(index) { >- var original = document.getElementById(index); //original <div> >- fields_in_use[index.substr(0, 7)]++; >- var clone = original.cloneNode(true); >- var new_key = CreateKey(); >- var new_id = original.getAttribute('id')+new_key; >- >- clone.setAttribute('id',new_id); // setting a new id for the parent div >- >- var divs = clone.getElementsByTagName('div'); >- >- [% UNLESS ( hide_marc ) %] // No indicator if hide_marc >- // setting a new name for the new indicator >- for(var i=0; i < 2; i++) { >- var indicator = clone.getElementsByTagName('input')[i]; >- indicator.setAttribute('name',indicator.getAttribute('name')+new_key); >- } >- [% END %] >- >- // settings all subfields >- for(var i=0,divslen = divs.length ; i<divslen ; i++){ // foreach div >- if(divs[i].getAttribute("id").match(/^subfield/)){ // if it s a subfield >- >- // set the attribute for the new 'div' subfields >- divs[i].setAttribute('id',divs[i].getAttribute('id')+new_key); >- >- var inputs = divs[i].getElementsByTagName('input'); >- var id_input = ""; >- >- for( j = 0 ; j < inputs.length ; j++ ) { >- if(inputs[j].getAttribute("id") && inputs[j].getAttribute("id").match(/^tag_/) ){ >- inputs[j].value = ""; >- } >- } >- >- inputs[0].setAttribute('id',inputs[0].getAttribute('id')+new_key); >- inputs[0].setAttribute('name',inputs[0].getAttribute('name')+new_key); >- var id_input; >- try { >- id_input = inputs[1].getAttribute('id')+new_key; >- inputs[1].setAttribute('id',id_input); >- inputs[1].setAttribute('name',inputs[1].getAttribute('name')+new_key); >- } catch(e) { >- try{ // it s a select if it is not an input >- var selects = divs[i].getElementsByTagName('select'); >- id_input = selects[0].getAttribute('id')+new_key; >- selects[0].setAttribute('id',id_input); >- selects[0].setAttribute('name',selects[0].getAttribute('name')+new_key); >- }catch(e2){ // it is a textarea if it s not a select or an input >- var textaeras = divs[i].getElementsByTagName('textarea'); >- id_input = textaeras[0].getAttribute('id')+new_key; >- textaeras[0].setAttribute('id',id_input); >- textaeras[0].setAttribute('name',textaeras[0].getAttribute('name')+new_key); >- } >- } >- >- [% UNLESS ( advancedMARCEditor ) %] >- // when cloning a subfield, re set its label too. >- var labels = divs[i].getElementsByTagName('label'); >- labels[0].setAttribute('for',id_input); >- [% END %] >- >- [% UNLESS ( hide_marc ) %] >- // updating javascript parameters on button up >- var imgs = divs[i].getElementsByTagName('img'); >- imgs[0].setAttribute('onclick',"upSubfield(\'"+divs[i].getAttribute('id')+"\');"); >- [% END %] >- >- // setting its '+' and '-' buttons >- try { >- var anchors = divs[i].getElementsByTagName('a'); >- for (var j = 0; j < anchors.length; j++) { >- if(anchors[j].getAttribute('class') == 'buttonPlus'){ >- anchors[j].setAttribute('onclick',"CloneSubfield('" + divs[i].getAttribute('id') + "')"); >- } else if (anchors[j].getAttribute('class') == 'buttonMinus') { >- anchors[j].setAttribute('onclick',"UnCloneField('" + divs[i].getAttribute('id') + "')"); >- } >- } >- } >- catch(e){ >- // do nothig if ButtonPlus & CloneButtonPlus don t exist. >- } >- >- // button ... >- var spans=0; >- try { >- spans = divs[i].getElementsByTagName('a'); >- } catch(e) { >- // no spans >- } >- if(spans){ >- var buttonDot; >- if(!CloneButtonPlus){ // it s impossible to have + ... (buttonDot AND buttonPlus) >- buttonDot = spans[0]; >- if(buttonDot){ >- // 2 possibilities : >- try{ >- var buttonDotOnClick = buttonDot.getAttribute('onclick'); >- if(buttonDotOnClick.match('Clictag')){ // -1- It s a plugin >- var re = /\('.*'\)/i; >- buttonDotOnClick = buttonDotOnClick.replace(re,"('"+inputs[1].getAttribute('id')+"')"); >- if(buttonDotOnClick){ >- buttonDot.setAttribute('onclick',buttonDotOnClick); >- } >- } else { >- if(buttonDotOnClick.match('Dopop')) { // -2- It's a auth value >- var re1 = /&index=.*',/; >- var re2 = /,.*\)/; >- >- buttonDotOnClick = buttonDotOnClick.replace(re1,"&index="+inputs[1].getAttribute('id')+"',"); >- buttonDotOnClick = buttonDotOnClick.replace(re2,",'"+inputs[1].getAttribute('id')+"')"); >- >- if(buttonDotOnClick){ >- buttonDot.setAttribute('onclick',buttonDotOnClick); >- } >- } >- } >- try { >- // do not copy the script section. >- var script = spans[0].getElementsByTagName('script')[0]; >- spans[0].removeChild(script); >- } catch(e) { >- // do nothing if there is no script >- } >- }catch(e){} >- } >- } >- } >- [% UNLESS ( hide_marc ) %] >- var buttonUp = divs[i].getElementsByTagName('img')[0]; >- buttonUp.setAttribute('onclick',"upSubfield('" + divs[i].getAttribute('id') + "')"); >- [% END %] >- >- } else { // it's a indicator div >- if(divs[i].getAttribute('id').match(/^div_indicator/)){ >- var inputs = divs[i].getElementsByTagName('input'); >- inputs[0].setAttribute('id',inputs[0].getAttribute('id')+new_key); >- inputs[1].setAttribute('id',inputs[1].getAttribute('id')+new_key); >- >- var CloneButtonPlus; >- try { >- var anchors = divs[i].getElementsByTagName('a'); >- for (var j = 0; j < anchors.length; j++) { >- if (anchors[j].getAttribute('class') == 'buttonPlus') { >- anchors[j].setAttribute('onclick',"CloneField('" + new_id + "')"); >- } else if (anchors[j].getAttribute('class') == 'buttonMinus') { >- anchors[j].setAttribute('onclick',"UnCloneField('" + new_id + "')"); >- } else if (anchors[j].getAttribute('class') == 'expandfield') { >- anchors[j].setAttribute('onclick',"ExpandField('" + new_id + "')"); >- } >- } >- } >- catch(e){ >- // do nothig CloneButtonPlus doesn't exist. >- } >- >- } >- } >- } >- >- // insert this line on the page >- original.parentNode.insertBefore(clone,original.nextSibling); >-} >- >-function CloneSubfield(index){ >- var original = document.getElementById(index); //original <div> >- fields_in_use[index.substr(0, 12)]++; >- var clone = original.cloneNode(true); >- var new_key = CreateKey(); >- var new_id = original.getAttribute('id')+new_key; >- // set the attribute for the new 'div' subfields >- var inputs = clone.getElementsByTagName('input'); >- var selects = clone.getElementsByTagName('select'); >- var textareas = clone.getElementsByTagName('textarea'); >- var linkid; >- >- // input >- var id_input = ""; >- for(var i=0,len=inputs.length; i<len ; i++ ){ >- id_input = inputs[i].getAttribute('id')+new_key; >- inputs[i].setAttribute('id',id_input); >- inputs[i].setAttribute('name',inputs[i].getAttribute('name')+new_key); >- linkid = id_input; >- } >- >- // select >- for(var i=0,len=selects.length; i<len ; i++ ){ >- id_input = selects[i].getAttribute('id')+new_key; >- selects[i].setAttribute('id',selects[i].getAttribute('id')+new_key); >- selects[i].setAttribute('name',selects[i].getAttribute('name')+new_key); >- } >- >- // textarea >- for(var i=0,len=textareas.length; i<len ; i++ ){ >- id_input = textareas[i].getAttribute('id')+new_key; >- textareas[i].setAttribute('id',textareas[i].getAttribute('id')+new_key); >- textareas[i].setAttribute('name',textareas[i].getAttribute('name')+new_key); >- } >- >- // Changing the "..." link's onclick attribute for plugin callback >- var links = clone.getElementsByTagName('a'); >- var link = links[0]; >- var buttonDotOnClick = link.getAttribute('onclick'); >- if(buttonDotOnClick.match('Clictag')){ // -1- It s a plugin >- var re = /\('.*'\)/i; >- buttonDotOnClick = buttonDotOnClick.replace(re,"('"+linkid+"')"); >- if(buttonDotOnClick){ >- link.setAttribute('onclick',buttonDotOnClick); >- } >- } >- >- >- [% UNLESS ( advancedMARCEditor ) %] >- // when cloning a subfield, reset its label too. >- var label = clone.getElementsByTagName('label')[0]; >- label.setAttribute('for',id_input); >- [% END %] >- >- // setting a new id for the parent div >- clone.setAttribute('id',new_id); >- >- try { >- var buttonUp = clone.getElementsByTagName('img')[0]; >- buttonUp.setAttribute('onclick',"upSubfield('" + new_id + "')"); >- var anchors = clone.getElementsByTagName('a'); >- if(anchors.length){ >- for(var i = 0 ,lenanchors = anchors.length ; i < lenanchors ; i++){ >- if(anchors[i].getAttribute('class') == 'buttonPlus'){ >- anchors[i].setAttribute('onclick',"CloneSubfield('" + new_id + "')"); >- } else if (anchors[i].getAttribute('class') == 'buttonMinus') { >- anchors[i].setAttribute('onclick',"UnCloneField('" + new_id + "')"); >- } >- } >- } >- } >- catch(e){ >- // do nothig if ButtonPlus & CloneButtonPlus don't exist. >- } >- // insert this line on the page >- original.parentNode.insertBefore(clone,original.nextSibling); >-} >- >- /** >- * This function removes or clears unwanted subfields >- */ >-function UnCloneField(index) { >- var original = document.getElementById(index); >- var field_id; >- if (index.match("tag")) { >- field_id = index.substr(0, 7); >- } else { >- field_id = index.substr(0, 12); >- } >- if (1 == fields_in_use[field_id]) { >- // clear inputs, but don't delete >- $(":input.input_marceditor", original).each(function(){ >- // thanks to http://www.learningjquery.com/2007/08/clearing-form-data for >- // hint about clearing selects correctly >- var type = this.type; >- var tag = this.tagName.toLowerCase(); >- if (type == 'text' || type == 'password' || tag == 'textarea') { >- this.value = ""; >- } else if (type == 'checkbox' || type == 'radio') { >- this.checked = false; >- } else if (tag == 'select') { >- this.selectedIndex = -1; >- } >- }); >- $(":input.indicator", original).val(""); >- } else { >- original.parentNode.removeChild(original); >- fields_in_use[field_id]--; >- } >-} >- >-/** >- * This function create a random number >- */ >-function CreateKey(){ >- return parseInt(Math.random() * 100000); >-} >- >-/** >- * This function allows to move a subfield up by clickink on the 'up' button . >- */ >-function upSubfield(index) { >- try{ >- var line = document.getElementById(index); // get the line where the user has clicked. >- } catch(e) { >- return; // this line doesn't exist... >- } >- var tag = line.parentNode; // get the dad of this line. (should be "<div id='tag_...'>") >- >- // getting all subfields for this tag >- var subfields = tag.getElementsByTagName('div'); >- var subfieldsLength = subfields.length; >- >- if(subfieldsLength<=1) return; // nothing to do if there is just one subfield. >- >- // among all subfields >- for(var i=0;i<subfieldsLength;i++){ >- if(subfields[i].getAttribute('id') == index){ //looking for the subfield which is clicked : >- if(i==1){ // if the clicked subfield is on the top >- tag.appendChild(subfields[1]); >- return; >- } else { >- var lineAbove = subfields[i-1]; >- tag.insertBefore(line,lineAbove); >- return; >- } >- } >- } >-} >- >-function unHideSubfield(index,labelindex) { // FIXME :: is it used ? >- subfield = document.getElementById(index); >- subfield.style.display = 'block'; >- label = document.getElementById(labelindex); >- label.style.display='none'; >-} > //]]> > </script> > <link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" /> >@@ -657,6 +267,7 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ? > //]]> > </script> > [% INCLUDE 'header.inc' %] >+ > <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/cataloguing/addbooks.pl">Cataloging</a> › [% IF ( biblionumber ) %]Editing <em>[% title |html %]</em> (Record number [% biblionumber %])[% ELSE %]Add MARC record[% END %]</div> > > <div id="doc" class="yui-t7"> >@@ -802,83 +413,129 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ? > <input type="hidden" name="breedingid" value="[% breedingid %]" /> > > <div id="addbibliotabs" class="toptabs numbered"> >- <ul>[% FOREACH BIG_LOO IN BIG_LOOP %] >- <li> [% IF ( BIG_LOO.number ) %] >- <a href="#tab[% BIG_LOO.number %]XX">[% BIG_LOO.number %]</a> >- [% ELSE %] >- <a href="#tab[% BIG_LOO.number %]XX">[% BIG_LOO.number %]</a> >- [% END %]</li> >- [% END %]</ul> >+ <ul> >+ [% FOREACH BIG_LOO IN BIG_LOOP %] >+ <li><a href="#tab[% BIG_LOO.number %]XX">[% BIG_LOO.number %]</a></li> >+ [% END %] >+ </ul> > > [% FOREACH BIG_LOO IN BIG_LOOP %] >-<!-- hide every tab except the 1st --> >-[% IF ( BIG_LOO.number ) %] >- <div id="tab[% BIG_LOO.number %]XX"> >-[% ELSE %] > <div id="tab[% BIG_LOO.number %]XX"> >-[% END %] >- > > [% FOREACH innerloo IN BIG_LOO.innerloop %] >- [% IF ( innerloo.tag ) %] >- <div class="tag" id="tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]"> >+ [% IF ( innerloo.tag ) %] >+ <div class="tag" id="tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]"> > <div class="tag_title" id="div_indicator_tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]"> >- [% UNLESS hide_marc %] >- [% IF advancedMARCEditor %] >- <a href="#" tabindex="1" class="tagnum" title="[% innerloo.tag_lib %] - Click to Expand this Tag" onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;">[% innerloo.tag %]</a> >- [% ELSE %] >- <span class="tagnum" title="[% innerloo.tag_lib %]">[% innerloo.tag %] >- [% IF marcflavour != 'NORMARC' %]<a class="marcdocs" onclick="PopupMARCFieldDoc('[% innerloo.tag %]', [% BIG_LOO.number %]); return false;"> ?</a>[% END %] >- </span> >- [% END %] >+ [% UNLESS hide_marc %] >+ [% IF advancedMARCEditor %] >+ <a href="#" tabindex="1" class="tagnum" title="[% innerloo.tag_lib %] - Click to Expand this Tag" onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;">[% innerloo.tag %]</a> >+ [% ELSE %] >+ <span class="tagnum" title="[% innerloo.tag_lib %]">[% innerloo.tag %] >+ [% IF marcflavour != 'NORMARC' %]<a class="marcdocs" onclick="PopupMARCFieldDoc('[% innerloo.tag %]', [% BIG_LOO.number %]); return false;"> ?</a>[% END %] >+ </span> >+ [% END %] > [% IF ( innerloo.fixedfield ) %] >- <input tabindex="1" class="indicator flat" type="text" style="display:none;" name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]" size="1" maxlength="1" value="[% innerloo.indicator1 %]" /> >- <input tabindex="1" class="indicator flat" type="text" style="display:none;" name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]" size="1" maxlength="1" value="[% innerloo.indicator2 %]" /> >+ <input type="text" >+ tabindex="1" >+ class="indicator flat" >+ style="display:none;" >+ name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]" >+ size="1" >+ maxlength="1" >+ value="[% innerloo.indicator1 %]" /> >+ <input type="text" >+ tabindex="1" >+ class="indicator flat" >+ style="display:none;" >+ name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]" >+ size="1" >+ maxlength="1" >+ value="[% innerloo.indicator2 %]" /> > [% ELSE %] >- <input tabindex="1" class="indicator flat" type="text" name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]" size="1" maxlength="1" value="[% innerloo.indicator1 %]" /> >- <input tabindex="1" class="indicator flat" type="text" name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]" size="1" maxlength="1" value="[% innerloo.indicator2 %]" /> >+ <input type="text" >+ tabindex="1" >+ class="indicator flat" >+ name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]" >+ size="1" >+ maxlength="1" >+ value="[% innerloo.indicator1 %]" /> >+ <input type="text" >+ tabindex="1" >+ class="indicator flat" >+ name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]" >+ size="1" >+ maxlength="1" >+ value="[% innerloo.indicator2 %]" /> > [% END %] - >- [% ELSE %] >+ [% ELSE %] > [% IF ( innerloo.fixedfield ) %] >- <input tabindex="1" type="hidden" name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]" value="[% innerloo.indicator1 %]" /> >- <input tabindex="1" type="hidden" name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]" value="[% innerloo.indicator2 %]" /> >+ <input type="hidden" >+ tabindex="1" >+ name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]" >+ value="[% innerloo.indicator1 %]" /> >+ <input type="hidden" >+ tabindex="1" >+ name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]" >+ value="[% innerloo.indicator2 %]" /> > [% ELSE %] >- <input tabindex="1" type="hidden" name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]" value="[% innerloo.indicator1 %]" /> >- <input tabindex="1" type="hidden" name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]" value="[% innerloo.indicator2 %]" /> >+ <input type="hidden" >+ tabindex="1" >+ name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]" >+ value="[% innerloo.indicator1 %]" /> >+ <input type="hidden" >+ tabindex="1" >+ name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]" >+ value="[% innerloo.indicator2 %]" /> > [% END %] >- [% END %] >+ [% END %] > > [% UNLESS advancedMARCEditor %] >- <a href="#" tabindex="1" class="expandfield" onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;" title="Click to Expand this Tag">[% innerloo.tag_lib %]</a> >- [% END %] >- [% IF ( innerloo.repeatable ) %] >- <span class="subfield_controls"><a href="#" tabindex="1" class="buttonPlus" onclick="CloneField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;" title="Repeat this Tag"><img src="/intranet-tmpl/prog/img/repeat-tag.png" alt="Repeat this Tag" /></a> >+ <a href="#" tabindex="1" class="expandfield" onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;" title="Click to Expand this Tag">[% innerloo.tag_lib %]</a> > [% END %] >- <a href="#" tabindex="1" class="buttonMinus" onclick="UnCloneField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;" title="Delete this Tag"><img src="/intranet-tmpl/prog/img/delete-tag.png" alt="Delete this Tag" /></a></span> >+ <span class="field_controls"> >+ [% IF ( innerloo.repeatable ) %] >+ <a href="#" tabindex="1" class="buttonPlus" onclick="CloneField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]','[% hide_marc %]','[% advancedMARCEditor %]'); return false;" title="Repeat this Tag"> >+ <img src="/intranet-tmpl/prog/img/repeat-tag.png" alt="Repeat this Tag" /> >+ </a> >+ [% END %] >+ <a href="#" tabindex="1" class="buttonMinus" onclick="UnCloneField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;" title="Delete this Tag"> >+ <img src="/intranet-tmpl/prog/img/delete-tag.png" alt="Delete this Tag" /> >+ </a> >+ </span> > >- > </div> >- >+ > [% FOREACH subfield_loo IN innerloo.subfield_loop %] > <!-- One line on the marc editor --> >- <div class="subfield_line" style="[% subfield_loo.visibility %]; float: left; clear: left; width: 100%;" id="subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]"> >+ <div class="subfield_line" style="[% subfield_loo.visibility %]" id="subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]"> > > [% UNLESS advancedMARCEditor %] > [% IF ( subfield_loo.fixedfield ) %]<label for="tag_[% subfield_loo.tag %]_subfield_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" style="display:none;" class="labelsubfield"> >- [% ELSE %]<label for="tag_[% subfield_loo.tag %]_subfield_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" class="labelsubfield">[% END %] >- [% END %] >+ [% ELSE %]<label for="tag_[% subfield_loo.tag %]_subfield_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" class="labelsubfield"> >+ [% END %] >+ [% END %] > > [% UNLESS hide_marc %] >- <span class="subfieldcode">[% IF ( subfield_loo.fixedfield ) %] >- <img class="buttonUp" style="display:none;" src="[% themelang %]/../img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]')" alt="Move Up" title="Move Up" /> >+ <span class="subfieldcode"> >+ [% IF ( subfield_loo.fixedfield ) %] >+ <img class="buttonUp" style="display:none;" src="/intranet-tmpl/prog/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]')" alt="Move Up" title="Move Up" /> > [% ELSE %] >- <img class="buttonUp" src="[% themelang %]/../img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]')" alt="Move Up" title="Move Up" /> >+ <img class="buttonUp" src="/intranet-tmpl/prog/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]')" alt="Move Up" title="Move Up" /> > [% END %] >- <input title="[% subfield_loo.marc_lib_plain %]" style=" [% IF ( subfield_loo.fixedfield ) %]display:none; [% END %]border:0;" type="text" tabindex="0" name="tag_[% subfield_loo.tag %]_code_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" value="[% subfield_loo.subfield %]" size="1" maxlength="1" class="flat" /> >- </span> >+ <input type="text" >+ title="[% subfield_loo.marc_lib_plain %]" >+ style=" [% IF ( subfield_loo.fixedfield ) %]display:none; [% END %]border:0;" >+ name="tag_[% subfield_loo.tag %]_code_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" >+ value="[% subfield_loo.subfield %]" >+ size="1" >+ maxlength="1" >+ class="flat" >+ tabindex="0" /> >+ </span> > [% ELSE %] >- <input type="hidden" name="tag_[% subfield_loo.tag %]_code_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" value="[% subfield_loo.subfield %]" /> >- </span> >+ <input type="hidden" >+ name="tag_[% subfield_loo.tag %]_code_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" >+ value="[% subfield_loo.subfield %]" /> > [% END %] > > [% UNLESS advancedMARCEditor %] >@@ -891,22 +548,29 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ? > > [% subfield_loo.marc_value %] > >+ <span class="subfield_controls"> > [% IF ( subfield_loo.repeatable ) %] >- <span class="subfield_controls"><a href="#" class="buttonPlus" tabindex="1" onclick="CloneSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]'); return false;"><img src="/intranet-tmpl/prog/img/clone-subfield.png" alt="Clone" title="Clone this subfield" /></a> >- <a href="#" class="buttonMinus" tabindex="1" onclick="UnCloneField('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]'); return false;"><img src="/intranet-tmpl/prog/img/delete-subfield.png" alt="Delete" title="Delete this subfield" /></a></span> >+ <a href="#" class="buttonPlus" tabindex="1" onclick="CloneSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]','[% advancedMARCEditor %]'); return false;"> >+ <img src="/intranet-tmpl/prog/img/clone-subfield.png" alt="Clone" title="Clone this subfield" /> >+ </a> >+ <a href="#" class="buttonMinus" tabindex="1" onclick="UnCloneField('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]'); return false;"> >+ <img src="/intranet-tmpl/prog/img/delete-subfield.png" alt="Delete" title="Delete this subfield" /> >+ </a> > [% END %] >- >+ </span> > > </div> > <!-- End of the line --> >- > [% END %] >- </div> >- [% END %]<!-- tag --> >- [% END %] >+ > </div> >-[% END %] >-</div> >+ [% END %]<!-- if innerloo.tag --> >+ [% END %]<!-- BIG_LOO.innerloop --> >+ </div> >+[% END %]<!-- BIG_LOOP --> >+ >+</div><!-- tabs --> >+ > <!-- Fields for fast add cataloguing --> > <input type="hidden" name="barcode" value="[% barcode %]" /> > <input type="hidden" name="branch" value="[% branch %]" /> >@@ -914,6 +578,7 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ? > <input type="hidden" name="stickyduedate" value="[% stickyduedate %]" /> > <input type="hidden" name="duedatespec" value="[% duedatespec %]" /> > <!-- /End of fast add fields --> >+ > </form> > > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >index 6692274..4672519 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >@@ -1,6 +1,7 @@ > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Cataloging › [% title |html %] [% IF ( author ) %] by [% author %][% END %] (Record #[% biblionumber %]) › Items</title> > [% INCLUDE 'doc-head-close.inc' %] >+<script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script> > <script type="text/javascript"> > //<![CDATA[ > $(document).ready(function(){ >@@ -84,78 +85,6 @@ function confirm_deletion(biblionumber,itemnumber) { > } > } > >-function CloneSubfield(index){ >- var original = document.getElementById(index); //original <div> >- var clone = original.cloneNode(true); >- var new_key = CreateKey(); >- var old_id = original.getAttribute('id'); >- old_id=old_id.substr(12); >- var new_id = old_id+new_key; >- >- // set the attribute for the new 'div' subfields >- var inputs = clone.getElementsByTagName('input'); >- var selects = clone.getElementsByTagName('select'); >- var textareas = clone.getElementsByTagName('textarea'); >- >- // input >- var id_input = ""; >- for(var i=0,len=inputs.length; i<len ; i++ ){ >- id_input = inputs[i].getAttribute('id')+new_key; >- inputs[i].setAttribute('id',id_input); >- inputs[i].setAttribute('name',inputs[i].getAttribute('name')); >- } >- >- // select >- for(var i=0,len=selects.length; i<len ; i++ ){ >- id_input = selects[i].getAttribute('id')+new_key; >- selects[i].setAttribute('id',selects[i].getAttribute('id')+new_key); >- selects[i].setAttribute('name',selects[i].getAttribute('name')); >- } >- >- // textarea >- for(var i=0,len=textareas.length; i<len ; i++ ){ >- id_input = textareas[i].getAttribute('id')+new_key; >- textareas[i].setAttribute('id',textareas[i].getAttribute('id')+new_key); >- textareas[i].setAttribute('name',textareas[i].getAttribute('name')); >- } >- >- [% UNLESS ( advancedMARCEditor ) %] >- // when cloning a subfield, reset its label too. >- var label = clone.getElementsByTagName('label')[0]; >- label.setAttribute('for',id_input); >- [% END %] >- >- // setting a new if for the parent div >- clone.setAttribute('id',new_id); >- >- var CloneButtonPlus; >- try { >- var spans = clone.getElementsByTagName('span'); >- if(spans.length){ >- for(var i = 0 ,lenspans = spans.length ; i < lenspans ; i++){ >- if(spans[i].getAttribute('class') == 'buttonPlus'){ >- CloneButtonPlus = spans[i]; >- CloneButtonPlus.setAttribute('onclick',"CloneSubfield('" + new_id + "')"); >- var buttonUp = clone.getElementsByTagName('img')[0]; >- buttonUp.setAttribute('onclick',"upSubfield('" + new_id + "')"); >- } >- } >- } >- } >- catch(e){ >- // do nothing if ButtonPlus & CloneButtonPlus don't exist. >- } >- // insert this line on the page >- original.parentNode.insertBefore(clone,original.nextSibling); >-} >- >-/** >- * This function creates a random number >- */ >-function CreateKey(){ >- return parseInt(Math.random() * 100000); >-} >- > $(document).ready(function() { > $("#cataloguing_additem_itemlist tr").hover( > function () {$(this).attr("class","highlight");}, >@@ -247,7 +176,9 @@ $(document).ready(function() { > <input type="hidden" name="subfield" value="[% ite.subfield %]" /> > <input type="hidden" name="mandatory" value="[% ite.mandatory %]" /> > [% IF ( ite.repeatable ) %] >- <span class="buttonPlus" onclick="CloneSubfield('subfield[% ite.tag %][% ite.subfield %][% ite.random %]')">+</span> >+ <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;"> >+ <img src="/intranet-tmpl/prog/img/clone-subfield.png" alt="Clone" title="Clone this subfield" /> >+ </a> > [% END %] > [% IF ( ite.mandatory ) %] <span class="required">Required</span>[% END %] > </div></li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt >index 7c82b48..458e9b5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt >@@ -1,6 +1,7 @@ > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Serials › Serial edition [% bibliotitle %]</title> > [% INCLUDE 'doc-head-close.inc' %] >+<script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script> > <script language="JavaScript" type="text/javascript"> > //<![CDATA[ > function popup(subscriptionid) { >@@ -68,70 +69,7 @@ function changeDate2(adate) { > var elem = document.getElementById("supexpecteddate"); > elem.value = adate; > } >-function CloneSubfield(index){ >- var original = document.getElementById(index); //original <div> >- var clone = original.cloneNode(true); >- var new_key = CreateKey(); >- var old_id = original.getAttribute('id'); >- old_id=old_id.substr(12); >- var new_id = old_id+new_key; >- >- // set the attribute for the new 'div' subfields >- var inputs = clone.getElementsByTagName('input'); >- var selects = clone.getElementsByTagName('select'); >- var textareas = clone.getElementsByTagName('textarea'); >- >- // input >- var id_input = ""; >- for(var i=0,len=inputs.length; i<len ; i++ ){ >- id_input = inputs[i].getAttribute('id')+new_key; >- inputs[i].setAttribute('id',id_input); >- inputs[i].setAttribute('name',inputs[i].getAttribute('name')); >- } >- >- // select >- for(var i=0,len=selects.length; i<len ; i++ ){ >- id_input = selects[i].getAttribute('id')+new_key; >- selects[i].setAttribute('id',selects[i].getAttribute('id')+new_key); >- selects[i].setAttribute('name',selects[i].getAttribute('name')); >- } >- >- // textarea >- for(var i=0,len=textareas.length; i<len ; i++ ){ >- id_input = textareas[i].getAttribute('id')+new_key; >- textareas[i].setAttribute('id',textareas[i].getAttribute('id')+new_key); >- textareas[i].setAttribute('name',textareas[i].getAttribute('name')); >- } >- >- [% UNLESS ( advancedMARCEditor ) %] >- // when cloning a subfield, reset its label too. >- var label = clone.getElementsByTagName('label')[0]; >- label.setAttribute('for',id_input); >- [% END %] >- >- // setting a new if for the parent div >- clone.setAttribute('id',new_id); >- >- var CloneButtonPlus; >- try { >- var spans = clone.getElementsByTagName('span'); >- if(spans.length){ >- for(var i = 0 ,lenspans = spans.length ; i < lenspans ; i++){ >- if(spans[i].getAttribute('class') == 'buttonPlus'){ >- CloneButtonPlus = spans[i]; >- CloneButtonPlus.setAttribute('onclick',"CloneSubfield('" + new_id + "')"); >- var buttonUp = clone.getElementsByTagName('img')[0]; >- buttonUp.setAttribute('onclick',"upSubfield('" + new_id + "')"); >- } >- } >- } >- } >- catch(e){ >- // do nothig if ButtonPlus & CloneButtonPlus don't exist. >- } >- // insert this line on the page >- original.parentNode.insertBefore(clone,original.nextSibling); >-} >+ > $(document).ready(function() { > $("form#serials_edit").submit(function() { > var total_errors = 0; >@@ -286,7 +224,7 @@ $(document).ready(function() { > [% FOREACH item IN serialslis.items %] > <div id="item[% item.serialid %][% item.countitems %]" class="items"> > <ol>[% FOREACH iteminformatio IN item.iteminformation %]<li> >- <div class="subfield_line" style="[% iteminformatio.hidden %];" id="subfield[% item.serialid %][% item.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]"> >+ <div class="subfield_line" style="[% iteminformatio.hidden %]" id="subfield[% item.serialid %][% item.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]"> > > <label>[% iteminformatio.subfield %] - [% IF ( iteminformatio.mandatory ) %]<b>[% END %][% iteminformatio.marc_lib %][% IF ( iteminformatio.mandatory ) %] *</b>[% END %]</label> > [% iteminformatio.marc_value %] >@@ -295,8 +233,10 @@ $(document).ready(function() { > <input type="hidden" name="tag" value="[% iteminformatio.tag %]" /> > <input type="hidden" name="subfield" value="[% iteminformatio.subfield %]" /> > <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory %]" /> >- [% IF ( iteminformatio.ITEM_SUBFIELDS_ARE_NOT_REPEATABLE ) %] >- <span class="buttonPlus" onclick="CloneSubfield('subfield[% item.serialid %][% item.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]')">+</span> >+ [% IF ( iteminformatio.repeatable ) %] >+ <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;"> >+ <img src="/intranet-tmpl/prog/img/clone-subfield.png" alt="Clone" title="Clone this subfield" /> >+ </a> > [% END %] > > </div></li> >@@ -389,7 +329,7 @@ $(document).ready(function() { > <div class="cataloguing_additem_itemlist"> > <div id="item[% newserialloo.serialid %][% newserialloo.countitems %]" class="items"> > <ol>[% FOREACH iteminformatio IN newserialloo.iteminformation %]<li> >- <div class="subfield_line" style="[% iteminformatio.hidden %];" id="subfield[% newserialloo.serialid %][% newserialloo.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]"> >+ <div class="subfield_line" style="[% iteminformatio.hidden %]" id="subfield[% newserialloo.serialid %][% newserialloo.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]"> > > <label>[% iteminformatio.subfield %] - [% IF ( iteminformatio.mandatory ) %]<b>[% END %][% iteminformatio.marc_lib %][% IF ( iteminformatio.mandatory ) %] *</b>[% END %]</label> > [% iteminformatio.marc_value %] >@@ -398,8 +338,10 @@ $(document).ready(function() { > <input type="hidden" name="tag" value="[% iteminformatio.tag %]" /> > <input type="hidden" name="subfield" value="[% iteminformatio.subfield %]" /> > <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory %]" /> >- [% IF ( iteminformatio.ITEM_SUBFIELDS_ARE_NOT_REPEATABLE ) %] >- <span class="buttonPlus" onclick="CloneSubfield('subfield[% newserialloo.serialid %][% newserialloo.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]')">+</span> >+ [% IF ( iteminformatio.repeatable ) %] >+ <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;"> >+ <img src="/intranet-tmpl/prog/img/clone-subfield.png" alt="Clone" title="Clone this subfield" /> >+ </a> > [% END %] > </div> > </li>[% END %]</ol> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt >index 4c7198e..a161efa 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt >@@ -2,6 +2,7 @@ > <title>Koha › Tools › Batch item modification</title> > [% INCLUDE 'doc-head-close.inc' %] > <script type="text/javascript" src="[% themelang %]/js/background-job-progressbar.js"></script> >+<script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script> > <link rel="stylesheet" type="text/css" href="[% themelang %]/css/pages/batchMod.css" /> > <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script> > <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script> >@@ -154,7 +155,9 @@ $("input[name='disable_input']").click(function() { > <input type="hidden" name="subfield" value="[% ite.subfield %]" /> > <input type="hidden" name="mandatory" value="[% ite.mandatory %]" /> > [% IF ( ite.repeatable ) %] >- <span class="buttonPlus" onclick="CloneSubfield('subfield[% ite.tag %][% ite.subfield %][% ite.random %]')">+</span> >+ <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;"> >+ <img src="/intranet-tmpl/prog/img/clone-subfield.png" alt="Clone" title="Clone this subfield" /> >+ </a> > [% END %] > > </div></li> >diff --git a/tools/batchMod.pl b/tools/batchMod.pl >index 3ba93a8..8391209 100755 >--- a/tools/batchMod.pl >+++ b/tools/batchMod.pl >@@ -393,14 +393,14 @@ foreach my $tag (sort keys %{$tagslib}) { > my $temp; > my $extended_param = plugin_parameters( $dbh, $temp, $tagslib, $subfield_data{id}, \@loop_data ); > my ( $function_name, $javascript ) = plugin_javascript( $dbh, $temp, $tagslib, $subfield_data{id}, \@loop_data ); >- $subfield_data{marc_value} = qq[<input $attributes >+ $subfield_data{marc_value} = qq[<input type="text" $attributes > onfocus="Focus$function_name($subfield_data{random}, '$subfield_data{id}');" > onblur=" Blur$function_name($subfield_data{random}, '$subfield_data{id}');" /> > <a href="#" class="buttonDot" onclick="Clic$function_name('$subfield_data{id}'); return false;" title="Tag Editor">...</a> > $javascript]; > } else { > warn "Plugin Failed: $plugin"; >- $subfield_data{marc_value} = "<input $attributes />"; # supply default input form >+ $subfield_data{marc_value} = "<input type=\"text\" $attributes />"; # supply default input form > } > } > elsif ( $tag eq '' ) { # it's an hidden field >@@ -419,7 +419,7 @@ foreach my $tag (sort keys %{$tagslib}) { > $subfield_data{marc_value} = "<textarea $attributes_no_value>$value</textarea>\n"; > } else { > # it's a standard field >- $subfield_data{marc_value} = "<input $attributes />"; >+ $subfield_data{marc_value} = "<input type=\"text\" $attributes />"; > } > # $subfield_data{marc_value}="<input type=\"text\" name=\"field_value\">"; > push (@loop_data, \%subfield_data); >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7455
:
7257
|
7258
|
7259
|
10884
|
11032
|
11338
|
11850
|
11866
|
11908
|
11909
|
12216
|
12313
|
12314
|
12315
|
12546
|
12827
|
12828
|
12982
|
12983
|
12984
|
12985