From fd680afc6f82605cf433e92b21576c60333ba1f6 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Sat, 2 Feb 2013 10:07:04 -0500 Subject: [PATCH] Bug 9635 - Replace YUI buttons on label batches pages with Bootstrap This patch converts the toolbar used by label batches pages to Bootstrap, replacing YUI button and menu code with Bootstrap markup. This patch also consolidates the include file and main template. The include file was used in only one template. To test, create a label batch and test all functions related to that batch: adding and removing items, de-duplicating the batch, exporting individual items, exporting the batch, and deleting the batch. Buttons should look correct and work correctly. Signed-off-by: Bernardo Gonzalez Kriegel Comment: Work as described, no errors. Tested all functions (add, del, de-duplicate, export item, export batch) Signed-off-by: Katrin Fischer Works nicely, no problems found. Signed-off-by: Jared Camins-Esakov --- .../en/includes/labels-batches-toolbar.inc | 185 ------------------ .../en/modules/labels/label-edit-batch.tt | 140 ++++++++++++- 2 files changed, 138 insertions(+), 187 deletions(-) delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/labels-batches-toolbar.inc diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/labels-batches-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/labels-batches-toolbar.inc deleted file mode 100644 index 8786a8ce13..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/labels-batches-toolbar.inc +++ /dev/null @@ -1,185 +0,0 @@ -
- - -
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt index 5a49e7030b..bde821af2f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt @@ -1,4 +1,3 @@ - [% INCLUDE 'doc-head-open.inc' %] Koha › Tools › Labels › Manage label batches [% INCLUDE 'doc-head-close.inc' %] @@ -17,6 +16,136 @@ return true; // ok }; } + function DeleteConfirm() { + var msg = "Are you sure you want to delete batch [% batch_id %]?" + var answer = confirm(msg); + if (answer) { + window.location = "/cgi-bin/koha/labels/label-manage.pl?op=delete&label_element=batch&element_id=[% batch_id %]"; + } + else { + return; // abort delete + } + }; + function Remove() { + items = new Array; + item_num = new Array; + if(document.items.action.length > 0) { + for (var i=0; i < document.items.action.length; i++) { + if (document.items.action[i].checked) { + items.push("label_id=" + document.items.action[i].value); + item_num.push(i+1); + } + } + if (items.length < 1) { + alert(_("Please select at least one item to delete.")); + return; // no item selected + } + getstr = items.join("&"); + item_msg = item_num.join(", "); + var msg = "Are you sure you want to remove label number(s): " + item_msg + " from this batch?" + } +// else if (document.items.action.checked) { +// getstr = "label_id="+document.items.action.value; +// var msg = "Are you sure you want to remove selected item from this batch?" +// } + else { + alert(_("Please select at least label to delete.")); + return; // no item selected + } + var answer = confirm(msg); + if (answer) { + window.location = "/cgi-bin/koha/labels/label-edit-batch.pl?op=remove&batch_id=[% batch_id %]&" + getstr; + } + else { + return; // abort delete + } + }; + function Add() { + var barcodes = document.getElementById("barcode"); + if (barcodes.value == '') { + window.open("/cgi-bin/koha/labels/label-item-search.pl?batch_id=[% batch_id %]&type=labels",'FindABibIndex','width=875,height=400,toolbar=no,scrollbars=yes'); + } + else { + document.forms["add_by_barcode"].submit(); + } + }; + function DeDuplicate() { + window.location = "/cgi-bin/koha/labels/label-edit-batch.pl?op=de_duplicate&batch_id=[% batch_id %]"; + }; + function Xport(mode) { + if (mode == 'label') { + labels= new Array; + if(document.items.action.length > 0) { + for (var i=0; i < document.items.action.length; i++) { + if (document.items.action[i].checked) { + labels.push("label_id=" + document.items.action[i].value); + } + } + if (labels.length < 1) { + alert(_("Please select at least one label to export.")); + return; // no batch selected + } + getstr = labels.join("&"); + } + else if (document.items.action.checked) { + getstr = document.items.action.value; + } + else { + alert(_("Please select at least one label to export.")); + return; // no batch selected + } + return GB_showCenter('Export labels', "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id %]&" + getstr, 700, 800); + } + else if (mode == 'batch') { + return GB_showCenter('Export labels', "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id %]", 700, 800); + } + else { + // some pass-thru error trapping just in case... + } + }; + function selected_layout() { + if (document.items.action.length) { + for (i=0;i @@ -34,7 +163,14 @@
- [% INCLUDE 'labels-batches-toolbar.inc' %] +
Current library: [% LoginBranchname %]
-- 2.39.2