|
Lines 3-128
Link Here
|
| 3 |
[% INCLUDE 'doc-head-open.inc' %] |
3 |
[% INCLUDE 'doc-head-open.inc' %] |
| 4 |
<title>Koha › Cataloging › Merging records</title> |
4 |
<title>Koha › Cataloging › Merging records</title> |
| 5 |
[% INCLUDE 'doc-head-close.inc' %] |
5 |
[% INCLUDE 'doc-head-close.inc' %] |
| 6 |
<script type="text/javascript" src="[% interface %]/[% theme %]/js/merge-record.js"></script> |
|
|
| 7 |
[% INCLUDE 'merge-record-strings.inc' %] |
| 8 |
<style type="text/css"> |
6 |
<style type="text/css"> |
| 9 |
div.record ul, div.record li { float:none; display:block; } |
7 |
div.record ul, div.record li { float:none; display:block; } |
| 10 |
div#result { margin-top: 1em; } |
8 |
div#result { margin-top: 1em; } |
| 11 |
/* We use this style "against" the li ui-tabs-nav style automatically applied */ |
9 |
/* We use this style "against" the li ui-tabs-nav style automatically applied */ |
| 12 |
#dataPreview { width : 80%; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } } |
10 |
#dataPreview { width : 80%; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } } |
| 13 |
</style> |
11 |
</style> |
| 14 |
<script type="text/javascript"> |
|
|
| 15 |
//<![CDATA[ |
| 16 |
[% UNLESS (result) %] |
| 17 |
[% IF (choosereference) %] |
| 18 |
function changeFramework(fw) { |
| 19 |
$("#frameworkcode").val(fw); |
| 20 |
} |
| 21 |
$(document).ready(function(){ |
| 22 |
$(".previewData").on("click", function(e){ |
| 23 |
e.preventDefault(); |
| 24 |
var ltitle = $(this).text(); |
| 25 |
var page = $(this).attr("href"); |
| 26 |
$("#dataPreviewLabel").text(ltitle); |
| 27 |
$("#dataPreview .modal-body").load(page + " div"); |
| 28 |
$('#dataPreview').modal({show:true}); |
| 29 |
}); |
| 30 |
$("#dataPreview").on("hidden", function(){ |
| 31 |
$("#dataPreviewLabel").html(""); |
| 32 |
$("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>"); |
| 33 |
}); |
| 34 |
}); |
| 35 |
[% ELSE %] |
| 36 |
function check_mandatory () { |
| 37 |
var missing = { |
| 38 |
'fields': [], |
| 39 |
'subfields': [] |
| 40 |
}; |
| 41 |
for (tag in tagslib) { |
| 42 |
if (tag == '000' || tag == '001') |
| 43 |
continue; |
| 44 |
if (tagslib[tag].mandatory == 1) { |
| 45 |
if ($("#resultul span.field:contains("+ tag +")").length == 0) { |
| 46 |
missing.fields.push(tag); |
| 47 |
} |
| 48 |
} |
| 49 |
for (subfieldcode in tagslib[tag]) { |
| 50 |
if (subfieldcode == 'lib' || subfieldcode == 'mandatory' |
| 51 |
|| subfieldcode == 'repeatable' || subfieldcode == 'tab' |
| 52 |
|| subfieldcode == '@') { |
| 53 |
continue; |
| 54 |
} |
| 55 |
if (tagslib[tag][subfieldcode].mandatory == 1 && tagslib[tag][subfieldcode].tab >= 0) { |
| 56 |
var fields = $("#resultul span.field:contains("+ tag +")"); |
| 57 |
$(fields).each(function() { |
| 58 |
var subfields = $(this).parents('li').find("span.subfield:contains("+ subfieldcode +")"); |
| 59 |
if (subfields.length == 0) { |
| 60 |
missing.subfields.push( { |
| 61 |
'tag': tag, |
| 62 |
'subfieldcode': subfieldcode |
| 63 |
} ); |
| 64 |
} |
| 65 |
}); |
| 66 |
} |
| 67 |
} |
| 68 |
} |
| 69 |
return missing; |
| 70 |
} |
| 71 |
|
| 72 |
// When submiting the form |
| 73 |
function mergeformsubmit() { |
| 74 |
var missing = check_mandatory(); |
| 75 |
var alert_msg = ''; |
| 76 |
var error = 0; |
| 77 |
if (missing.fields.length > 0) { |
| 78 |
alert_msg += _("Following required fields are missing:") + "\n"; |
| 79 |
for (var i in missing.fields) { |
| 80 |
alert_msg += "\t- " + missing.fields[i] + "\n"; |
| 81 |
error ++; |
| 82 |
} |
| 83 |
alert_msg += "\n"; |
| 84 |
} |
| 85 |
if (missing.subfields.length > 0) { |
| 86 |
alert_msg += _("Following required subfields are missing:") + "\n"; |
| 87 |
for (var i in missing.subfields) { |
| 88 |
var subfield = missing.subfields[i]; |
| 89 |
alert_msg += "\t- " + subfield.tag + "$" + subfield.subfieldcode + "\n"; |
| 90 |
error ++; |
| 91 |
} |
| 92 |
} |
| 93 |
|
| 94 |
if (error != 0) { |
| 95 |
alert(alert_msg); |
| 96 |
return false; |
| 97 |
} else { |
| 98 |
$("#tabs").remove(); |
| 99 |
} |
| 100 |
} |
| 101 |
|
| 102 |
$(document).ready(function(){ |
| 103 |
tagslib = []; |
| 104 |
$.getJSON("/cgi-bin/koha/cataloguing/merge_ajax.pl", {frameworkcode : "[% framework %]" }, function(json) { |
| 105 |
tagslib = json; |
| 106 |
rebuild_target($("#tabs"), $("#resultul")); |
| 107 |
}); |
| 108 |
|
| 109 |
// Creating tabs |
| 110 |
$("#tabs").tabs(); |
| 111 |
|
| 112 |
// Check all checkboxes in first tab, and uncheck all others to avoid |
| 113 |
// inconsistencies from a page refresh. |
| 114 |
$('#tabs div#tabrecord[% ref_biblionumber %]').find('input[type="checkbox"]').prop('checked', true); |
| 115 |
$('#tabs > div:not("#tabrecord[% ref_biblionumber %]")').find('input[type="checkbox"]').prop('checked', false); |
| 116 |
|
| 117 |
//Set focus to cataloging search |
| 118 |
$("input[name=q]:eq(0)").focus(); |
| 119 |
}); |
| 120 |
|
| 121 |
[% END %] |
| 122 |
[% END %] |
| 123 |
//]]> |
| 124 |
</script> |
| 125 |
</head> |
12 |
</head> |
|
|
13 |
|
| 126 |
<body id="cat_merge" class="cat"> |
14 |
<body id="cat_merge" class="cat"> |
| 127 |
[% INCLUDE 'header.inc' %] |
15 |
[% INCLUDE 'header.inc' %] |
| 128 |
[% INCLUDE 'cataloging-search.inc' %] |
16 |
[% INCLUDE 'cataloging-search.inc' %] |
|
Lines 296-299
$(document).ready(function(){
Link Here
|
| 296 |
</div> |
184 |
</div> |
| 297 |
</div> |
185 |
</div> |
| 298 |
|
186 |
|
|
|
187 |
[% MACRO jsinclude BLOCK %] |
| 188 |
<script type="text/javascript" src="[% interface %]/[% theme %]/js/merge-record.js"></script> |
| 189 |
[% INCLUDE 'merge-record-strings.inc' %] |
| 190 |
<script type="text/javascript"> |
| 191 |
[% UNLESS (result) %] |
| 192 |
[% IF (choosereference) %] |
| 193 |
function changeFramework(fw) { |
| 194 |
$("#frameworkcode").val(fw); |
| 195 |
} |
| 196 |
$(document).ready(function(){ |
| 197 |
$(".previewData").on("click", function(e){ |
| 198 |
e.preventDefault(); |
| 199 |
var ltitle = $(this).text(); |
| 200 |
var page = $(this).attr("href"); |
| 201 |
$("#dataPreviewLabel").text(ltitle); |
| 202 |
$("#dataPreview .modal-body").load(page + " div"); |
| 203 |
$('#dataPreview').modal({show:true}); |
| 204 |
}); |
| 205 |
$("#dataPreview").on("hidden", function(){ |
| 206 |
$("#dataPreviewLabel").html(""); |
| 207 |
$("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>"); |
| 208 |
}); |
| 209 |
}); |
| 210 |
[% ELSE %] |
| 211 |
function check_mandatory () { |
| 212 |
var missing = { |
| 213 |
'fields': [], |
| 214 |
'subfields': [] |
| 215 |
}; |
| 216 |
for (tag in tagslib) { |
| 217 |
if (tag == '000' || tag == '001') |
| 218 |
continue; |
| 219 |
if (tagslib[tag].mandatory == 1) { |
| 220 |
if ($("#resultul span.field:contains("+ tag +")").length == 0) { |
| 221 |
missing.fields.push(tag); |
| 222 |
} |
| 223 |
} |
| 224 |
for (subfieldcode in tagslib[tag]) { |
| 225 |
if (subfieldcode == 'lib' || subfieldcode == 'mandatory' |
| 226 |
|| subfieldcode == 'repeatable' || subfieldcode == 'tab' |
| 227 |
|| subfieldcode == '@') { |
| 228 |
continue; |
| 229 |
} |
| 230 |
if (tagslib[tag][subfieldcode].mandatory == 1 && tagslib[tag][subfieldcode].tab >= 0) { |
| 231 |
var fields = $("#resultul span.field:contains("+ tag +")"); |
| 232 |
$(fields).each(function() { |
| 233 |
var subfields = $(this).parents('li').find("span.subfield:contains("+ subfieldcode +")"); |
| 234 |
if (subfields.length == 0) { |
| 235 |
missing.subfields.push( { |
| 236 |
'tag': tag, |
| 237 |
'subfieldcode': subfieldcode |
| 238 |
} ); |
| 239 |
} |
| 240 |
}); |
| 241 |
} |
| 242 |
} |
| 243 |
} |
| 244 |
return missing; |
| 245 |
} |
| 246 |
|
| 247 |
// When submiting the form |
| 248 |
function mergeformsubmit() { |
| 249 |
var missing = check_mandatory(); |
| 250 |
var alert_msg = ''; |
| 251 |
var error = 0; |
| 252 |
if (missing.fields.length > 0) { |
| 253 |
alert_msg += _("Following required fields are missing:") + "\n"; |
| 254 |
for (var i in missing.fields) { |
| 255 |
alert_msg += "\t- " + missing.fields[i] + "\n"; |
| 256 |
error ++; |
| 257 |
} |
| 258 |
alert_msg += "\n"; |
| 259 |
} |
| 260 |
if (missing.subfields.length > 0) { |
| 261 |
alert_msg += _("Following required subfields are missing:") + "\n"; |
| 262 |
for (var i in missing.subfields) { |
| 263 |
var subfield = missing.subfields[i]; |
| 264 |
alert_msg += "\t- " + subfield.tag + "$" + subfield.subfieldcode + "\n"; |
| 265 |
error ++; |
| 266 |
} |
| 267 |
} |
| 268 |
|
| 269 |
if (error != 0) { |
| 270 |
alert(alert_msg); |
| 271 |
return false; |
| 272 |
} else { |
| 273 |
$("#tabs").remove(); |
| 274 |
} |
| 275 |
} |
| 276 |
|
| 277 |
$(document).ready(function(){ |
| 278 |
tagslib = []; |
| 279 |
$.getJSON("/cgi-bin/koha/cataloguing/merge_ajax.pl", {frameworkcode : "[% framework %]" }, function(json) { |
| 280 |
tagslib = json; |
| 281 |
rebuild_target($("#tabs"), $("#resultul")); |
| 282 |
}); |
| 283 |
|
| 284 |
// Creating tabs |
| 285 |
$("#tabs").tabs(); |
| 286 |
|
| 287 |
// Check all checkboxes in first tab, and uncheck all others to avoid |
| 288 |
// inconsistencies from a page refresh. |
| 289 |
$('#tabs div#tabrecord[% ref_biblionumber %]').find('input[type="checkbox"]').prop('checked', true); |
| 290 |
$('#tabs > div:not("#tabrecord[% ref_biblionumber %]")').find('input[type="checkbox"]').prop('checked', false); |
| 291 |
|
| 292 |
//Set focus to cataloging search |
| 293 |
$("input[name=q]:eq(0)").focus(); |
| 294 |
}); |
| 295 |
|
| 296 |
[% END %] |
| 297 |
[% END %] |
| 298 |
</script> |
| 299 |
[% END %] |
| 300 |
|
| 299 |
[% INCLUDE 'intranet-bottom.inc' %] |
301 |
[% INCLUDE 'intranet-bottom.inc' %] |