|
Lines 1-1262
Link Here
|
| 1 |
[% USE raw %] |
|
|
| 2 |
[% USE Asset %] |
| 3 |
[% USE Koha %] |
| 4 |
[% USE HtmlTags %] |
| 5 |
[% PROCESS 'i18n.inc' %] |
| 6 |
[% INCLUDE 'doc-head-open.inc' %] |
| 7 |
<title |
| 8 |
>[% FILTER collapse %] |
| 9 |
[% IF( biblionumber ) %] |
| 10 |
[% tx("Editing {title} (Record number {biblionumber})", { title = title, biblionumber = biblionumber }) | html %] |
| 11 |
[% ELSE %] |
| 12 |
[% t("Add MARC record") | html %] |
| 13 |
[% END %] |
| 14 |
› [% t("Cataloging") | html %] › [% t("Koha") | html %] |
| 15 |
[% END %]</title |
| 16 |
> |
| 17 |
[% INCLUDE 'doc-head-close.inc' %] |
| 18 |
[% INCLUDE 'calendar.inc' %] |
| 19 |
[% Asset.js( "lib/sortable/Sortable.min.js" ) | $raw %] |
| 20 |
[% INCLUDE 'select2.inc' %] |
| 21 |
<script> |
| 22 |
[% IF Koha.Preference('CreateAVFromCataloguing') && CAN_user_parameters_manage_auth_values %] |
| 23 |
var auth_values_creation = 1; |
| 24 |
[% ELSE %] |
| 25 |
var auth_values_creation = 0; |
| 26 |
[% END %] |
| 27 |
$.fn.select2.defaults.set("width", "100%" ); |
| 28 |
</script> |
| 29 |
[% Asset.js("js/cataloging.js") | $raw %] |
| 30 |
[% Asset.js("js/browser.js") | $raw %] |
| 31 |
<script> |
| 32 |
var browser = KOHA.browser('[% searchid | html %]', parseInt('[% biblionumber | html %]', 10)); |
| 33 |
browser.show(); |
| 34 |
|
| 35 |
$(window).load(function(){ |
| 36 |
$("#loading").hide(); |
| 37 |
}); |
| 38 |
|
| 39 |
function changeEditor() { |
| 40 |
|
| 41 |
var breedingid = [% breedingid || "null" | html %]; |
| 42 |
|
| 43 |
if ( !confirm( breedingid ? _("This record cannot be transferred to the advanced editor. Continue?") : _("Any changes will not be saved. Continue?") ) ) return false; |
| 44 |
|
| 45 |
Cookies.set( 'catalogue_editor_[% logged_in_user.borrowernumber | html %]', 'advanced', { expires: 365, path: '/', sameSite: 'Lax' } ); |
| 46 |
|
| 47 |
var biblionumber = [% biblionumber || "null" | html %]; |
| 48 |
|
| 49 |
if ( biblionumber ) { |
| 50 |
window.location = '/cgi-bin/koha/cataloguing/editor.pl#catalog/' + biblionumber; |
| 51 |
} else { |
| 52 |
window.location = '/cgi-bin/koha/cataloguing/editor.pl'; |
| 53 |
} |
| 54 |
|
| 55 |
return false; |
| 56 |
} |
| 57 |
|
| 58 |
$(document).ready(function() { |
| 59 |
|
| 60 |
[% IF bib_doesnt_exist %] |
| 61 |
$("#addbibliotabs").hide(); |
| 62 |
$("#toolbar").hide(); |
| 63 |
[% END %] |
| 64 |
|
| 65 |
$("a[data-bs-toggle='tab']").on("shown.bs.tab", function (e) { |
| 66 |
$( e.target.hash + " .input_marceditor:visible:eq(0)").focus(); |
| 67 |
}); |
| 68 |
|
| 69 |
/* On page load, check for location.hash in the page URL */ |
| 70 |
/* If present the location hash will be used to activate the correct tab */ |
| 71 |
var hash = location.hash; |
| 72 |
var hashPieces = hash.split('?'); |
| 73 |
if( hashPieces[0] !== "" ){ |
| 74 |
selectTab( hashPieces[0] ); |
| 75 |
window.scrollTo( 0, 0 ); |
| 76 |
} else { |
| 77 |
selectTab( "#tab0XX_panel" ); |
| 78 |
} |
| 79 |
|
| 80 |
initializeSortable("#addbibliotabs ul.sortable_field"); |
| 81 |
initializeSortable("#addbibliotabs ul.sortable_subfield"); |
| 82 |
|
| 83 |
[% IF tab %] |
| 84 |
hash = "#[% tab | html %]"; |
| 85 |
selectTab( hash ); |
| 86 |
[% END %] |
| 87 |
|
| 88 |
/* check cookie to hide/show marcdocs*/ |
| 89 |
if( Cookies.get("marcdocs_[% borrowernumber | html %]") == 'hide'){ |
| 90 |
toggleMARCdocLinks(false); |
| 91 |
} else { |
| 92 |
toggleMARCdocLinks(true); |
| 93 |
} |
| 94 |
|
| 95 |
$("#marcDocsSelect").click(function(){ |
| 96 |
if( Cookies.get("marcdocs_[% borrowernumber | html %]") == 'hide'){ |
| 97 |
toggleMARCdocLinks(true); |
| 98 |
} else { |
| 99 |
toggleMARCdocLinks(false); |
| 100 |
} |
| 101 |
}); |
| 102 |
|
| 103 |
/* check cookie to hide/show marc tags*/ |
| 104 |
var marctags_cookie = Cookies.get("marctags_[% borrowernumber | html %]"); |
| 105 |
if( marctags_cookie == 'hide'){ |
| 106 |
toggleMARCTagLinks(false); |
| 107 |
} else if( marctags_cookie == 'show'){ |
| 108 |
toggleMARCTagLinks(true) |
| 109 |
} else { |
| 110 |
[% UNLESS Koha.Preference("hide_marc") %] |
| 111 |
toggleMARCTagLinks(true) |
| 112 |
[% ELSE %] |
| 113 |
toggleMARCTagLinks(false); |
| 114 |
[% END %] |
| 115 |
} |
| 116 |
|
| 117 |
$("#marcTagsSelect").click(function(){ |
| 118 |
if( Cookies.get("marctags_[% borrowernumber | html %]") == 'hide'){ |
| 119 |
toggleMARCTagLinks(true) |
| 120 |
} else { |
| 121 |
toggleMARCTagLinks(false); |
| 122 |
} |
| 123 |
}); |
| 124 |
|
| 125 |
$("#z3950search").click(function(){ |
| 126 |
PopupZ3950(); |
| 127 |
}); |
| 128 |
|
| 129 |
$("#linkerbutton").click(function(){ |
| 130 |
AutomaticLinker(); |
| 131 |
}); |
| 132 |
|
| 133 |
$("#saverecord").click(function(){ |
| 134 |
$(".btn-group").removeClass("open"); |
| 135 |
onOption(); |
| 136 |
return false; |
| 137 |
}); |
| 138 |
|
| 139 |
$("#saveandview").click(function(){ |
| 140 |
$(".btn-group").removeClass("open"); |
| 141 |
redirect("view"); |
| 142 |
return false; |
| 143 |
}); |
| 144 |
|
| 145 |
$("#saveanditems").click(function(){ |
| 146 |
$(".btn-group").removeClass("open"); |
| 147 |
redirect("items"); |
| 148 |
return false; |
| 149 |
}); |
| 150 |
$("#saveandcontinue").click(function(){ |
| 151 |
$(".btn-group").removeClass("open"); |
| 152 |
var tab = $("#addbibliotabs div.active:first").attr('id'); |
| 153 |
$("#current_tab").val(tab); |
| 154 |
redirect("just_save", tab); |
| 155 |
return false; |
| 156 |
}); |
| 157 |
|
| 158 |
$( '#toggleEditor' ).change( function() { |
| 159 |
changeEditor(); |
| 160 |
} ); |
| 161 |
|
| 162 |
$( '#switcheditor' ).click( function() { |
| 163 |
changeEditor(); |
| 164 |
} ); |
| 165 |
|
| 166 |
$(".change-framework").on("click", function(){ |
| 167 |
var frameworkcode = $(this).data("frameworkcode"); |
| 168 |
$("#frameworkcode").val( frameworkcode ); |
| 169 |
Changefwk(); |
| 170 |
}); |
| 171 |
|
| 172 |
$(".toolbar-tabs-container .nav-tabs a").on("click",function(e){ |
| 173 |
e.preventDefault(); |
| 174 |
selectTab( this.hash ); |
| 175 |
}); |
| 176 |
|
| 177 |
$(".tag_anchor").on("click", function(e){ |
| 178 |
e.preventDefault(); |
| 179 |
$(".tag_anchor").removeClass("selected"); |
| 180 |
$(this).addClass("selected"); |
| 181 |
var link = this.href; |
| 182 |
var linkid = link.substring( link.indexOf("#") + 1 ); |
| 183 |
window.scrollTo( 0, getScrollto( linkid, "toolbar" ) ); |
| 184 |
}); |
| 185 |
|
| 186 |
$("body").on("click", ".linkfield", function(e){ |
| 187 |
e.preventDefault(); |
| 188 |
var tab = $(this).data("tab"); |
| 189 |
var field = $(this).data("field"); |
| 190 |
var tablink = $("a[data-tabname='tab" + tab + "XX']" ).get(0).hash; |
| 191 |
selectTab( tablink ); |
| 192 |
window.scrollTo( 0, getScrollto( field, "toolbar" ) ); |
| 193 |
}); |
| 194 |
|
| 195 |
$("body").on("click", ".show-errors", function(e){ |
| 196 |
document.getElementById("form-errors").scrollIntoView(); |
| 197 |
}); |
| 198 |
|
| 199 |
}); |
| 200 |
|
| 201 |
function selectTab( tablink ){ |
| 202 |
/* return if no tabs displayed (BIG_LOOP.size <= 1) */ |
| 203 |
if ($(".toolbar-tabs-container .nav-tabs li").length === 0){ |
| 204 |
return; |
| 205 |
} |
| 206 |
let a = $("a[href='" + tablink + "']"); |
| 207 |
$(".toolbar-tabs-container .nav-tabs li").removeClass("selected"); |
| 208 |
a.tab("show").parent().addClass("selected"); |
| 209 |
/* Get number from string like "tab9XX" */ |
| 210 |
var tabid = a.data("tabname").substring(3, 4); |
| 211 |
$(".tag_anchors").removeClass("tab_selected").hide(); |
| 212 |
$(".tag_anchors_" + tabid ).addClass("tab_selected").show(); |
| 213 |
} |
| 214 |
|
| 215 |
function redirect(dest){ |
| 216 |
$("#redirect").attr("value",dest); |
| 217 |
return Check(); |
| 218 |
} |
| 219 |
|
| 220 |
[% IF ( CAN_user_editcatalogue_edit_items ) %] |
| 221 |
var onOption = function () { |
| 222 |
return Check(); |
| 223 |
} |
| 224 |
[% END %] |
| 225 |
|
| 226 |
/** |
| 227 |
* this function append button for create new authority if not found |
| 228 |
*/ |
| 229 |
|
| 230 |
function addCreateAuthorityButton(tag_subfield_line, heading, tag_index) { |
| 231 |
var title = _("Create authority"); |
| 232 |
var elem = $('<a href="#" title="' + title + '"><i class="fa fa-plus-circle"></i></a>'); |
| 233 |
tag_subfield_line.append(elem); |
| 234 |
var tag_subfield_line_a = $('.subfield_line[id^=subfield' + heading.tag + 'a]').eq(tag_index); |
| 235 |
var subfield_a = tag_subfield_line_a.find('.input_marceditor').eq(0); |
| 236 |
var index = subfield_a.attr('id'); |
| 237 |
elem.click(function() { |
| 238 |
var popup = window.open("", "new_auth_popup",'fullscreen,toolbar=false,scrollbars=yes'); |
| 239 |
if(popup !== null) { |
| 240 |
// Create a new form that will be POSTed in the new window |
| 241 |
var form = $('<form>').attr({ |
| 242 |
method: 'get', |
| 243 |
action: "/cgi-bin/koha/authorities/authorities.pl", |
| 244 |
target: "new_auth_popup" |
| 245 |
}); |
| 246 |
//add the authtypecode |
| 247 |
form.append($('<input>').attr({ |
| 248 |
type: 'hidden', |
| 249 |
name: 'authtypecode', |
| 250 |
value: heading.auth_type |
| 251 |
})); |
| 252 |
form.append($('<input>').attr({ |
| 253 |
type: 'hidden', |
| 254 |
name: 'tagreport', |
| 255 |
value: heading.tag_to_report |
| 256 |
})); |
| 257 |
form.append($('<input>').attr({ |
| 258 |
type: 'hidden', |
| 259 |
name: 'tagbiblio', |
| 260 |
value: heading.tag |
| 261 |
})); |
| 262 |
form.append($('<input>').attr({ |
| 263 |
type: 'hidden', |
| 264 |
name: 'index', |
| 265 |
value: index |
| 266 |
})); |
| 267 |
$('.tag[id^=tag_' + heading.tag + '_]').eq(tag_index).find(':input').each(function(){ |
| 268 |
form.append($('<input>').attr({ |
| 269 |
type: 'hidden', |
| 270 |
name: this.name.split('_',4).join(''), |
| 271 |
value: $(this).val() |
| 272 |
})); |
| 273 |
}); |
| 274 |
$('body').append(form); |
| 275 |
form.submit(); |
| 276 |
form.remove(); |
| 277 |
} |
| 278 |
return false; |
| 279 |
}); |
| 280 |
|
| 281 |
} |
| 282 |
|
| 283 |
/** |
| 284 |
* Updates the authid for every heading field |
| 285 |
* Adds visual feedback for the changes made on the form. |
| 286 |
*/ |
| 287 |
function updateHeadingLinks(links) { |
| 288 |
var current_tag = ''; |
| 289 |
var tag_index = 0; |
| 290 |
|
| 291 |
// Delete the old message dialog and create a new one |
| 292 |
$('#autolinker_dialog').remove(); |
| 293 |
var message_dialog = $('<div id="autolinker_dialog" class="alert alert-info"><strong>' + _("Automatic authority link results:") + '</strong><ul></ul></div>'); |
| 294 |
var message_dialog_ul = message_dialog.find('ul'); |
| 295 |
|
| 296 |
$.each(links, function(index, heading) { |
| 297 |
if(current_tag == heading.tag) { |
| 298 |
tag_index++; |
| 299 |
} |
| 300 |
else { |
| 301 |
current_tag = heading.tag; |
| 302 |
tag_index = 0; |
| 303 |
} |
| 304 |
|
| 305 |
// Find the $9 field to update |
| 306 |
var tag_subfield_line = $('.subfield_line[id^=subfield' + heading.tag + '9]').eq(tag_index); |
| 307 |
if( tag_subfield_line.length < 1 ){ return; } |
| 308 |
|
| 309 |
var subfield = tag_subfield_line.find('.input_marceditor').eq(0); |
| 310 |
subfield.removeClass("matching_authority_field no_matching_authority_field"); |
| 311 |
|
| 312 |
// Delete the old status if one exists |
| 313 |
tag_subfield_line.children('.subfield_status').remove(); |
| 314 |
|
| 315 |
// If the field wasn't modified. Skip it. |
| 316 |
if(heading.status == 'UNCHANGED') { |
| 317 |
return; |
| 318 |
} |
| 319 |
|
| 320 |
|
| 321 |
// Make the subfield line visible and update its value |
| 322 |
tag_subfield_line.show(); |
| 323 |
subfield.val(heading.authid); |
| 324 |
|
| 325 |
// Add the new status |
| 326 |
var image = '<i class="fa fa-xmark subfield_status no_matching_authority" </i> '; |
| 327 |
var message = ''; |
| 328 |
var field_class = 'no_matching_authority_field'; |
| 329 |
switch(heading.status) { |
| 330 |
case 'LOCAL_FOUND': |
| 331 |
image = '<i class="fa fa-check subfield_status matching_authority"</i> '; |
| 332 |
message = _("A matching authority was found in the local database."); |
| 333 |
field_class = 'matching_authority_field'; |
| 334 |
break; |
| 335 |
case 'CREATED': |
| 336 |
image = '<i class="fa fa-check subfield_status matching_authority"></i> '; |
| 337 |
message = _("No matching authority found. A new authority was created automatically."); |
| 338 |
field_class = 'matching_authority_field'; |
| 339 |
break; |
| 340 |
case 'MULTIPLE_MATCH': |
| 341 |
message = _("More than one local match found. Possibly a duplicate authority!"); |
| 342 |
break; |
| 343 |
case 'NONE_FOUND': |
| 344 |
message = _("No matching authority found."); |
| 345 |
break; |
| 346 |
default: |
| 347 |
message = heading.status; |
| 348 |
break; |
| 349 |
} |
| 350 |
|
| 351 |
subfield[0].classList.add(field_class); |
| 352 |
tag_subfield_line.find('i').each(function() { |
| 353 |
this.remove(); |
| 354 |
}); |
| 355 |
tag_subfield_line.append(image); |
| 356 |
|
| 357 |
// Add the message to the dialog |
| 358 |
message_dialog_ul.append('<li><strong>' + heading.tag + '</strong> - ' + message + '</li>'); |
| 359 |
|
| 360 |
// Add a link to create a new authority if none was found |
| 361 |
if(heading.status == 'NONE_FOUND' && tag_subfield_line.find('i').length == 1) { |
| 362 |
addCreateAuthorityButton(tag_subfield_line, heading , tag_index); |
| 363 |
} |
| 364 |
}); |
| 365 |
|
| 366 |
if(message_dialog.find('li').length == 0) { |
| 367 |
message_dialog_ul.append("<li>" + _("No authority link was changed.") + "</li>"); |
| 368 |
} |
| 369 |
$('#addbibliotabs').before(message_dialog); |
| 370 |
} |
| 371 |
|
| 372 |
/** |
| 373 |
* Use an ajax request to automatically find authority links for the current record |
| 374 |
*/ |
| 375 |
function AutomaticLinker() { |
| 376 |
// Show the Loading overlay |
| 377 |
$("#loading").show(); |
| 378 |
|
| 379 |
// Remove fields that are completely empty |
| 380 |
$('#f').find('.tag').each(function() { |
| 381 |
var empty = true; |
| 382 |
$(this).find('.input_marceditor').each(function() { |
| 383 |
if($(this).val() != '') { |
| 384 |
empty = false; |
| 385 |
return false; |
| 386 |
} |
| 387 |
}); |
| 388 |
if(empty) { |
| 389 |
UnCloneField($(this).attr('id')); |
| 390 |
} |
| 391 |
}); |
| 392 |
|
| 393 |
// Get all the form values to post via AJAX |
| 394 |
var form_data = {}; |
| 395 |
$('#f').find(':input').each(function(){ |
| 396 |
form_data[this.name] = $(this).val(); |
| 397 |
}); |
| 398 |
delete form_data['']; |
| 399 |
|
| 400 |
// Send the data to automatic_linker.pl |
| 401 |
$.ajax({ |
| 402 |
url:'/cgi-bin/koha/svc/cataloguing/automatic_linker.pl', |
| 403 |
type:'post', |
| 404 |
data: form_data, |
| 405 |
dataType: 'json', |
| 406 |
error: function(xhr) { |
| 407 |
alert("Error : \n" + xhr.responseText); |
| 408 |
}, |
| 409 |
success: function(json) { |
| 410 |
switch(json.status) { |
| 411 |
case 'UNAUTHORIZED': |
| 412 |
alert(_("Error : You do not have the permissions necessary to use this functionality.")); |
| 413 |
break; |
| 414 |
case 'OK': |
| 415 |
updateHeadingLinks(json.links); |
| 416 |
break; |
| 417 |
} |
| 418 |
}, |
| 419 |
complete: function() { |
| 420 |
$("#loading").hide(); |
| 421 |
} |
| 422 |
}); |
| 423 |
} |
| 424 |
|
| 425 |
|
| 426 |
function PopupMARCFieldDoc() { |
| 427 |
let field = this.dataset.tag; |
| 428 |
[% IF Koha.Preference('marcfielddocurl') %] |
| 429 |
var docurl = "[% Koha.Preference('marcfielddocurl').replace('"','"') | html %]"; |
| 430 |
docurl = docurl.replace("{MARC}", "[% marcflavour | html %]"); |
| 431 |
docurl = docurl.replace("{FIELD}", ""+field); |
| 432 |
docurl = docurl.replace("{LANG}", "[% lang | html %]"); |
| 433 |
window.open(docurl); |
| 434 |
[% ELSIF ( marcflavour == 'MARC21' ) %] |
| 435 |
_MARC21FieldDoc(field); |
| 436 |
[% ELSIF ( marcflavour == 'UNIMARC' ) %] |
| 437 |
_UNIMARCFieldDoc(field); |
| 438 |
[% END %] |
| 439 |
return false; |
| 440 |
} |
| 441 |
[%# Attach to body, so that cloned nodes will still have the event listener %] |
| 442 |
$(document).ready(function(){ |
| 443 |
$('body').on('click','.marcdocs',PopupMARCFieldDoc); |
| 444 |
}); |
| 445 |
|
| 446 |
function confirmnotdup(redirect){ |
| 447 |
$("#confirm_not_duplicate").attr("value","1"); |
| 448 |
$("#redirect").attr("value",redirect); |
| 449 |
Check(); |
| 450 |
} |
| 451 |
|
| 452 |
function Dopop(link,i) { |
| 453 |
defaultvalue = document.getElementById(i).value; |
| 454 |
window.open(link+"&result="+defaultvalue,"valuebuilder",'width=700,height=550,toolbar=false,scrollbars=yes'); |
| 455 |
} |
| 456 |
|
| 457 |
/** |
| 458 |
* this function open a popup to search on z3950 server. |
| 459 |
*/ |
| 460 |
function PopupZ3950() { |
| 461 |
var strQuery = GetZ3950Terms(); |
| 462 |
if(strQuery){ |
| 463 |
window.open("/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=[% biblionumber | html %]"+strQuery,"z3950search",'width=800,height=550,location=yes,toolbar=no,scrollbars=yes,resize=yes'); |
| 464 |
} |
| 465 |
} |
| 466 |
|
| 467 |
function _MARC21FieldDoc(field) { |
| 468 |
if(field == 0) { |
| 469 |
window.open("http://www.loc.gov/marc/bibliographic/bdleader.html"); |
| 470 |
} else if (field >= 90 && field <= 99 ){ |
| 471 |
window.open("http://www.loc.gov/marc/bibliographic/bd09x.html"); |
| 472 |
} else if (field >= 590 && field <= 599 ){ |
| 473 |
window.open("http://www.loc.gov/marc/bibliographic/bd59x.html"); |
| 474 |
} else if (field >= 690 && field <= 699 ){ |
| 475 |
window.open("http://www.loc.gov/marc/bibliographic/bd69x.html"); |
| 476 |
} else if (field < 900) { |
| 477 |
window.open("http://www.loc.gov/marc/bibliographic/bd" + ("000"+field).slice(-3) + ".html"); |
| 478 |
} else { |
| 479 |
window.open("http://www.loc.gov/marc/bibliographic/bd9xx.html"); |
| 480 |
} |
| 481 |
} |
| 482 |
|
| 483 |
function _UNIMARCFieldDoc(field) { |
| 484 |
/* http://archive.ifla.org/VI/3/p1996-1/ is an outdated version of UNIMARC, but |
| 485 |
seems to be the only version available that can be linked to per tag. More recent |
| 486 |
versions of the UNIMARC standard are available on the IFLA website only as |
| 487 |
PDFs! |
| 488 |
*/ |
| 489 |
var url; |
| 490 |
if (field == 0) { |
| 491 |
url = "http://archive.ifla.org/VI/3/p1996-1/uni.htm"; |
| 492 |
} else { |
| 493 |
var first = field.substring(0,1); |
| 494 |
url = "http://archive.ifla.org/VI/3/p1996-1/uni" + first + ".htm#"; |
| 495 |
if (first == 0) url = url + "b"; |
| 496 |
url = first == 9 |
| 497 |
? "http://archive.ifla.org/VI/3/p1996-1/uni9.htm" |
| 498 |
: url + field; |
| 499 |
} |
| 500 |
window.open(url); |
| 501 |
} |
| 502 |
|
| 503 |
/* |
| 504 |
* Functions to hide/show marc docs and tags links |
| 505 |
*/ |
| 506 |
|
| 507 |
function toggleMARCdocLinks(flag){ |
| 508 |
if( flag === true ){ |
| 509 |
$(".marcdocs").show(); |
| 510 |
Cookies.set("marcdocs_[% borrowernumber | html %]",'show', { path: "/", expires: 365, sameSite: 'Lax' }); |
| 511 |
$("#marcDocsSelect i").addClass('fa-check-square').removeClass('fa-square'); |
| 512 |
} else { |
| 513 |
$(".marcdocs").hide(); |
| 514 |
Cookies.set("marcdocs_[% borrowernumber | html %]",'hide', { path: "/", expires: 365, sameSite: 'Lax' }); |
| 515 |
$("#marcDocsSelect i").removeClass('fa-check-square').addClass('fa-square'); |
| 516 |
} |
| 517 |
} |
| 518 |
|
| 519 |
function toggleMARCTagLinks(flag){ |
| 520 |
if( flag === true ){ |
| 521 |
$(".tagnum").show(); |
| 522 |
$(".subfieldcode").show(); |
| 523 |
Cookies.set("marctags_[% borrowernumber | html %]",'show', { path: "/", expires: 365, sameSite: 'Lax' }); |
| 524 |
$("#marcTagsSelect i").addClass('fa-check-square').removeClass('fa-square'); |
| 525 |
} else { |
| 526 |
$(".tagnum").hide(); |
| 527 |
$(".subfieldcode").hide(); |
| 528 |
Cookies.set("marctags_[% borrowernumber | html %]",'hide', { path: "/", expires: 365, sameSite: 'Lax' }); |
| 529 |
$("#marcTagsSelect i").removeClass('fa-check-square').addClass('fa-square'); |
| 530 |
} |
| 531 |
} |
| 532 |
|
| 533 |
/** |
| 534 |
* check if mandatory/important subfields are written |
| 535 |
* @param mandatory true to check for mandatories, false for importants |
| 536 |
*/ |
| 537 |
function AreFieldsNotOk (mandatory = true) { |
| 538 |
var fields = new Array(); |
| 539 |
var subfields = new Array(); |
| 540 |
var tab = new Array(); |
| 541 |
var label = new Array(); |
| 542 |
var flag = false; |
| 543 |
var tabflag= new Array(); |
| 544 |
var StrAlert = "<div id='form-errors' class='alert alert-warning list'>"; |
| 545 |
var notFilledClass = "subfield_not_filled"; |
| 546 |
|
| 547 |
if (mandatory) { |
| 548 |
[% FOREACH BIG_LOO IN BIG_LOOP %] |
| 549 |
[% FOREACH innerloo IN BIG_LOO.innerloop %] |
| 550 |
[% IF ( innerloo.mandatory ) %] |
| 551 |
fields.push(new Array("[% innerloo.tag | html %]","[% innerloo.index | html %][% innerloo.random | html %]","[% innerloo.index | html %]", "[% BIG_LOO.number | html %]")); |
| 552 |
[% END %] |
| 553 |
[% FOREACH subfield_loo IN innerloo.subfield_loop %] |
| 554 |
[% IF ( subfield_loo.mandatory ) %]subfields.push("[% subfield_loo.id | html %]"); |
| 555 |
tab.push("[% BIG_LOO.number | html %]"); |
| 556 |
label.push("[% subfield_loo.marc_lib | $raw %]"); |
| 557 |
[% END %] |
| 558 |
[% END %] |
| 559 |
[% END %] |
| 560 |
[% END %] |
| 561 |
StrAlert += "<h4>" + _("The following mandatory subfields aren't filled:") + "</h4>"; |
| 562 |
} else { |
| 563 |
[% FOREACH BIG_LOO IN BIG_LOOP %] |
| 564 |
[% FOREACH innerloo IN BIG_LOO.innerloop %] |
| 565 |
[% IF ( innerloo.important ) %] |
| 566 |
fields.push(new Array("[% innerloo.tag | html %]","[% innerloo.index | html %][% innerloo.random | html %]","[% innerloo.index | html %]", "[% BIG_LOO.number | html %]")); |
| 567 |
[% END %] |
| 568 |
[% FOREACH subfield_loo IN innerloo.subfield_loop %] |
| 569 |
[% IF ( subfield_loo.important ) %]subfields.push("[% subfield_loo.id | html %]"); |
| 570 |
tab.push("[% BIG_LOO.number | html %]"); |
| 571 |
label.push("[% subfield_loo.marc_lib | $raw %]"); |
| 572 |
[% END %] |
| 573 |
[% END %] |
| 574 |
[% END %] |
| 575 |
[% END %] |
| 576 |
StrAlert += "<h4>" + _("The following important subfields aren’t filled:") + "</h4>"; |
| 577 |
notFilledClass = "important_subfield_not_filled"; |
| 578 |
} |
| 579 |
StrAlert += "<ul>"; |
| 580 |
for(var i=0,len=subfields.length; i<len ; i++){ |
| 581 |
var tag=subfields[i].substr(4,3); |
| 582 |
var subfield=subfields[i].substr(17,1); |
| 583 |
var tagnumber=subfields[i].substr(19,subfields[i].lastIndexOf("_")-19); |
| 584 |
if (tabflag[tag+subfield+tagnumber] == null) { |
| 585 |
tabflag[tag+subfield+tagnumber]=new Array(); |
| 586 |
tabflag[tag+subfield+tagnumber][0]=0; |
| 587 |
} |
| 588 |
if( tabflag[tag+subfield+tagnumber][0] != 1 && (document.getElementById(subfields[i]) != null && ! document.getElementById(subfields[i]).value || document.getElementById(subfields[i]) == null)){ |
| 589 |
tabflag[tag+subfield+tagnumber][0] = 0 + tabflag[tag+subfield+tagnumber] ; |
| 590 |
|
| 591 |
var elt = document.getElementById(subfields[i]); |
| 592 |
if ( elt.nodeName == 'SELECT' ) { |
| 593 |
$(elt).siblings('.select2').find("span[role='combobox']").addClass(notFilledClass); |
| 594 |
} else { |
| 595 |
elt.setAttribute('class','input_marceditor noEnterSubmit ' + notFilledClass); |
| 596 |
} |
| 597 |
$('#' + subfields[i]).focus(); |
| 598 |
tabflag[tag+subfield+tagnumber][1]=label[i]; |
| 599 |
tabflag[tag+subfield+tagnumber][2]=tab[i]; |
| 600 |
} else { |
| 601 |
tabflag[tag+subfield+tagnumber][0] = 1; |
| 602 |
} |
| 603 |
tabflag[tag+subfield+tagnumber][3] = subfields[i]; |
| 604 |
} |
| 605 |
|
| 606 |
for (var tagsubfieldid in tabflag){ |
| 607 |
if (tabflag[tagsubfieldid][0]==0){ |
| 608 |
var tag=tagsubfieldid.substr(0,3); |
| 609 |
var subfield=tagsubfieldid.substr(3,1); |
| 610 |
StrAlert += "<li>"+_("Tag %s subfield %s %s in tab %s").format(tag, subfield, formatFieldName( tabflag[tagsubfieldid][1] ), tabflag[tagsubfieldid][2]) + ' <a class="linkfield btn btn-link" href="#" data-tab="' + tabflag[tagsubfieldid][2] + '" data-field="' + tabflag[tagsubfieldid][3] + '"><i class="fa fa-arrow-right" aria-hidden="true"></i> ' + _("Go to field") + '</a></li>'; |
| 611 |
flag = true; |
| 612 |
} |
| 613 |
} |
| 614 |
StrAlert += "</ul>"; |
| 615 |
/* Check for mandatories/importants field(not subfields) */ |
| 616 |
/* Loop over array of fields identified as mandatory or |
| 617 |
important to see if at least one subfield is filled */ |
| 618 |
mandatoryFields = new Object(); |
| 619 |
|
| 620 |
for(var i=0,len=fields.length; i<len; i++){ |
| 621 |
isempty = true; |
| 622 |
arr = fields[i]; |
| 623 |
divid = "tag_" + arr[0] + "_" + arr[1]; |
| 624 |
varegexp = new RegExp("^tag_" + arr[0] + "_code_"); |
| 625 |
|
| 626 |
if(parseInt(arr[0]) >= 10){ |
| 627 |
elem = document.getElementById(divid); |
| 628 |
eleminputs = elem.getElementsByTagName('input'); |
| 629 |
|
| 630 |
for(var j=0,len2=eleminputs.length; j<len2; j++){ |
| 631 |
|
| 632 |
if(eleminputs[j].name.match(varegexp) && eleminputs[j].value){ |
| 633 |
inputregexp = new RegExp("^tag_" + arr[0] + "_subfield_" + eleminputs[j].value + "_" + arr[2]); |
| 634 |
|
| 635 |
for( var k=0; k<len2; k++){ |
| 636 |
if( eleminputs[k].id.match(inputregexp) ){ |
| 637 |
if( eleminputs[k].value ){ |
| 638 |
isempty = false |
| 639 |
} |
| 640 |
} |
| 641 |
} |
| 642 |
|
| 643 |
elemselect = elem.getElementsByTagName('select'); |
| 644 |
for( var k=0; k<elemselect.length; k++){ |
| 645 |
if(elemselect[k].id.match(inputregexp) && elemselect[k].value){ |
| 646 |
isempty = false |
| 647 |
} |
| 648 |
} |
| 649 |
} |
| 650 |
} |
| 651 |
|
| 652 |
elemtextareas = elem.getElementsByTagName('textarea'); |
| 653 |
for(var j=0,len2=elemtextareas.length; j<len2; j++){ |
| 654 |
// this bit assumes that the only textareas in this context would be for subfields |
| 655 |
if (elemtextareas[j].value) { |
| 656 |
isempty = false; |
| 657 |
} |
| 658 |
} |
| 659 |
|
| 660 |
} else { |
| 661 |
isempty = false; |
| 662 |
} |
| 663 |
|
| 664 |
if(isempty){ |
| 665 |
flag = true; |
| 666 |
if (mandatory) { |
| 667 |
mandatoryFields[ arr[0] ] = { |
| 668 |
importance: "mandatory", |
| 669 |
elemid: "div_indicator_" + divid, |
| 670 |
tab: arr[3] |
| 671 |
} |
| 672 |
} else { |
| 673 |
mandatoryFields[ arr[0] ] = { |
| 674 |
importance: "important", |
| 675 |
elemid: "div_indicator_" + divid, |
| 676 |
tab: arr[3] |
| 677 |
} |
| 678 |
} |
| 679 |
} |
| 680 |
|
| 681 |
} |
| 682 |
|
| 683 |
if( Object.entries(mandatoryFields).length > 0 ){ |
| 684 |
StrAlert += "<h4>" + _("The following fields aren't filled:") + "</h4>"; |
| 685 |
StrAlert += "<ul>"; |
| 686 |
for( var prop in mandatoryFields ){ |
| 687 |
if( mandatoryFields[prop]["importance"] == "mandatory" ){ |
| 688 |
StrAlert += "<li>" + _("Field %s is mandatory, at least one of its subfields must be filled.").format( prop ) + ' <a class="linkfield btn btn-link" href="#" data-tab="' + mandatoryFields[prop]["tab"] + '" data-field="' + mandatoryFields[prop]["elemid"] + '"><i class="fa fa-arrow-right" aria-hidden="true"></i> ' + _("Go to field") + '</a></li>'; |
| 689 |
} else { |
| 690 |
StrAlert += "<li>" + _("Field %s is important, at least one of its subfields must be filled.").format(prop) + ' <a class="linkfield btn btn-link" href="#" data-tab="' + mandatoryFields[prop]["tab"] + '" data-field="' + mandatoryFields[prop]["elemid"] + '"><i class="fa fa-arrow-right" aria-hidden="true"></i> ' + _("Go to field") + '</a></li>'; |
| 691 |
} |
| 692 |
} |
| 693 |
StrAlert += "</ul>"; |
| 694 |
} |
| 695 |
StrAlert += "</div>"; |
| 696 |
if ( flag ) { |
| 697 |
$("#show-errors").html('<button type="button" class="btn btn-danger show-errors"><i class="fa-solid fa-triangle-exclamation"></i> ' + _("Errors") + '</span>'); |
| 698 |
return StrAlert; |
| 699 |
} else { |
| 700 |
return flag; |
| 701 |
} |
| 702 |
} |
| 703 |
|
| 704 |
/** |
| 705 |
* Run checks for mandatory and important fields |
| 706 |
* Output errors if necessary, or submit the form |
| 707 |
*/ |
| 708 |
function Check(){ |
| 709 |
var StrAlert = AreFieldsNotOk(); |
| 710 |
var StrWarning = AreFieldsNotOk( false ); |
| 711 |
if ( $('.plugin-blocks-submit').length > 0 ) { |
| 712 |
// This class can be set by framework plugins to block submittal temporarily (e.g. during ajax call) |
| 713 |
return false; |
| 714 |
} else if( !StrAlert && StrWarning ) { |
| 715 |
// Check important fields |
| 716 |
$("#check_errors").html( StrWarning ); |
| 717 |
$('html, body').animate({ scrollTop: 0 }, 'fast'); |
| 718 |
|
| 719 |
var r=confirm( _("Important fields(s) are not filled. Are you sure you want to save?" ) ); |
| 720 |
if (! r){ |
| 721 |
return false; |
| 722 |
} else { |
| 723 |
document.f.submit(); |
| 724 |
return true; |
| 725 |
} |
| 726 |
} else if( StrAlert ){ |
| 727 |
var strAll = StrAlert; |
| 728 |
if( StrWarning ){ |
| 729 |
strAll += StrWarning; |
| 730 |
} |
| 731 |
$("#check_errors").html( strAll ); |
| 732 |
$('html, body').animate({ scrollTop: 0 }, 'fast'); |
| 733 |
return false; |
| 734 |
} else if( !StrAlert && !StrWarning ){ |
| 735 |
document.f.submit(); |
| 736 |
return true; |
| 737 |
} |
| 738 |
} |
| 739 |
|
| 740 |
/** |
| 741 |
* check if z3950 mandatories are set or not |
| 742 |
*/ |
| 743 |
function GetZ3950Terms(){ |
| 744 |
var frameworkcode = document.getElementById("frameworkcode").value; |
| 745 |
var strQuery = "&frameworkcode=" + encodeURIComponent(frameworkcode); |
| 746 |
var mandatories = new Array(); |
| 747 |
var mandatories_label = new Array(); |
| 748 |
[% FOREACH BIG_LOO IN BIG_LOOP %] |
| 749 |
[% FOREACH innerloo IN BIG_LOO.innerloop %] |
| 750 |
[% FOREACH subfield_loo IN innerloo.subfield_loop %] |
| 751 |
[% IF ( subfield_loo.z3950_mandatory ) %] |
| 752 |
mandatories.push("[% subfield_loo.id | html %]"); |
| 753 |
mandatories_label.push("[% subfield_loo.z3950_mandatory | html %]"); |
| 754 |
[% END %] |
| 755 |
[% END %] |
| 756 |
[% END %] |
| 757 |
[% END %] |
| 758 |
|
| 759 |
for(var i=0,len=mandatories.length; i<len ; i++){ |
| 760 |
var field_value = document.getElementById(mandatories[i]).value; |
| 761 |
if( field_value ){ |
| 762 |
strQuery += "&"+encodeURIComponent(mandatories_label[i])+"="+encodeURIComponent(field_value); |
| 763 |
} |
| 764 |
} |
| 765 |
return strQuery; |
| 766 |
} |
| 767 |
|
| 768 |
function Changefwk() { |
| 769 |
var f = document.f; |
| 770 |
f.op.value = "cud-change-framework"; |
| 771 |
f.biblionumber.value = "[% biblionumberdata | html %]"; |
| 772 |
f.submit(); |
| 773 |
} |
| 774 |
|
| 775 |
/* Wrap a value in HTML without putting HTML in translatable string */ |
| 776 |
function formatFieldName( string ){ |
| 777 |
return "<strong><em>" + string + "</em></strong>"; |
| 778 |
} |
| 779 |
|
| 780 |
$(document).ready(function(){ |
| 781 |
$('body').on('click','.expandfield',ExpandField); |
| 782 |
}); |
| 783 |
</script> |
| 784 |
[% Asset.css("css/addbiblio.css") | $raw %] |
| 785 |
</head> |
| 786 |
<body id="cat_addbiblio" class="cat"> |
| 787 |
|
| 788 |
<div id="loading"> |
| 789 |
<div>Loading, please wait...</div> |
| 790 |
</div> |
| 791 |
|
| 792 |
[% WRAPPER 'header.inc' %] |
| 793 |
[% INCLUDE 'cataloging-search.inc' %] |
| 794 |
[% END %] |
| 795 |
|
| 796 |
[% WRAPPER 'sub-header.inc' %] |
| 797 |
[% WRAPPER breadcrumbs %] |
| 798 |
[% WRAPPER breadcrumb_item %] |
| 799 |
<a href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cataloging</a> |
| 800 |
[% END %] |
| 801 |
[% WRAPPER breadcrumb_item bc_active= 1 %] |
| 802 |
[% IF ( biblionumber ) %] |
| 803 |
<span>[% tp('Editing MARC record titled:', "Editing") | html %] [% title | html %] (Record number [% biblionumber | html %])</span> |
| 804 |
[% ELSE %] |
| 805 |
[% IF ( circborrowernumber ) %] |
| 806 |
<span>Add MARC record (fast cataloging)</span> |
| 807 |
[% ELSE %] |
| 808 |
<span>Add MARC record</span> |
| 809 |
[% END %] |
| 810 |
[% END %] |
| 811 |
[% END %] |
| 812 |
[% END #/ WRAPPER breadcrumbs %] |
| 813 |
[% END #/ WRAPPER sub-header.inc %] |
| 814 |
|
| 815 |
[% WRAPPER 'main-container.inc' wide_centered => 1 %] |
| 816 |
[% IF ( INVALID_METADATA ) %] |
| 817 |
<div class="page-section bg-danger"> |
| 818 |
<h1>Errors found</h1> |
| 819 |
<p><strong>This record had encoding issues, non-xml characters have been stripped in order to allow editing. Please be cautious when saving that some data may have been removed from the record.</strong></p> |
| 820 |
<pre class="problem">[% INVALID_METADATA | html %]</pre> |
| 821 |
</div> |
| 822 |
[% END %] |
| 823 |
|
| 824 |
[% IF ( Koha.Preference('EnableAdvancedCatalogingEditor') && CAN_user_editcatalogue_advanced_editor ) %] |
| 825 |
<div id="toggle-editor"> |
| 826 |
<label for="toggle-editor">Advanced editor: </label> |
| 827 |
<label class="switch"> |
| 828 |
<input id="toggleEditor" type="checkbox" /> |
| 829 |
<span class="slider"></span> |
| 830 |
</label> |
| 831 |
</div> |
| 832 |
[% END %] |
| 833 |
|
| 834 |
<div id="check_errors"></div> |
| 835 |
|
| 836 |
<h1> |
| 837 |
[% IF ( biblionumber ) %] |
| 838 |
Editing [% title | html | $HtmlTags tag="em" %] (Record number [% biblionumber | html %]) |
| 839 |
[% ELSE %] |
| 840 |
[% IF (circborrowernumber) %] |
| 841 |
<span>Add MARC record (fast cataloging)</span> |
| 842 |
[% ELSE %] |
| 843 |
<span>Add MARC record</span> |
| 844 |
[% END %] |
| 845 |
[% END %] |
| 846 |
</h1> |
| 847 |
|
| 848 |
[% UNLESS ( number ) %] |
| 849 |
<!-- show duplicate warning on tab 0 only --> |
| 850 |
[% IF ( duplicatebiblionumber ) %] |
| 851 |
<div class="alert alert-warning"> |
| 852 |
<h3>Duplicate record suspected</h3> |
| 853 |
<p |
| 854 |
>Is this a duplicate of |
| 855 |
<a |
| 856 |
href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=[% duplicatebiblionumber | uri %]" |
| 857 |
onclick="openWindow('/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=[% duplicatebiblionumber | uri %]&popup=1', 'DuplicateBiblio','800','600'); return false;" |
| 858 |
>[% duplicatetitle | html %] <i class="fa-solid fa-window-restore"></i |
| 859 |
></a> |
| 860 |
?</p |
| 861 |
> |
| 862 |
[% IF ( CAN_user_editcatalogue_edit_items ) %] |
| 863 |
<form action="/cgi-bin/koha/cataloguing/additem.pl" method="get"> |
| 864 |
<input type="hidden" name="biblionumber" value="[% duplicatebiblionumber | html %]" /> |
| 865 |
<button type="submit" class="new"><i class="fa-fw fa-solid fa-pencil" aria-hidden="true"></i> Yes, edit existing items</button> |
| 866 |
</form> |
| 867 |
[% ELSE %] |
| 868 |
<form action="/cgi-bin/koha/catalogue/detail.pl" method="get"> |
| 869 |
<input type="hidden" name="biblionumber" value="[% duplicatebiblionumber | html %]" /> |
| 870 |
<input type="submit" value="Yes: View existing items" /> |
| 871 |
</form> |
| 872 |
[% END %] |
| 873 |
<form action="/cgi-bin/koha/cataloguing/addbiblio.pl" method="get"> |
| 874 |
[% IF ( CAN_user_editcatalogue_edit_items ) %] |
| 875 |
<button type="submit" class="new" onclick="confirmnotdup('items'); return false;"><i class="fa fa-fw fa-save"></i> No, save as new record</button> |
| 876 |
[% ELSE %] |
| 877 |
<button type="submit" class="new" onclick="confirmnotdup('view'); return false;"><i class="fa fa-fw fa-save"></i> No, save as new record</button> |
| 878 |
[% END %] |
| 879 |
</form> |
| 880 |
</div> |
| 881 |
<!-- /.dialog.alert --> |
| 882 |
[% END # /IF duplicatebiblionumber %] |
| 883 |
[% END # /UNLESS number %] |
| 884 |
<!-- prettier-ignore-start --> |
| 885 |
[% IF ( done ) %] |
| 886 |
<script> |
| 887 |
opener.document.forms['f'].biblionumber.value=[% biblionumber | html %]; |
| 888 |
opener.document.forms['f'].title.value='[% title | html %]'; |
| 889 |
window.close(); |
| 890 |
</script> |
| 891 |
[% ELSE %] |
| 892 |
<form method="post" name="f" id="f" action="/cgi-bin/koha/cataloguing/addbiblio.pl" onsubmit="return Check();" class="marc_editor"> |
| 893 |
[% INCLUDE 'csrf-token.inc' %] |
| 894 |
<input type="hidden" value="[% IF ( biblionumber ) %]view[% ELSE %]items[% END %]" id="redirect" name="redirect" /> |
| 895 |
<input type="hidden" value="" id="current_tab" name="current_tab" /> |
| 896 |
<input type="hidden" name="original_op" value="[% op | html %]" /> |
| 897 |
<input type="hidden" value="0" id="confirm_not_duplicate" name="confirm_not_duplicate" /> |
| 898 |
[% END %] |
| 899 |
|
| 900 |
<div id="toolbar" class="btn-toolbar sticky"> |
| 901 |
[% IF CAN_user_editcatalogue_edit_items or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) %] |
| 902 |
[% IF (circborrowernumber) %][%# fast cataloging must lead to items %] |
| 903 |
<!-- Action is under fast cataloging - Save button redirecting to items --> |
| 904 |
<div class="btn-group"><a href="#" id="saveanditems" class="btn btn-primary"><i class="fa fa-save"></i> Save</a></div> |
| 905 |
[% ELSE %] |
| 906 |
<!-- Not using fast cataloging - Display split menu --> |
| 907 |
<div class="btn-group"> |
| 908 |
<button class="btn btn-primary" id="saverecord"><i class="fa fa-save"></i> Save</button> |
| 909 |
<button class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> |
| 910 |
|
| 911 |
</button> |
| 912 |
<ul class="dropdown-menu dropdown-menu-end"> |
| 913 |
<li><a class="dropdown-item" id="saveandview" href="#">Save and view record</a></li> |
| 914 |
<li><a class="dropdown-item" id="saveanditems" href="#">Save and edit items</a></li> |
| 915 |
<li><a class="dropdown-item" id="saveandcontinue" href="#">Save and continue editing</a></li> |
| 916 |
</ul> |
| 917 |
</div> |
| 918 |
[% END %] |
| 919 |
[% ELSE %] |
| 920 |
<!-- User cannot edit items - single button redirecting to view --> |
| 921 |
<div class="btn-group"><a href="#" id="saveandview" class="btn btn-default"><i class="fa fa-save"></i> Save</a></div> |
| 922 |
[% END # /IF CAN_user_editcatalogue_edit_items %] |
| 923 |
|
| 924 |
[% UNLESS (circborrowernumber) %][%# Hide in fast cataloging %] |
| 925 |
[% IF biblionumber %] |
| 926 |
<div class="btn-group"><a class="btn btn-default" href="#" id="z3950search"><i class="fa fa-search"></i> Replace record via Z39.50/SRU search</a></div> |
| 927 |
[% ELSE %] |
| 928 |
<div class="btn-group"><a class="btn btn-default" href="#" id="z3950search"><i class="fa fa-search"></i> Z39.50/SRU search</a></div> |
| 929 |
[% END %] |
| 930 |
[% IF ( CAN_user_editauthorities ) %] |
| 931 |
<div class="btn-group"><a class="btn btn-default" href="#" id="linkerbutton"><i class="fa-solid fa-rotate"></i> Link authorities automatically</a></div> |
| 932 |
[% END %] |
| 933 |
[% END %] |
| 934 |
|
| 935 |
<div class="btn-group"> |
| 936 |
<button class="btn btn-default dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"><i class="fa fa-cog"></i> Settings</button> |
| 937 |
<ul id="settings-menu" class="dropdown-menu"> |
| 938 |
[% IF Koha.Preference( 'EnableAdvancedCatalogingEditor' ) == 1 && CAN_user_editcatalogue_advanced_editor %] |
| 939 |
<li><a class="dropdown-item" href="#" id="switcheditor">Switch to advanced editor</a></li> |
| 940 |
[% END %] |
| 941 |
[% UNLESS advancedMARCEditor %] |
| 942 |
<li> |
| 943 |
<a class="dropdown-item" href="#" id="marcDocsSelect"><i class="fa fa-check-square"></i> Show MARC tag documentation links</a> |
| 944 |
<li> |
| 945 |
<a class="dropdown-item" href="#" id="marcTagsSelect"><i class="fa fa-check-square"></i> Show tags</a> |
| 946 |
</li> |
| 947 |
[% END %] |
| 948 |
<li><h6 class="dropdown-header">Change framework</h6></li> |
| 949 |
<li> |
| 950 |
<a class="dropdown-item change-framework" href="#" data-frameworkcode=""> |
| 951 |
[% IF ( frameworkcode ) %] |
| 952 |
<i class="fa fa-fw"> </i> |
| 953 |
[% ELSE %] |
| 954 |
<i class="fa fa-fw fa-check"></i> |
| 955 |
[% END %] |
| 956 |
Default |
| 957 |
</a> |
| 958 |
</li> |
| 959 |
[% FOREACH framework IN frameworks%] |
| 960 |
<li> |
| 961 |
<a class="dropdown-item change-framework" href="#" data-frameworkcode="[% framework.frameworkcode | html %]"> |
| 962 |
[% IF framework.frameworkcode == frameworkcode %] |
| 963 |
<i class="fa fa-fw fa-check"></i> |
| 964 |
[% ELSE %] |
| 965 |
<i class="fa fa-fw"> </i> |
| 966 |
[% END %] |
| 967 |
[% framework.frameworktext | html %] |
| 968 |
</a> |
| 969 |
</li> |
| 970 |
[% END %] |
| 971 |
</ul> <!-- /#settings-menu --> |
| 972 |
</div> <!-- /.btn-group --> |
| 973 |
[% UNLESS (circborrowernumber) %][%# Hide in fast cataloging %] |
| 974 |
[% IF (biblionumber) %] |
| 975 |
<div class="btn-group"> |
| 976 |
<a href="[% PROCESS biblio_a_href biblionumber => biblionumber %]" class="btn btn-link" id="cancel">Cancel</a> |
| 977 |
</div> |
| 978 |
[% ELSE %] |
| 979 |
<div class="btn-group"> |
| 980 |
<a class="btn btn-link" id="cancel" href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cancel</a> |
| 981 |
</div> |
| 982 |
[% END %] |
| 983 |
<div id="show-errors" class="btn-group"></div> |
| 984 |
[% END # /UNLESS circborrowernumber %] |
| 985 |
<div class="toolbar-tabs-container"> |
| 986 |
[% IF ( BIG_LOOP && BIG_LOOP.size > 1 ) %] |
| 987 |
[% WRAPPER tabs_nav %] |
| 988 |
[%- FOREACH BIG_LOO IN BIG_LOOP -%] |
| 989 |
[% IF loop.first %] |
| 990 |
[% SET bt_active = 1 %] |
| 991 |
[% ELSE %] |
| 992 |
[% SET bt_active = 0 %] |
| 993 |
[% END %] |
| 994 |
[% WRAPPER tab_item tabname= "tab${BIG_LOO.number}XX" bt_active= bt_active %] |
| 995 |
<span>[% BIG_LOO.number | html %]</span> |
| 996 |
[% END %] |
| 997 |
[%- END -%] |
| 998 |
[% END # /WRAPPER tabs_nav %] |
| 999 |
[% END %] |
| 1000 |
<ul class="tag_anchors_list"> |
| 1001 |
[% FOREACH BIG_LOO IN BIG_LOOP %] |
| 1002 |
[% IF loop.first %][% SET tab_selected = "tab_selected" %][% ELSE %][% SET tab_selected = "" %][% END %] |
| 1003 |
[% FOREACH innerloo IN BIG_LOO.innerloop %] |
| 1004 |
[% IF ( innerloo.tag ) %] |
| 1005 |
<li class="tag_anchors tag_anchors_[% BIG_LOO.number | html %] [% tab_selected | html %]"> |
| 1006 |
<a class="tag_anchor" id="tag_anchor_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]" title="tag_anchor_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]" href="#div_indicator_tag_[% innerloo.tag | uri %]_[% innerloo.index | uri %][% innerloo.random | uri %]">[% innerloo.tag | uri %]</a> |
| 1007 |
</li> |
| 1008 |
[% END %] |
| 1009 |
[% END %] |
| 1010 |
[% END %] |
| 1011 |
</ul> |
| 1012 |
</div> |
| 1013 |
</div> <!-- /#toolbar.btn-toolbar --> |
| 1014 |
|
| 1015 |
[% IF bib_doesnt_exist %] |
| 1016 |
<div class="alert alert-warning"> |
| 1017 |
The record you are trying to edit doesn't exist.<br> |
| 1018 |
<a href="/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=">Add a new record</a> or <a href="/cgi-bin/koha/catalogue/search.pl">do a catalog search</a>. |
| 1019 |
</div> |
| 1020 |
[% END %] |
| 1021 |
|
| 1022 |
[% IF ( popup ) %] |
| 1023 |
<input type="hidden" name="mode" value="popup" /> |
| 1024 |
[% END %] |
| 1025 |
<input type="hidden" name="op" value="cud-addbiblio" /> |
| 1026 |
<input type="hidden" id="frameworkcode" name="frameworkcode" value="[% frameworkcode | html %]" /> |
| 1027 |
<input type="hidden" name="z3950" value="[% z3950 | html %]" /> |
| 1028 |
<input type="hidden" name="biblionumber" value="[% biblionumber | html %]" /> |
| 1029 |
<input type="hidden" name="breedingid" value="[% breedingid | html %]" /> |
| 1030 |
|
| 1031 |
[% WRAPPER tabs id= "addbibliotabs" %] |
| 1032 |
[% WRAPPER tab_panels %] |
| 1033 |
[% FOREACH BIG_LOO IN BIG_LOOP %] |
| 1034 |
[% IF loop.first %] |
| 1035 |
[% SET bt_active = 1 %] |
| 1036 |
[% ELSE %] |
| 1037 |
[% SET bt_active = 0 %] |
| 1038 |
[% END %] |
| 1039 |
[% WRAPPER tab_panel tabname="tab${BIG_LOO.number}XX" bt_active= bt_active %] |
| 1040 |
|
| 1041 |
[% IF ( BIG_LOOP.size > 1 ) %] |
| 1042 |
<h3>Section [% BIG_LOO.number | html %]</h3> |
| 1043 |
[% END %] |
| 1044 |
[% previous = "" %] |
| 1045 |
[% FOREACH innerloo IN BIG_LOO.innerloop %] |
| 1046 |
[% IF ( innerloo.tag ) %] |
| 1047 |
[% IF innerloo.tag != previous %] |
| 1048 |
[% IF previous != "" %] |
| 1049 |
</ul> |
| 1050 |
[% END %] |
| 1051 |
[% previous = innerloo.tag %] |
| 1052 |
[% IF ( innerloo.repeatable ) %] |
| 1053 |
<ul class="sortable_field"> |
| 1054 |
[% ELSE %] |
| 1055 |
<ul> |
| 1056 |
[% END %] |
| 1057 |
[% END %] |
| 1058 |
[% IF ( innerloo.repeatable ) %] |
| 1059 |
<li class="tag sortable_tag clearfix" id="tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]"> |
| 1060 |
[% ELSE %] |
| 1061 |
<li class="tag clearfix" id="tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]"> |
| 1062 |
[% END %] |
| 1063 |
<div class="tag_title" id="div_indicator_tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]"> |
| 1064 |
[% IF ( innerloo.repeatable ) %] |
| 1065 |
<span class="handle"></span> |
| 1066 |
[% END %] |
| 1067 |
[% IF advancedMARCEditor %] |
| 1068 |
<a href="#" tabindex="1" class="tagnum" title="[% innerloo.tag_lib | html %] - Click to expand this tag" data-field_id="tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">[% innerloo.tag | html %]</a> |
| 1069 |
[% ELSE %] |
| 1070 |
<span class="tagnum" title="[% innerloo.tag_lib | html %]">[% innerloo.tag | html %]</span> |
| 1071 |
<a href="#" class="marcdocs" data-tag="[% innerloo.tag | html %]"> ?</a> |
| 1072 |
[% END %] |
| 1073 |
|
| 1074 |
[% IF ( innerloo.fixedfield ) %] |
| 1075 |
<input type="text" |
| 1076 |
tabindex="1" |
| 1077 |
class="indicator flat" |
| 1078 |
style="display:none;" |
| 1079 |
name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]" |
| 1080 |
size="1" |
| 1081 |
maxlength="1" |
| 1082 |
value="[% innerloo.indicator1 | html %]" /> |
| 1083 |
<input type="text" |
| 1084 |
tabindex="1" |
| 1085 |
class="indicator flat" |
| 1086 |
style="display:none;" |
| 1087 |
name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]" |
| 1088 |
size="1" |
| 1089 |
maxlength="1" |
| 1090 |
value="[% innerloo.indicator2 | html %]" /> |
| 1091 |
[% ELSE %] |
| 1092 |
<input type="text" |
| 1093 |
tabindex="1" |
| 1094 |
class="indicator flat" |
| 1095 |
name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]" |
| 1096 |
size="1" |
| 1097 |
maxlength="1" |
| 1098 |
value="[% innerloo.indicator1 | html %]" /> |
| 1099 |
<input type="text" |
| 1100 |
tabindex="1" |
| 1101 |
class="indicator flat" |
| 1102 |
name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]" |
| 1103 |
size="1" |
| 1104 |
maxlength="1" |
| 1105 |
value="[% innerloo.indicator2 | html %]" /> |
| 1106 |
[% END # /IF innerloo.fixedfield %] - |
| 1107 |
|
| 1108 |
[% UNLESS advancedMARCEditor %] |
| 1109 |
<a href="#" tabindex="1" class="expandfield" data-field_id="tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]" title="Click to expand this tag">[% innerloo.tag_lib | html %]</a> |
| 1110 |
[% END %] |
| 1111 |
|
| 1112 |
<span class="field_controls"> |
| 1113 |
[% IF ( innerloo.repeatable ) %] |
| 1114 |
<a href="#" tabindex="1" class="buttonPlus" onclick="CloneField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]','0','[% advancedMARCEditor | html %]'); return false;" title="Repeat this tag"> |
| 1115 |
<img src="[% interface | html %]/[% theme | html %]/img/repeat-tag.png" alt="Repeat this tag" /> |
| 1116 |
</a> |
| 1117 |
[% END %] |
| 1118 |
<a href="#" tabindex="1" class="buttonMinus" onclick="UnCloneField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]'); return false;" title="Delete this tag"> |
| 1119 |
<img src="[% interface | html %]/[% theme | html %]/img/delete-tag.png" alt="Delete this tag" /> |
| 1120 |
</a> |
| 1121 |
</span> <!-- /.field_controls --> |
| 1122 |
</div> <!-- /div.tag_title --> |
| 1123 |
|
| 1124 |
<ul class="sortable_subfield"> |
| 1125 |
[% FOREACH subfield_loo IN innerloo.subfield_loop %] |
| 1126 |
<!-- One line on the marc editor --> |
| 1127 |
<li class="subfield_line" style="[% subfield_loo.visibility | html %]" id="subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]"> |
| 1128 |
<div class="subfieldcode"> |
| 1129 |
<span class="handle"></span> |
| 1130 |
<input type="text" |
| 1131 |
title="[% subfield_loo.marc_lib | $raw %]" |
| 1132 |
style=" [% IF ( subfield_loo.fixedfield ) %]display:none; [% END %]" |
| 1133 |
name="tag_[% subfield_loo.tag | html %]_code_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]" |
| 1134 |
value="[% subfield_loo.subfield | html %]" |
| 1135 |
size="1" |
| 1136 |
maxlength="1" |
| 1137 |
class="flat" |
| 1138 |
tabindex="0" /> |
| 1139 |
</div> |
| 1140 |
[% UNLESS advancedMARCEditor %] |
| 1141 |
[% IF ( subfield_loo.mandatory ) %] |
| 1142 |
<div class="subfield subfield_mandatory"> |
| 1143 |
[% ELSIF ( subfield_loo.important ) %] |
| 1144 |
<div class="subfield subfield_important"> |
| 1145 |
[% ELSE %] |
| 1146 |
<div class="subfield"> |
| 1147 |
[% END %] |
| 1148 |
[% IF ( subfield_loo.fixedfield ) %] |
| 1149 |
<label for="tag_[% subfield_loo.tag | html %]_subfield_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]" style="display:none;" class="labelsubfield"> |
| 1150 |
[% ELSE %] |
| 1151 |
<label for="tag_[% subfield_loo.tag | html %]_subfield_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]" class="labelsubfield"> |
| 1152 |
[% END %] |
| 1153 |
[% subfield_loo.marc_lib | $raw %] |
| 1154 |
</label> |
| 1155 |
</div> |
| 1156 |
[% END %] |
| 1157 |
|
| 1158 |
[% SET mv = subfield_loo.marc_value %] |
| 1159 |
<div id="field_marceditor[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]" class="field_marceditor"> |
| 1160 |
[% IF ( mv.type == 'text' ) %] |
| 1161 |
[% IF ( mv.readonly == 1 ) %] |
| 1162 |
<input type="text" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor readonly" tabindex="1" size="[%- mv.size | html -%]" maxlength="[%- mv.maxlength | html -%]" readonly="readonly" /> |
| 1163 |
[% ELSE %] |
| 1164 |
<input type="text" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor" tabindex="1" size="[%- mv.size | html -%]" maxlength="[%- mv.maxlength | html -%]" /> |
| 1165 |
[% END %] |
| 1166 |
|
| 1167 |
[% ELSIF ( mv.type == 'text_complex' ) %] |
| 1168 |
<input type="text" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor framework_plugin" tabindex="1" size="[%- mv.size | html -%]" maxlength="[%- mv.maxlength | html -%]" data-plugin="[% mv.plugin | html %]" /> |
| 1169 |
[% mv.javascript | $raw %] |
| 1170 |
[% ELSIF ( mv.type == 'hidden' ) %] |
| 1171 |
<input tabindex="1" type="hidden" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" size="[%- mv.size | html -%]" maxlength="[%- mv.maxlength | html -%]" value="[%- mv.value | html -%]" /> |
| 1172 |
[% ELSIF ( mv.type == 'textarea' ) %] |
| 1173 |
<textarea cols="70" rows="4" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" class="input_marceditor" tabindex="1">[%- mv.value | html -%]</textarea> |
| 1174 |
[% ELSIF ( mv.type == 'select' ) %] |
| 1175 |
[% IF mv.category AND CAN_user_parameters_manage_auth_values %] |
| 1176 |
<select name="[%- mv.name | html -%]" tabindex="1" class="input_marceditor" id="[%- mv.id | html -%]" data-category="[% mv.category | html %]"> |
| 1177 |
[% ELSE %] |
| 1178 |
<select name="[%- mv.name | html -%]" tabindex="1" class="input_marceditor select2" id="[%- mv.id | html -%]"> |
| 1179 |
[% END %] |
| 1180 |
[% SET matched = 0 %] |
| 1181 |
[% FOREACH aval IN mv.values %] |
| 1182 |
[% IF aval == mv.default %] |
| 1183 |
[% SET matched = 1 %] |
| 1184 |
<option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option> |
| 1185 |
[% ELSE %] |
| 1186 |
<option value="[%- aval | html -%]">[%- mv.labels.$aval | html -%]</option> |
| 1187 |
[% END %] |
| 1188 |
|
| 1189 |
[% END %] |
| 1190 |
[% UNLESS matched # If the current value is not in the authorised value list %] |
| 1191 |
<option value="[%- mv.default | html -%]" selected="selected">[%- mv.default | html -%] (Not an authorised value)</option> |
| 1192 |
</select> |
| 1193 |
<span style="float:right;" title="The current value [% mv.default | html %] is not configured for the authorised value category controlling this subfield"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i></span> |
| 1194 |
[% ELSE %] |
| 1195 |
</select> |
| 1196 |
[% END %] |
| 1197 |
[% UNLESS matched # If the current value is not in the authorised list %] |
| 1198 |
[% END %] |
| 1199 |
[% END # /IF (mv.type...) %] |
| 1200 |
</div> |
| 1201 |
[% IF ( subfield_loo.mandatory ) %] |
| 1202 |
<div class="subfield_loop_mandatory"> |
| 1203 |
<span class="required">Required</span> |
| 1204 |
</div> |
| 1205 |
[% ELSIF ( subfield_loo.important ) %] |
| 1206 |
<div class="subfield_loop_mandatory"> |
| 1207 |
<span class="important">Important</span> |
| 1208 |
</div> |
| 1209 |
[% END %] |
| 1210 |
<div class="subfield_controls"> |
| 1211 |
[% IF ( mv.type == 'text' ) %] |
| 1212 |
[% IF ( mv.authtype ) %] |
| 1213 |
<a href="#" class="buttonDot tag_editor" onclick="openAuth(this.parentNode.parentNode.getElementsByTagName('input')[1].id,'[%- mv.authtype | html -%]','biblio'); return false;" tabindex="1" title="Tag editor">Tag editor</a> |
| 1214 |
[% END %] |
| 1215 |
[% ELSIF ( mv.type == 'text_complex' ) %] |
| 1216 |
[% IF mv.noclick %] |
| 1217 |
<span class="buttonDot tag_editor disabled" tabindex="-1" title="Field autofilled by plugin"></span> |
| 1218 |
[% ELSE %] |
| 1219 |
[% IF mv.plugin == "upload.pl" %] |
| 1220 |
<a href="#" id="buttonDot_[% mv.id | html %]" class="tag_editor upload framework_plugin" tabindex="1" data-plugin="[% mv.plugin | html %]"><i class="fa fa-upload" aria-hidden="true"></i> Upload</a> |
| 1221 |
[% ELSE %] |
| 1222 |
<a href="#" id="buttonDot_[% mv.id | html %]" class="buttonDot tag_editor framework_plugin" tabindex="1" title="Tag editor" data-plugin="[% mv.plugin | html %]">Tag editor</a> |
| 1223 |
[% END %] |
| 1224 |
[% END %] |
| 1225 |
</span> |
| 1226 |
[% END %] |
| 1227 |
[% IF ( subfield_loo.repeatable ) %] |
| 1228 |
<a href="#" class="buttonPlus" tabindex="1" onclick="CloneSubfield('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]','[% advancedMARCEditor | html %]'); return false;"> |
| 1229 |
<img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" /> |
| 1230 |
</a> |
| 1231 |
<a href="#" class="buttonMinus" tabindex="1" onclick="UnCloneField('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]'); return false;"> |
| 1232 |
<img src="[% interface | html %]/[% theme | html %]/img/delete-subfield.png" alt="Delete" title="Delete this subfield" /> |
| 1233 |
</a> |
| 1234 |
[% END %] |
| 1235 |
</div> |
| 1236 |
</li> <!-- /.subfield_line --> |
| 1237 |
<!-- End of the line --> |
| 1238 |
[% END # /FOREACH subfield_loop %] |
| 1239 |
</ul> <!-- /.sortable_subfield --> |
| 1240 |
</li> <!-- /.tag.clearfix --> |
| 1241 |
[% END %]<!-- if innerloo.tag --> |
| 1242 |
[% END # /FOREACH BIG_LOO.innerloop %] |
| 1243 |
</ul> <!-- /.sortable_field --> |
| 1244 |
[% END # /tab_panel#tabXXX %] |
| 1245 |
[% END # /FOREACH BIG_LOOP %] |
| 1246 |
[% END # /WRAPPER tab_panels %] |
| 1247 |
[% END # /WRAPPER tabs %] |
| 1248 |
|
| 1249 |
[%# Fields for fast cataloging %] |
| 1250 |
<input type="hidden" name="barcode" value="[% barcode | html %]" /> |
| 1251 |
<input type="hidden" name="branch" value="[% branch | html %]" /> |
| 1252 |
<input type="hidden" name="circborrowernumber" value="[% circborrowernumber | html %]" /> |
| 1253 |
<input type="hidden" name="stickyduedate" value="[% stickyduedate | html %]" /> |
| 1254 |
<input type="hidden" name="duedatespec" value="[% duedatespec | html %]" /> |
| 1255 |
[%# End of fields for fast cataloging %] |
| 1256 |
</form> <!-- /name=f --> |
| 1257 |
<!-- prettier-ignore-end --> |
| 1258 |
|
| 1259 |
[% INCLUDE 'modals/cataloguing_create_av.inc' %] |
| 1260 |
[% END %] |
| 1261 |
|
| 1262 |
[% INCLUDE 'intranet-bottom.inc' %] |
| 1263 |
- |