From 5153ef138755794095dea8aa282b0022b5c60c67 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Tue, 2 Jul 2013 14:05:20 +0000 Subject: [PATCH] Bug 9044: (follow-up) change dropdown list into links list Signed-off-by: Bernardo Gonzalez Kriegel That's the one I sign. Comment: At first I don't know where to find links, until I selected an item. Works as described. No koha-qa errors. Solved merge conflict on updatedatabase.pl Signed-off-by: Katrin Fischer Signed-off-by: Galen Charlton --- .../prog/en/modules/catalogue/detail.tt | 100 +++++++++++------- 1 file changed, 62 insertions(+), 38 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 7914ee9c25..dc979da7e0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -73,40 +73,70 @@ function verify_images() { [% IF StaffDetailItemSelection %] function selectAllItems(div) { $("input[name='itemnumber'][type='checkbox']", div).attr('checked', 'checked'); + itemSelectionBuildActionLinks(div); } - function deselectAllItems(div) { + function clearAllItems(div) { $("input[name='itemnumber'][type='checkbox']", div).removeAttr('checked'); + itemSelectionBuildActionLinks(div); } - function itemSelectionExecuteAction(div) { + function itemSelectionBuildDeleteLink(div) { var itemnumbers = new Array(); $("input[name='itemnumber'][type='checkbox']:checked", div).each(function() { itemnumbers.push($(this).val()); }); if (itemnumbers.length > 0) { - var action = $('select[name="itemselection_action"]', div).val(); - if (action.length > 0) { - var del = (action == 'delete') ? 1 : 0; - var url = '/cgi-bin/koha/tools/batchMod.pl?op=show'; - if (action == 'delete') { - url += '&del=1'; - } - url += '&itemnumber=' + itemnumbers.join('&itemnumber='); - url += '&src=' + '[% "/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber" |uri %]'; - new_window = $("input[name='new_window']", div).attr('checked'); - if (new_window) { - window.open(url); - } else { - window.location.href = url; - } - } else { - alert(_("Please choose an action")); - } + var url = '/cgi-bin/koha/tools/batchMod.pl?op=show&del=1'; + url += '&itemnumber=' + itemnumbers.join('&itemnumber='); + url += '&src=' + '[% "/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber" |uri %]'; + $('a.itemselection_action_delete').attr('href', url); + $('a.itemselection_action_delete').show(); } else { - alert(_("Please select at least one item.")); + $('a.itemselection_action_delete').hide(); + return false; } + return true } + + function itemSelectionBuildModifyLink(div) { + var itemnumbers = new Array(); + $("input[name='itemnumber'][type='checkbox']:checked", div).each(function() { + itemnumbers.push($(this).val()); + }); + if (itemnumbers.length > 0) { + var url = '/cgi-bin/koha/tools/batchMod.pl?op=show'; + url += '&itemnumber=' + itemnumbers.join('&itemnumber='); + url += '&src=' + '[% "/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber" |uri %]'; + $('a.itemselection_action_modify').attr('href', url); + $('a.itemselection_action_modify').show(); + } else { + $('a.itemselection_action_modify').hide(); + return false; + } + return true; + } + + function itemSelectionBuildActionLinks(div) { + var delete_link_ok = itemSelectionBuildDeleteLink(div); + var modify_link_ok = itemSelectionBuildModifyLink(div); + if (modify_link_ok || delete_link_ok) { + $('.itemselection_actions', div).show(); + } else { + $('.itemselection_actions', div).hide(); + } + } + + $(document).ready(function() { + $('table.items_table').each(function() { + var div = $(this).parent().parent(); + itemSelectionBuildActionLinks(div); + }); + $("input[name='itemnumber'][type='checkbox']").change(function() { + var div = $(this).parents('table').parent().parent(); + itemSelectionBuildActionLinks(div); + }); + }); [% END %] $(document).ready(function() { @@ -453,24 +483,18 @@ function verify_images() { [% items_table_block_iter = items_table_block_iter + 1 %] [% IF (StaffDetailItemSelection) %] Select all | - Deselect all | -
- - - - - -
+ Clear all + + | Actions: + [% IF CAN_user_tools_items_batchdel %] + Delete selected items + [% END %] + [% IF CAN_user_tools_items_batchmod %] + Modify selected items + [% END %] + [% END %] - +
[% IF (StaffDetailItemSelection) %][% END %] -- 2.39.5