View | Details | Raw Unified | Return to bug 16490
Collapse All | Expand All

(-)a/catalogue/search.pl (+12 lines)
Lines 205-210 if($cgi->cookie("holdfor")){ Link Here
205
    );
205
    );
206
}
206
}
207
207
208
# get biblionumbers stored in the cart
209
my @cart_list;
210
211
if($cgi->cookie("intranet_bib_list")){
212
    my $cart_list = $cgi->cookie("intranet_bib_list");
213
    @cart_list = split(/\//, $cart_list);
214
}
215
208
# load the branches
216
# load the branches
209
my $branches = GetBranches();
217
my $branches = GetBranches();
210
218
Lines 610-615 for (my $i=0;$i<@servers;$i++) { Link Here
610
            # in order to avoid problems generated by the default size value in TT
618
            # in order to avoid problems generated by the default size value in TT
611
            foreach my $line (@newresults) {
619
            foreach my $line (@newresults) {
612
                if ( not exists $line->{'size'} ) { $line->{'size'} = "" }
620
                if ( not exists $line->{'size'} ) { $line->{'size'} = "" }
621
                # while we're checking each line, see if item is in the cart
622
                if ( grep {$_ eq $line->{'biblionumber'}} @cart_list) {
623
                    $line->{'incart'} = 1;
624
                }
613
            }
625
            }
614
            $template->param(SEARCH_RESULTS => \@newresults);
626
            $template->param(SEARCH_RESULTS => \@newresults);
615
            ## FIXME: add a global function for this, it's better than the current global one
627
            ## FIXME: add a global function for this, it's better than the current global one
(-)a/koha-tmpl/intranet-tmpl/prog/css/staff-global.css (+11 lines)
Lines 1097-1102 a.xml { Link Here
1097
    background-image: url("../img/famfamfam/silk/page_white_code.png");
1097
    background-image: url("../img/famfamfam/silk/page_white_code.png");
1098
}
1098
}
1099
1099
1100
a.cartRemove {
1101
    color: #cc3333;
1102
    font-size : 90%;
1103
    margin : 0;
1104
    padding: 0;
1105
}
1106
1107
a.incart {
1108
    color: #666;
1109
}
1110
1100
div.message {
1111
div.message {
1101
	background: #ffffff; /* Old browsers */
1112
	background: #ffffff; /* Old browsers */
1102
	background: -moz-linear-gradient(top, #ffffff 0%, #f4f6fa 2%, #eaeef5 23%, #e8edf6 94%, #cddbf2 100%); /* FF3.6+ */
1113
	background: -moz-linear-gradient(top, #ffffff 0%, #f4f6fa 2%, #eaeef5 23%, #e8edf6 94%, #cddbf2 100%); /* FF3.6+ */
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc (+3 lines)
Lines 65-70 Link Here
65
        var MSG_CONFIRM_DEL_RECORDS = _("Are you sure you want to remove the selected items?");
65
        var MSG_CONFIRM_DEL_RECORDS = _("Are you sure you want to remove the selected items?");
66
        var MSG_IN_YOUR_CART = _("Items in your cart: %s");
66
        var MSG_IN_YOUR_CART = _("Items in your cart: %s");
67
        var MSG_NON_RESERVES_SELECTED = _("One or more selected items cannot be reserved.");
67
        var MSG_NON_RESERVES_SELECTED = _("One or more selected items cannot be reserved.");
68
        var MSG_ITEM_NOT_IN_CART = _("Add to cart");
69
        var MSG_ITEM_IN_CART = _("In your cart");
70
        var MSG_RECORD_REMOVED = _("The item has been removed from your cart");
68
    //]]>
71
    //]]>
69
    </script>
72
    </script>
70
73
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt (-6 / +31 lines)
Lines 184-189 $('#sort_by').change(function() { Link Here
184
184
185
[% IF LocalCoverImages %]KOHA.LocalCover.LoadResultsCovers();[% END %]
185
[% IF LocalCoverImages %]KOHA.LocalCover.LoadResultsCovers();[% END %]
186
186
187
    $("#searchresults").on("click",".addtocart",function(e){
188
        e.preventDefault();
189
        var selection_id = this.id;
190
        var biblionumber = selection_id.replace("cart","");
191
        addRecord(biblionumber);
192
    });
193
194
    $("#searchresults").on("click",".cartRemove",function(e){
195
        e.preventDefault();
196
        var selection_id = this.id;
197
        var biblionumber = selection_id.replace("cartR","");
198
        delSingleRecord(biblionumber);
199
    });
200
187
});
201
});
188
202
189
203
Lines 553-564 var holdForPatron = function () { Link Here
553
567
554
                                [% END %]
568
                                [% END %]
555
                                [% END %]
569
                                [% END %]
556
                                  <p class="hold">[% IF ( SEARCH_RESULT.norequests ) %]
570
                                  <p class="hold">
557
                                  <span class="noholdstext">No holds allowed</span>
571
558
                              [% ELSE %]
572
                            [% IF ( SEARCH_RESULT.norequests ) %]
559
                                  <a id="reserve_[% SEARCH_RESULT.biblionumber %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Holds</a>
573
                                <span class="noholdstext">No holds allowed</span>
560
                                  [% IF ( holdfor ) %] <span class="holdforlink">| <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]&amp;findborrower=[% holdfor_cardnumber %]">Place hold for [% holdfor_firstname %] [% holdfor_surname %] ([% holdfor_cardnumber %])</a></span>[% END %]
574
                            [% ELSE %]
561
                              [% END %]
575
                                <a id="reserve_[% SEARCH_RESULT.biblionumber %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Holds</a>
576
                                [% IF ( holdfor ) %] <span class="holdforlink">| <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]&amp;findborrower=[% holdfor_cardnumber %]">Place hold for [% holdfor_firstname %] [% holdfor_surname %] ([% holdfor_cardnumber %])</a></span>[% END %]
577
                            [% END %]
578
579
                                [% IF Koha.Preference('intranetbookbag') == 1 %]
580
                                    [% IF ( SEARCH_RESULT.incart ) %]
581
                                        | <a class="addtocart" id="cart[% SEARCH_RESULT.biblionumber %]" href="#">In your cart</a> <a class="cartRemove" id="cartR[% SEARCH_RESULT.biblionumber %]" href="#">(remove)</a>
582
                                    [% ELSE %]
583
                                        | <a class="addtocart" id="cart[% SEARCH_RESULT.biblionumber %]" href="#">Add to cart</a> <a style="display:none;" class="cartRemove" id="cartR[% SEARCH_RESULT.biblionumber %]" href="#">(remove)</a>
584
                                    [% END %]
585
                                [% END # / IF intranetbookbag %]
586
562
                          [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
587
                          [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
563
                          | <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Edit record</a>
588
                          | <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Edit record</a>
564
                          [% END %]
589
                          [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/basket.js (-1 / +46 lines)
Lines 126-135 function addRecord(val, selection,NoMsgAlert) { Link Here
126
    if (write) {
126
    if (write) {
127
        writeCookie(nameCookie, valCookie);
127
        writeCookie(nameCookie, valCookie);
128
        if (selection) { // when adding a selection of records
128
        if (selection) { // when adding a selection of records
129
            updateLink(val,"add");
129
            return 1;
130
            return 1;
130
        }
131
        }
131
        if (! NoMsgAlert ) {
132
        if (! NoMsgAlert ) {
132
            showCartUpdate(MSG_RECORD_ADDED);
133
            showCartUpdate(MSG_RECORD_ADDED);
134
            updateLink(val,"add");
133
        }
135
        }
134
    }
136
    }
135
}
137
}
Lines 227-232 function selRecord(num, status) { Link Here
227
    document.myform.records.value = str;
229
    document.myform.records.value = str;
228
}
230
}
229
231
232
function delSingleRecord(biblionumber){
233
    var valCookie = readCookie(nameCookie);
234
    var arrayRecords = valCookie.split("/");
235
    var pos = jQuery.inArray(biblionumber,arrayRecords);
236
    arrayRecords.splice(pos,1);
237
    valCookie = arrayRecords.join("/");
238
    writeCookie( nameCookie, valCookie );
239
    updateBasket( arrayRecords.length-1 );
240
    updateLink(biblionumber,"del");
241
    showCartUpdate(MSG_RECORD_REMOVED);
242
}
243
230
function delSelRecords() {
244
function delSelRecords() {
231
    var recordsSel = 0;
245
    var recordsSel = 0;
232
    var end = 0;
246
    var end = 0;
Lines 243-248 function delSelRecords() { Link Here
243
                    num = str.substring(0, s);
257
                    num = str.substring(0, s);
244
                    str = delRecord(num,str);
258
                    str = delRecord(num,str);
245
                    str2 = delRecord(num,str2);
259
                    str2 = delRecord(num,str2);
260
                    updateLink(num,"del",top.opener);
246
                } else {
261
                } else {
247
                    end = 1;
262
                    end = 1;
248
                }
263
                }
Lines 308-313 function delBasket(context,rep) { Link Here
308
    if (rep) {
323
    if (rep) {
309
        if(context == "popup"){
324
        if(context == "popup"){
310
            delCookie(nameCookie);
325
            delCookie(nameCookie);
326
            updateAllLinks(top.opener);
311
            document.location = "about:blank";
327
            document.location = "about:blank";
312
            updateBasket(0,top.opener);
328
            updateBasket(0,top.opener);
313
            window.close();
329
            window.close();
Lines 439-444 function hideCart(){ Link Here
439
    $("#cartDetails").fadeOut("fast");
455
    $("#cartDetails").fadeOut("fast");
440
}
456
}
441
457
458
function updateLink(val,op,target){
459
    if(target){
460
        if(op == "add"){
461
            target.$("#cart"+val).html(MSG_ITEM_IN_CART).addClass("incart");
462
            target.$("#cartR"+val).show();
463
        } else {
464
            target.$("#cart"+val).html(MSG_ITEM_NOT_IN_CART).removeClass("incart").addClass("addtocart");
465
            target.$("#cartR"+val).hide();
466
        }
467
    } else {
468
        if(op == "add"){
469
            $("#cart"+val).html(MSG_ITEM_IN_CART).addClass("incart");
470
            $("#cartR"+val).show();
471
        } else {
472
            $("#cart"+val).html(MSG_ITEM_NOT_IN_CART).removeClass("incart").addClass("addtocart");
473
            $("#cartR"+val).hide();
474
        }
475
    }
476
}
477
478
function updateAllLinks(target){
479
    if(target){
480
        target.$("a.incart").html(MSG_ITEM_NOT_IN_CART).removeClass("incart").addClass("addtocart");
481
        target.$(".cartRemove").hide();
482
    } else {
483
        $("a.incart").html(MSG_ITEM_NOT_IN_CART).removeClass("incart").addClass("addtocart");
484
        $(".cartRemove").hide();
485
    }
486
}
487
442
$(document).ready(function(){
488
$(document).ready(function(){
443
	$("#cartmenulink").click(function(){ openBasket(); return false; });
489
	$("#cartmenulink").click(function(){ openBasket(); return false; });
444
	if(basketcount){ updateBasket(basketcount); }
490
	if(basketcount){ updateBasket(basketcount); }
445
- 

Return to bug 16490