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 (-7 / +36 lines)
Lines 182-188 $('#sort_by').change(function() { Link Here
182
        [% END %]
182
        [% END %]
183
    [% END %]
183
    [% END %]
184
184
185
[% IF LocalCoverImages %]KOHA.LocalCover.LoadResultsCovers();[% END %]
185
    [% IF LocalCoverImages %]
186
        KOHA.LocalCover.LoadResultsCovers();
187
    [% END %]
188
186
    $("#select_all").on("click",function(e){
189
    $("#select_all").on("click",function(e){
187
        e.preventDefault();
190
        e.preventDefault();
188
        selectAll();
191
        selectAll();
Lines 191-196 $('#sort_by').change(function() { Link Here
191
        e.preventDefault();
194
        e.preventDefault();
192
        clearAll();
195
        clearAll();
193
    });
196
    });
197
198
    $("#searchresults").on("click",".addtocart",function(e){
199
        e.preventDefault();
200
        var selection_id = this.id;
201
        var biblionumber = selection_id.replace("cart","");
202
        addRecord(biblionumber);
203
    });
204
205
    $("#searchresults").on("click",".cartRemove",function(e){
206
        e.preventDefault();
207
        var selection_id = this.id;
208
        var biblionumber = selection_id.replace("cartR","");
209
        delSingleRecord(biblionumber);
210
    });
211
194
});
212
});
195
213
196
214
Lines 560-571 var holdForPatron = function () { Link Here
560
578
561
                                [% END %]
579
                                [% END %]
562
                                [% END %]
580
                                [% END %]
563
                                  <p class="hold">[% IF ( SEARCH_RESULT.norequests ) %]
581
                                  <p class="hold">
564
                                  <span class="noholdstext">No holds allowed</span>
582
565
                              [% ELSE %]
583
                            [% IF ( SEARCH_RESULT.norequests ) %]
566
                                  <a id="reserve_[% SEARCH_RESULT.biblionumber %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Holds</a>
584
                                <span class="noholdstext">No holds allowed</span>
567
                                  [% 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 %]
585
                            [% ELSE %]
568
                              [% END %]
586
                                <a id="reserve_[% SEARCH_RESULT.biblionumber %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Holds</a>
587
                                [% 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 %]
588
                            [% END %]
589
590
                                [% IF Koha.Preference('intranetbookbag') == 1 %]
591
                                    [% IF ( SEARCH_RESULT.incart ) %]
592
                                        | <a class="addtocart" id="cart[% SEARCH_RESULT.biblionumber %]" href="#">In your cart</a> <a class="cartRemove" id="cartR[% SEARCH_RESULT.biblionumber %]" href="#">(remove)</a>
593
                                    [% ELSE %]
594
                                        | <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>
595
                                    [% END %]
596
                                [% END # / IF intranetbookbag %]
597
569
                          [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
598
                          [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
570
                          | <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Edit record</a>
599
                          | <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Edit record</a>
571
                          [% END %]
600
                          [% 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 438-443 function hideCart(){ Link Here
438
    $("#cartDetails").fadeOut("fast");
454
    $("#cartDetails").fadeOut("fast");
439
}
455
}
440
456
457
function updateLink(val,op,target){
458
    if(target){
459
        if(op == "add"){
460
            target.$("#cart"+val).html(MSG_ITEM_IN_CART).addClass("incart");
461
            target.$("#cartR"+val).show();
462
        } else {
463
            target.$("#cart"+val).html(MSG_ITEM_NOT_IN_CART).removeClass("incart").addClass("addtocart");
464
            target.$("#cartR"+val).hide();
465
        }
466
    } else {
467
        if(op == "add"){
468
            $("#cart"+val).html(MSG_ITEM_IN_CART).addClass("incart");
469
            $("#cartR"+val).show();
470
        } else {
471
            $("#cart"+val).html(MSG_ITEM_NOT_IN_CART).removeClass("incart").addClass("addtocart");
472
            $("#cartR"+val).hide();
473
        }
474
    }
475
}
476
477
function updateAllLinks(target){
478
    if(target){
479
        target.$("a.incart").html(MSG_ITEM_NOT_IN_CART).removeClass("incart").addClass("addtocart");
480
        target.$(".cartRemove").hide();
481
    } else {
482
        $("a.incart").html(MSG_ITEM_NOT_IN_CART).removeClass("incart").addClass("addtocart");
483
        $(".cartRemove").hide();
484
    }
485
}
486
441
$(document).ready(function(){
487
$(document).ready(function(){
442
	$("#cartmenulink").click(function(){ openBasket(); return false; });
488
	$("#cartmenulink").click(function(){ openBasket(); return false; });
443
	if(basketcount){ updateBasket(basketcount); }
489
	if(basketcount){ updateBasket(basketcount); }
444
- 

Return to bug 16490