Lines 4-148
Link Here
|
4 |
|
4 |
|
5 |
[% INCLUDE 'doc-head-open.inc' %] |
5 |
[% INCLUDE 'doc-head-open.inc' %] |
6 |
<title>Koha › Cataloging › [% title |html %] [% IF ( author ) %] by [% author | html %][% END %] (Record #[% biblionumber %]) › Items</title> |
6 |
<title>Koha › Cataloging › [% title |html %] [% IF ( author ) %] by [% author | html %][% END %] (Record #[% biblionumber %]) › Items</title> |
7 |
[% Asset.css("css/datatables.css") %] |
|
|
8 |
[% INCLUDE 'doc-head-close.inc' %] |
7 |
[% INCLUDE 'doc-head-close.inc' %] |
|
|
8 |
[% Asset.css("css/datatables.css") %] |
9 |
[% INCLUDE 'datatables.inc' %] |
9 |
[% INCLUDE 'datatables.inc' %] |
10 |
[% Asset.js("js/cataloging.js") %] |
10 |
[% Asset.js("js/cataloging.js") %] |
11 |
[% INCLUDE 'columns_settings.inc' %] |
11 |
[% INCLUDE 'columns_settings.inc' %] |
12 |
[% INCLUDE 'browser-strings.inc' %] |
12 |
[% INCLUDE 'browser-strings.inc' %] |
|
|
13 |
[% INCLUDE 'select2.inc' %] |
14 |
[% INCLUDE 'str/cataloging_additem.inc' %] |
13 |
[% Asset.js("js/browser.js") %] |
15 |
[% Asset.js("js/browser.js") %] |
14 |
<script type="text/javascript"> |
16 |
[% Asset.js("js/cataloging_additem.js") %] |
15 |
//<![CDATA[ |
|
|
16 |
var browser = KOHA.browser('[% searchid %]', parseInt('[% biblionumber %]', 10)); |
17 |
browser.show(); |
18 |
|
19 |
$(document).ready(function(){ |
20 |
|
21 |
// Remove the onclick event defined in browser.js, |
22 |
// otherwise the deletion confirmation will not work correctly |
23 |
$('a[href*="biblionumber="]').off('click'); |
24 |
|
25 |
[% IF (popup) %] |
26 |
[% IF (opisadd) %] |
27 |
window.close(); |
28 |
[% END %] |
29 |
[% END %] |
30 |
$("fieldset.rows input, fieldset.rows select").addClass("noEnterSubmit"); |
31 |
/* Inline edit/delete links */ |
32 |
var biblionumber = $("input[name='biblionumber']").attr("value"); |
33 |
$("tr.editable").each(function(){ |
34 |
$(this).find("td:not(:first)").on('click', function(){ |
35 |
var rowid = $(this).parent().attr("id"); |
36 |
num_rowid = rowid.replace("row",""); |
37 |
$(".linktools").remove(); |
38 |
var edit_link = $('<a href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&frameworkcode=[% frameworkcode %]&biblionumber=[% biblionumber %]&itemnumber='+num_rowid+'&searchid=[% searchid %]#edititem"></a>'); |
39 |
$(edit_link).text(_("Edit item")); |
40 |
var delete_link = $('<a href="/cgi-bin/koha/cataloguing/additem.pl?op=delitem&frameworkcode=[% frameworkcode %]&biblionumber=[% biblionumber %]&itemnumber='+num_rowid+'&searchid=[% searchid %]"></a>'); |
41 |
$(delete_link).text(_("Delete item")); |
42 |
$(delete_link).on('click', function(e) { |
43 |
return confirm_deletion(); |
44 |
}); |
45 |
var tools_node = $('<span class="linktools"></span>'); |
46 |
$(tools_node).append(edit_link); |
47 |
$(tools_node).append(delete_link); |
48 |
$(this).append(tools_node); |
49 |
}); |
50 |
}); |
51 |
|
52 |
$("#addnewitem").click(function(){ |
53 |
if ( confirm(_("Are you sure you want to add a new item? Any changes made on this page will be lost.")) ){ |
54 |
window.location.href = "/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblionumber %]"; |
55 |
} |
56 |
}); |
57 |
|
58 |
var columns_settings = [% ColumnsSettings.GetColumns( 'cataloguing', 'additem', 'itemst', 'json' ) %] |
59 |
// Skip the first column |
60 |
columns_settings.unshift( { cannot_be_toggled: "1" } ); |
61 |
|
62 |
var itemst = KohaTable("itemst", { |
63 |
"aoColumnDefs": [ |
64 |
{ "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }, |
65 |
], |
66 |
'bPaginate': false, |
67 |
'bInfo': false, |
68 |
"bAutoWidth": false, |
69 |
"bKohaColumnsUseNames": true |
70 |
}, columns_settings); |
71 |
|
72 |
var multiCopyControl = $("#add_multiple_copies_span"); |
73 |
var addMultipleBlock = $("#addmultiple"); |
74 |
var addSingleBlock = $("#addsingle"); |
75 |
multiCopyControl.hide(); |
76 |
$("#add_multiple_copies").on("click",function(e){ |
77 |
e.preventDefault; |
78 |
addMultipleBlock.toggle(); |
79 |
addSingleBlock.toggle(); |
80 |
multiCopyControl.toggle(); |
81 |
$('body,html').animate({ scrollTop: $('body').height() }, 100); |
82 |
}); |
83 |
$("#cancel_add_multiple").on("click",function(e){ |
84 |
e.preventDefault(); |
85 |
addMultipleBlock.toggle(); |
86 |
addSingleBlock.toggle(); |
87 |
multiCopyControl.toggle(); |
88 |
}); |
89 |
}); |
90 |
|
91 |
function Check(f) { |
92 |
var total_errors = CheckMandatorySubfields(f); |
93 |
if (total_errors==0) { |
94 |
// Explanation about this line: |
95 |
// In case of limited edition permission, we have to prevent user from modifying some fields. |
96 |
// But there is no such thing as readonly attribute for select elements. |
97 |
// So we use disabled instead. But disabled prevent values from being passed through the form at submit. |
98 |
// So we "un-disable" the elements just before submitting. |
99 |
// That's a bit clumsy, and if someone comes up with a better solution, feel free to improve that. |
100 |
$("select[name=field_value]").prop('disabled', false); |
101 |
return true; |
102 |
} else { |
103 |
var alertString2 = _("Form not submitted because of the following problem(s)"); |
104 |
alertString2 += "\n------------------------------------------------------------------------------------\n"; |
105 |
alertString2 += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_errors); |
106 |
alert(alertString2); |
107 |
return false; |
108 |
} |
109 |
return true; |
110 |
} |
111 |
function CheckMultipleAdd(f) { |
112 |
|
113 |
if (!f || isNaN(f) || !parseInt(f) == f || f <= 0) { |
114 |
alert(_("Please enter a number of items to create.")); |
115 |
return false; |
116 |
} |
117 |
<!-- Add a soft-limit of 99 with a reminder about potential data entry error --> |
118 |
if (f>99) { |
119 |
return confirm(_("You are about to add %s items. Continue?").format(f)); |
120 |
} |
121 |
} |
122 |
function Dopop(link,i) { |
123 |
defaultvalue=document.forms[0].field_value[i].value; |
124 |
newin=window.open(link+"&result="+defaultvalue,"valuebuilder",'width=500,height=400,toolbar=false,scrollbars=yes'); |
125 |
} |
126 |
|
127 |
function confirm_deletion() { |
128 |
return confirm(_("Are you sure you want to delete this item?")); |
129 |
} |
130 |
|
131 |
//]]> |
132 |
</script> |
133 |
[% Asset.css("css/addbiblio.css") %] |
17 |
[% Asset.css("css/addbiblio.css") %] |
134 |
|
|
|
135 |
[% INCLUDE 'select2.inc' %] |
136 |
<script type="text/javascript"> |
137 |
$(document).ready(function() { |
138 |
$('.subfield_line select').select2(); |
139 |
}); |
140 |
</script> |
141 |
|
142 |
[% IF ( bidi ) %] |
143 |
[% Asset.css("css/right-to-left.css") %] |
144 |
[% END %] |
145 |
</head> |
18 |
</head> |
|
|
19 |
|
146 |
<body id="cat_additem" class="cat"> |
20 |
<body id="cat_additem" class="cat"> |
147 |
[% INCLUDE 'header.inc' %] |
21 |
[% INCLUDE 'header.inc' %] |
148 |
[% INCLUDE 'cataloging-search.inc' %] |
22 |
[% INCLUDE 'cataloging-search.inc' %] |