From 74753b4b69eba4a23a8e37f48bf402482136a367 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 30 Dec 2011 15:27:01 -0500 Subject: [PATCH] Bug 7719 - Change state of controls based on whether boxes are checked Some OPAC interface controls cannot function unless a checkbox is checked. Examples: - Placing a hold on multiple items in the cart window or on a list view page - Adding tags to multiple items in the cart window or on a list view page - Removing one or more items from the cart window - Removing one or more items from a list on the list view page - Adding one or more items to a list from the cart window This patch moves these controls into a separate div in which links are enabled or disabled based on whether checkboxes are checked. It does so on two pages: The lists view page (when viewing the contents of a list) and in the cart window. Links which are in their disabled state should not perform any action. After checking one or more checkboxes the links should become active and behave normally. Signed-off-by: Liz Rea Works in chrome and firefox (latest). Passes tests. Signed-off-by: Paul Poulain --- koha-tmpl/opac-tmpl/prog/en/css/opac.css | 84 +++++++++++-- .../opac-tmpl/prog/en/modules/opac-basket.tt | 85 +++++++------ .../opac-tmpl/prog/en/modules/opac-shelves.tt | 113 ++++++++++++------ .../prog/images/delete-shelf-disabled.gif | Bin 0 -> 117 bytes .../prog/images/place-hold-small-disabled.png | Bin 0 -> 316 bytes .../prog/images/shelf-delete-disabled.gif | Bin 0 -> 118 bytes .../prog/images/shelf-new-disabled.gif | Bin 0 -> 300 bytes .../prog/images/tags-small-disabled.png | Bin 0 -> 316 bytes 8 files changed, 202 insertions(+), 80 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/prog/images/delete-shelf-disabled.gif create mode 100644 koha-tmpl/opac-tmpl/prog/images/place-hold-small-disabled.png create mode 100644 koha-tmpl/opac-tmpl/prog/images/shelf-delete-disabled.gif create mode 100644 koha-tmpl/opac-tmpl/prog/images/shelf-new-disabled.gif create mode 100644 koha-tmpl/opac-tmpl/prog/images/tags-small-disabled.png diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css index 1a8c6b1579..3011e58be7 100644 --- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css +++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css @@ -13,6 +13,10 @@ a:hover,#toolbar input.editshelf:hover,input.editshelf:hover,a.editshelf:hover,i color : #990033; } +a.disabled { + color : #888888 !important; +} + body { background-color : white; text-align : left; @@ -467,16 +471,37 @@ a .term { /* toolbar buttons */ -#toolbar { +#toolbar, +#selections-toolbar { background-color:#EEEEEE; border:1px solid #E8E8E8; -margin : .5em 0; +margin : 0 0; padding:3px 3px 5px 5px; vertical-align:middle; } +#basket #toolbar { + padding: 7px 5px 9px 9px; +} + +#selections-toolbar { +background: #E8E8E8; /* Old browsers */ +background: -moz-linear-gradient(top, #b2b2b2 0%, #e0e0e0 14%, #e8e8e8 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#b2b2b2), color-stop(14%,#e0e0e0), color-stop(100%,#e8e8e8)); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, #b2b2b2 0%,#e0e0e0 14%,#e8e8e8 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, #b2b2b2 0%,#e0e0e0 14%,#e8e8e8 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, #b2b2b2 0%,#e0e0e0 14%,#e8e8e8 100%); /* IE10+ */ +background: linear-gradient(top, #b2b2b2 0%,#e0e0e0 14%,#e8e8e8 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e0e0e0', endColorstr='#e8e8e8',GradientType=0 ); /* IE6-9 */ + margin : 0 0 1em 0; + padding-top : .5em; + padding-left : 10px; +} + #toolbar a, -#toolbar input { +#selections-toolbar a, +#toolbar input, +#selections-toolbar input { white-space : nowrap; } @@ -499,15 +524,15 @@ vertical-align:middle; #toolbar a.print { - background: transparent url(../../images/print-small.png) 5px 50% no-repeat; + background: transparent url(../../images/print-small.png) 10px 50% no-repeat; text-decoration : none; - padding-left : 23px; + padding-left : 30px; } #toolbar a.brief { background: transparent url(../../images/brief.gif) 5px 50% no-repeat; text-decoration : none; - padding-left : 23px; + padding-left : 27px; } #toolbar a.detail { @@ -540,18 +565,34 @@ vertical-align:middle; padding-left : 26px; } -#toolbar a.hold { +#toolbar a.hold, +#selections-toolbar a.hold { background: transparent url(../../images/place-hold-small.png) 5px 50% no-repeat; text-decoration : none; padding-left : 23px; } +#selections-toolbar a.hold.disabled { + background: transparent url(../../images/place-hold-small-disabled.png) 5px 50% no-repeat; +} + #toolbar a.newshelf { background : transparent url("../../images/shelf-new.gif") 5px 50% no-repeat; padding-left : 23px; text-decoration : none; } +#selections-toolbar a.removeitems { + background: transparent url(../../images/shelf-delete.gif) 11px 50% no-repeat; + text-decoration : none; + padding-left : 25px; +} + + +#selections-toolbar a.removeitems.disabled { + background: transparent url(../../images/shelf-delete-disabled.gif) 11px 50% no-repeat; +} + #toolbar a.send, a.send { background: transparent url(../../images/send.png) 2px 50% no-repeat; @@ -585,7 +626,8 @@ input.editshelf { text-decoration : none; } -#toolbar input.newshelf { +#toolbar input.newshelf, +a.newshelf { background : transparent url("../../images/shelf-new.gif") center left no-repeat; border : 0; color : #006699; @@ -596,14 +638,24 @@ input.editshelf { text-decoration : none; } +a.newshelf.disabled { + background : transparent url("../../images/shelf-new-disabled.gif") center left no-repeat; +} + #toolbar input.deleteshelf, -input.deleteshelf { +input.deleteshelf, +a.deleteshelf { background : transparent url("../../images/shelf-delete.gif") 7px 50% no-repeat; border : 0; color : #006699; cursor : pointer; font-size : 100%; padding-left : 20px; + text-decoration : none; +} + +a.deleteshelf.disabled { + background : transparent url("../../images/shelf-delete-disabled.gif") 7px 50% no-repeat; } #toolbar input.deleteshelf:hover { @@ -618,6 +670,10 @@ input.deleteshelf:active { border : 0; } +#selections { + font-weight : bold; +} + #tagsel_span input.submit, #tagsel_tag { background-image: url(../../images/tags-small.png); @@ -627,6 +683,10 @@ input.deleteshelf:active { text-decoration: none; } +#tagsel_tag.disabled { + background-image: url(../../images/tags-small-disabled.png); +} + #tagslist li { display : inline; } #placehold input.submit:hover, @@ -2299,3 +2359,9 @@ p.patronimage.edit { border-color:#E8E8E8; margin: 1em 1em 1em 0; } + +span.sep { + color: #888; + padding: 0 .2em; + text-shadow: 1px 1px 0 #FFF; +} diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-basket.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-basket.tt index fff80cd069..437cbd2181 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-basket.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-basket.tt @@ -22,11 +22,15 @@ [% END %] @@ -134,16 +151,16 @@ function tagAdded() { [% END %] [% IF ( verbose ) %] - [% UNLESS ( print_basket ) %]

