From 755b509cd6f97f581fd5332a9b96f2f5569cac33 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 16 Oct 2008 10:45:29 -0500 Subject: [PATCH] Steamlining javascript for cloning additem block and tweaking style. Signed-off-by: Galen Charlton --- koha-tmpl/intranet-tmpl/prog/en/js/additem.js | 53 ++++++------------- .../prog/en/modules/acqui/orderreceive.tmpl | 22 +++++--- 2 files changed, 30 insertions(+), 45 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/additem.js b/koha-tmpl/intranet-tmpl/prog/en/js/additem.js index 43822a1018..a1e3092579 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/additem.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/additem.js @@ -1,40 +1,3 @@ -function countItemBlocks() { - var outeritemblock = document.getElementById('outeritemblock'); - var quantityrec = document.getElementById('quantityrec'); - var origquantityrec = document.getElementById('origquantityrec'); - var itemblockcount = outeritemblock.getElementsByTagName('div'); - var num = parseFloat(origquantityrec.value) + itemblockcount.length; - quantityrec.setAttribute('value',num); -} -function deleteItemBlock(index) { - var aDiv = document.getElementById(index); - aDiv.parentNode.removeChild(aDiv); - countItemBlocks(); -} -function cloneItemBlock(index) { - var original = document.getElementById(index); //original
- var clone = original.cloneNode(true); - // set the attribute for the new 'div' subfields - clone.setAttribute('id',index + index);//set another id. - var NumTabIndex; - NumTabIndex = parseInt(original.getAttribute('tabindex')); - if(isNaN(NumTabIndex)) NumTabIndex = 0; - clone.setAttribute('tabindex',NumTabIndex+1); - var CloneButtonPlus; - var CloneButtonMinus; - // try{ - CloneButtonPlus = clone.getElementsByTagName('a')[0]; - CloneButtonPlus.setAttribute('onclick',"cloneItemBlock('" + index + index + "')"); - CloneButtonMinus = clone.getElementsByTagName('a')[1]; - CloneButtonMinus.setAttribute('onclick',"deleteItemBlock('" + index + index + "')"); - CloneButtonMinus.setAttribute('style',"display:inline"); - // } - //catch(e){ // do nothig if ButtonPlus & CloneButtonPlus don't exist. - //} - // insert this line on the page - original.parentNode.insertBefore(clone,original.nextSibling); - countItemBlocks(); -} function check_additem() { var barcodes = document.getElementsByName('barcode'); var success = true; @@ -51,3 +14,19 @@ function check_additem() { // duplicates within the form. return success; } +$(document).ready(function(){ + $(".cloneItemBlock").click(function(){ + $(this).parent().parent().clone(true).insertAfter($(this).parent().parent()).find("a.deleteItemBlock").show(); + var quantityrec = parseFloat($("#quantityrec").attr("value")); + quantityrec++; + $("#quantityrec").attr("value",quantityrec); + return false; + }); + $(".deleteItemBlock").click(function(){ + $(this).parent().parent().remove(); + var quantityrec = parseFloat($("#quantityrec").attr("value")); + quantityrec--; + $("#quantityrec").attr("value",quantityrec); + return false; + }); +}); \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tmpl index 66f4979e21..021b2d3d55 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tmpl @@ -1,7 +1,13 @@ Koha › Acquisitions › Receipt summary for : <!-- TMPL_VAR NAME="name" --> <!-- TMPL_IF NAME="invoice" -->invoice, <!-- TMPL_VAR NAME="invoice" --><!-- /TMPL_IF --> - + + @@ -24,7 +30,7 @@
Catalog Details -
  • Title:
  • +
    1. Title:
    2. Author:
    3. Copyright: @@ -33,12 +39,12 @@
    4. Series:
    5. -
+
- Item details (n): (add to catalog) + Item details: (add to catalog)
-
+
  1. @@ -82,9 +88,9 @@ -
-')">+ - ')">- + +
[+] + [-]
" /> -- 2.39.5