From c7147fcde03f7ba1ac13e485adcac587f2dde85c Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 18 Jun 2019 15:32:24 +0000 Subject: [PATCH] Bug 23159: Reindent addbiblio.tt This patch corrects whitespace in the basic MARC editor template, addbiblio.tt: Tabs converted to spaces, indentation corrected. Some comments have been added in the markup to clarify the page structure. To test, apply the patch and open the basic MARC editor. Confirm that everything works correctly, including: - Showing/hiding subfields - Re-ordering subfields - Removing tags and subfields - Cloning tags and subfields - Plugin links Use the "-w" flag when using diff to examine the patch. The only changes should be places where single lines were broken up and where comments were added. Signed-off-by: Mark Tompsett Signed-off-by: Marcel de Rooy Signed-off-by: Martin Renvoize --- .../prog/en/modules/cataloguing/addbiblio.tt | 1194 +++++++++-------- 1 file changed, 611 insertions(+), 583 deletions(-) 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 b248af3acc..c9e4ab6819 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -16,7 +16,7 @@ $("#loading").hide(); }); var Sticky; - $(document).ready(function() { + $(document).ready(function() { [% IF bib_doesnt_exist %] $("#addbibliotabs").hide(); @@ -24,8 +24,8 @@ [% END %] $('#addbibliotabs').tabs().bind('show.ui-tabs', function(e, ui) { - $("#"+ui.panel.id+" input:eq(0)").focus(); - }); + $("#"+ui.panel.id+" input:eq(0)").focus(); + }); [% IF tab %] $('#addbibliotabs').selectTabByID("tab[% tab | html %]"); @@ -158,263 +158,271 @@ }); -function redirect(dest){ - $("#redirect").attr("value",dest); - return Check(); -} - -[% IF ( CAN_user_editcatalogue_edit_items ) %] - var onOption = function () { + function redirect(dest){ + $("#redirect").attr("value",dest); return Check(); } -[% END %] - -function confirmnotdup(redirect){ - $("#confirm_not_duplicate").attr("value","1"); - $("#redirect").attr("value",redirect); - Check(); -} - -function Dopop(link,i) { - defaultvalue = document.getElementById(i).value; - window.open(link+"&result="+defaultvalue,"valuebuilder",'width=700,height=550,toolbar=false,scrollbars=yes'); -} - -/** - * this function open a popup to search on z3950 server. - */ -function PopupZ3950() { - var strQuery = GetZ3950Terms(); - if(strQuery){ - window.open("/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=[% biblionumber | html %]"+strQuery,"z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes'); - } -} - -function PopupMARCFieldDoc(field) { - [% IF Koha.Preference('marcfielddocurl') %] - var docurl = "[% Koha.Preference('marcfielddocurl').replace('"','"') | html %]"; - docurl = docurl.replace("{MARC}", "[% marcflavour | html %]"); - docurl = docurl.replace("{FIELD}", ""+field); - docurl = docurl.replace("{LANG}", "[% lang | html %]"); - window.open(docurl); - [% ELSIF ( marcflavour == 'MARC21' ) %] - _MARC21FieldDoc(field); - [% ELSIF ( marcflavour == 'UNIMARC' ) %] - _UNIMARCFieldDoc(field); + + [% IF ( CAN_user_editcatalogue_edit_items ) %] + var onOption = function () { + return Check(); + } [% END %] -} - -function _MARC21FieldDoc(field) { - if(field == 0) { - window.open("http://www.loc.gov/marc/bibliographic/bdleader.html"); - } else if (field < 900) { - window.open("http://www.loc.gov/marc/bibliographic/bd" + ("000"+field).slice(-3) + ".html"); - } else { - window.open("http://www.loc.gov/marc/bibliographic/bd9xx.html"); + + function confirmnotdup(redirect){ + $("#confirm_not_duplicate").attr("value","1"); + $("#redirect").attr("value",redirect); + Check(); } -} - -function _UNIMARCFieldDoc(field) { - /* http://archive.ifla.org/VI/3/p1996-1/ is an outdated version of UNIMARC, but - seems to be the only version available that can be linked to per tag. More recent - versions of the UNIMARC standard are available on the IFLA website only as - PDFs! - */ - var url; - if (field == 0) { - url = "http://archive.ifla.org/VI/3/p1996-1/uni.htm"; - } else { - var first = field.substring(0,1); - url = "http://archive.ifla.org/VI/3/p1996-1/uni" + first + ".htm#"; - if (first == 0) url = url + "b"; - url = first == 9 - ? "http://archive.ifla.org/VI/3/p1996-1/uni9.htm" - : url + field; + + function Dopop(link,i) { + defaultvalue = document.getElementById(i).value; + window.open(link+"&result="+defaultvalue,"valuebuilder",'width=700,height=550,toolbar=false,scrollbars=yes'); } - window.open(url); -} - -/* - * Functions to hide/show marc docs and tags links - */ - -function toggleMARCdocLinks(flag){ - if( flag === true ){ - $(".marcdocs").show(); - $.cookie("marcdocs_[% borrowernumber | html %]",'show', { path: "/", expires: 365 }); - $("#marcDocsSelect i").addClass('fa-check-square-o').removeClass('fa-square-o'); - } else { - $(".marcdocs").hide(); - $.cookie("marcdocs_[% borrowernumber | html %]",'hide', { path: "/", expires: 365 }); - $("#marcDocsSelect i").removeClass('fa-check-square-o').addClass('fa-square-o'); + + /** + * this function open a popup to search on z3950 server. + */ + function PopupZ3950() { + var strQuery = GetZ3950Terms(); + if(strQuery){ + window.open("/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=[% biblionumber | html %]"+strQuery,"z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes'); + } } -} - -function toggleMARCTagLinks(flag){ - if( flag === true ){ - $(".tagnum").show(); - $(".subfieldcode").show(); - $.cookie("marctags_[% borrowernumber | html %]",'show', { path: "/", expires: 365 }); - $("#marcTagsSelect i").addClass('fa-check-square-o').removeClass('fa-square-o'); - } else { - $(".tagnum").hide(); - $(".subfieldcode").hide(); - $.cookie("marctags_[% borrowernumber | html %]",'hide', { path: "/", expires: 365 }); - $("#marcTagsSelect i").removeClass('fa-check-square-o').addClass('fa-square-o'); + + function PopupMARCFieldDoc(field) { + [% IF Koha.Preference('marcfielddocurl') %] + var docurl = "[% Koha.Preference('marcfielddocurl').replace('"','"') | html %]"; + docurl = docurl.replace("{MARC}", "[% marcflavour | html %]"); + docurl = docurl.replace("{FIELD}", ""+field); + docurl = docurl.replace("{LANG}", "[% lang | html %]"); + window.open(docurl); + [% ELSIF ( marcflavour == 'MARC21' ) %] + _MARC21FieldDoc(field); + [% ELSIF ( marcflavour == 'UNIMARC' ) %] + _UNIMARCFieldDoc(field); + [% END %] + } + + function _MARC21FieldDoc(field) { + if(field == 0) { + window.open("http://www.loc.gov/marc/bibliographic/bdleader.html"); + } else if (field < 900) { + window.open("http://www.loc.gov/marc/bibliographic/bd" + ("000"+field).slice(-3) + ".html"); + } else { + window.open("http://www.loc.gov/marc/bibliographic/bd9xx.html"); + } } -} - -/** - * check if mandatory subfields are written - */ -function AreMandatoriesNotOk(){ - var mandatories = new Array(); - var mandatoriesfields = new Array(); - var tab = new Array(); - var label = new Array(); - var flag=0; - var tabflag= new Array(); - [% FOREACH BIG_LOO IN BIG_LOOP %] - [% FOREACH innerloo IN BIG_LOO.innerloop %] - [% IF ( innerloo.mandatory ) %] - mandatoriesfields.push(new Array("[% innerloo.tag | html %]","[% innerloo.index | html %][% innerloo.random | html %]","[% innerloo.index | html %]")); - [% END %] - [% FOREACH subfield_loo IN innerloo.subfield_loop %] - [% IF ( subfield_loo.mandatory ) %]mandatories.push("[% subfield_loo.id | html %]"); - tab.push("[% BIG_LOO.number | html %]"); - label.push("[% subfield_loo.marc_lib | $raw %]"); + + function _UNIMARCFieldDoc(field) { + /* http://archive.ifla.org/VI/3/p1996-1/ is an outdated version of UNIMARC, but + seems to be the only version available that can be linked to per tag. More recent + versions of the UNIMARC standard are available on the IFLA website only as + PDFs! + */ + var url; + if (field == 0) { + url = "http://archive.ifla.org/VI/3/p1996-1/uni.htm"; + } else { + var first = field.substring(0,1); + url = "http://archive.ifla.org/VI/3/p1996-1/uni" + first + ".htm#"; + if (first == 0) url = url + "b"; + url = first == 9 + ? "http://archive.ifla.org/VI/3/p1996-1/uni9.htm" + : url + field; + } + window.open(url); + } + + /* + * Functions to hide/show marc docs and tags links + */ + + function toggleMARCdocLinks(flag){ + if( flag === true ){ + $(".marcdocs").show(); + $.cookie("marcdocs_[% borrowernumber | html %]",'show', { path: "/", expires: 365 }); + $("#marcDocsSelect i").addClass('fa-check-square-o').removeClass('fa-square-o'); + } else { + $(".marcdocs").hide(); + $.cookie("marcdocs_[% borrowernumber | html %]",'hide', { path: "/", expires: 365 }); + $("#marcDocsSelect i").removeClass('fa-check-square-o').addClass('fa-square-o'); + } + } + + function toggleMARCTagLinks(flag){ + if( flag === true ){ + $(".tagnum").show(); + $(".subfieldcode").show(); + $.cookie("marctags_[% borrowernumber | html %]",'show', { path: "/", expires: 365 }); + $("#marcTagsSelect i").addClass('fa-check-square-o').removeClass('fa-square-o'); + } else { + $(".tagnum").hide(); + $(".subfieldcode").hide(); + $.cookie("marctags_[% borrowernumber | html %]",'hide', { path: "/", expires: 365 }); + $("#marcTagsSelect i").removeClass('fa-check-square-o').addClass('fa-square-o'); + } + } + + /** + * check if mandatory subfields are written + */ + function AreMandatoriesNotOk(){ + var mandatories = new Array(); + var mandatoriesfields = new Array(); + var tab = new Array(); + var label = new Array(); + var flag=0; + var tabflag= new Array(); + [% FOREACH BIG_LOO IN BIG_LOOP %] + [% FOREACH innerloo IN BIG_LOO.innerloop %] + [% IF ( innerloo.mandatory ) %] + mandatoriesfields.push(new Array("[% innerloo.tag | html %]","[% innerloo.index | html %][% innerloo.random | html %]","[% innerloo.index | html %]")); + [% END %] + [% FOREACH subfield_loo IN innerloo.subfield_loop %] + [% IF ( subfield_loo.mandatory ) %]mandatories.push("[% subfield_loo.id | html %]"); + tab.push("[% BIG_LOO.number | html %]"); + label.push("[% subfield_loo.marc_lib | $raw %]"); + [% END %] [% END %] [% END %] [% END %] - [% END %] - var StrAlert = _("Can't save this record because the following field aren't filled:"); - StrAlert += "\n\n"; - for(var i=0,len=mandatories.length; i= 10){ - elem = document.getElementById(divid); - eleminputs = elem.getElementsByTagName('input'); - - for(var j=0,len2=eleminputs.length; j= 10){ + elem = document.getElementById(divid); + eleminputs = elem.getElementsByTagName('input'); + + for(var j=0,len2=eleminputs.length; j [% Asset.css("css/addbiblio.css") | $raw %] @@ -433,367 +441,387 @@ function Changefwk() {
Loading, please wait...
-[% INCLUDE 'header.inc' %] - - - -
-
-
+ [% INCLUDE 'header.inc' %] -

-[% IF ( biblionumber ) %]Editing [% title | html %] (Record number [% biblionumber | html %]) -[% ELSE %]Add MARC record [% IF (circborrowernumber) %](fast cataloging)[% END %] -[% END %] -

- -[% UNLESS ( number ) %] - - [% IF ( duplicatebiblionumber ) %] -
-

Duplicate record suspected

-

Is this a duplicate of [% duplicatetitle | html %] ?

- [% IF ( CAN_user_editcatalogue_edit_items ) %]
- - -
[% ELSE %]
- - -
[% END %] -
- [% IF ( CAN_user_editcatalogue_edit_items ) %][% ELSE %][% END %] -
-
- [% END %] - [% END %] - -[% IF ( done ) %] - -[% ELSE %] -
- - - -[% END %] - -
- [% IF CAN_user_editcatalogue_edit_items or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) %] - [% IF (circborrowernumber) %][%# fast cataloging must lead to items %] - - + - [% UNLESS (circborrowernumber) %][%# Hide in fast cataloging %] - - [% END %] +
+
+
-
- - -
- [% UNLESS (circborrowernumber) %][%# Hide in fast cataloging %] - [% IF (biblionumber) %] - [% IF ( BiblioDefaultViewmarc ) %] -
- Cancel -
- [% ELSIF ( BiblioDefaultViewlabeled_marc ) %] -
- Cancel -
- [% ELSIF ( BiblioDefaultViewisbd ) %] -
- Cancel -
- [% ELSE %] -
- Cancel -
- [% END %] - [% ELSE %] - Cancel - [% END %] - [% END %] -
- [% IF ( BIG_LOOP.size > 1 ) %] -
    - [%- FOREACH BIG_LOO IN BIG_LOOP -%] - [% IF loop.first %] -
  • - [% ELSE %] -
  • - [% END %] - [% BIG_LOO.number | html %] -
  • - [%- END -%] -
- [% END %] -
    - [% FOREACH BIG_LOO IN BIG_LOOP %] - [% IF loop.first %][% SET tab_selected = "tab_selected" %][% ELSE %][% SET tab_selected = "" %][% END %] - [% FOREACH innerloo IN BIG_LOO.innerloop %] - [% IF ( innerloo.tag ) %] -
  • - [% innerloo.tag | uri %] -
  • + + + [% UNLESS ( number ) %] + + [% IF ( duplicatebiblionumber ) %] +
    +

    Duplicate record suspected

    +

    Is this a duplicate of [% duplicatetitle | html %] ?

    + [% IF ( CAN_user_editcatalogue_edit_items ) %] + + + + + [% ELSE %] +
    + + +
    + [% END %] +
    + [% IF ( CAN_user_editcatalogue_edit_items ) %] + + [% ELSE %] + + [% END %] +
    +
    [% END %] [% END %] - [% END %] -
-
-
-[% IF bib_doesnt_exist %] -
- The record you are trying to edit doesn't exist.
- Add a new record or do a catalog search. -
-[% END %] - -[% IF ( popup ) %] - -[% END %] - - - - - - -
- - -[% FOREACH BIG_LOO IN BIG_LOOP %] -
- - [% IF ( BIG_LOOP.size > 1 ) %] -

Section [% BIG_LOO.number | html %]

- [% END %] - [% FOREACH innerloo IN BIG_LOO.innerloop %] - [% IF ( innerloo.tag ) %] -
-
- [% IF advancedMARCEditor %] - [% innerloo.tag | html %] - [% ELSE %] - [% innerloo.tag | html %] - [% IF marcflavour != 'NORMARC' %] ?[% END %] - [% END %] - [% IF ( innerloo.fixedfield ) %] - - + [% IF ( done ) %] + [% ELSE %] - - - [% END %] - - - [% UNLESS advancedMARCEditor %] - [% innerloo.tag_lib | html %] - [% END %] - - [% IF ( innerloo.repeatable ) %] - - Repeat this Tag - +
+ + + [% END %] - - Delete this Tag - - - -
- [% FOREACH subfield_loo IN innerloo.subfield_loop %] - -
- - [% UNLESS advancedMARCEditor %] - [% IF ( subfield_loo.fixedfield ) %]
- - [% END %] + [% IF ( popup ) %] + + [% END %] + + + + + + +
+ + + [% FOREACH BIG_LOO IN BIG_LOOP %] +
+ + [% IF ( BIG_LOOP.size > 1 ) %] +

Section [% BIG_LOO.number | html %]

+ [% END %] + [% FOREACH innerloo IN BIG_LOO.innerloop %] + [% IF ( innerloo.tag ) %] +
+
+ [% IF advancedMARCEditor %] + [% innerloo.tag | html %] + [% ELSE %] + [% innerloo.tag | html %] + [% IF marcflavour != 'NORMARC' %] ?[% END %] + [% END %] + + [% IF ( innerloo.fixedfield ) %] + + + [% ELSE %] + + + [% END %] - + + [% UNLESS advancedMARCEditor %] + [% innerloo.tag_lib | html %] + [% END %] + + + [% IF ( innerloo.repeatable ) %] + + Repeat this Tag + + [% END %] + + Delete this Tag + + +
+ + [% FOREACH subfield_loo IN innerloo.subfield_loop %] + +
+ [% UNLESS advancedMARCEditor %] + [% IF ( subfield_loo.fixedfield ) %] +
+ + [% END %] +
+ [% END %] + [% END %] +
+ [% END %] +
+ + [%# Fields for fast cataloging %] + + + + + + [%# End of fields for fast cataloging %] + +
- [% END %] - [% END %] -
-[% END %] - -
- -[%# Fields for fast cataloging %] - - - - - -[%# End of fields for fast cataloging %] - - - -
-
[% INCLUDE 'intranet-bottom.inc' %] -- 2.39.5