Select All Clear All | Selected items : + [% UNLESS ( print_basket ) %]

Select all Clear all | Select titles to: -Remove +Remove [% IF ( opacuserlogin ) %] [% IF ( virtualshelves ) %][% IF ( loggedinusername ) %] - | Add to a list + | Add to a list [% END %][% END %] - [% IF ( RequestOnOpac ) %]| Place hold[% END %] + [% IF ( RequestOnOpac ) %]| Place hold[% END %] [% IF ( loggedinusername ) %][% IF ( TagsEnabled ) %] - | Tag[% END %][% END %] + | Tag[% END %][% END %] [% END %] -

[% END %] -
+ +
[% END %] + [% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %]

[% IF ( print_basket ) %] [% BIBLIO_RESULT.title |html %] - [% IF ( BIBLIO_RESULT.subtitle ) %] [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %][% subtitl.subfield |html %][% END %][% END %] + [% IF ( BIBLIO_RESULT.subtitle ) %] [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %] [% subtitl.subfield |html %] [% END %][% END %] [% IF ( BIBLIO_RESULT.author ) %] [% BIBLIO_RESULT.author |html %][% END %] [% ELSE %] - + [% BIBLIO_RESULT.title |html %] - [% IF ( BIBLIO_RESULT.subtitle ) %] [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %][% subtitl.subfield |html %][% END %][% END %] + [% IF ( BIBLIO_RESULT.subtitle ) %] [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %] [% subtitl.subfield |html %] [% END %][% END %] [% IF ( BIBLIO_RESULT.author ) %] [% BIBLIO_RESULT.author |html %][% END %] [% END %]

