+[% USE ColumnsSettings %]
+
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Cataloging › [% title |html %] [% IF ( author ) %] by [% author %][% END %] (Record #[% biblionumber %]) › Items</title>
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
[% INCLUDE 'doc-head-close.inc' %]
[% INCLUDE 'datatables.inc' %]
<script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script>
+[% INCLUDE 'columns_settings.inc' %]
[% INCLUDE 'browser-strings.inc' %]
<!--[if lt IE 9]>
<script type="text/javascript" src="[% interface %]/lib/shims/json2.min.js"></script>
browser.show();
$(document).ready(function(){
+
+ // Remove the onclick event defined in browser.js,
+ // otherwise the deletion confirmation will not work correctly
+ $('a[href*="biblionumber="]').off('click');
+
[% IF (popup) %]
[% IF (opisadd) %]
window.close();
[% END %]
[% END %]
- $("fieldset.rows input").addClass("noEnterSubmit");
- /* Inline edit/delete links */
- var biblionumber = $("input[name='biblionumber']").attr("value");
- $("tr.editable td").click(function(event){
- var $tgt = $(event.target);
- if($tgt.is("a")||$tgt.is(":first-child")||$tgt.is(":nth-child(2)")){ return true; } else {
- var rowid = $(this).parent().attr("id");
- num_rowid = rowid.replace("row","");
- $(".linktools").remove();
- $(this).append("<span class=\"linktools\"><a href=\"/cgi-bin/koha/cataloguing/additem.pl?op=edititem&frameworkcode=[% frameworkcode %]&biblionumber=[% biblionumber %]&itemnumber="+num_rowid+"#edititem\">" + _("Edit item") + "</a> <a href=\"/cgi-bin/koha/cataloguing/additem.pl?op=delitem&frameworkcode=[% frameworkcode %]&biblionumber=[% biblionumber %]&itemnumber="+num_rowid+"\" onclick=\"confirm_deletion([% biblionumber %],"+num_rowid+"); return false;\">" + _("Delete item") + "</a></span>");
- }
- });
+ $("fieldset.rows input, fieldset.rows select").addClass("noEnterSubmit");
+ /* Inline edit/delete links */
+ var biblionumber = $("input[name='biblionumber']").attr("value");
+ $("tr.editable").each(function(){
+ $(this).find("td:not(:first)").on('click', function(){
+ var rowid = $(this).parent().attr("id");
+ num_rowid = rowid.replace("row","");
+ $(".linktools").remove();
+ var edit_link = $('<a href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&frameworkcode=[% frameworkcode %]&biblionumber=[% biblionumber %]&itemnumber='+num_rowid+'&searchid=[% searchid %]#edititem">' + _("Edit item") + '</a>');
+ var delete_link = $('<a href="/cgi-bin/koha/cataloguing/additem.pl?op=delitem&frameworkcode=[% frameworkcode %]&biblionumber=[% biblionumber %]&itemnumber='+num_rowid+'&searchid=[% searchid %]">' + _("Delete item") + '</a></span>');
+ $(delete_link).on('click', function(e) {
+ return confirm_deletion();
+ });
+ var tools_node = $('<span class="linktools"></span>');
+ $(tools_node).append(edit_link);
+ $(tools_node).append(delete_link);
+ $(this).append(tools_node);
+ });
+ });
- var itemst = $("#itemst").dataTable($.extend(true, {}, dataTablesDefaults, {
+ var columns_settings = [% ColumnsSettings.GetColumns( 'cataloguing', 'additem', 'itemst', 'json' ) %]
+ // Skip the first column
+ columns_settings.unshift( { cannot_be_toggled: "1" } );
+
+ var itemst = KohaTable("#itemst", {
"aoColumnDefs": [
{ "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
],
'bPaginate': false,
'bInfo': false,
"bAutoWidth": false
- } ) );
+ }, columns_settings);
});
-function active(numlayer)
-{
- for (i=10; i < 11 ; i++ ) {
- ong = i+"XX";
- link = "link"+i;
- if (numlayer==i) {
- document.getElementById(ong).style.visibility="visible";
- document.getElementById(link).style.backgroundColor="#11AA11";
- document.getElementById(link).style.backgroundImage="url([% themelang %]/images/background-mem.gif)";
- } else {
- document.getElementById(ong).style.visibility="hidden";
- document.getElementById(link).style.backgroundColor="#FFFFFF";
- document.getElementById(link).style.backgroundImage="";
- }
- }
-}
function Check(f) {
var total_errors = CheckMandatorySubfields(f);
- if (total_errors > 0) {
+ if (total_errors==0) {
+ // Explanation about this line:
+ // In case of limited edition permission, we have to prevent user from modifying some fields.
+ // But there is no such thing as readonly attribute for select elements.
+ // So we use disabled instead. But disabled prevent values from being passed through the form at submit.
+ // So we "un-disable" the elements just before submitting.
+ // That's a bit clumsy, and if someone comes up with a better solution, feel free to improve that.
+ $("select[name=field_value]").removeAttr("disabled");
+ return true;
+ } else {
var alertString2 = _("Form not submitted because of the following problem(s)");
alertString2 += "\n------------------------------------------------------------------------------------\n";
- alertString2 += "\n- "+ total_errors + _(" mandatory fields empty (highlighted)");
+ alertString2 += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_errors);
alert(alertString2);
return false;
}
function CheckMultipleAdd(f) {
if (!f || isNaN(f) || !parseInt(f) == f || f <= 0) {
- alert(_("Please enter a number of items to create."));
- return false;
+ alert(_("Please enter a number of items to create."));
+ return false;
+ }
+ <!-- Add a soft-limit of 99 with a reminder about potential data entry error -->
+ if (f>99) {
+ return confirm(_("You are about to add %s items. Continue?").format(f));
}
}
function Dopop(link,i) {
newin=window.open(link+"&result="+defaultvalue,"valuebuilder",'width=500,height=400,toolbar=false,scrollbars=yes');
}
-function confirm_deletion(biblionumber,itemnumber) {
- var original = $("#row"+itemnumber).attr("class");
- $("#row"+itemnumber).attr("class","confirm");
- var is_confirmed = confirm(_("Are you sure you want to delete this item?"));
- if (is_confirmed) {
- window.location = "additem.pl?op=delitem&biblionumber="+biblionumber+"&itemnumber="+itemnumber;
- } else {
- $("#row"+itemnumber).attr("class","");
- }
+function confirm_deletion() {
+ return confirm(_("Are you sure you want to delete this item?"));
}
-$(document).ready(function() {
- $("#cataloguing_additem_itemlist tr").hover(
- function () {$(this).addClass("highlight");},
- function () {$(this).removeClass("highlight");}
- );
-});
//]]>
</script>
<link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
<thead>
<tr>
<th> </th>
- [% FOREACH item_header_loo IN item_header_loop %]
- <th>
- [% item_header_loo.header_value %]
+ [% FOREACH item_header IN item_header_loop %]
+ [% IF item_header.column_name %]
+ <th data-colname="[% item_header.column_name %]">
+ [% ELSE %]
+ <th>
+ [% END %]
+ [% item_header.header_value %]
</th>
[% END %]
</tr>
[% FOREACH item_loo IN item_loop %]
[% IF ( item_loo.itemnumber == itemnumber) %]
[% IF item_loo.nomod %]
- <tr id="row[% item_loo.itemnumber %]" class="active">
+ <tr id="row[% item_loo.itemnumber %]" class="active highlight">
[% ELSE %]
- <tr id="row[% item_loo.itemnumber %]" class="active editable">
+ <tr id="row[% item_loo.itemnumber %]" class="active editable highlight">
[% END %]
[% ELSE %]
[% IF item_loo.nomod %]
[% ELSE %]
<td>
[% IF ( item_loo.hostitemflag ) %]
- <a href="additem.pl?op=edititem&biblionumber=[% item_loo.hostbiblionumber %]&itemnumber=[% item_loo.itemnumber %]#edititem">Edit in host</a> <a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delinkitem&biblionumber=[% biblionumber %]&hostitemnumber=[% item_loo.itemnumber %]">Delink</a>
+ <a href="additem.pl?op=edititem&biblionumber=[% item_loo.hostbiblionumber %]&itemnumber=[% item_loo.itemnumber %]#edititem">Edit in host</a> <a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delinkitem&biblionumber=[% biblionumber %]&hostitemnumber=[% item_loo.itemnumber %]&searchid=[% searchid %]">Delink</a>
[% ELSE %]
- <a href="additem.pl?op=edititem&biblionumber=[% biblionumber %]&itemnumber=[% item_loo.itemnumber %]#edititem">Edit</a>
+ <a href="additem.pl?op=edititem&biblionumber=[% biblionumber %]&itemnumber=[% item_loo.itemnumber %]&searchid=[% searchid %]#edititem">Edit</a>
[% IF ( item_loo.countanalytics ) %]
<a href="/cgi-bin/koha/catalogue/search.pl?idx=hi&q=% item_loo.itemnumber %]">View analytics</a>
[% ELSE %]
- <a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delitem&biblionumber=[% biblionumber %]&itemnumber=[% item_loo.itemnumber %]" onclick="confirm_deletion([% biblionumber %],[% item_loo.itemnumber %]); return false;">Delete</a>
+ <a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delitem&biblionumber=[% biblionumber %]&itemnumber=[% item_loo.itemnumber %]&searchid=[% searchid %]" onclick="return confirm_deletion();">Delete</a>
[% END %]
[% END %]
</td>
</div>
<div class="yui-u">
<div id="cataloguing_additem_newitem">
- <form method="post" action="/cgi-bin/koha/cataloguing/additem.pl" name="f">
+ <form id="f" method="post" action="/cgi-bin/koha/cataloguing/additem.pl" name="f">
<input type="hidden" name="op" value="[% op %]" />
[% IF (popup) %]
<input type="hidden" name="popup" value="1" />
[% ELSE %]
<label>[% ite.subfield %] - [% ite.marc_lib %]</label>
[% END %]
- [% ite.marc_value %]
+
+ [% SET mv = ite.marc_value %]
+ [% IF ( mv.type == 'hidden' ) %]
+ <input type="hidden" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]">
+ [% ELSIF ( mv.type == 'select' ) %]
+ [% IF ( mv.readonlyselect ) %]
+ <select name="field_value" id="[%- mv.id -%]" size="1" class="input_marceditor" readonly="readonly" disabled="disabled">
+ [% ELSE %]
+ <select name="field_value" id="[%- mv.id -%]" size="1" class="input_marceditor">
+ [% END %]
+ [% FOREACH aval IN mv.values %]
+ [% IF aval == mv.default %]
+ <option value="[%- aval -%]" selected="selected">[%- mv.labels.$aval -%]</option>
+ [% ELSE %]
+ <option value="[%- aval -%]">[%- mv.labels.$aval -%]</option>
+ [% END %]
+ [% END %]
+ </select>
+ [% ELSIF ( mv.type == 'text_auth' ) %]
+ <input type="text" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]" />
+ [% SET dopop = "Dopop('/cgi-bin/koha/authorities/auth_finder.pl?authtypecode=\"${mv.authtypecode}\"&index=${mv.id}','${mv.id}')" %]
+ <a href="#" class="buttonDot" onclick="[%- dopop -%]; return false;" title="Tag editor">...</a>
+ [% ELSIF ( mv.type == 'text_plugin' ) %]
+ <input type="text" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]" />
+ [% IF ( mv.nopopup ) %]
+ <a href="#" id="buttonDot_[%- mv.id -%]" class="[%- mv.class -%]" title="No popup">...</a>
+ [% ELSE %]
+ <a href="#" id="buttonDot_[%- mv.id -%]" class="[%- mv.class -%]" title="Tag editor">...</a>
+ [% END %]
+ [%- mv.javascript -%]
+ [% ELSIF ( mv.type == 'text' ) %]
+ <input type="text" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]" />
+ [% ELSIF ( mv.type == 'textarea' ) %]
+ <textarea id="[%- mv.id -%]" name="field_value" class="input_marceditor" rows="5" cols="64" >[% mv.value %]</textarea>
+ [% END %]
+
<input type="hidden" name="tag" value="[% ite.tag %]" />
<input type="hidden" name="subfield" value="[% ite.subfield %]" />
<input type="hidden" name="mandatory" value="[% ite.mandatory %]" />
<input type="submit" name="add_duplicate_submit" value="Add & duplicate" onclick="return Check(this.form)" />
<input type="submit" name="add_multiple_copies" value="Add multiple items" onclick="javascript:this.nextSibling.style.visibility='visible';document.f.number_of_copies.focus(); return false;" /><span id="add_multiple_copies_span" style="visibility:hidden">
<label for="number_of_copies">Number of items to add : </label>
- <input type="text" id="number_of_copies" name="number_of_copies" value="" size="2" />
+ <input type="text" id="number_of_copies" name="number_of_copies" value="" />
<input type="submit" id="add_multiple_copies_submit" name="add_multiple_copies_submit" value="Add" onclick="javascript:return Check(this.form) && CheckMultipleAdd(this.form.number_of_copies.value);" />
</span>