"Add to my list" becomes "remove from my list", and
authorsenator <lebbeous@esilibrary.com>
Wed, 16 Mar 2011 18:48:52 +0000 (14:48 -0400)
committersenator <lebbeous@esilibrary.com>
Wed, 16 Mar 2011 18:48:52 +0000 (14:48 -0400)
it now works on the record detail page as well as the results page.
Also, I fixed a bug by which an HTML form was rendered wrongly, totally
breaking the display of the results page in IE and preventing the first
result on any page of search results from adding to the anonymous list.

Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm
Open-ILS/web/css/skin/default/opac/style.css
Open-ILS/web/templates/default/opac/parts/record/summary.tt2
Open-ILS/web/templates/default/opac/parts/result/table.tt2
Open-ILS/web/templates/default/opac/results.tt2

index a6e408d..35e41fc 100644 (file)
@@ -187,7 +187,14 @@ sub get_records_and_facets {
 sub fetch_marc_xml_by_id {
     my ($self, $id_list) = @_;
     $id_list = [$id_list] unless ref($id_list);
-    return {} if scalar(grep { defined $_ } @$id_list) < 1;
+
+    {
+        no warnings qw/numeric/;
+        $id_list = [map { int $_ } @$id_list];
+        $id_list = [grep { $_ > 0} @$id_list];
+    };
+
+    return {} if scalar(@$id_list) < 1;
 
     # I'm just sure there needs to be some more efficient way to get all of
     # this.
index ce35479..219a338 100644 (file)
@@ -556,6 +556,10 @@ div.select-wrapper:hover {
     left:2px;
 }
 
+.almost-content-wrapper {
+       background: white;
+}
+
 #content-wrapper {
        background: white;
        min-height: 260px;
index ab4da64..f151888 100644 (file)
                             <div style="width:230px;text-align:left;margin-top:3px;">
                                 <div style="float:right;">
                                     <div class="rdetail_aux_utils opac-auto-010">
-                                        <a href="[% ctx.opac_root %]/place_hold[% propagator; propagator.length > 1 ? "&" : ""; %]hold_target=[% record.id %]&hold_type=T" id="rdetail_place_hold"><img
+                                        <a href="[% ctx.opac_root %]/place_hold[% propagator; propagator.length > 1 ? "&" : ""; %]hold_target=[% record.id %]&hold_type=T" id="rdetail_place_hold" class="no-dec"><img
                                             src="[% ctx.media_prefix %]/images/green_check.png" alt="[% l('place hold') %]" />
                                             <span style="position:relative;top:-3px;left:3px;">Place Hold</span></a>
                                     </div>
-                                    <div style="padding-top:6px;" class="rdetail_aux_utils">
-                                        <div style="position:absolute;">
-                                            <div style="position:relative;top:5px; left: 25px;">
-                                                <a title="Add to my list" id="add_mylist"
-                                                    href="#">Add to my list</a>
+                                    <div class="rdetail_aux_utils opac-auto-121">
+                                        [%  operation = ctx.mylist.grep(record.id).size ? "delete" : "add";
+                                            label = (operation == "add") ? "Add to" : "Remove from"; %]
+                                        <form action="[% ctx.opac_root %]/mylist/[% operation %]" method="POST">
+                                            <input type="hidden" name="record" value="[% record.id %]" />
+                                            <div class="pos-abs">
+                                                <div class="opac-auto-149">
+                                                    <input type="submit" title="[% l(label _ ' my list') %]" value="[% l(label _ ' my list') %]" class="subtle-button" />
+                                                </div>
                                             </div>
-                                        </div>
-                                        <a href="#"><img
-                                            alt="[% l('add to my list') %]"
-                                            src="[% ctx.media_prefix %]/images/clipboard.png" /></a>
+                                            <input type="image"
+                                                alt="[% l(label _ ' my list') %]"
+                                                src="[% ctx.media_prefix %]/images/clipboard.png" />
+                                        </form>
                                     </div>
                                 </div>
                                 <div style="float:right;margin-right:17px;">
index b4ef916..4b14e04 100644 (file)
                                                                     style="position:relative;top:-3px;left:3px;">Place Hold</span></a>
                                                         </div>
                                                         <div class="results_aux_utils opac-auto-011">
-                                                            <form action="[% ctx.opac_root %]/mylist/add" method="POST">
+                                                            [%  operation = ctx.mylist.grep(rec.bre.id).size ? "delete" : "add";
+                                                                label = (operation == "add") ? "Add to" : "Remove from"; %]
+                                                            <form action="[% ctx.opac_root %]/mylist/[% operation %]" method="POST">
                                                                 <input type="hidden" name="record" value="[% rec.bre.id %]" />
                                                             <div style="position:absolute;">
                                                                 <div style="position:relative;top:5px; left: 25px;">
-                                                                    <input type="submit" title="[% l('Add to my list') %]" value="[% l('Add to my list') %]" class="subtle-button" />
+                                                                    <input type="submit" title="[% l(label _ ' my list') %]" value="[% l(label _ ' my list') %]" class="subtle-button" />
                                                                 </div>
                                                             </div>
                                                                 <input type="image"
-                                                                alt="[% l('Add to my list') %]"
+                                                                alt="[% l(label _ ' my list') %]"
                                                                 src="[% ctx.media_prefix %]/images/clipboard.png" />
                                                         </form>
                                                         </div>
index 3b06cae..db1f298 100644 (file)
@@ -13,7 +13,7 @@
         [% INCLUDE "default/opac/parts/utils.tt2" %]
         [% INCLUDE "default/opac/parts/searchbar.tt2" took_care_of_form=1 %]
     </div>
-    <div id="content-wrapper">
+    <div class="almost-content-wrapper">
         <div id="results_header_bar">
             <div id="results_header_inner">
                 <div class="results_header_btns">
@@ -59,6 +59,9 @@
                 <div class="clear-both"></div>
             </div>
         </div>
+    </div>
+    </form>
+    <div id="content-wrapper">
         <div id="main-content">
             <div id="tehResultsPage">
                 [% path = "default/opac/parts/result/" _
@@ -68,5 +71,4 @@
             <div class="common-full-pad"></div>    
         </div>
     </div>
-    </form>
 [% END %]