@@ -306,29 +324,28 @@ function tagAdded() { [% ELSE %] [% UNLESS ( print_basket ) %] - -

+ +

Select All Clear All - | Selected items : - -Remove -[% IF ( opacuserlogin ) %] - [% IF ( virtualshelves ) %][% IF ( loggedinusername ) %] - | Add to a list - [% END %][% END %] - [% IF ( RequestOnOpac ) %]| Place hold[% END %] - [% IF ( loggedinusername ) %][% IF ( TagsEnabled ) %] - | Tag[% END %][% END %] -[% END %] - - [% IF ( opacuserlogin ) %][% IF ( loggedinusername ) %][% IF ( TagsEnabled ) %][% END %][% END %][% END %] -

+ | Select titles to: + Remove + [% IF ( opacuserlogin ) %] + [% IF ( virtualshelves ) %][% IF ( loggedinusername ) %] + Add to a list + [% END %][% END %] + [% IF ( RequestOnOpac ) %] Place hold[% END %] + [% IF ( loggedinusername ) %][% IF ( TagsEnabled ) %] + Tag[% END %][% END %] + [% END %] + + [% IF ( opacuserlogin ) %][% IF ( loggedinusername ) %][% IF ( TagsEnabled ) %][% END %][% END %][% END %] +
[% END %] @@ -346,7 +363,7 @@ function tagAdded() { [% END %] [% UNLESS ( print_basket ) %] [% END %] [% END %] - [% UNLESS ( item_level_itypes ) %]
- + diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt index 1f20687757..d783852528 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt @@ -6,10 +6,11 @@ var MSG_NO_TAG_SPECIFIED = _("No tag was specified."); var MSG_REMOVE_FROM_LIST = _("Are you sure you want to remove these items from the list?"); var MSG_CONFIRM_DELETE_LIST = _("Are you sure you want to delete this list?"); +var MSG_NO_RECORD_SELECTED = _("Please select one or more items"); [% IF ( opacuserlogin ) %][% IF ( RequestOnOpac ) %] function holdSelections() { - var checkedBoxes = $(":checkbox:checked"); + var checkedBoxes = $("input:checkbox:checked"); if ($(checkedBoxes).size() == 0) { alert(MSG_NO_RECORD_SELECTED); } else { @@ -63,33 +64,51 @@ function tagAdded() { return false; }[% END %][% END %][% END %] +function enableCheckboxActions(){ + // Enable/disable controls if checkboxes are checked + var checkedBoxes = $(".checkboxed input:checkbox:checked"); + if ($(checkedBoxes).size()) { + $("#selections").html(_("With selected titles: ")); + $("#selections-toolbar .links a").removeClass("disabled"); + } else { + $("#selections").html(_("Select titles to: ")); + $("#selections-toolbar .links a").addClass("disabled"); + } +} + $(function() { [% IF ( opacbookbag ) %]$(".addtocart").show();[% END %] - $("span.clearall").html(""+_('Clear All')+"<\/a>|"); - $("span.checkall").html(""+_('Select All')+"<\/a>"); + $("span.clearall").html(""+_('Clear all')+"<\/a>"); + $("span.checkall").html(""+_('Select all')+"<\/a>"); $("a.print").show(); - [% IF ( opacuserlogin ) %][% IF ( RequestOnOpac ) %]$("#placehold").html(""+_('Place Hold')+"<\/a>"); - $("#toolbar a.hold").click(function(){ + [% IF ( opacuserlogin ) %][% IF ( RequestOnOpac ) %]$("#placehold").html(""+_('Place hold')+"<\/a>"); + $("#selections-toolbar a.hold").click(function(){ holdSelections(); return false; });[% END %][% END %] $("#CheckAll").click(function(){ $(".checkboxed").checkCheckboxes(); + enableCheckboxActions(); return false; }); $("#CheckNone").click(function(){ $(".checkboxed").unCheckCheckboxes(); + enableCheckboxActions(); return false; }); + $(".cb").click(function(){ + enableCheckboxActions(); + }); + [% IF ( opacuserlogin ) %][% IF ( loggedinusername ) %][% IF ( TagsEnabled ) %] $("#addtags").click(function(){ tagSelected(); return false; }); - $("#addtags").html(""+_("Tag")+"<\/a> |"); + $("#addtags").html(""+_("Tag")+"<\/a> "); $(".tagbutton").click(KOHA.Tags.add_tag_button); [% IF ( loggedinusername ) %] @@ -112,6 +131,22 @@ $(function() { }); [% END %] [% END %][% END %][% END %] + [% IF ( loggedinusername && manageshelf ) %] + $("#myform").submit(function(){ + var checkedBoxes = $(".checkboxed input:checkbox:checked"); + if ($(checkedBoxes).size()) { + return confirmDelete(MSG_REMOVE_FROM_LIST); + } else { + alert(MSG_NO_RECORD_SELECTED); + return false; + } + }); + $("#removeitems").html(""+_("Remove from list")+"") + .click(function(){ + $("#myform").submit(); + return false; + }); + [% END %] [% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %] }); function Check(f) { @@ -185,34 +220,19 @@ $(function() { [% IF ( viewshelf ) %]

Lists > [% shelfname |html %]

[% IF ( itemsloop ) %] -
- - -[% IF ( RequestOnOpac ) %] - [% UNLESS ( TagsEnabled ) %] |[% END %] -[% END %] -[% IF ( loggedinusername ) %] - [% IF ( TagsEnabled ) %] - - - [% END %][% END %] - - Download List - -[% IF ( opacuserlogin ) %]Send List[% END %] - -Print List - - [% IF ( manageshelf ) %] | +
+ + Download List + +[% IF ( opacuserlogin ) %]Send List[% END %] + +Print List + + [% IF ( manageshelf ) %] | - -
+
+ +
@@ -220,8 +240,26 @@ $(function() {
- - +
+ | + Select titles to: + [% IF ( RequestOnOpac ) %] + + [% END %] + [% IF ( loggedinusername ) %] + [% IF ( TagsEnabled ) %] + + + [% END %] + [% END %] + [% IF ( loggedinusername && manageshelf ) %][% END %] +
+ [% IF ( manageshelf ) %] @@ -235,7 +273,7 @@ $(function() { [% ELSE %]
@@ -258,6 +296,7 @@ $(function() { [% END %] [% IF ( itemsloo.title ) %][% itemsloo.title |html %][% ELSE %]No title[% END %] [% FOREACH subtitl IN itemsloo.subtitle %][% subtitl.subfield|html %][% END %] [% IF ( itemsloo.author ) %]by [% itemsloo.author %] + [% ELSE %]  [% END %] Publication: @@ -360,7 +399,7 @@ $(function() { [% IF ( itemsloop ) %] - + [% ELSE %] diff --git a/koha-tmpl/opac-tmpl/prog/images/delete-shelf-disabled.gif b/koha-tmpl/opac-tmpl/prog/images/delete-shelf-disabled.gif new file mode 100644 index 0000000000000000000000000000000000000000..3d68178636f4838032901a7e7af67ad9106d5400 GIT binary patch literal 117 zcmZ?wbhEHb$hImP92si1RN%H z`u_dpd`pI7$|}a7#=9c zN&@A|JY5_^DsCk`c>X;7!IP8(2Bo^X1_mZ2KRb>GPoA@LC@Az#WansLQMR{tU@-h( zyorHvLPAQ)6R^zGiBqRfojP^m^y%^n4H6YIZ``PuIpao!BLk4PW5&&!H)qbgX=!1x r!-9dSqp`bt_H5~v#;}jfED{W7{xL6__#z<-=mG{$S3j3^P6%g1poj5 literal 0 HcmV?d00001 diff --git a/koha-tmpl/opac-tmpl/prog/images/shelf-new-disabled.gif b/koha-tmpl/opac-tmpl/prog/images/shelf-new-disabled.gif new file mode 100644 index 0000000000000000000000000000000000000000..b2c7bc0a0cb22dc6cee537792fdf86ee1b0fe3dd GIT binary patch literal 300 zcmZ?wbhEHbzkC6^z7NQty{MS2M5Q+#YIO)dwY9dxpE~TAt4|j;N81-K0ZFLUcE|8Onm+N zbxcgmr%#`L{rdGE3>at$6o0ZXGB7AG=zuH%`H6we(_un^hfa{#6i&BJK^qy_W9h$6 z28eKYA9|!2VZ+3r@Iw~tG ztE#HHy1Hs>Yk&Uy`R&`cFJHd={{8#!-@iRQJvB8oKux&`f4zW|KuM5a@PAam@IX0M z5-3;Z>EaktaVzNoJCj(Q0Rx8un?Uze(KBou3JSCP`}^DZj{uo$c4cL1a&mHN3epM< z5a)8XV&zlPi pKYsee#3ImgmOtg=XJ!@&23=2<*G`r<7Xw|u;OXk;vd$@?2>{KlcWVFu literal 0 HcmV?d00001 -- 2.39.5