diff --git a/C4/Auth.pm b/C4/Auth.pm
index 0b9286868f..9fd298f160 100755
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -352,6 +352,7 @@ sub get_template_and_user {
intranetreadinghistory => C4::Context->preference("intranetreadinghistory"),
intranetstylesheet => C4::Context->preference("intranetstylesheet"),
intranetuserjs => C4::Context->preference("intranetuserjs"),
+ intranetbookbag => C4::Context->preference("intranetbookbag"),
noItemTypeImages => C4::Context->preference("noItemTypeImages"),
suggestion => C4::Context->preference("suggestion"),
virtualshelves => C4::Context->preference("virtualshelves"),
@@ -894,6 +895,7 @@ sub checkauth {
intranetcolorstylesheet =>
C4::Context->preference("intranetcolorstylesheet"),
intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+ intranetbookbag => C4::Context->preference("intranetbookbag"),
IntranetNav => C4::Context->preference("IntranetNav"),
intranetuserjs => C4::Context->preference("intranetuserjs"),
TemplateEncoding => C4::Context->preference("TemplateEncoding"),
@@ -901,7 +903,6 @@ sub checkauth {
AutoLocation => C4::Context->preference("AutoLocation"),
wrongip => $info{'wrongip'}
);
-
$template->param( loginprompt => 1 ) unless $info{'nopermission'};
my $self_url = $query->url( -absolute => 1 );
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 6c552f6df5..f6c1b4205e 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -3064,6 +3064,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
SetVersion ($DBversion);
}
+$DBversion = "3.01.00.116";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do( qq# INSERT INTO `systempreferences` VALUES ('intranetbookbag','1','','If ON, enables display of Cart feature in the intranet','YesNo') #);
+
+ print "Upgrade to $DBversion done (intranetbookbag syspref added)\n";
+ SetVersion ($DBversion);
+}
=item DropAllForeignKeys($table)
diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
index 7a81fd3a69..5118721963 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
+++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
@@ -1789,3 +1789,175 @@ h1#xml a {
padding:44px 0 0;
text-decoration:none;
width:35px;
+}
+
+#cartDetails,#cartUpdate,#holdDetails,#listsDetails {
+ background-color : #FFF;
+ border: 1px solid #739acf;
+ color : black;
+ display : none;
+ margin : 0;
+ padding : 10px;
+ text-align : center;
+ width : 180px;
+}
+
+#cartmenulink, #listsmenulink {
+ background : #aaa;
+ padding : 5px;
+ color : #333;
+ text-decoration : none;
+ cursor : pointer;
+}
+
+ #cartmenulink *, #listsmenulink * {
+ font-style : normal;
+ background-image : url(../../images/button-background.png);
+ background-repeat : no-repeat;
+}
+
+ #cartmenulink i, #listsmenulink i {
+ background-position : top left;
+ position : absolute;
+ margin-bottom : -5px;
+ top : 0;
+ left : 0;
+ width : 5px;
+ height : 5px;
+}
+
+ #cartmenulink span, #listsmenulink span {
+ background-position : bottom left;
+ left : -5px;
+ padding : 0 0 5px 10px;
+ margin-bottom : -5px;
+}
+/* For IE7 */
+ *:first-child+html #cartmenulink span { padding-top : 3px; padding-bottom : 7px; }
+ *:first-child+html #listsmenulink span { padding-top : 5px; }
+
+ #cartmenulink span i, #listsmenulink span i {
+ background-position : bottom right;
+ margin-bottom : 0;
+ position : absolute;
+ left : 100%;
+ width : 10px;
+ height : 100%;
+ top : 0;
+}
+
+ #cartmenulink span span, #listsmenulink span span {
+ background-position : top right;
+ position : absolute;
+ right : -10px;
+ margin-left : 10px;
+ top : -5px;
+ height : 0;
+}
+
+* html #cartmenulink span, * html #cartmenulink i, * html #listsmenulink span, * html #listsmenulink i {
+ float : left;
+ width : auto;
+ background-image : none;
+ cursor : pointer;
+}
+* html #cartmenulink span, * html #listsmenulink span {
+ padding-top : 5px;
+}
+#listsmenulink {
+ background : #9FBFFF;
+}
+
+#cartmenulink {
+ background : #98CB58;
+ color : #336600;
+ font-size : 105%;
+}
+
+#listsmenulink:hover {
+ background-color : #b8d0e6;
+}
+
+#cartmenulink:hover {
+ background-color : #BFDE96;
+}
+
+#cartmenulink img {
+ background-image : none;
+ display : inline;
+ padding : 3px 3px 0 3px;
+}
+
+#cartmenulink span#basketcount {
+ background-image : none;
+ float : none;
+ display : inline;
+ height : auto;
+ position : relative;
+ margin : 0;
+ padding : 0;
+ left : auto;
+ right : auto;
+ top : auto;
+}
+
+#cartmenulink span#basketcount span {
+ background-image : none;
+ background-color : #E6FCB7;
+ color : #000;
+ display : inline;
+ float : none;
+ font-size : 80%;
+ font-weight : normal;
+ margin : 0 0 0 .9em;
+ padding : 0 .3em 0 .3em;
+ position : relative;
+ left : auto;
+ right : auto;
+ top : auto;
+}
+
+a#listsmenulink, a#listsmenulink:hover {
+ color : #006699;
+ font-size : 105%;
+ font-weight : bold;
+ line-height : 185%;
+ margin-left : 1.5em;
+}
+
+a#cartmenulink, a#cartmenulink:hover {
+ color : #336600;
+ font-size : 105%;
+ font-weight : bold;
+ line-height : 185%;
+ margin-left : 1.5em;
+}
+* html a#cartmenulink {
+ padding-top: 0;
+}
+ * html a#cartmenulink:hover {
+ padding-top : 0;
+}
+/* For IE7 */
+*:first-child+html a#listsmenulink { padding-top : 0; }
+*:first-child+html a#listsmenulink:hover { padding-top : 0; }
+*:first-child+html a#cartmenulink { padding-top : 0; }
+*:first-child+html a#cartmenulink:hover { padding-top : 0; }
+*:first-child+html #cartmenulink span i{ top : -4px; }
+*:first-child+html #listsmenulink span i { top : -5px; }
+
+#listsmenulink img {
+ background-image : none;
+ display : inline;
+ padding : 0 0 2px 0;
+}
+
+* html #cartmenulink {
+ border : 1px solid #336600;
+}
+
+* html #listsmenulink {
+ border : 1px solid #006699;
+}
+
+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc
index f771a7345c..8811f97ce5 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc
@@ -17,8 +17,13 @@
/" />
+
-
+
+
+
+
+
@@ -29,8 +34,7 @@
-
+
@@ -48,10 +52,12 @@
+
+
+
+
+
+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc
index 4c034e93bd..24b5d84939 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc
@@ -1,3 +1,5 @@
+
Your cart is empty.
+
+
+
+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/basket.js b/koha-tmpl/intranet-tmpl/prog/en/js/basket.js
deleted file mode 120000
index 104343c0ce..0000000000
--- a/koha-tmpl/intranet-tmpl/prog/en/js/basket.js
+++ /dev/null
@@ -1 +0,0 @@
-../../../../opac-tmpl/prog/en/js/basket.js
\ No newline at end of file
diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/basket.js b/koha-tmpl/intranet-tmpl/prog/en/js/basket.js
new file mode 100644
index 0000000000..f0bbf7b94b
--- /dev/null
+++ b/koha-tmpl/intranet-tmpl/prog/en/js/basket.js
@@ -0,0 +1,470 @@
+//////////////////////////////////////////////////////////////////////////////
+// BASIC FUNCTIONS FOR COOKIE MANAGEMENT //
+//////////////////////////////////////////////////////////////////////////////
+
+var CGIBIN = "/cgi-bin/koha/";
+
+var nameCookie = "intranet_bib_list";
+var nameParam = "bib_list";
+var valCookie = readCookie(nameCookie);
+
+if(valCookie){
+ var arrayRecords = valCookie.split("/");
+ if(arrayRecords.length > 0){
+ var basketcount = arrayRecords.length-1;
+ } else {
+ var basketcount = "";
+ }
+} else {
+ var basketcount = "";
+}
+
+function writeCookie(name, val, wd) {
+ if (wd) {
+ parent.opener.document.cookie = name + "=" + val + "; path=/";
+ }
+ else {
+ parent.document.cookie = name + "=" + val + "; path=/";
+ }
+}
+
+function readCookieValue (str, val_beg) {
+ var val_end = str.indexOf(";", val_end);
+ if (val_end == -1)
+ val_end = str.length;
+ return str.substring(val_beg, val_end);
+}
+
+function readCookie(name, wd) {
+ var str_name = name + "=";
+ var str_len = str_name.length;
+ var str_cookie = "";
+ if (wd) {
+ str_cookie = parent.opener.document.cookie;
+ }
+ else {
+ str_cookie = parent.document.cookie;
+ }
+ // fixed - getting the part of the basket that is bib_list
+ var cookie_parts = str_cookie.split(";");
+ for(var i=0;i < cookie_parts.length;i++) {
+ var c = cookie_parts[i];
+ while (c.charAt(0)==' ') c = c.substring(1,c.length);
+ if(c.indexOf(str_name) == 0) return c.substring(str_name.length,c.length);
+ }
+ return null;
+}
+
+function delCookie(name) {
+ var exp = new Date();
+ exp.setTime(exp.getTime()-1);
+ if(parent.opener){
+ parent.opener.document.cookie = name + "=null; path=/; expires=" + exp.toGMTString();
+ } else {
+ document.cookie = name + "=null; path=/; expires=" + exp.toGMTString();
+ }
+}
+
+///////////////////////////////////////////////////////////////////
+// SPECIFIC FUNCTIONS USING COOKIES //
+///////////////////////////////////////////////////////////////////
+
+function openBasket() {
+ var strCookie = "";
+ var valCookie = readCookie(nameCookie);
+ if ( valCookie ) {
+ strCookie = nameParam + "=" + valCookie;
+ }
+
+ if ( strCookie ) {
+ var iW = 820;
+ var iH = 450;
+ var optWin = "dependant=yes,status=yes,scrollbars=yes,resizable=yes,toolbar=no,location=yes,height="+iH+",width="+iW;
+ var loc = CGIBIN + "basket/basket.pl?" + strCookie;
+ var basket = open(loc, "basket", optWin);
+ if (window.focus) {basket.focus()}
+ }
+ else {
+ showCartUpdate(MSG_BASKET_EMPTY);
+ }
+}
+
+function addRecord(val, selection,NoMsgAlert) {
+ var valCookie = readCookie(nameCookie);
+ var write = 0;
+
+ if ( ! valCookie ) { // empty basket
+ valCookie = val + '/';
+ write = 1;
+ updateBasket(1);
+ }
+ else {
+ // is this record already in the basket ?
+ var found = false;
+ var arrayRecords = valCookie.split("/");
+ for (var i = 0; i < valCookie.length - 1; i++) {
+ if (val == arrayRecords[i]) {
+ found = true;
+ break;
+ }
+ }
+ if ( found ) {
+ if (selection) {
+ return 0;
+ }
+ if (! NoMsgAlert ) {
+ showCartUpdate(MSG_RECORD_IN_BASKET);
+ }
+ }
+ else {
+ valCookie += val + '/';
+ write = 1;
+ updateBasket(arrayRecords.length);
+ }
+ }
+
+ if (write) {
+ writeCookie(nameCookie, valCookie);
+ if (selection) { // when adding a selection of records
+ return 1;
+ }
+ if (! NoMsgAlert ) {
+ showCartUpdate(MSG_RECORD_ADDED);
+ }
+ }
+}
+
+function AllAreChecked(s){
+ if (! s.length) { return false;}
+ var l = s.length;
+ for (var i=0; i < l; i++) {
+ if(! s[i].checked) { return false; }
+ }
+ return true;
+}
+
+function SelectAll(){
+ if(document.bookbag_form.biblionumber.length > 0) {
+ var checky = AllAreChecked(document.bookbag_form.biblionumber);
+ var l = document.bookbag_form.biblionumber.length;
+ for (var i=0; i < l; i++) {
+ document.bookbag_form.biblionumber[i].checked = (checky) ? false : true;
+ }
+ }
+}
+
+function addMultiple(){
+ var c_value = "";
+ if(document.bookbag_form.biblionumber.length > 0) {
+ for (var i=0; i < document.bookbag_form.biblionumber.length; i++) {
+ if (document.bookbag_form.biblionumber[i].checked) {
+ c_value = c_value + document.bookbag_form.biblionumber[i].value + "/";
+ }
+ }
+ addSelRecords(c_value);
+ } else {
+ c_value = c_value + document.bookbag_form.biblionumber.value + "/";
+ addSelRecords(c_value);
+ }
+}
+
+function addSelRecords(valSel) { // function for adding a selection of biblios to the basket
+ // from the results list
+ var arrayRecords = valSel.split("/");
+ var i = 0;
+ var nbAdd = 0;
+ for (i=0;i
nbAdd) {
+ msg = nbAdd+" "+MSG_NRECORDS_ADDED+", "+(i-nbAdd)+" "+MSG_NRECORDS_IN_BASKET;
+ }
+ else {
+ msg = nbAdd+" "+MSG_NRECORDS_ADDED;
+ }
+ }
+ else {
+ if (i < 1) {
+ msg = MSG_NO_RECORD_SELECTED;
+ }
+ else {
+ msg = MSG_NO_RECORD_ADDED+" ("+MSG_NRECORDS_IN_BASKET+") !";
+ }
+ }
+ showCartUpdate(msg);
+}
+
+function showCartUpdate(msg){
+ // set body of popup window
+ $("#cartDetails").html(msg);
+ showCart();
+ setTimeout("hideCart()",2000);
+}
+
+function showListsUpdate(msg){
+ // set body of popup window
+ $("#listsDetails").html(msg);
+ showLists();
+ setTimeout("hideLists()",2000);
+}
+
+function selRecord(num, status) {
+ var str = document.myform.records.value
+ if (status){
+ str += num+"/";
+ }
+ else {
+ str = delRecord(num, str);
+ }
+
+ document.myform.records.value = str;
+}
+
+function delSelRecords() {
+ var recordsSel = 0;
+ var end = 0;
+ var valCookie = readCookie(nameCookie, 1);
+
+ if (valCookie) {
+ var str = document.myform.records.value;
+ if (str.length > 0){
+ recordsSel = 1;
+ var str2 = valCookie;
+ while (!end){
+ s = str.indexOf("/");
+ if (s>0){
+ num = str.substring(0, s)
+ str = delRecord(num,str);
+ str2 = delRecord(num,str2);
+ } else {
+ end = 1;
+ }
+ }
+
+ if (str2.length == 0) { // equivalent to emptying the basket
+ var rep = false;
+ rep = confirm(MSG_CONFIRM_DEL_BASKET);
+ if (rep) {
+ delCookie(nameCookie);
+ document.location = "about:blank";
+ updateBasket(0,top.opener);
+ window.close();
+ } else {
+ return;
+ }
+ } else {
+ writeCookie(nameCookie, str2, 1);
+ }
+ }
+ }
+
+ if (recordsSel) {
+ var strCookie = "";
+ var valCookie = readCookie(nameCookie, 1);
+ strCookie = nameParam + "=" + valCookie;
+ var arrayRecords = valCookie.split("/");
+ updateBasket(arrayRecords.length-1,top.opener);
+ document.location = CGIBIN + "basket/basket.pl?" + strCookie;
+ }
+ else {
+ alert(MSG_NO_RECORD_SELECTED);
+ }
+}
+
+function delRecord (n, s) {
+ var re = /\d/;
+ var aux = s;
+ var found = 0;
+ var pos = -1;
+
+ while (!found) {
+ pos = aux.indexOf(n, pos+1);
+ var charAfter = aux.charAt(pos+n.length); // character right after the researched string
+ if (charAfter.match(re)) { // record number inside another one
+ continue;
+ }
+ else { // good record number
+ aux = s.substring(0, pos)+ s.substring(pos+n.length+1, s.length);
+ s = aux;
+ found = 1;
+ }
+ }
+
+ return s;
+}
+
+
+function delBasket() {
+
+ var rep = false;
+ rep = confirm(MSG_CONFIRM_DEL_BASKET);
+ if (rep) {
+ delCookie(nameCookie);
+ document.location = "about:blank";
+ updateBasket(0,top.opener);
+ window.close();
+ }
+}
+
+
+function quit() {
+ if (document.myform.records.value) {
+ var rep = false;
+ rep = confirm(MSG_CONFIRM_DEL_RECORDS);
+ if (rep) {
+ delSelRecords();
+ }
+ }
+ updateBasket(arrayRecords.length-1,top.opener);
+ window.close();
+}
+
+function sendBasket() {
+ var valCookie = readCookie(nameCookie);
+ var strCookie = nameParam + "=" + valCookie;
+
+ var loc = CGIBIN + "basket/sendbasket.pl?" + strCookie;
+
+ var optWin="dependant=yes,scrollbars=no,resizable=no,height=300,width=450,top=50,left=100";
+ var win_form = open(loc,"win_form",optWin);
+}
+
+function downloadBasket() {
+ var valCookie = readCookie(nameCookie);
+ var strCookie = nameParam + "=" + valCookie;
+
+ var loc = CGIBIN + "basket/downloadcart.pl?" + strCookie;
+
+ open(loc,"win_form",'dependant=yes,scrollbars=no,resizable=no,height=300,width=450,top=50,left=100');
+}
+
+function printBasket() {
+ var loc = document.location + "&print=1";
+ document.location = loc;
+}
+
+function showMore() {
+ var strCookie = "";
+
+ var valCookie = readCookie(nameCookie);
+ if (valCookie) {
+ strCookie = nameParam + "=" + valCookie;
+ }
+ var loc = CGIBIN + "basket/basket.pl?" + strCookie + "&verbose=1";
+ document.location = loc;
+}
+
+function showLess() {
+ var strCookie = "";
+
+ var valCookie = readCookie(nameCookie);
+ if (valCookie) {
+ strCookie = nameParam + "=" + valCookie;
+ }
+ var loc = CGIBIN + "basket/basket.pl?" + strCookie + "&verbose=0";
+ document.location = loc;
+}
+
+function updateBasket(updated_value,target) {
+ if(target){
+ target.$('#basketcount').html(""+updated_value+"");
+ target.$('#cartDetails').html(_("Your cart contains ")+updated_value+_(" items"));
+ } else {
+ $('#basketcount').html(""+updated_value+"");
+ $('#cartDetails').html(_("Your cart contains ")+updated_value+_(" items"));
+ }
+ var basketcount = updated_value;
+}
+
+function openBiblio(dest,biblionumber) {
+ openerURL=dest+"?biblionumber="+biblionumber;
+ opener.document.location = openerURL;
+ opener.focus();
+}
+
+function addSelToShelf() {
+ var items = document.getElementById('records').value;
+ if(items){
+ document.location = "/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumber="+items;
+ } else {
+ alert(MSG_NO_RECORD_SELECTED);
+ }
+}
+
+/// vShelfAdd() builds url string for multiple-biblio adds.
+
+function vShelfAdd() {
+ bibs= new Array;
+ if(document.bookbag_form.biblionumber.length > 0) {
+ for (var i=0; i < document.bookbag_form.biblionumber.length; i++) {
+ if (document.bookbag_form.biblionumber[i].checked) {
+ bibs.push("biblionumber=" + document.bookbag_form.biblionumber[i].value);
+ }
+ }
+ if (bibs.length == 0) { showListsUpdate(MSG_NO_RECORD_SELECTED); }
+ return bibs.join("&");
+ } else {
+ if (document.bookbag_form.biblionumber.checked) {
+ return "biblionumber=" + document.bookbag_form.biblionumber.value;
+ }
+ }
+}
+
+function showCart(){
+ var position = $("#cartmenulink").offset();
+ var top = position.top + $("#cartmenulink").outerHeight();
+ var menuWidth = 200;
+ var buttonWidth = $("#cartmenulink").innerWidth();
+ var buttonOffset = menuWidth - buttonWidth;
+ var left = position.left - buttonOffset;
+ $("#cartDetails").css("position","absolute").css("top",top);
+ $("#cartDetails").css("position","absolute").css("left",left);
+ $("#cartDetails").fadeIn("fast",function(){
+ $("#cartDetails").dropShadow({left: 3, top: 3, blur: 0, color: "#000", opacity: 0.1});
+ });
+}
+
+function showLists(){
+ var position = $("#listsmenulink").offset();
+ var top = position.top + $("#listsmenulink").outerHeight();
+ var menuWidth = 200;
+ var buttonWidth = $("#listsmenulink").innerWidth();
+ var buttonOffset = menuWidth - buttonWidth;
+ var left = position.left - buttonOffset;
+ $("#listsDetails").css("position","absolute").css("top",top);
+ $("#listsDetails").css("position","absolute").css("left",left);
+ $("#listsDetails").fadeIn("fast",function(){
+ $("#listsDetails").dropShadow({left: 3, top: 3, blur: 0, color: "#000", opacity: 0.1});
+ });
+}
+
+function hideCart(){
+ $("#cartDetails").removeShadow();
+ $("#cartDetails").fadeOut("fast");
+}
+
+function hideLists(){
+ $("#listsDetails").removeShadow();
+ $("#listsDetails").fadeOut("fast");
+}
+
+
+$(document).ready(function(){
+ $("#cartmenulink").click(function(){ openBasket(); return false; });
+ $("#cartDetails,#cartmenulink").click(function(){ hideCart(); });
+ $("#cartmenulink").hover(function(){
+ showCart();
+ },function(){
+ hideCart();
+ });
+ if(basketcount){ updateBasket(basketcount); }
+});
+
+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl
index dd3c5dbae1..f86aad6dcc 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl
@@ -39,7 +39,7 @@ $('#sort_by').change(function() {
$(".addtocart").show();
var param1 = "