new virtual shelves changes, keyed by biblionumber -- approved
authorJoshua Ferraro <jmf@liblime.com>
Thu, 9 Aug 2007 14:22:17 +0000 (09:22 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Thu, 9 Aug 2007 14:22:17 +0000 (09:22 -0500)
40 files changed:
C4/Auth.pm
C4/BookShelves.pm [new file with mode: 0755]
C4/Branch.pm
C4/VirtualShelves.pm [deleted file]
Makefile.PL
bookshelves/addbookbybiblionumber.pl [new file with mode: 0755]
bookshelves/shelves.pl [new file with mode: 0755]
help.pl
installer/kohastructure.sql
koha-tmpl/intranet-tmpl/prog/en/about.tmpl
koha-tmpl/intranet-tmpl/prog/en/auth.tmpl
koha-tmpl/intranet-tmpl/prog/en/bookshelves/addbookbybiblionumber.tmpl [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/bookshelves/shelves.tmpl [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/help/admin/systempreferences.tmpl
koha-tmpl/intranet-tmpl/prog/en/help/nohelp.tmpl
koha-tmpl/intranet-tmpl/prog/en/includes/action-catalogue.inc
koha-tmpl/intranet-tmpl/prog/en/includes/error-top.inc
koha-tmpl/intranet-tmpl/prog/en/includes/menu-bookshelves.inc [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/includes/menu-virtualshelves.inc [deleted file]
koha-tmpl/intranet-tmpl/prog/en/includes/menus.inc
koha-tmpl/intranet-tmpl/prog/en/tools/export.tmpl
koha-tmpl/intranet-tmpl/prog/en/virtualshelves/addbybiblionumber.tmpl [deleted file]
koha-tmpl/intranet-tmpl/prog/en/virtualshelves/shelves.tmpl [deleted file]
koha-tmpl/opac-tmpl/prog/en/includes/basket.js
koha-tmpl/opac-tmpl/prog/en/opac-ISBDdetail.tmpl
koha-tmpl/opac-tmpl/prog/en/opac-MARCdetail.tmpl
koha-tmpl/opac-tmpl/prog/en/opac-addbookbybiblionumber.tmpl [new file with mode: 0644]
koha-tmpl/opac-tmpl/prog/en/opac-addbybiblionumber.tmpl [deleted file]
koha-tmpl/opac-tmpl/prog/en/opac-detail.tmpl
koha-tmpl/opac-tmpl/prog/en/opac-shelves.tmpl
opac/opac-addbookbybiblionumber.pl [new file with mode: 0755]
opac/opac-addbybiblionumber.pl [deleted file]
opac/opac-main.pl
opac/opac-shelves.pl
t/BookShelves.t [new file with mode: 0644]
t/VirtualShelves.t [deleted file]
tools/export.pl
updater/updatedatabase
virtualshelves/addbybiblionumber.pl [deleted file]
virtualshelves/shelves.pl [deleted file]

index 9a349b5..14ae8da 100644 (file)
@@ -223,17 +223,18 @@ sub get_template_and_user {
     if ( $in->{'type'} eq "intranet" ) {
         $template->param(
             intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
-            intranetstylesheet => C4::Context->preference("intranetstylesheet"),
-            IntranetNav        => C4::Context->preference("IntranetNav"),
-            intranetuserjs     => C4::Context->preference("intranetuserjs"),
-            TemplateEncoding   => C4::Context->preference("TemplateEncoding"),
-            AmazonContent      => C4::Context->preference("AmazonContent"),
-            LibraryName        => C4::Context->preference("LibraryName"),
-            LoginBranchcode    => (C4::Context->userenv?C4::Context->userenv->{"branch"}:"insecure"),
-            LoginBranchname    => (C4::Context->userenv?C4::Context->userenv->{"branchname"}:"insecure"),
-            AutoLocation       => C4::Context->preference("AutoLocation"),
-            hide_marc          => C4::Context->preference("hide_marc"),
-            patronimages       => C4::Context->preference("patronimages"),
+            intranetstylesheet      => C4::Context->preference("intranetstylesheet"),
+            IntranetNav             => C4::Context->preference("IntranetNav"),
+            intranetuserjs          => C4::Context->preference("intranetuserjs"),
+            TemplateEncoding        => C4::Context->preference("TemplateEncoding"),
+            AmazonContent           => C4::Context->preference("AmazonContent"),
+            LibraryName             => C4::Context->preference("LibraryName"),
+            LoginBranchcode         => (C4::Context->userenv?C4::Context->userenv->{"branch"}:"insecure"),
+            LoginBranchname         => (C4::Context->userenv?C4::Context->userenv->{"branchname"}:"insecure"),
+            LoginBranchnameShort    => substr((C4::Context->userenv?C4::Context->userenv->{"branchname"}:"insecure"),0,10),
+            AutoLocation            => C4::Context->preference("AutoLocation"),
+            hide_marc               => C4::Context->preference("hide_marc"),
+            patronimages            => C4::Context->preference("patronimages"),
             "BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1,
             advancedMARCEditor      => C4::Context->preference("advancedMARCEditor"),
             suggestion              => C4::Context->preference("suggestion"),
@@ -345,7 +346,7 @@ has authenticated.
 
 sub checkauth {
     my $query = shift;
-       # warn "Checking Auth";
+
 # $authnotrequired will be set for scripts which will run without authentication
     my $authnotrequired = shift;
     my $flagsrequired   = shift;
@@ -388,7 +389,7 @@ sub checkauth {
     # state variables
     my $loggedin = 0;
     my %info;
-    my ( $userid, $cookie, $sessionID, $flags );
+    my ( $userid, $cookie, $sessionID, $flags, $envcookie );
     my $logout = $query->param('logout.x');
     if ( $userid = $ENV{'REMOTE_USER'} ) {
 
@@ -430,7 +431,7 @@ sub checkauth {
             close L;
         }
         if ($userid) {
-                       warn "here $userid";
+                       warn "here $userid";
             if ( $lasttime < time() - $timeout ) {
 
                 # timed logout
@@ -550,14 +551,10 @@ sub checkauth {
 #  new op dev :
 # launch a sequence to check if we have a ip for the branch, if we have one we replace the branchcode of the userenv by the branch bound in the ip.
                 my $ip       = $ENV{'REMOTE_ADDR'};
-                               # if they specify at login, use that
-                               if ($query->param('branch')) {
-                               $branchcode  = $query->param('branch');
-                               $branchname = GetBranchName($branchcode);
-                               }
                 my $branches = GetBranches();
                 my @branchesloop;
                 foreach my $br ( keys %$branches ) {
+
                     #          now we work with the treatment of ip
                     my $domain = $branches->{$br}->{'branchip'};
                     if ( $domain && $ip =~ /^$domain/ ) {
@@ -596,17 +593,7 @@ sub checkauth {
                 $session->param('ip',$session->remote_addr());
                                $session->param('lasttime',time());
                        }
-                       if ($session){
-               C4::Context::set_userenv(
-                $session->param('number'),       $session->param('id'),
-                $session->param('cardnumber'),   $session->param('firstname'),
-                $session->param('surname'),      $session->param('branch'),
-                $session->param('branchname'),   $session->param('flags'),
-                $session->param('emailaddress'), $session->param('branchprinter')
-               );
-               }               
         }
-
         else {
             if ($userid) {
                 $info{'invalid_username_or_password'} = 1;
@@ -636,16 +623,8 @@ sub checkauth {
         my $value = $query->param($name);
         push @inputs, { name => $name, value => $value };
     }
-    # get the branchloop, which we need for authetication
-       use C4::Branch;
-    my $branches = GetBranches();
-    my @branch_loop;
-    for my $branch_hash (keys %$branches) {
-                push @branch_loop, {branchcode => "$branch_hash", branchname => $branches->{$branch_hash}->{'branchname'}, };
-    }
 
     my $template = gettemplate( $template_name, $type, $query );
-    $template->param(branchloop => \@branch_loop,);
     $template->param(
         INPUTS               => \@inputs,
         suggestion           => C4::Context->preference("suggestion"),
diff --git a/C4/BookShelves.pm b/C4/BookShelves.pm
new file mode 100755 (executable)
index 0000000..ce8810c
--- /dev/null
@@ -0,0 +1,471 @@
+# -*- tab-width: 8 -*-
+# Please use 8-character tabs for this file (indents are every 4 characters)
+
+package C4::BookShelves;
+
+# $Id$
+
+# Copyright 2000-2002 Katipo Communications
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA  02111-1307 USA
+
+use strict;
+require Exporter;
+use C4::Context;
+use C4::Circulation;
+use vars qw($VERSION @ISA @EXPORT);
+
+# set the version for version checking
+$VERSION = do { my @v = '$Revision$' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
+
+=head1 NAME
+
+C4::BookShelves - Functions for manipulating Koha virtual bookshelves
+
+=head1 SYNOPSIS
+
+  use C4::BookShelves;
+
+=head1 DESCRIPTION
+
+This module provides functions for manipulating virtual bookshelves,
+including creating and deleting bookshelves, and adding and removing
+items to and from bookshelves.
+
+=head1 FUNCTIONS
+
+=over 2
+
+=cut
+
+@ISA    = qw(Exporter);
+@EXPORT = qw(
+        &GetShelves &GetShelfContents &GetShelf
+
+        &AddToShelf &AddToShelfFromBiblio &AddShelf
+
+        &ModShelf
+        &ShelfPossibleAction
+        &DelFromShelf &DelShelf
+);
+
+my $dbh = C4::Context->dbh;
+
+=item GetShelves
+
+  $shelflist = &GetShelves($owner, $mincategory);
+  ($shelfnumber, $shelfhash) = each %{$shelflist};
+
+Looks up the virtual bookshelves, and returns a summary. C<$shelflist>
+is a reference-to-hash. The keys are the bookshelf numbers
+(C<$shelfnumber>, above), and the values (C<$shelfhash>, above) are
+themselves references-to-hash, with the following keys:
+
+C<mincategory> : 2 if the list is for "look". 3 if the list is for "Select bookshelf for adding a book".
+bookshelves of the owner are always selected, whatever the category
+
+=over 4
+
+=item C<$shelfhash-E<gt>{shelfname}>
+
+A string. The name of the shelf.
+
+=item C<$shelfhash-E<gt>{count}>
+
+The number of books on that bookshelf.
+
+=back
+
+=cut
+
+#'
+# FIXME - Wouldn't it be more intuitive to return a list, rather than
+# a reference-to-hash? The shelf number can be just another key in the
+# hash.
+
+sub GetShelves {
+    my ( $owner, $mincategory ) = @_;
+
+    my $query = qq(
+        SELECT bookshelf.shelfnumber, bookshelf.shelfname,owner,surname,firstname,bookshelf.category,
+               count(shelfcontents.itemnumber) as count
+        FROM   bookshelf
+            LEFT JOIN   shelfcontents ON bookshelf.shelfnumber = shelfcontents.shelfnumber
+            LEFT JOIN   borrowers ON bookshelf.owner = borrowers.borrowernumber
+        WHERE  owner=? OR category>=?
+        GROUP BY bookshelf.shelfnumber
+        ORDER BY bookshelf.category, bookshelf.shelfname, borrowers.firstname, borrowers.surname
+    );
+    my $sth = $dbh->prepare($query);
+    $sth->execute( $owner, $mincategory );
+    my %shelflist;
+    while (
+        my (
+            $shelfnumber, $shelfname, $owner, $surname,
+            $firstname,   $category,  $count
+        )
+        = $sth->fetchrow
+      )
+    {
+        $shelflist{$shelfnumber}->{'shelfname'} = $shelfname;
+        $shelflist{$shelfnumber}->{'count'}     = $count;
+        $shelflist{$shelfnumber}->{'category'}  = $category;
+        $shelflist{$shelfnumber}->{'owner'}     = $owner;
+        $shelflist{$shelfnumber}->{'surname'}     = $surname;
+        $shelflist{$shelfnumber}->{'firstname'}   = $firstname;
+    }
+    return ( \%shelflist );
+}
+
+=item GetShef
+
+  (shelfnumber,shelfname,owner,category) = &GetShelf($shelfnumber);
+
+Looks up information about the contents of virtual bookshelf number
+C<$shelfnumber>
+
+Returns the database's information on 'bookshelf' table.
+
+=cut
+
+sub GetShelf {
+    my ($shelfnumber) = @_;
+    my $query = qq(
+        SELECT shelfnumber,shelfname,owner,category
+        FROM   bookshelf
+        WHERE  shelfnumber=?
+    );
+    my $sth = $dbh->prepare($query);
+    $sth->execute($shelfnumber);
+    return $sth->fetchrow;
+}
+
+=item GetShelfContents
+
+  $itemlist = &GetShelfContents($shelfnumber);
+
+Looks up information about the contents of virtual bookshelf number
+C<$shelfnumber>.
+
+Returns a reference-to-array, whose elements are references-to-hash,
+as returned by C<C4::Biblio::GetBiblioFromItemNumber>.
+
+=cut
+
+#'
+sub GetShelfContents {
+    my ( $shelfnumber ) = @_;
+    my @itemlist;
+    my $query =
+       " SELECT itemnumber
+         FROM   shelfcontents
+         WHERE  shelfnumber=?
+         ORDER BY itemnumber
+       ";
+    my $sth = $dbh->prepare($query);
+    $sth->execute($shelfnumber);
+    my $sth2 = $dbh->prepare("
+        SELECT biblio.*,biblioitems.* FROM items 
+            LEFT JOIN biblio on items.biblionumber=biblio.biblionumber
+            LEFT JOIN biblioitems on items.biblionumber=biblioitems.biblionumber
+        WHERE items.itemnumber=?"
+    );
+    while ( my ($itemnumber) = $sth->fetchrow ) {
+        $sth2->execute($itemnumber);
+        my $item = $sth2->fetchrow_hashref;
+        $item->{'itemnumber'}=$itemnumber;
+        push( @itemlist, $item );
+    }
+    return ( \@itemlist );
+}
+
+=item AddShelf
+
+  $shelfnumber = &AddShelf( $shelfname, $owner, $category);
+
+Creates a new virtual bookshelf with name C<$shelfname>, owner C<$owner> and category
+C<$category>.
+
+Returns a code to know what's happen.
+    * -1 : if this bookshelf already exist.
+    * $shelfnumber : if success.
+
+=cut
+
+sub AddShelf {
+    my ( $shelfname, $owner, $category ) = @_;
+    my $query = qq(
+        SELECT *
+        FROM   bookshelf
+        WHERE  shelfname=? AND owner=?
+    );
+    my $sth = $dbh->prepare($query);
+    $sth->execute($shelfname,$owner);
+    if ( $sth->rows ) {
+        return (-1);
+    }
+    else {
+        my $query = qq(
+            INSERT INTO bookshelf
+                (shelfname,owner,category)
+            VALUES (?,?,?)
+        );
+        $sth = $dbh->prepare($query);
+        $sth->execute( $shelfname, $owner, $category );
+        my $shelfnumber = $dbh->{'mysql_insertid'};
+        return ($shelfnumber);
+    }
+}
+
+=item AddToShelf
+
+  &AddToShelf($itemnumber, $shelfnumber);
+
+Adds item number C<$itemnumber> to virtual bookshelf number
+C<$shelfnumber>, unless that item is already on that shelf.
+
+=cut
+
+#'
+sub AddToShelf {
+    my ( $itemnumber, $shelfnumber ) = @_;
+    return unless $itemnumber;
+    my $query = qq(
+        SELECT *
+        FROM   shelfcontents
+        WHERE  shelfnumber=? AND itemnumber=?
+    );
+    my $sth = $dbh->prepare($query);
+
+    $sth->execute( $shelfnumber, $itemnumber );
+    unless ( $sth->rows ) {
+        # already on shelf
+        my $query = qq(
+            INSERT INTO shelfcontents
+                (shelfnumber, itemnumber, flags)
+            VALUES
+                (?, ?, 0)
+        );
+        $sth = $dbh->prepare($query);
+        $sth->execute( $shelfnumber, $itemnumber );
+    }
+}
+
+=item AddToShelfFromBiblio
+    &AddToShelfFromBiblio($biblionumber, $shelfnumber)
+
+    this function allow to add a book into the shelf number $shelfnumber
+    from biblionumber.
+
+=cut
+
+sub AddToShelfFromBiblio {
+    my ( $biblionumber, $shelfnumber ) = @_;
+    return unless $biblionumber;
+    my $query = qq(
+        SELECT itemnumber
+        FROM   items
+        WHERE  biblionumber=?
+    );
+    my $sth = $dbh->prepare($query);
+    $sth->execute($biblionumber);
+    my ($itemnumber) = $sth->fetchrow;
+    $query = qq(
+        SELECT *
+        FROM   shelfcontents
+        WHERE  shelfnumber=? AND itemnumber=?
+    );
+    $sth = $dbh->prepare($query);
+    $sth->execute( $shelfnumber, $itemnumber );
+    unless ( $sth->rows ) {
+        # "already on shelf";
+        my $query =qq(
+            INSERT INTO shelfcontents
+                (shelfnumber, itemnumber, flags)
+            VALUES
+                (?, ?, 0)
+        );
+        $sth = $dbh->prepare($query);
+        $sth->execute( $shelfnumber, $itemnumber );
+    }
+}
+
+=item ModShelf
+
+ModShelf($shelfnumber, $shelfname, $owner, $category )
+
+Modify the value into bookshelf table with values given on input arg.
+
+=cut
+
+sub ModShelf {
+    my ( $shelfnumber, $shelfname, $owner, $category ) = @_;
+    my $query = qq(
+        UPDATE bookshelf
+        SET    shelfname=?,owner=?,category=?
+        WHERE  shelfnumber=?
+    );
+    my $sth = $dbh->prepare($query);
+    $sth->execute( $shelfname, $owner, $category, $shelfnumber );
+}
+
+=item DelShelf
+
+  ($status) = &DelShelf($shelfnumber);
+
+Deletes virtual bookshelf number C<$shelfnumber>. The bookshelf must
+be empty.
+
+Returns a two-element array, where C<$status> is 0 if the operation
+was successful, or non-zero otherwise. C<$msg> is "Done" in case of
+success, or an error message giving the reason for failure.
+
+=cut
+
+
+=item ShelfPossibleAction
+
+ShelfPossibleAction($loggedinuser, $shelfnumber, $action);
+
+C<$loggedinuser,$shelfnumber,$action>
+
+$action can be "view" or "manage".
+
+Returns 1 if the user can do the $action in the $shelfnumber shelf.
+Returns 0 otherwise.
+
+=cut
+
+sub ShelfPossibleAction {
+    my ( $user, $shelfnumber, $action ) = @_;
+    my $query = qq(
+        SELECT owner,category
+        FROM   bookshelf
+        WHERE  shelfnumber=?
+    );
+    my $sth = $dbh->prepare($query);
+    $sth->execute($shelfnumber);
+    my ( $owner, $category ) = $sth->fetchrow;
+    return 1 if (($category >= 3 or $owner eq $user) && $action eq 'manage' );
+    return 1 if (($category >= 2 or $owner eq $user) && $action eq 'view' );
+    return 0;
+}
+
+=item DelFromShelf
+
+  &DelFromShelf( $itemnumber, $shelfnumber);
+
+Removes item number C<$itemnumber> from virtual bookshelf number
+C<$shelfnumber>. If the item wasn't on that bookshelf to begin with,
+nothing happens.
+
+=cut
+
+#'
+sub DelFromShelf {
+    my ( $itemnumber, $shelfnumber ) = @_;
+    my $query = qq(
+        DELETE FROM shelfcontents
+        WHERE  shelfnumber=? AND itemnumber=?
+    );
+    my $sth = $dbh->prepare($query);
+    $sth->execute( $shelfnumber, $itemnumber );
+}
+
+=head2 DelShelf
+
+  $Number = DelShelf($shelfnumber);
+
+    this function delete the shelf number, and all of it's content
+
+=cut
+
+#'
+sub DelShelf {
+    my ( $shelfnumber ) = @_;
+        my $sth = $dbh->prepare("DELETE FROM bookshelf WHERE shelfnumber=?");
+        $sth->execute($shelfnumber);
+        return 0;
+}
+
+END { }    # module clean-up code here (global destructor)
+
+1;
+
+__END__
+
+=back
+
+=head1 AUTHOR
+
+Koha Developement team <info@koha.org>
+
+=head1 SEE ALSO
+
+C4::Circulation::Circ2(3)
+
+=cut
+
+#
+# $Log$
+# Revision 1.21  2007/04/04 16:46:22  tipaul
+# HUGE COMMIT : code cleaning circulation.
+#
+# some stuff to do, i'll write a mail on koha-devel NOW !
+#
+# Revision 1.20  2007/03/09 14:31:47  tipaul
+# rel_3_0 moved to HEAD
+#
+# Revision 1.15.8.10  2007/01/25 13:18:15  tipaul
+# checking that a bookshelf with the same name AND OWNER does not exist before creating it
+#
+# Revision 1.15.8.9  2006/12/15 17:37:52  toins
+# removing a function used only once.
+#
+# Revision 1.15.8.8  2006/12/14 17:22:55  toins
+# bookshelves work perfectly with mod_perl and are cleaned.
+#
+# Revision 1.15.8.7  2006/12/13 19:46:41  hdl
+# Some bug fixing.
+#
+# Revision 1.15.8.6  2006/12/11 17:10:06  toins
+# fixing some bugs on bookshelves.
+#
+# Revision 1.15.8.5  2006/12/07 16:45:43  toins
+# removing warn compilation. (perl -wc)
+#
+# Revision 1.15.8.4  2006/11/23 09:05:01  tipaul
+# enable removal of a bookshelf even if there are items inside
+#
+# Revision 1.15.8.3  2006/10/30 09:50:20  tipaul
+# removing getiteminformations (using direct SQL, as we are in a .pm, so it's "legal")
+#
+# Revision 1.15.8.2  2006/08/31 16:03:52  toins
+# Add Pod to DelShelf
+#
+# Revision 1.15.8.1  2006/08/30 15:59:14  toins
+# Code cleaned according to coding guide lines.
+#
+# Revision 1.15  2004/12/16 11:30:58  tipaul
+# adding bookshelf features :
+# * create bookshelf on the fly
+# * modify a bookshelf name & status
+#
+# Revision 1.14  2004/12/15 17:28:23  tipaul
+# adding bookshelf features :
+# * create bookshelf on the fly
+# * modify a bookshelf (this being not finished, will commit the rest soon)
index 79d4d54..4a540be 100644 (file)
@@ -91,7 +91,8 @@ foreach my $thisbranch (keys %$branches) {
 =cut
 
 sub GetBranches {
-    my ($onlymine)=@_;
+
+    my $onlymine=@_;
     # returns a reference to a hash of references to ALL branches...
     my %branches;
     my $dbh = C4::Context->dbh;
diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm
deleted file mode 100755 (executable)
index 06bddb1..0000000
+++ /dev/null
@@ -1,411 +0,0 @@
-# -*- tab-width: 8 -*-
-# Please use 8-character tabs for this file (indents are every 4 characters)
-
-package C4::VirtualShelves;
-
-# $Id$
-
-# Copyright 2000-2002 Katipo Communications
-#
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
-
-use strict;
-require Exporter;
-use C4::Context;
-use C4::Circulation;
-use vars qw($VERSION @ISA @EXPORT);
-
-# set the version for version checking
-$VERSION = do { my @v = '$Revision$' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
-
-=head1 NAME
-
-C4::VirtualShelves - Functions for manipulating Koha virtual virtualshelves
-
-=head1 SYNOPSIS
-
-  use C4::VirtualShelves;
-
-=head1 DESCRIPTION
-
-This module provides functions for manipulating virtual virtualshelves,
-including creating and deleting virtualshelves, and adding and removing
-items to and from virtualshelves.
-
-=head1 FUNCTIONS
-
-=over 2
-
-=cut
-
-@ISA    = qw(Exporter);
-@EXPORT = qw(
-        &GetShelves &GetShelfContents &GetShelf
-
-        &AddToShelf &AddToShelfFromBiblio &AddShelf
-
-        &ModShelf
-        &ShelfPossibleAction
-        &DelFromShelf &DelShelf
-);
-
-my $dbh = C4::Context->dbh;
-
-=item GetShelves
-
-  $shelflist = &GetShelves($owner, $mincategory);
-  ($shelfnumber, $shelfhash) = each %{$shelflist};
-
-Looks up the virtual virtualshelves, and returns a summary. C<$shelflist>
-is a reference-to-hash. The keys are the virtualshelves numbers
-(C<$shelfnumber>, above), and the values (C<$shelfhash>, above) are
-themselves references-to-hash, with the following keys:
-
-C<mincategory> : 2 if the list is for "look". 3 if the list is for "Select virtualshelves for adding a virtual".
-virtualshelves of the owner are always selected, whatever the category
-
-=over 4
-
-=item C<$shelfhash-E<gt>{shelfname}>
-
-A string. The name of the shelf.
-
-=item C<$shelfhash-E<gt>{count}>
-
-The number of virtuals on that virtualshelves.
-
-=back
-
-=cut
-
-#'
-# FIXME - Wouldn't it be more intuitive to return a list, rather than
-# a reference-to-hash? The shelf number can be just another key in the
-# hash.
-
-sub GetShelves {
-    my ( $owner, $mincategory ) = @_;
-
-    my $query = qq(
-        SELECT virtualshelves.shelfnumber, virtualshelves.shelfname,owner,surname,firstname,virtualshelves.category,
-               count(virtualshelfcontents.biblionumber) as count
-        FROM   virtualshelves
-            LEFT JOIN   virtualshelfcontents ON virtualshelves.shelfnumber = virtualshelfcontents.shelfnumber
-            LEFT JOIN   borrowers ON virtualshelves.owner = borrowers.borrowernumber
-        WHERE  owner=? OR category>=?
-        GROUP BY virtualshelves.shelfnumber
-        ORDER BY virtualshelves.category, virtualshelves.shelfname, borrowers.firstname, borrowers.surname
-    );
-    my $sth = $dbh->prepare($query);
-    $sth->execute( $owner, $mincategory );
-    my %shelflist;
-    while (
-        my (
-            $shelfnumber, $shelfname, $owner, $surname,
-            $firstname,   $category,  $count
-        )
-        = $sth->fetchrow
-      )
-    {
-        $shelflist{$shelfnumber}->{'shelfname'} = $shelfname;
-        $shelflist{$shelfnumber}->{'count'}     = $count;
-        $shelflist{$shelfnumber}->{'category'}  = $category;
-        $shelflist{$shelfnumber}->{'owner'}     = $owner;
-        $shelflist{$shelfnumber}->{'surname'}     = $surname;
-        $shelflist{$shelfnumber}->{'firstname'}   = $firstname;
-    }
-    return ( \%shelflist );
-}
-
-=item GetShef
-
-  (shelfnumber,shelfname,owner,category) = &GetShelf($shelfnumber);
-
-Looks up information about the contents of virtual virtualshelves number
-C<$shelfnumber>
-
-Returns the database's information on 'virtualshelves' table.
-
-=cut
-
-sub GetShelf {
-    my ($shelfnumber) = @_;
-    my $query = qq(
-        SELECT shelfnumber,shelfname,owner,category
-        FROM   virtualshelves
-        WHERE  shelfnumber=?
-    );
-    my $sth = $dbh->prepare($query);
-    $sth->execute($shelfnumber);
-    return $sth->fetchrow;
-}
-
-=item GetShelfContents
-
-  $itemlist = &GetShelfContents($shelfnumber);
-
-Looks up information about the contents of virtual virtualshelves number
-C<$shelfnumber>.
-
-Returns a reference-to-array, whose elements are references-to-hash,
-as returned by C<C4::Biblio::GetBiblioFromItemNumber>.
-
-=cut
-
-#'
-sub GetShelfContents {
-    my ( $shelfnumber ) = @_;
-    my @itemlist;
-    my $query =
-       " SELECT biblionumber
-         FROM   virtualshelfcontents
-         WHERE  shelfnumber=?
-         ORDER BY biblionumber
-       ";
-    my $sth = $dbh->prepare($query);
-    $sth->execute($shelfnumber);
-    my $sth2 = $dbh->prepare("
-        SELECT biblio.*,biblioitems.* FROM biblio
-            LEFT JOIN biblioitems on biblio.biblionumber=biblioitems.biblionumber
-        WHERE biblio.biblionumber=?"
-    );
-    while ( my ($biblionumber) = $sth->fetchrow ) {
-        $sth2->execute($biblionumber);
-        my $item = $sth2->fetchrow_hashref;
-        $item->{'biblionumber'}=$biblionumber;
-        push( @itemlist, $item );
-    }
-    return ( \@itemlist );
-}
-
-=item AddShelf
-
-  $shelfnumber = &AddShelf( $shelfname, $owner, $category);
-
-Creates a new virtual virtualshelves with name C<$shelfname>, owner C<$owner> and category
-C<$category>.
-
-Returns a code to know what's happen.
-    * -1 : if this virtualshelves already exist.
-    * $shelfnumber : if success.
-
-=cut
-
-sub AddShelf {
-    my ( $shelfname, $owner, $category ) = @_;
-    my $query = qq(
-        SELECT *
-        FROM   virtualshelves
-        WHERE  shelfname=? AND owner=?
-    );
-    my $sth = $dbh->prepare($query);
-    $sth->execute($shelfname,$owner);
-    if ( $sth->rows ) {
-        return (-1);
-    }
-    else {
-        my $query = qq(
-            INSERT INTO virtualshelves
-                (shelfname,owner,category)
-            VALUES (?,?,?)
-        );
-        $sth = $dbh->prepare($query);
-        $sth->execute( $shelfname, $owner, $category );
-        my $shelfnumber = $dbh->{'mysql_insertid'};
-        return ($shelfnumber);
-    }
-}
-
-=item AddToShelf
-
-  &AddToShelf($biblionumber, $shelfnumber);
-
-Adds item number C<$biblionumber> to virtual virtualshelves number
-C<$shelfnumber>, unless that item is already on that shelf.
-
-=cut
-
-#'
-sub AddToShelf {
-    my ( $biblionumber, $shelfnumber ) = @_;
-    return unless $biblionumber;
-    my $query = qq(
-        SELECT *
-        FROM   virtualshelfcontents
-        WHERE  shelfnumber=? AND biblionumber=?
-    );
-    my $sth = $dbh->prepare($query);
-
-    $sth->execute( $shelfnumber, $biblionumber );
-    unless ( $sth->rows ) {
-        # already on shelf
-        my $query = qq(
-            INSERT INTO virtualshelfcontents
-                (shelfnumber, biblionumber, flags)
-            VALUES
-                (?, ?, 0)
-        );
-        $sth = $dbh->prepare($query);
-        $sth->execute( $shelfnumber, $biblionumber );
-    }
-}
-
-=item AddToShelfFromBiblio
-    &AddToShelfFromBiblio($biblionumber, $shelfnumber)
-
-    this function allow to add a virtual into the shelf number $shelfnumber
-    from biblionumber.
-
-=cut
-
-sub AddToShelfFromBiblio {
-    my ( $biblionumber, $shelfnumber ) = @_;
-    return unless $biblionumber;
-    my $query = qq(
-        SELECT *
-        FROM   virtualshelfcontents
-        WHERE  shelfnumber=? AND biblionumber=?
-    );
-    my $sth = $dbh->prepare($query);
-    $sth->execute( $shelfnumber, $biblionumber );
-    unless ( $sth->rows ) {
-        my $query =qq(
-            INSERT INTO virtualshelfcontents
-                (shelfnumber, biblionumber, flags)
-            VALUES
-                (?, ?, 0)
-        );
-        $sth = $dbh->prepare($query);
-        $sth->execute( $shelfnumber, $biblionumber );
-    }
-}
-
-=item ModShelf
-
-ModShelf($shelfnumber, $shelfname, $owner, $category )
-
-Modify the value into virtualshelves table with values given on input arg.
-
-=cut
-
-sub ModShelf {
-    my ( $shelfnumber, $shelfname, $owner, $category ) = @_;
-    my $query = qq(
-        UPDATE virtualshelves
-        SET    shelfname=?,owner=?,category=?
-        WHERE  shelfnumber=?
-    );
-    my $sth = $dbh->prepare($query);
-    $sth->execute( $shelfname, $owner, $category, $shelfnumber );
-}
-
-=item DelShelf
-
-  ($status) = &DelShelf($shelfnumber);
-
-Deletes virtual virtualshelves number C<$shelfnumber>. The virtualshelves must
-be empty.
-
-Returns a two-element array, where C<$status> is 0 if the operation
-was successful, or non-zero otherwise. C<$msg> is "Done" in case of
-success, or an error message giving the reason for failure.
-
-=cut
-
-
-=item ShelfPossibleAction
-
-ShelfPossibleAction($loggedinuser, $shelfnumber, $action);
-
-C<$loggedinuser,$shelfnumber,$action>
-
-$action can be "view" or "manage".
-
-Returns 1 if the user can do the $action in the $shelfnumber shelf.
-Returns 0 otherwise.
-
-=cut
-
-sub ShelfPossibleAction {
-    my ( $user, $shelfnumber, $action ) = @_;
-    my $query = qq(
-        SELECT owner,category
-        FROM   virtualshelves
-        WHERE  shelfnumber=?
-    );
-    my $sth = $dbh->prepare($query);
-    $sth->execute($shelfnumber);
-    my ( $owner, $category ) = $sth->fetchrow;
-    return 1 if (($category >= 3 or $owner eq $user) && $action eq 'manage' );
-    return 1 if (($category >= 2 or $owner eq $user) && $action eq 'view' );
-    return 0;
-}
-
-=item DelFromShelf
-
-  &DelFromShelf( $biblionumber, $shelfnumber);
-
-Removes item number C<$biblionumber> from virtual virtualshelves number
-C<$shelfnumber>. If the item wasn't on that virtualshelves to begin with,
-nothing happens.
-
-=cut
-
-#'
-sub DelFromShelf {
-    my ( $biblionumber, $shelfnumber ) = @_;
-    my $query = qq(
-        DELETE FROM virtualshelfcontents
-        WHERE  shelfnumber=? AND biblionumber=?
-    );
-    my $sth = $dbh->prepare($query);
-    $sth->execute( $shelfnumber, $biblionumber );
-}
-
-=head2 DelShelf
-
-  $Number = DelShelf($shelfnumber);
-
-    this function delete the shelf number, and all of it's content
-
-=cut
-
-#'
-sub DelShelf {
-    my ( $shelfnumber ) = @_;
-        my $sth = $dbh->prepare("DELETE FROM virtualshelves WHERE shelfnumber=?");
-        $sth->execute($shelfnumber);
-        return 0;
-}
-
-END { }    # module clean-up code here (global destructor)
-
-1;
-
-__END__
-
-=back
-
-=head1 AUTHOR
-
-Koha Developement team <info@koha.org>
-
-=head1 SEE ALSO
-
-C4::Circulation::Circ2(3)
-
-=cut
index bb5e56a..611f8b7 100644 (file)
@@ -86,7 +86,6 @@ WriteMakefile(
     PREREQ_PM => {
 'CGI' => 3.15,
 'CGI::Carp' => 1.29,
-'CGI::Session' => '4.10',
 'Class::Accessor' => 0.30,
 'DBD::mysql' => 3.0008,
 'DBI' => 1.53,
diff --git a/bookshelves/addbookbybiblionumber.pl b/bookshelves/addbookbybiblionumber.pl
new file mode 100755 (executable)
index 0000000..787a13b
--- /dev/null
@@ -0,0 +1,175 @@
+#!/usr/bin/perl
+
+#script to provide bookshelf management
+#
+#
+# Copyright 2000-2002 Katipo Communications
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA  02111-1307 USA
+
+# $Id$
+
+=head1 NAME
+
+    addbookbybiblionumber.pl
+
+=head1 DESCRIPTION
+
+    This script allow to add a book in a virtual shelf from a biblionumber.
+
+=head1 CGI PARAMETERS
+
+=over 4
+
+=item biblionumber
+
+    The biblionumber
+
+=item shelfnumber
+
+    the shelfnumber where to add the book.
+
+=item newbookshelf
+
+    if this parameter exists, then it must be equals to the name of the shelf
+    to add.
+
+=item category
+
+    if this script has to add a shelf, it add one with this category.
+
+=back
+
+=cut
+
+use strict;
+use C4::Biblio;
+use CGI;
+use C4::Output;
+use C4::BookShelves;
+use C4::Circulation;
+use C4::Auth;
+
+
+#use it only to debug !
+use CGI::Carp qw/fatalsToBrowser/;
+use warnings;
+
+my $query = new CGI;
+my $biblionumber = $query->param('biblionumber');
+my $shelfnumber = $query->param('shelfnumber');
+my $newbookshelf = $query->param('newbookshelf');
+my $category = $query->param('category');
+
+my ($template, $loggedinuser, $cookie)
+= get_template_and_user({template_name => "bookshelves/addbookbybiblionumber.tmpl",
+                            query => $query,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {catalogue => 1},
+                        });
+
+$shelfnumber = AddShelf($newbookshelf,$loggedinuser,$category) if $newbookshelf;
+
+if ($shelfnumber || ($shelfnumber == -1)) { # the shelf already exist.
+    &AddToShelfFromBiblio($biblionumber, $shelfnumber);
+    print "Content-Type: text/html\n\n<html><body onload=\"window.close()\"></body></html>";
+    exit;
+} else {    # this shelf doesn't already exist.
+    my  ( $bibliocount, @biblios )  = GetBiblio($biblionumber);
+
+    my ($shelflist) = GetShelves($loggedinuser,3);
+    my @shelvesloop;
+    my %shelvesloop;
+    foreach my $element (sort keys %$shelflist) {
+        push (@shelvesloop, $element);
+        $shelvesloop{$element} = $shelflist->{$element}->{'shelfname'};
+    }
+
+    my $CGIbookshelves=CGI::scrolling_list(
+                -name     => 'shelfnumber',
+                -values   => \@shelvesloop,
+                -labels   => \%shelvesloop,
+                -size     => 1,
+                -tabindex=>'',
+                -multiple => 0 );
+
+    $template->param(
+                biblionumber => $biblionumber,
+                title => $biblios[0]->{'title'},
+                author => $biblios[0]->{'author'},
+                CGIbookshelves => $CGIbookshelves,
+                intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
+                intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+                IntranetNav => C4::Context->preference("IntranetNav"),
+                );
+
+    output_html_with_http_headers $query, $cookie, $template->output;
+}
+
+# $Log$
+# Revision 1.8  2007/04/24 13:54:29  hdl
+# functions that were in C4::Interface::CGI::Output are now in C4::Output.
+# So this implies quite a change for files.
+# Sorry about conflicts which will be caused.
+# directory Interface::CGI should now be dropped.
+# I noticed that many scripts (reports ones, but also some circ/stats.pl or opac-topissues) still use Date::Manip.
+#
+# Revision 1.7  2007/04/04 16:46:22  tipaul
+# HUGE COMMIT : code cleaning circulation.
+#
+# some stuff to do, i'll write a mail on koha-devel NOW !
+#
+# Revision 1.6  2007/03/09 14:32:26  tipaul
+# rel_3_0 moved to HEAD
+#
+# Revision 1.4.2.6  2006/12/18 16:35:17  toins
+# removing use HTML::Template from *.pl.
+#
+# Revision 1.4.2.5  2006/12/05 11:35:29  toins
+# Biblio.pm cleaned.
+# additionalauthors, bibliosubject, bibliosubtitle tables are now unused.
+# Some functions renamed according to the coding guidelines.
+#
+# Revision 1.4.2.4  2006/11/30 18:23:51  toins
+# theses scripts don't need to use C4::Search.
+#
+# Revision 1.4.2.3  2006/10/30 09:48:19  tipaul
+# samll bugfix to create a bookshelf correctly
+#
+# Revision 1.4.2.2  2006/08/30 16:13:54  toins
+# correct an error in the "if condition".
+#
+# Revision 1.4.2.1  2006/08/30 15:59:14  toins
+# Code cleaned according to coding guide lines.
+#
+# Revision 1.4  2006/07/04 14:36:51  toins
+# Head & rel_2_2 merged
+#
+# Revision 1.3.2.4  2006/06/20 16:21:42  oleonard
+# Adding "tabindex=''" to CGI:scrolling_lists to prevent incorrect tabbing. See Bug 1098
+#
+# Revision 1.3.2.3  2006/02/05 21:59:21  kados
+# Adds script support for IntranetNav ... see mail to koha-devel for
+# details
+#
+# Revision 1.3.2.2  2006/02/05 21:45:25  kados
+# Adds support for intranetstylesheet system pref in Koha scripts
+#
+
+# Local Variables:
+# tab-width: 4
+# End:
diff --git a/bookshelves/shelves.pl b/bookshelves/shelves.pl
new file mode 100755 (executable)
index 0000000..4062e38
--- /dev/null
@@ -0,0 +1,323 @@
+#!/usr/bin/perl
+
+#
+# Copyright 2000-2002 Katipo Communications
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA  02111-1307 USA
+
+=head1 NAME
+
+    shelves.pl
+
+=head1 DESCRIPTION
+
+    this script is used to script to provide bookshelf management
+
+=head1 CGI PARAMETERS
+
+=over 4
+
+=item C<modifyshelfcontents>
+
+    if this script has to modify the shelve content.
+
+=item C<shelfnumber>
+
+    to know on which shelve this script has to work.
+
+=item C<addbarcode>
+
+=item C<op>
+
+    op can be equals to:
+        * modifsave to save change on the shelves
+        * modif to change the template to allow to modify the shelves.
+
+=item C<viewshelf>
+
+    to load the template with 'viewshelves param' which allow to read the shelves information.
+
+=item C<shelves>
+
+    if equals to 1. then call the function shelves which add
+    or delete a shelf.
+
+=item C<addshelf>
+
+    if the param shelves = 1 then addshelf must be equals to the name of the shelf to add.
+
+=back
+
+=cut
+
+use strict;
+use CGI;
+use C4::BookShelves;
+use C4::Biblio;
+use C4::Auth;
+use C4::Output;
+
+my $query = new CGI;
+
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+    {
+        template_name   => "bookshelves/shelves.tmpl",
+        query           => $query,
+        type            => "intranet",
+        authnotrequired => 0,
+        flagsrequired   => { catalogue => 1 },
+    }
+);
+
+if ( $query->param('modifyshelfcontents') ) {
+    my $shelfnumber = $query->param('viewshelf');
+    my $barcode     = $query->param('addbarcode');
+    my ($item) = GetItem( 0, $barcode );
+    if ( ShelfPossibleAction( $loggedinuser, $shelfnumber, 'manage' ) ) {
+        AddToShelf( $item->{'itemnumber'}, $shelfnumber );
+        foreach ( $query->param ) {
+            if (/REM-(\d*)/) {
+                my $itemnumber = $1;
+                DelFromShelf( $itemnumber, $shelfnumber );
+            }
+        }
+    }
+}
+
+# getting the Shelves list
+my $shelflist = GetShelves( $loggedinuser, 2 );
+$template->param( { loggedinuser => $loggedinuser } );
+my $op = $query->param('op');
+
+SWITCH: {
+    if ( $op && ( $op eq 'modifsave' ) ) {
+        ModShelf(
+            $query->param('shelfnumber'), $query->param('shelfname'),
+            $loggedinuser,                $query->param('category')
+        );
+        last SWITCH;
+    }
+    if ( $op && ( $op eq 'modif' ) ) {
+        my ( $shelfnumber, $shelfname, $owner, $category ) =
+          GetShelf( $query->param('shelf') );
+        $template->param(
+            edit                => 1,
+            shelfnumber         => $shelfnumber,
+            shelfname           => $shelfname,
+            "category$category" => 1
+        );
+
+        #         editshelf($query->param('shelf'));
+        last SWITCH;
+    }
+    if ( $query->param('viewshelf') ) {
+        #check that the user can view the shelf
+        my $shelfnumber = $query->param('viewshelf');
+        if ( ShelfPossibleAction( $loggedinuser, $shelfnumber, 'view' ) ) {
+            my $items = GetShelfContents($shelfnumber);
+            $template->param(
+                shelfname   => $shelflist->{$shelfnumber}->{'shelfname'},
+                shelfnumber => $shelfnumber,
+                viewshelf   => $query->param('viewshelf'),
+                manageshelf => &ShelfPossibleAction( $loggedinuser, $shelfnumber, 'manage' ),
+                itemsloop   => $items,
+            );
+        }
+        last SWITCH;
+    }
+    if ( $query->param('shelves') ) {
+        if ( my $newshelf = $query->param('addshelf') ) {
+            my $shelfnumber = AddShelf(
+                $newshelf,
+                $query->param('owner'),
+                $query->param('category')
+            );
+
+            if ( $shelfnumber == -1 ) {    #shelf already exists.
+                $template->param(
+                    {
+                        shelfnumber => $shelfnumber,
+                        already     => 1
+                    }
+                );
+            }
+    }
+    my @paramsloop;
+    foreach ( $query->param() ) {
+        my %line;
+        if (/DEL-(\d+)/) {
+            my $delshelf = $1;
+            my ( $status, $count ) = DelShelf($delshelf);
+            if ($status) {
+                $line{'status'} = $status;
+                $line{'count'}  = $count;
+            }
+        }
+
+        #if the shelf is not deleted, %line points on null
+        push( @paramsloop, \%line );
+    }
+    $template->param( paramsloop => \@paramsloop );
+    my ($shelflist) = GetShelves( $loggedinuser, 2 );
+    my $color = '';
+    my @shelvesloop;
+    foreach my $element ( sort keys %$shelflist ) {
+        my %line;
+        ( $color eq 1 ) ? ( $color = 0 ) : ( $color = 1 );
+        $line{'toggle'}         = $color;
+        $line{'shelf'}          = $element;
+        $line{'shelfname'}      = $shelflist->{$element}->{'shelfname'};
+        $line{'shelfbookcount'} = $shelflist->{$element}->{'count'};
+        push( @shelvesloop, \%line );
+    }
+    $template->param(
+        shelvesloop => \@shelvesloop,
+        shelves     => 1,
+    );
+        last SWITCH;
+    }
+}
+
+($shelflist) =
+  GetShelves( $loggedinuser, 2 )
+  ;    # rebuild shelflist in case a shelf has been added
+
+my $color = '';
+my @shelvesloop;
+my $numberCanManage = 0;
+
+foreach my $element ( sort keys %$shelflist ) {
+    my %line;
+    ( $color eq 1 ) ? ( $color = 0 ) : ( $color = 1 );
+    $line{'toggle'}    = $color;
+    $line{'shelf'}     = $element;
+    $line{'shelfname'} = $shelflist->{$element}->{'shelfname'};
+    $line{ "category" . $shelflist->{$element}->{'category'} } = 1;
+    $line{'mine'} = 1 if $shelflist->{$element}->{'owner'} eq $loggedinuser;
+    $line{'shelfbookcount'} = $shelflist->{$element}->{'count'};
+    $line{'canmanage'} =  ShelfPossibleAction( $loggedinuser, $element, 'manage' );
+    $line{'firstname'} = $shelflist->{$element}->{'firstname'}
+        unless $shelflist->{$element}->{'owner'} eq $loggedinuser;
+    $line{'surname'} = $shelflist->{$element}->{'surname'}
+        unless $shelflist->{$element}->{'owner'} eq $loggedinuser;
+    
+    $numberCanManage++ if $line{'canmanage'};
+    
+        push( @shelvesloop, \%line );
+}
+
+$template->param(
+    shelvesloop     => \@shelvesloop,
+    numberCanManage => $numberCanManage,
+);
+
+output_html_with_http_headers $query, $cookie, $template->output;
+
+sub shelves {
+    my $innertemplate = shift;
+    if ( my $newshelf = $query->param('addshelf') ) {
+        my $shelfnumber = AddShelf(
+            $newshelf,
+            $query->param('owner'),
+            $query->param('category')
+        );
+
+        if ( $shelfnumber == -1 ) {    #shelf already exists.
+            $template->param(
+                {
+                    shelfnumber => $shelfnumber,
+                    already     => 1
+                }
+            );
+        }
+    }
+    my @paramsloop;
+    foreach ( $query->param() ) {
+        my %line;
+        if (/DEL-(\d+)/) {
+            my $delshelf = $1;
+            my ( $status, $count ) = DelShelf($delshelf);
+            if ($status) {
+                $line{'status'} = $status;
+                $line{'count'}  = $count;
+            }
+        }
+
+        #if the shelf is not deleted, %line points on null
+        push( @paramsloop, \%line );
+    }
+    $innertemplate->param( paramsloop => \@paramsloop );
+    my ($shelflist) = GetShelves( $loggedinuser, 2 );
+    my $color = '';
+    my @shelvesloop;
+    foreach my $element ( sort keys %$shelflist ) {
+        my %line;
+        ( $color eq 1 ) ? ( $color = 0 ) : ( $color = 1 );
+        $line{'toggle'}         = $color;
+        $line{'shelf'}          = $element;
+        $line{'shelfname'}      = $shelflist->{$element}->{'shelfname'};
+        $line{'shelfbookcount'} = $shelflist->{$element}->{'count'};
+        push( @shelvesloop, \%line );
+    }
+    $innertemplate->param(
+        shelvesloop => \@shelvesloop,
+        shelves     => 1,
+    );
+}
+
+#
+# $Log$
+# Revision 1.13  2007/04/24 13:54:29  hdl
+# functions that were in C4::Interface::CGI::Output are now in C4::Output.
+# So this implies quite a change for files.
+# Sorry about conflicts which will be caused.
+# directory Interface::CGI should now be dropped.
+# I noticed that many scripts (reports ones, but also some circ/stats.pl or opac-topissues) still use Date::Manip.
+#
+# Revision 1.12  2007/04/04 16:46:22  tipaul
+# HUGE COMMIT : code cleaning circulation.
+#
+# some stuff to do, i'll write a mail on koha-devel NOW !
+#
+# Revision 1.11  2007/03/09 14:32:26  tipaul
+# rel_3_0 moved to HEAD
+#
+# Revision 1.9.2.9  2007/02/05 15:54:30  toins
+# don't display "remove selected shelves" if the user logged has no shelf.
+#
+# Revision 1.9.2.8  2006/12/15 17:36:57  toins
+# - some change on the html param.
+# - Writing directly the code of a sub called only once.
+# - adding syspref: BiblioDefaultView.
+#
+# Revision 1.9.2.7  2006/12/14 17:22:55  toins
+# bookshelves work perfectly with mod_perl and are cleaned.
+#
+# Revision 1.9.2.6  2006/12/13 10:06:05  toins
+# fix a mod_perl specific bug.
+#
+# Revision 1.9.2.5  2006/12/11 17:10:06  toins
+# fixing some bugs on bookshelves.
+#
+# Revision 1.9.2.4  2006/11/30 18:23:51  toins
+# theses scripts don't need to use C4::Search.
+#
+# Revision 1.9.2.3  2006/10/30 09:50:45  tipaul
+# better perl writting
+#
+# Revision 1.9.2.2  2006/10/17 07:59:35  toins
+# ccode added.
+#
diff --git a/help.pl b/help.pl
index 7c0743d..0a76f6e 100755 (executable)
--- a/help.pl
+++ b/help.pl
@@ -1,8 +1,27 @@
 #!/usr/bin/perl
-use HTML::Template;
+
+# Copyright 2006 Katipo Communications
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA  02111-1307 USA
+
 use strict;
 require Exporter;
-use C4::Output;  # contains gettemplate
+use C4::Output;    # contains gettemplate
+use C4::Output;
+
 # use C4::Auth;
 use C4::Context;
 use CGI;
@@ -10,45 +29,46 @@ use CGI;
 my $query = new CGI;
 
 # find the script that called the online help using the CGI referer()
-my $refer  = $query->referer();
+
+my $refer = $query->referer();
+
 # workaround for popup not functioning correctly in IE
 my $referurl = $query->param('url');
-if($referurl){
+if ($referurl) {
     $refer = $query->param('url');
 }
 
 $refer =~ /.*koha\/(.*)\.pl.*/;
 my $from = "help/$1.tmpl";
 
-my $template = gethelptemplate($from,"intranet");
+my $template = gethelptemplate( $from, "intranet" );
+
 # my $template
 output_html_with_http_headers $query, "", $template->output;
 
-
 sub gethelptemplate {
-       my ($tmplbase) = @_;
-
-       my $htdocs;
-               $htdocs = C4::Context->config('intrahtdocs');
-       my ($theme, $lang) = themelanguage($htdocs, $tmplbase, "intranet");
-       unless (-e "$htdocs/$theme/$lang/$tmplbase") {
-               $tmplbase="help/nohelp.tmpl";
-               ($theme, $lang) = themelanguage($htdocs, $tmplbase, "intranet");
-       }
-       my $template = HTML::Template->new(filename      => "$htdocs/$theme/$lang/$tmplbase",
-                                  die_on_bad_params => 0,
-                                  global_vars       => 1,
-                                  path              => ["$htdocs/$theme/$lang/includes"]);
-
-       # XXX temporary patch for Bug 182 for themelang
-       $template->param(themelang => '/intranet-tmpl' . "/$theme/$lang",
-                                                       interface => '/intranet-tmpl',
-                                                       theme => $theme,
-                                                       lang => $lang,
-                                                       intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
-               intranetstylesheet => C4::Context->preference("intranetstylesheet"),
-               IntranetNav => C4::Context->preference("IntranetNav"),
-               referer => $refer,
-                       );
-       return $template;
+    my ($tmplbase) = @_;
+
+    my $htdocs;
+    $htdocs = C4::Context->config('intrahtdocs');
+    my ( $theme, $lang ) = themelanguage( $htdocs, $tmplbase, "intranet" );
+    unless ( -e "$htdocs/$theme/$lang/$tmplbase" ) {
+        $tmplbase = "help/nohelp.tmpl";
+        ( $theme, $lang ) = themelanguage( $htdocs, $tmplbase, "intranet" );
+    }
+    my $template = HTML::Template->new(
+        filename          => "$htdocs/$theme/$lang/$tmplbase",
+        die_on_bad_params => 0,
+        global_vars       => 1,
+        path              => ["$htdocs/$theme/$lang/includes"]
+    );
+
+    # XXX temporary patch for Bug 182 for themelang
+    $template->param(
+        themelang => '/intranet-tmpl' . "/$theme/$lang",
+        interface => '/intranet-tmpl',
+        theme     => $theme,
+        lang      => $lang
+    );
+    return $template;
 }
index adbd4c7..144e7d5 100644 (file)
@@ -447,11 +447,11 @@ CREATE TABLE `biblioitems` (
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
 --
--- Table structure for table `virtualshelves`
+-- Table structure for table `bookshelf`
 --
 
-DROP TABLE IF EXISTS `virtualshelves`;
-CREATE TABLE `virtualshelves` (
+DROP TABLE IF EXISTS `bookshelf`;
+CREATE TABLE `bookshelf` (
   `shelfnumber` int(11) NOT NULL auto_increment,
   `shelfname` char(255) default NULL,
   `owner` char(80) default NULL,
@@ -1382,19 +1382,19 @@ CREATE TABLE sessions (
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
 --
--- Table structure for table `virtualshelfcontents`
+-- Table structure for table `shelfcontents`
 --
 
-DROP TABLE IF EXISTS `virtualshelfcontents`;
-CREATE TABLE `virtualshelfcontents` (
+DROP TABLE IF EXISTS `shelfcontents`;
+CREATE TABLE `shelfcontents` (
   `shelfnumber` int(11) NOT NULL default '0',
-  `biblionumber` int(11) NOT NULL default '0',
+  `itemnumber` int(11) NOT NULL default '0',
   `flags` int(11) default NULL,
   `dateadded` timestamp NULL default NULL,
   KEY `shelfnumber` (`shelfnumber`),
-  KEY `biblionumber` (`biblionumber`),
-  CONSTRAINT `virtualshelfcontents_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `virtualshelves` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
-  CONSTRAINT `shelfcontents_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
+  KEY `itemnumber` (`itemnumber`),
+  CONSTRAINT `shelfcontents_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `bookshelf` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
+  CONSTRAINT `shelfcontents_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
 --
index d0a53a5..ff06429 100644 (file)
@@ -5,7 +5,7 @@
 
 <div id="main">
 <div id="mainbloc">
-       <h1>About Koha</h1>
+       <h1>Data about the current version of Koha for bug reports (or general interest).</h1>
        
 <table>
        <caption>Server information</caption>
index 69c6c4b..b91d737 100644 (file)
 <p>
 <label>Password:<br />
 <input type="password" name="password" id="password" class="input" value="" size="20" tabindex="20" /></label>
-</p> 
-<p>
-<label for="branch">Library:</label>
-<select name="branch" id="branch" class="input">
-<!-- TMPL_LOOP NAME="branchloop" -->
-<option value="<!-- TMPL_VAR NAME='branchcode' -->"><!-- TMPL_VAR NAME='branchname' --></option>
-<!-- /TMPL_LOOP -->
-</select>
-</p>
+</p>    
 <p class="submit"><input type="submit" value="Login &raquo;" /></p>
 </form>
+
 <!-- /TMPL_IF -->
 
 <script type="text/javascript">
diff --git a/koha-tmpl/intranet-tmpl/prog/en/bookshelves/addbookbybiblionumber.tmpl b/koha-tmpl/intranet-tmpl/prog/en/bookshelves/addbookbybiblionumber.tmpl
new file mode 100644 (file)
index 0000000..a1c8936
--- /dev/null
@@ -0,0 +1,42 @@
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
+<title>Koha &rsaquo; Add to Virtual Shelf</title>
+<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+
+<h1>Add 
+    <i><!-- TMPL_VAR NAME="title" --></i>
+    <!-- TMPL_IF NAME="author" -->
+        by <!-- TMPL_VAR NAME="author" -->
+    <!-- /TMPL_IF --> to a virtual shelf
+</h1>
+
+<form name="f1" method="post" action="/cgi-bin/koha/bookshelves/addbookbybiblionumber.pl">
+    <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->">
+    
+    <b>Select an existing shelf</b>
+    <p>
+        <label>Add to virtual shelf</label><!-- TMPL_VAR NAME="CGIbookshelves" -->
+    </p>
+    <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
+    <input type="submit" value="Add to virtual shelf" class="submit" />
+</form>
+<p>...or...</p>
+<form name="f2" method="post" action="/cgi-bin/koha/bookshelves/addbookbybiblionumber.pl">
+    <b>Add to a new shelf:</b>
+        <p>
+            <label for="newbookshelf">
+                Shelf name:
+            </label>
+            <input type="text" name="newbookshelf" id="newbookshelf" size="40" />
+        </p>
+        <p>
+            <label for="category">Category:</label>
+            <select name="category" id="category">
+                <option value="1">Private</option>
+                <option value="2">Public</option>
+            </select>
+        </p>
+    <input type="submit" value="Add to virtual shelf" class="submit" /> 
+</form>
+
+</body>
+</html>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/bookshelves/shelves.tmpl b/koha-tmpl/intranet-tmpl/prog/en/bookshelves/shelves.tmpl
new file mode 100644 (file)
index 0000000..54b1d81
--- /dev/null
@@ -0,0 +1,247 @@
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
+<title>Koha &rsaquo; Add to Virtual Shelf</title>
+<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+
+<!-- TMPL_INCLUDE NAME="menus.inc" -->
+<!-- TMPL_INCLUDE NAME="menu-bookshelves.inc" -->
+
+<!-- TMPL_IF Name="viewshelf" -->
+
+<div id="action">
+    <a class="button" href="/cgi-bin/koha/bookshelves/shelves.pl">Back to virtual Shelves</a>
+    <!-- TMPL_IF name="manageshelf" -->
+    <a class="button" href="/cgi-bin/koha/bookshelves/shelves.pl?op=modif&shelf=<!-- TMPL_VAR Name="shelfnumber" -->">
+        Modify this shelf</a>
+    <!-- /TMPL_IF -->
+</div>
+
+<h3>Contents of <!-- TMPL_VAR Name="shelfname" --></h3>
+
+<form class="inline" action="/cgi-bin/koha/bookshelves/shelves.pl" method="post" name="mainform">
+    <!-- TMPL_IF NAME="itemsloop" -->
+    <table>
+        <input type="hidden" name="viewshelf" value="<!-- TMPL_VAR Name="shelfnumber" -->" />
+        <input type="hidden" name="modifyshelfcontents" value="1" />
+            <tr>
+                <th>
+                    <a href="javascript:CheckAll();">
+                        <small>(Un)Check All</small>
+                    </a>
+                </th>
+                <th>&nbsp;</th>
+                <th>Title</th>
+                <th>Author</th>
+                <th>Call No.</th>
+            </tr>
+        <!-- TMPL_LOOP Name="itemsloop" -->
+            <tr<!-- TMPL_IF name="color" --> class="highlight"<!-- /TMPL_IF -->>
+                    <td>
+                        <input type="checkbox" name="REM-<!-- TMPL_VAR Name="itemnumber" -->" />
+                    </td>
+                    <td>
+                        <img src="<!-- TMPL_VAR NAME="themelang" -->/images/<!-- TMPL_VAR NAME="itemtype" -->.gif" alt="<!-- TMPL_VAR NAME="itemtype" -->" title="<!-- TMPL_VAR NAME="itemtype" -->" />
+                    </td>
+                    <td>
+                <!-- TMPL_IF name="BiblioDefaultViewmarc" -->
+                            <a class="title" href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->">
+                                <!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="subtitle" -->
+                            </a>
+                        <!-- TMPL_ELSE -->
+                            <!-- TMPL_IF name="BiblioDefaultViewisbd" -->
+                                <a class="title" href="/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->">
+                                    <!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="subtitle" -->
+                                </a>
+                            <!-- TMPL_ELSE -->
+                                <a class="title" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->">
+                                    <!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="subtitle" -->
+                                </a>
+                            <!-- /TMPL_IF -->
+                        <!-- /TMPL_IF -->
+                    </td>
+                    <td><!-- TMPL_VAR Name="author" --></td>
+                    <td><!-- TMPL_VAR NAME="classification" --></td>
+        </tr>
+        <!-- /TMPL_LOOP -->
+    </table>
+    <!-- TMPL_ELSE -->
+    <br />
+    <b>This shelf is empty.</b>
+    <!-- TMPL_UNLESS NAME="itemsloop" -->
+        <input type="hidden" name="DEL-<!-- TMPL_VAR NAME="shelfnumber" -->" />
+        <input type="hidden" name="shelves" value="1" />
+        <input type="submit" class="icon delete"
+               value="Delete this shelf"
+               onclick="return confirmDelete('Are you sure you want to delete this shelf?')" />
+        <!-- /TMPL_UNLESS -->
+        <!-- /TMPL_IF -->
+    <!-- TMPL_IF name="manageshelf" -->
+        <!-- TMPL_IF NAME="itemsloop" -->
+            <b>With selected items :</b>
+            <input type="submit"
+                   value="Remove"
+                   class="icon delete"
+                   onclick="return confirmDelete('Are you sure you want to remove these items from the shelf?')"
+                   style="display:inline;"
+                   />
+        <!-- /TMPL_IF -->
+        <!-- /TMPL_IF -->
+</form>
+    <!-- TMPL_IF name="manageshelf" -->
+    
+<br />
+<form action="/cgi-bin/koha/bookshelves/shelves.pl" method="post">
+    <table>
+        <tr><th colspan="2">Add an item to this shelf by barcode</th></tr>
+        <tr>
+            <td>
+                <label for="addbarcode">Barcode:</label>
+            </td>
+            <td>
+                <input name="addbarcode" type="text" id="addbarcode" size="14" maxlength="14" />
+                <input type="hidden" name="viewshelf" value="<!-- TMPL_VAR Name="shelfnumber" -->" />
+                <input type="hidden" name="modifyshelfcontents" value="1" />
+                <input type="submit" value="Save" />
+            </td>
+        </tr>
+    </table>
+</form>
+<!-- /TMPL_IF -->
+<!-- TMPL_ELSE -->
+    <!-- TMPL_IF Name="shelves" -->
+        <!-- TMPL_IF Name="status1" -->
+            <p class="error"><!-- TMPL_VAR Name="string1" --></p>
+        <!-- /TMPL_IF -->
+        <!-- TMPL_LOOP Name="paramsloop" -->
+            <!-- TMPL_IF Name="status" -->
+                <p class="error"><!-- TMPL_VAR Name="string" --></p>
+            <!-- /TMPL_IF -->
+        <!-- /TMPL_LOOP -->
+    <form method="post" action="/cgi-bin/koha/bookshelves/shelves.pl">
+        <input type="hidden" name="shelves" value="1">
+        <h3>Create a new virtual shelf</h3>
+        <table>
+        <tr><th scope="row"><label for="addshelf">Shelf name:</label> </th><td> <input id="addshelf" type="text" name="addshelf" size="25"></td></tr>
+        <tr><th scope="row"><label for="owner">Owner:</label> </th><td><input type="hidden" name="owner" id="owner" value="<!-- TMPL_VAR name="loggedinuser" -->"><!-- TMPL_VAR name="loggedinusername" --></td></tr>
+        <tr><th scope="row"><label for="category">Category:</label> </th><td><select name="category" id="category">
+                                    <option value="1">Private</option>
+                                    <option value="2">Public</option>
+                                    </select></td></tr></table>
+        <ul>
+            <li>A <b>private</b> virtual shelf is managed by you and can be seen only by you.</li>
+            <li> A <b>public</b> virtual shelf can be seen by everybody, but managed only by you.</li>
+        </ul>
+                                <p><input type="submit" value="Add a new shelf"></p>
+                    </form>
+        
+        <!-- TMPL_IF NAME="numberCanManage" -->
+        <!-- TMPL_IF NAME="shelvesloop" -->
+        <form method="post" action="/cgi-bin/koha/bookshelves/shelves.pl" name="mainform">
+                    <input type="hidden" name="shelves" value="1" />
+                    <h3>Delete virtual shelves</h3>
+                    <table>
+                        <tr><th>&nbsp;</th><th>Shelf name</th><th>Contents</th></tr>
+                        <!-- TMPL_LOOP Name="shelvesloop" -->
+                        <!-- TMPL_IF name="canmanage" -->
+                        <tr>
+                            <td>
+                                <input type="checkbox" name="DEL-<!-- TMPL_VAR Name="shelf" -->" />
+                            </td>
+                            <td>
+                                <a href="/cgi-bin/koha/bookshelves/shelves.pl?viewshelf=<!-- TMPL_VAR Name="shelf" -->"><!-- TMPL_VAR Name="shelfname" --></a>
+                            </td>
+                            <td>
+                                <!-- TMPL_VAR Name="shelfbookcount" --> item(s)
+                            </td>
+                        </tr>
+                        <!-- /TMPL_IF -->
+                        <!-- /TMPL_LOOP -->
+                    </table>
+        <input type="submit" value="Delete shelves" /></form>
+        <!-- /TMPL_IF -->
+        <!-- /TMPL_IF -->
+        <br />
+        <p><form class="inline" action="/cgi-bin/koha/bookshelves/shelves.pl" method="get"><input type="submit" value="Back to virtual shelves" /></form></p>
+
+    <!-- TMPL_ELSE -->
+    <!-- TMPL_IF name="edit" -->
+        <form method="post">
+            <input type="hidden" name="op" value="modifsave">
+            <input type="hidden" name="shelfnumber" value="<!-- TMPL_VAR name="shelfnumber" -->">
+<h3>Modify virtual shelf <!-- TMPL_VAR name="shelfname"--></h3>
+            <table>
+            <tr><td><label for="shelfname">Shelf name: </label></td><td><input type="text" id="shelfname" name="shelfname" size="25" value="<!-- TMPL_VAR name="shelfname"-->" /></td></tr>
+            <tr><td><label for="owner">Owner: </label></td><td><input type="hidden" id="owner" name="owner" value="<!-- TMPL_VAR NAME="loggedinuser" -->"><!-- TMPL_VAR NAME="loggedinusername" --></td></tr>
+            <tr><td><label for="category">Category: </label></td><td><select id="category" name="category">
+                    <!-- TMPL_IF name="category1" -->
+                        <option value="1" selected>Private</option>
+                    <!-- TMPL_ELSE -->
+                        <option value="1">Private</option>
+                    <!-- /TMPL_IF -->
+                    <!-- TMPL_IF name="category2" -->
+                        <option value="2" selected>Public</option>
+                    <!-- TMPL_ELSE -->
+                        <option value="2">Public</option>
+                    <!-- /TMPL_IF -->
+                </select></td></tr>
+            </table>
+            <ul><li>A <strong>private</strong> virtual shelf is managed by you and can be seen <strong>only</strong> by you.</li>
+                <li> A <strong>public</strong> virtual shelf can be seen by <strong>everybody</strong>, but managed only by you.</li>
+            </ul>
+            <p><input type="submit" value="Save changes"></p>
+
+        </form>
+<!-- /TMPL_IF -->
+<h3>Virtual shelves</h3>
+
+<table>
+<tr><th>Shelf name</th><th>Category</th><th>Content size</th><th>&nbsp;</th></tr>
+<!-- TMPL_LOOP Name="shelvesloop" -->
+<tr<!-- TMPL_IF name="color" --> class="highlight"<!-- /TMPL_IF -->><td><a href="/cgi-bin/koha/bookshelves/shelves.pl?viewshelf=<!-- TMPL_VAR Name="shelf" -->"><!-- TMPL_VAR Name="shelfname" --></a></td><td><!-- TMPL_IF NAME="category1" -->Private<!-- /TMPL_IF --><!-- TMPL_IF NAME="category2" -->Public<!-- /TMPL_IF --><!-- TMPL_IF NAME="category3" -->Free<!-- /TMPL_IF --></td><td><!-- TMPL_VAR Name="shelfbookcount" --> item(s)</td><td><!-- TMPL_IF name="mine" --><a href="/cgi-bin/koha/bookshelves/shelves.pl?op=modif&amp;shelf=<!-- TMPL_VAR NAME="shelf" -->">Modify</a><!-- TMPL_ELSE -->&nbsp;<!-- /TMPL_IF --></td></tr>
+            <!-- /TMPL_LOOP -->
+        </table>
+        <p><form action="/cgi-bin/koha/bookshelves/shelves.pl" method="get"><input type="hidden" value="1" name="shelves" /><input type="submit" value="Add or remove virtual shelves" /></form></p>
+    <!-- /TMPL_IF -->
+<!-- /TMPL_IF -->
+
+<br clear="both" />
+
+<script type="text/javascript">
+       function confirmDelete(s){
+               if (window.confirm(s))
+                       return true;
+               return false;
+       }
+       /**
+        * this function checks all checkbox 
+        * or uncheck all if there are already checked.
+        */
+       function CheckAll(){
+               var checkboxes = document.getElementsByTagName('input');
+               var nbCheckbox = checkboxes.length;
+               var check = areAllChecked();
+               check = !check;
+               for(var i=0;i<nbCheckbox;i++){
+                       if(checkboxes[i].getAttribute('type') == "checkbox" ){
+                               checkboxes[i].checked = check;
+                       }
+               }
+       }
+       /**
+        * this function return true if all checkbox are checked
+        */
+       function areAllChecked(){
+               var checkboxes = document.getElementsByTagName('input');
+               var nbCheckbox = checkboxes.length;
+               for(var i=0;i<nbCheckbox;i++){
+                       if(checkboxes[i].getAttribute('type') == "checkbox" ){
+                               if(checkboxes[i].checked == 0){
+                                       return false;
+                               }
+                       }
+               }
+               return true;
+       }
+       
+</script>
+
+<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
index 4ce7246..28b019f 100644 (file)
 
 <li><b>printcirculationslips --</b> if set to 1, circulation "slips" are printed on your receipt printer. If set to 0, no slips are printed.</li>
 
-<li><b>suggestion --</b> If set to 1, the Suggestions feature is activated in the OPAC. This feature allows OPAC users to suggest purchases. When a suggestion is made in the OPAC, it is assigned the status "ASKED." A librarian then manages the suggestion and can set the status to "REJECTED" or "ORDERED." When an itme is ordered and has arrived in the library, the status becomes "AVAILABLE." Suggestions that are not yet "AVAILABLE" are visible to all users of the OPAC.</li>
+<li><b>suggestion --</b> If set to 1, the Suggestions feature is activated in the OPAC. This feature allows OPAC users to suggest book purchases. When a suggestion is made in the OPAC, it is assigned the status "ASKED." A librarian then manages the suggestion and can set the status to "REJECTED" or "ORDERED." When a book is ordered and has arrived in the library, the status becomes "AVAILABLE." Suggestions that are not yet "AVAILABLE" are visible to all users of the OPAC.</li>
 
 <li><b>template --</b> Preference order for screen templates. Koha comes with several different options for templates that control the look and feel of your Koha screens, and you can also write your own templates.</li>
 
 <li><b>timeout --</b> Inactivity timeout period (in seconds). If a workstation is idle for longer than this period, the user will have to login again.</li>
 
-<li><b>virtualshelves --</b> Set virtual shelves management on or off ("1" or "0"). Users can set up and manage their own "virtual shelves" of favorite library items if this feature is turned on.</li></ul>
+<li><b>virtualshelves --</b> Set virtual shelves management on or off ("1" or "0"). Users can set up and manage their own "virtual bookshelves" of favorite library items if this feature is turned on.</li></ul>
 <!-- TMPL_INCLUDE name="intranet-bottom.inc" -->
index 055e813..38e250d 100644 (file)
@@ -1,13 +1,8 @@
-<!-- TMPL_INCLUDE NAME="help-top.inc" -->
-
-       <div id="main-compact">
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
+<title>Online Help &rsaquo; No Help For This Topic!</title>
+<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+       
        <h1>Online Help</h1>
        <p>Sorry, there is no help available for this topic</p>
-<form action="/cgi-bin/koha/edithelp.pl" method="post">
-<input type="hidden" name="referer" value="<!-- TMPL_VAR NAME="referer" -->">
-<input type="hidden" name="type" value="addnew">
-<input type="submit" name="submit" value="Add help">
-</form>
        </div>
-       
-<!-- TMPL_INCLUDE NAME="help-bottom.inc" -->
+<!-- TMPL_INCLUDE name="intranet-bottom.inc" -->
index 3e4a263..33791aa 100644 (file)
@@ -28,7 +28,7 @@
             </div>
             
             <div class="others">
-                <a href="#" onclick="JavaScript:window.open('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->','Add_to_virtualshelf','width=500,height=400,toolbar=false,scrollbars=yes'); return false;">
+                <a href="#" onclick="JavaScript:window.open('/cgi-bin/koha/bookshelves/addbookbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->','Add_to_bookshelf','width=500,height=400,toolbar=false,scrollbars=yes'); return false;">
                     Add to shelf
                 </a>
                 <a href="/cgi-bin/koha/catalogue/detailprint.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">
index 2b03bbf..687031e 100644 (file)
@@ -54,7 +54,7 @@ a.catalogue:hover {
 <div id="submenu">
        <span class="koha">options &gt;&gt;&nbsp;&nbsp;</span>
        <a href="/cgi-bin/koha/catalogue/search.pl" class="submenu2">search</a>
-       <a href="/cgi-bin/koha/virtualshelves/shelves.pl" class="submenu">Virtual shelves</a>
+       <a href="/cgi-bin/koha/bookshelves/shelves.pl" class="submenu">Virtual shelves</a>
        <a href="/cgi-bin/koha/cataloguing/addbiblio.pl" class="submenu2">Add biblio</a>
        <a href="/cgi-bin/koha/maint/catmaintain.pl" class="submenu">Cat maintenance</a>
 </div>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/menu-bookshelves.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/menu-bookshelves.inc
new file mode 100644 (file)
index 0000000..baa9fef
--- /dev/null
@@ -0,0 +1,5 @@
+<div id="submenu">
+        <a href="/cgi-bin/koha/bookshelves/shelves.pl">Shelves</a>
+</div>
+
+<div id="main">
\ No newline at end of file
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/menu-virtualshelves.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/menu-virtualshelves.inc
deleted file mode 100644 (file)
index a2cfd1e..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<div id="submenu">
-        <a href="/cgi-bin/koha/virtualshelves/shelves.pl">Virtual Shelves</a>
-</div>
-
-<div id="main">
index d507c4a..344b8b5 100644 (file)
@@ -48,7 +48,7 @@
                         <input type="submit" value=" OK " class="submit" />
                         </form>
                      </li>
-                    <li><a href="/cgi-bin/koha/virtualshelves/shelves.pl">Virtual Shelves</a></li>
+                    <li><a href="/cgi-bin/koha/bookshelves/shelves.pl">Virtual Shelves</a></li>
                 </ul>
                 <!-- /TMPL_IF -->
     <!-- TMPL_IF NAME="CAN_user_editcatalogue" -->
index 6a17f0f..af7a989 100644 (file)
@@ -38,7 +38,7 @@
         </p>
         
         <p>
-            <label for="branch">Library</label>
+            <label for="branch">Branch</label>
             <select id="branch" name="branch">
             <option value="">-- All --</option>
                 <!-- TMPL_LOOP name="branchloop" -->
@@ -69,7 +69,7 @@
         <p>
         <label for="dont_export_fields">Don't export fields</label>
         <input id="dont_export_fields" type="text" name="dont_export_fields" />
-        <i>seperate by a blank. (e.g.: 100a 200 606)</i>
+        <i>splitted by a blank. (for example: 100a 200 606)</i>
         </p>
     </fieldset>
     <fieldset>
@@ -84,9 +84,6 @@
             </select>
             format.
         </p>
-        <p>
-        <label for="filename">Filename:</label><input id="filename" tyle=text" name="filename" value="koha.mrc" />
-        </p>
     </fieldset>
     <input type="hidden" name="op" value="export" />
     <input type="submit" value="Export" class="button" />
diff --git a/koha-tmpl/intranet-tmpl/prog/en/virtualshelves/addbybiblionumber.tmpl b/koha-tmpl/intranet-tmpl/prog/en/virtualshelves/addbybiblionumber.tmpl
deleted file mode 100644 (file)
index bc71214..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
-<title>Koha &rsaquo; Add to Virtual Shelf</title>
-<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-
-<h1>Add 
-    <i><!-- TMPL_VAR NAME="title" --></i>
-    <!-- TMPL_IF NAME="author" -->
-        by <!-- TMPL_VAR NAME="author" -->
-    <!-- /TMPL_IF --> to a virtual shelf
-</h1>
-
-<form name="f1" method="POST" action="/cgi-bin/koha/virtualshelves/addbybiblionumber.pl">
-    <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->">
-    
-    <b>Select an existing shelf</b>
-    <p>
-        <label>Add to virtual shelf</label><!-- TMPL_VAR NAME="CGIvirtualshelves" -->
-    </p>
-    <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
-    <input type="submit" value="Add to virtual shelf" class="submit" />
-</form>
-<p>...or...</p>
-<form name="f2" method="POST" action="/cgi-bin/koha/virtualshelves/addbybiblionumber.pl">
-    <b>Add to a new shelf:</b>
-        <p>
-            <label for="newvirtualshelf">
-                Shelf name:
-            </label>
-                       <input type="hidden" name="biblionumber" id="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->"/>
-            <input type="text" name="newvirtualshelf" id="newvirtualshelf" size="40" />
-        </p>
-        <p>
-            <label for="category">Category:</label>
-            <select name="category" id="category">
-                <option value="1">Private</option>
-                <option value="2">Public</option>
-                               <option value="3">Free</option>
-            </select>
-        </p>
-    <input type="submit" value="Add to virtual shelf" class="submit" /> 
-</form>
-
-</body>
-</html>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/virtualshelves/shelves.tmpl b/koha-tmpl/intranet-tmpl/prog/en/virtualshelves/shelves.tmpl
deleted file mode 100644 (file)
index da30f5b..0000000
+++ /dev/null
@@ -1,264 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
-<title>Koha &rsaquo; Virtual Shelves</title>
-<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-
-<!-- TMPL_INCLUDE NAME="menus.inc" -->
-<!-- TMPL_INCLUDE NAME="menu-virtualshelves.inc" -->
-
-<!-- TMPL_IF NAME="viewshelf" -->
-<div id="action">
-    <a class="button" href="/cgi-bin/koha/virtualshelves/shelves.pl">Back to virtual Shelves</a>
-    <!-- TMPL_IF name="manageshelf" -->
-    <a class="button" href="/cgi-bin/koha/virtualshelves/shelves.pl?op=modif&shelf=<!-- TMPL_VAR NAME="shelfnumber" -->">
-        Edit this shelf</a>
-    <!-- /TMPL_IF -->
-</div>
-
-<h3>Contents of <!-- TMPL_VAR NAME="shelfname" --></h3>
-
-<form class="inline" action="/cgi-bin/koha/virtualshelves/shelves.pl" method="post" name="mainform">
-    <!-- TMPL_IF NAME="itemsloop" -->
-    <table>
-        <input type="hidden" name="viewshelf" value="<!-- TMPL_VAR NAME="shelfnumber" -->" />
-        <input type="hidden" name="modifyshelfcontents" value="1" />
-            <tr>
-                <th>
-                    <a href="javascript:CheckAll();">
-                        <small>(Un)Check All</small>
-                    </a>
-                </th>
-                <th>&nbsp;</th>
-                <th>Title</th>
-                <th>Author</th>
-                <th>Call No.</th>
-            </tr>
-        <!-- TMPL_LOOP NAME="itemsloop" -->
-            <tr<!-- TMPL_IF name="color" --> class="highlight"<!-- /TMPL_IF -->>
-                    <td>
-                        <input type="checkbox" name="REM-<!-- TMPL_VAR NAME="biblionumber" -->" />
-                    </td>
-                    <td>
-                        <img src="<!-- TMPL_VAR NAME="themelang" -->/images/<!-- TMPL_VAR NAME="itemtype" -->.gif" alt="<!-- TMPL_VAR NAME="itemtype" -->" title="<!-- TMPL_VAR NAME="itemtype" -->" />
-                    </td>
-                    <td>
-                <!-- TMPL_IF name="BiblioDefaultViewmarc" -->
-                            <a class="title" href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->">
-                                <!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="subtitle" -->
-                            </a>
-                        <!-- TMPL_ELSE -->
-                            <!-- TMPL_IF name="BiblioDefaultViewisbd" -->
-                                <a class="title" href="/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->">
-                                    <!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="subtitle" -->
-                                </a>
-                            <!-- TMPL_ELSE -->
-                                <a class="title" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->">
-                                    <!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="subtitle" -->
-                                </a>
-                            <!-- /TMPL_IF -->
-                        <!-- /TMPL_IF -->
-                    </td>
-                    <td><!-- TMPL_VAR NAME="author" --></td>
-                    <td><!-- TMPL_VAR NAME="classification" --></td>
-        </tr>
-        <!-- /TMPL_LOOP -->
-    </table>
-    <!-- TMPL_ELSE -->
-    <br />
-    <b>This shelf is empty.</b>
-    <!-- TMPL_UNLESS NAME="itemsloop" -->
-        <input type="hidden" name="DEL-<!-- TMPL_VAR NAME="shelfnumber" -->" />
-        <input type="hidden" name="shelves" value="1" />
-        <input type="submit" class="icon delete"
-               value="Delete this shelf"
-               onclick="return confirmDelete('Are you sure you want to delete this shelf?')" />
-        <!-- /TMPL_UNLESS -->
-        <!-- /TMPL_IF -->
-    <!-- TMPL_IF name="manageshelf" -->
-        <!-- TMPL_IF NAME="itemsloop" -->
-            <b>With selected items :</b>
-            <input type="submit"
-                   value="Remove"
-                   class="icon delete"
-                   onclick="return confirmDelete('Are you sure you want to remove these items from the shelf?')"
-                   style="display:inline;"
-                   />
-        <!-- /TMPL_IF -->
-        <!-- /TMPL_IF -->
-</form>
-    <!-- TMPL_IF name="manageshelf" -->
-    
-<br />
-<form action="/cgi-bin/koha/virtualshelves/shelves.pl" method="post">
-    <table>
-        <tr><th colspan="2">Add an item to this shelf by barcode</th></tr>
-        <tr>
-            <td>
-                <label for="addbarcode">Barcode:</label>
-            </td>
-            <td>
-                <input name="addbarcode" type="text" id="addbarcode" size="14" maxlength="14" />
-                <input type="hidden" name="viewshelf" value="<!-- TMPL_VAR NAME="shelfnumber" -->" />
-                <input type="hidden" name="modifyshelfcontents" value="1" />
-                <input type="submit" value="Save" />
-            </td>
-        </tr>
-    </table>
-</form>
-<!-- /TMPL_IF -->
-<!-- TMPL_ELSE -->
-    <!-- TMPL_IF NAME="shelves" -->
-        <!-- TMPL_IF NAME="status1" -->
-            <p class="error"><!-- TMPL_VAR NAME="string1" --></p>
-        <!-- /TMPL_IF -->
-        <!-- TMPL_LOOP NAME="paramsloop" -->
-            <!-- TMPL_IF NAME="status" -->
-                <p class="error"><!-- TMPL_VAR NAME="string" --></p>
-            <!-- /TMPL_IF -->
-        <!-- /TMPL_LOOP -->
-    <form method="post" action="/cgi-bin/koha/virtualshelves/shelves.pl">
-        <input type="hidden" name="shelves" value="1">
-        <h3>Create a new virtual shelf</h3>
-        <table>
-        <tr><th scope="row"><label for="addshelf">Shelf name:</label> </th><td> <input id="addshelf" type="text" name="addshelf" size="25"></td></tr>
-        <tr><th scope="row"><label for="owner">Owner:</label> </th><td><input type="hidden" name="owner" id="owner" value="<!-- TMPL_VAR name="loggedinuser" -->"><!-- TMPL_VAR name="loggedinusername" --></td></tr>
-        <tr><th scope="row"><label for="category">Category:</label> </th><td><select name="category" id="category">
-                                    <option value="1">Private</option>
-                                    <option value="2">Public</option>
-                                                                       <option value="3">Free</option>
-                                    </select></td></tr></table>
-        <ul>
-            <li>A <b>private</b> virtual shelf is managed by you and can be seen only by you.</li>
-            <li> A <b>public</b> virtual shelf can be seen by everybody, but managed only by you.</li>
-                       <li> An <b>open</b> virtual shelf can be seen and managed by everybody.</li>
-        </ul>
-                                <p><input type="submit" value="Add a new shelf"></p>
-                    </form>
-        
-        <!-- TMPL_IF NAME="numberCanManage" -->
-        <!-- TMPL_IF NAME="shelvesloop" -->
-        <form method="post" action="/cgi-bin/koha/virtualshelves/shelves.pl" name="mainform">
-                    <input type="hidden" name="shelves" value="1" />
-                    <h3>Delete virtual shelves</h3>
-                    <table>
-                        <tr><th>&nbsp;</th><th>Shelf name</th><th>Contents</th></tr>
-                        <!-- TMPL_LOOP NAME="shelvesloop" -->
-                        <!-- TMPL_IF name="canmanage" -->
-                        <tr>
-                            <td>
-                                <input type="checkbox" name="DEL-<!-- TMPL_VAR NAME="shelf" -->" />
-                            </td>
-                            <td>
-                                <a href="/cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=<!-- TMPL_VAR NAME="shelf" -->"><!-- TMPL_VAR NAME="shelfname" --></a>
-                            </td>
-                            <td>
-                                <!-- TMPL_VAR NAME="shelfvirtualcount" --> item(s)
-                            </td>
-                        </tr>
-                        <!-- /TMPL_IF -->
-                        <!-- /TMPL_LOOP -->
-                    </table>
-        <input type="submit" value="Delete shelves" /></form>
-        <!-- /TMPL_IF -->
-        <!-- /TMPL_IF -->
-        <br />
-        <p><form class="inline" action="/cgi-bin/koha/virtualshelves/shelves.pl" method="get"><input type="submit" value="Back to virtual shelves" /></form></p>
-
-    <!-- TMPL_ELSE -->
-    <!-- TMPL_IF name="edit" -->
-        <form method="post">
-            <input type="hidden" name="op" value="modifsave">
-            <input type="hidden" name="shelfnumber" value="<!-- TMPL_VAR name="shelfnumber" -->">
-<h3>Edit virtual shelf '<!-- TMPL_VAR name="shelfname"-->'</h3>
-            <table>
-            <tr><td><label for="shelfname">Shelf name: </label></td><td><input type="text" id="shelfname" name="shelfname" size="25" value="<!-- TMPL_VAR name="shelfname"-->" /></td></tr>
-            <tr><td><label for="owner">Owner: </label></td><td><input type="hidden" id="owner" name="owner" value="<!-- TMPL_VAR NAME="loggedinuser" -->"><!-- TMPL_VAR NAME="loggedinusername" --></td></tr>
-            <tr><td><label for="category">Category: </label></td><td><select id="category" name="category">
-                    <!-- TMPL_IF name="category1" -->
-                        <option value="1" selected>Private</option>
-                    <!-- TMPL_ELSE -->
-                        <option value="1">Private</option>
-                    <!-- /TMPL_IF -->
-                    <!-- TMPL_IF name="category2" -->
-                        <option value="2" selected>Public</option>
-                    <!-- TMPL_ELSE -->
-                        <option value="2">Public</option>
-                                       <!-- TMPL_IF NAME="category3" -->
-                                               <option value="3" selected>Free</option>
-                                       <!-- TMPL_ELSE -->
-                                               <option value="3">Free</option>
-                    <!-- /TMPL_IF -->
-                </select></td></tr>
-            </table>
-            <ul><li>A <strong>private</strong> virtual shelf is managed by you and can be seen <strong>only</strong> by you.</li>
-                <li> A <strong>public</strong> virtual shelf can be seen by <strong>everybody</strong>, but managed only by you.</li>
-                                <li> A <b>free</b> virtual shelf can be seen and managed by everybody.</li>
-            </ul>
-            <p><input type="submit" value="Save changes"></p>
-
-        </form>
-<!-- /TMPL_IF -->
-<!-- /TMPL_IF -->
-<h3>Virtual shelves</h3>
-
-<table>
-<tr><th>Shelf name</th><th>Category</th><th>Items</th><th>&nbsp;</th></tr>
-
-<!-- TMPL_LOOP NAME="shelvesloop" -->
-<tr<!-- TMPL_IF name="color" --> class="highlight"<!-- /TMPL_IF -->>
-<td><a href="/cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=<!-- TMPL_VAR NAME="shelf" -->"><!-- TMPL_VAR NAME="shelfname" --></a></td>
-<td>
-<!-- TMPL_IF NAME="viewcategory1" -->Private<!-- /TMPL_IF -->
-<!-- TMPL_IF NAME="viewcategory2" -->Public<!-- /TMPL_IF -->
-<!-- TMPL_IF NAME="viewcategory3" -->Free<!-- /TMPL_IF -->
-</td>
-<td><!-- TMPL_VAR NAME="shelfvirtualcount" --> </td>
-<td><!-- TMPL_IF name="mine" --><a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=modif&amp;shelf=<!-- TMPL_VAR NAME="shelf" -->">Edit</a><!-- TMPL_ELSE -->&nbsp;<!-- /TMPL_IF --></td></tr>
-
-<!-- /TMPL_LOOP -->
-</table>
-        <p><form action="/cgi-bin/koha/virtualshelves/shelves.pl" method="get"><input type="hidden" value="1" name="shelves" /><input type="submit" value="Add or remove virtual shelves" /></form></p>
-    <!-- /TMPL_IF -->
-
-
-<br clear="both" />
-
-<script type="text/javascript">
-       function confirmDelete(s){
-               if (window.confirm(s))
-                       return true;
-               return false;
-       }
-       /**
-        * this function checks all checkbox 
-        * or uncheck all if there are already checked.
-        */
-       function CheckAll(){
-               var checkboxes = document.getElementsByTagName('input');
-               var nbCheckbox = checkboxes.length;
-               var check = areAllChecked();
-               check = !check;
-               for(var i=0;i<nbCheckbox;i++){
-                       if(checkboxes[i].getAttribute('type') == "checkbox" ){
-                               checkboxes[i].checked = check;
-                       }
-               }
-       }
-       /**
-        * this function return true if all checkbox are checked
-        */
-       function areAllChecked(){
-               var checkboxes = document.getElementsByTagName('input');
-               var nbCheckbox = checkboxes.length;
-               for(var i=0;i<nbCheckbox;i++){
-                       if(checkboxes[i].getAttribute('type') == "checkbox" ){
-                               if(checkboxes[i].checked == 0){
-                                       return false;
-                               }
-                       }
-               }
-               return true;
-       }
-       
-</script>
-
-<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
index f889bdd..ece26ec 100644 (file)
@@ -161,7 +161,7 @@ function addMultiple(){
 
 function addSelToShelf() {
     var items = document.getElementById('records').value;
-    document.location = "/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber="+items;
+    document.location = "/cgi-bin/koha/opac-addbookbybiblionumber.pl?biblionumber="+items;
 }
 
 function addSelRecords(valSel) { // function for adding a selection of biblios to the basket
index 1be9aec..433bb78 100644 (file)
@@ -24,7 +24,7 @@
         </a>
 <!-- TMPL_IF name="virtualshelves" -->
     <!-- TMPL_IF NAME="loggedinusername" -->
-        <a href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" onclick="Dopop('opac-addbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->'); return false;">
+        <a href="/cgi-bin/koha/opac-addbookbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" onclick="Dopop('opac-addbookbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->'); return false;">
             Add to My Book List
         </a>
     <!-- /TMPL_IF -->
index c9eaf51..890c1cc 100644 (file)
@@ -24,7 +24,7 @@
         </a>
 <!-- TMPL_IF name="virtualshelves" -->
     <!-- TMPL_IF NAME="loggedinusername" -->
-        <a href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" onclick="Dopop('opac-addbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->'); return false;">
+        <a href="/cgi-bin/koha/opac-addbookbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" onclick="Dopop('opac-addbookbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->'); return false;">
             Add to My Book List
         </a>
     <!-- /TMPL_IF -->
diff --git a/koha-tmpl/opac-tmpl/prog/en/opac-addbookbybiblionumber.tmpl b/koha-tmpl/opac-tmpl/prog/en/opac-addbookbybiblionumber.tmpl
new file mode 100644 (file)
index 0000000..4642fea
--- /dev/null
@@ -0,0 +1,62 @@
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
+<!-- TMPL_VAR NAME="LibraryNameTitle" --> Catalog -- Add to My Book List
+<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+
+
+<!-- TMPL_IF NAME="multiple"-->
+    <h1>Add these <!-- TMPL_VAR NAME="total"--> biblios to a shelf</h1>
+        <!-- TMPL_LOOP NAME="biblios"-->
+            <b><!-- TMPL_VAR NAME="title"--></b> 
+            <!-- TMPL_IF NAME="author"-->by <!-- TMPL_VAR NAME="author"--><!-- /TMPL_IF -->
+            <br /><br />
+        <!-- /TMPL_LOOP -->
+<!-- TMPL_ELSE -->
+<h1>Add 
+    <i><!-- TMPL_VAR NAME="title" --></i>
+    <!-- TMPL_IF NAME="author" -->
+        by <!-- TMPL_VAR NAME="author" -->
+    <!-- /TMPL_IF --> to a Virtual Shelf
+</h1>
+<!-- /TMPL_IF -->
+
+<!-- TMPL_IF NAME="CGIbookshelves"-->
+<form name="f1" action="/cgi-bin/koha/opac-addbookbybiblionumber.pl" method="post">
+    <p><b>Select an Existing Bookshelf</b></p>
+    <label>Add to virtual shelf</label> <!-- TMPL_VAR NAME="CGIbookshelves" -->
+    <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
+    <input type="hidden" name="modifyshelfcontents" value="1" />
+    <input type="submit" value="Add to virtual shelf" class="submit" />
+</form>
+<p>...or...</p>
+<!-- /TMPL_IF -->
+
+<form name="f2" method="post" action="/cgi-bin/koha/opac-addbookbybiblionumber.pl">
+    <b>Add to a New Bookshelf:</b>
+        <p>
+            <label for="newbookshelf">
+                Shelf Name:
+            </label>
+            <input type="text" name="newbookshelf" id="newbookshelf" size="40" />
+        </p>
+            <label for="category">Category:</label>
+            <select name="category" id="category">
+                <option value="1">Private</option>
+                <option value="2">Public</option>
+            </select>
+    <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
+    <input type="submit" value="Add to virtual shelf" class="submit" /> 
+</form>
+
+<p align="center">
+    <br /><br />
+    <a href="javascript:closePopup();">close this window.</a>
+</p>
+
+<script type="text/javascript" language="javascript">
+    function closePopup () {
+        window.close();
+    }
+</script>
+
+</body>
+</html>
diff --git a/koha-tmpl/opac-tmpl/prog/en/opac-addbybiblionumber.tmpl b/koha-tmpl/opac-tmpl/prog/en/opac-addbybiblionumber.tmpl
deleted file mode 100644 (file)
index 62c38c5..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
-<!-- TMPL_VAR NAME="LibraryNameTitle" --> Catalog -- Add to My Virtual Shelf
-<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-
-
-<!-- TMPL_IF NAME="multiple"-->
-    <h1>Add these <!-- TMPL_VAR NAME="total"--> biblios to a shelf</h1>
-        <!-- TMPL_LOOP NAME="biblios"-->
-            <b><!-- TMPL_VAR NAME="title"--></b> 
-            <!-- TMPL_IF NAME="author"-->by <!-- TMPL_VAR NAME="author"--><!-- /TMPL_IF -->
-            <br /><br />
-        <!-- /TMPL_LOOP -->
-<!-- TMPL_ELSE -->
-<h1>Add 
-    <i><!-- TMPL_VAR NAME="title" --></i>
-    <!-- TMPL_IF NAME="author" -->
-        by <!-- TMPL_VAR NAME="author" -->
-    <!-- /TMPL_IF --> to a Virtual Shelf
-</h1>
-<!-- /TMPL_IF -->
-
-<!-- TMPL_IF NAME="CGIvirtualshelves"-->
-<form name="f1" action="/cgi-bin/koha/opac-addbybiblionumber.pl" method="POST">
-    <p><b>Select an Existing Virtualshelf</b></p>
-    <label>Add to virtual shelf</label> <!-- TMPL_VAR NAME="CGIvirtualshelves" -->
-    <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
-    <input type="hidden" name="modifyshelfcontents" value="1" />
-    <input type="submit" value="Add to virtual shelf" class="submit" />
-</form>
-<p>...or...</p>
-<!-- /TMPL_IF -->
-
-<form name="f2" method="POST" action="/cgi-bin/koha/opac-addbybiblionumber.pl">
-    <b>Add to a New Virtualshelf:</b>
-        <p>
-            <label for="newvirtualshelf">
-                Shelf Name:
-            </label>
-            <input type="text" name="newvirtualshelf" id="newvirtualshelf" size="40" />
-        </p>
-            <label for="category">Category:</label>
-            <select name="category" id="category">
-                <option value="1">Private</option>
-                <option value="2">Public</option>
-            </select>
-    <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
-    <input type="submit" value="Add to virtual shelf" class="submit" /> 
-</form>
-
-<p align="center">
-    <br /><br />
-    <a href="javascript:closePopup();">close this window.</a>
-</p>
-
-<script type="text/javascript" language="javascript">
-    function closePopup () {
-        window.close();
-    }
-</script>
-
-</body>
-</html>
index f0aa599..8cadcf7 100644 (file)
@@ -24,7 +24,7 @@
         </a>
 <!-- TMPL_IF name="virtualshelves" -->
     <!-- TMPL_IF NAME="loggedinusername" -->
-        <a href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" onclick="Dopop('opac-addbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->'); return false;">
+        <a href="/cgi-bin/koha/opac-addbookbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" onclick="Dopop('opac-addbookbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->'); return false;">
             Add to My Book List
         </a>
     <!-- /TMPL_IF -->
index 33fc706..a061554 100644 (file)
 <h3><a href="/cgi-bin/koha/opac-shelves.pl">Virtual Shelves</a> <img src="<!-- TMPL_VAR NAME="themelang" -->/images/caret.gif" width="16" height="16" alt="&gt;" border="0" /> <!-- TMPL_IF NAME="itemsloop" --><em><!-- TMPL_VAR Name="shelfname" --></em><!-- TMPL_ELSE -->The Virtual Shelf <em><!-- TMPL_VAR Name="shelfname" --></em> is empty<!-- /TMPL_IF --></h3>
 <form class="inline" action="/cgi-bin/koha/opac-shelves.pl" method="post" name="myform">
     <table>
-        <input type="hidden" name="viewshelf" value="<!-- TMPL_VAR Name="shelfnumber" -->" />
-        <input type="hidden" name="modifyshelfcontents" value="1" />
-            <tr>
-                <th>
-                    <a style="color:white;" href="/cgi-bin/koha/opac-shelves.pl" onclick="CheckAll(); return false;">Check All</a>
-                </th>
-                <th>&nbsp;</th>
-                <th>Title</th>
-                <th>Author</th>
-                <th>Call No.</th>
-            </tr>
-        <!-- TMPL_LOOP Name="itemsloop" -->
-            <tr<!-- TMPL_IF name="color" --> class="highlight"<!-- /TMPL_IF -->>
-                    <td>
-                        <input type="checkbox" name="MOD-<!-- TMPL_VAR Name="biblionumber" -->" />
-                        <input type="hidden" name="ModBiblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->">
-                    </td>
-                    <td>
-                        <img src="<!-- TMPL_VAR NAME="themelang" -->/images/<!-- TMPL_VAR NAME="itemtype" -->.gif" alt="<!-- TMPL_VAR NAME="itemtype" -->" title="<!-- TMPL_VAR NAME="itemtype" -->" />
-                    </td>
-                    <td>
-                         <!-- TMPL_IF name="BiblioDefaultViewmarc" -->
-                                        <a class="title" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->">
-                                            <!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="subtitle" -->
-                                        </a>
-                                    <!-- TMPL_ELSE -->
-                                        <!-- TMPL_IF name="BiblioDefaultViewisbd" -->
-                                            <a class="title" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->">
-                                                <!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="subtitle" -->
-                                            </a>
-                                        <!-- TMPL_ELSE -->
-                                            <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->">
-                                                <!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="subtitle" -->
-                                            </a>
-                                        <!-- /TMPL_IF -->
-                                    <!-- /TMPL_IF -->
-                        </a>
-                    </td>
-                    <td><!-- TMPL_VAR Name="author" --></td>
-                    <td><!-- TMPL_VAR NAME="classification" --></td>
-        </tr>
-        <!-- /TMPL_LOOP -->
-    </table>
+        <!-- TMPL_IF name="manageshelf" --><tr>
+      <th><a href="/cgi-bin/koha/opac-shelves.pl" onclick="CheckAll(); return false;"><img src="<!-- TMPL_VAR NAME="themelang" -->/images/checkall.gif" height="18" width="18" alt="Check All" title="Check All" border="0" /></a></th><th colspan="2">&nbsp;</th>
+    </tr><!-- /TMPL_IF -->
+    <!-- TMPL_IF NAME="itemsloop" -->
+    <!-- TMPL_LOOP Name="itemsloop" -->
+      <tr>
+          <!-- TMPL_IF name="manageshelf" --><td><input type="checkbox" name="REM-<!-- TMPL_VAR Name="itemnumber" -->" /></td><!-- /TMPL_IF -->
+      <td><!-- TMPL_IF NAME="AmazonContent" --><a class="p1" href="/cgi-bin/koha/opac-detail.pl?bib=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->"><img src="<!-- TMPL_IF NAME="isbn" -->http://images.amazon.com/images/P/<!-- TMPL_VAR name="isbn" -->.01.TZZZZZZZ.jpg<!-- TMPL_ELSE -->http://g-images.amazon.com/images/G/01/x-site/icons/no-img-sm.gif<!-- /TMPL_IF -->" alt="image" class="thumbnail" /></a><!-- TMPL_ELSE -->&nbsp;<!-- /TMPL_IF --></td>
+          <td><a class="title" href="opac-detail.pl?bib=<!-- TMPL_VAR NAME="biblionumber" -->"><!-- TMPL_VAR Name="title" --> <!-- TMPL_VAR NAME="subtitle" --></a> <!-- TMPL_IF NAME="author" -->by <a href="/search?q=au:<!-- TMPL_VAR NAME="author" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="author" --></a><!-- TMPL_ELSE -->&nbsp;<!-- /TMPL_IF --> <p> <!-- TMPL_IF name="publicationyear" --> - <!-- TMPL_VAR name="publicationyear" --><!-- /TMPL_IF -->
+            <!-- TMPL_IF name="publishercode" -->- <!-- TMPL_VAR name="publishercode" --><!-- /TMPL_IF -->
+            <!-- TMPL_IF name="place" --> ; <!-- TMPL_VAR name="place" --><!-- /TMPL_IF -->
+            <!-- TMPL_IF name="pages" --> <!-- TMPL_VAR name="pages" --><!-- /TMPL_IF -->
+            <!-- TMPL_IF name="notes" --> : <!-- TMPL_VAR name="notes" --><!-- /TMPL_IF -->
+            <!-- TMPL_IF name="size" --> <!-- TMPL_VAR name="size" --><!-- /TMPL_IF -->
+            <!-- TMPL_IF name="timestamp" --> <i>(modified on <!-- TMPL_VAR name="timestamp" -->)</i><!-- /TMPL_IF --></p>
+        <p><!-- TMPL_UNLESS NAME="norequests" --><!-- TMPL_IF NAME="opacuserlogin" --><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?bib=<!-- TMPL_VAR NAME="biblionumber" -->">Place Reserve</a><!-- /TMPL_IF --><!-- /TMPL_UNLESS --><img src="<!-- TMPL_VAR NAME="themelang" -->/images/<!-- TMPL_VAR NAME="ccode" -->.gif" alt="<!-- TMPL_VAR NAME="ccode" -->" title="<!-- TMPL_VAR NAME="ccode" -->" /><a href="/search?q=callnum:<!-- TMPL_VAR NAME="classification" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="classification" --></a></p>
+</td>
+    </tr>
+    <!-- /TMPL_LOOP -->
     <!-- TMPL_ELSE -->
     <tr><td colspan="5">This Virtual Shelf is empty.</td></tr>
     <!-- /TMPL_IF -->
diff --git a/opac/opac-addbookbybiblionumber.pl b/opac/opac-addbookbybiblionumber.pl
new file mode 100755 (executable)
index 0000000..88930c0
--- /dev/null
@@ -0,0 +1,117 @@
+#!/usr/bin/perl
+
+#script to provide bookshelf management
+# WARNING: This file uses 4-character tabs!
+#
+# $Header$
+#
+# Copyright 2000-2002 Katipo Communications
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA  02111-1307 USA
+
+use strict;
+use C4::Biblio;
+use CGI;
+use C4::BookShelves;
+use C4::Circulation;
+use C4::Auth;
+use C4::Output;
+
+my $query        = new CGI;
+my $biblionumber = $query->param('biblionumber');
+my $shelfnumber  = $query->param('shelfnumber');
+my $newbookshelf = $query->param('newbookshelf');
+my $category     = $query->param('category');
+
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+    {
+        template_name   => "opac-addbookbybiblionumber.tmpl",
+        query           => $query,
+        type            => "opac",
+        authnotrequired => 1,
+    }
+);
+
+$shelfnumber = AddShelf( '', $newbookshelf, $loggedinuser, $category ) if $newbookshelf;
+
+# to know if we had to add more than one biblio.
+my $multiple = 0;
+$multiple = 1 if $biblionumber =~ /^(\d*\/)*$/;
+
+
+if ($shelfnumber) {
+
+    if ($multiple){
+        foreach (split /\//,$biblionumber){
+            &AddToShelfFromBiblio($_,$shelfnumber);
+        }
+    }
+    else {
+        &AddToShelfFromBiblio( $biblionumber, $shelfnumber );
+    }
+    print $query->header;
+    print "<html><body onload=\"window.close();\"></body></html>";
+    exit;
+}
+else {
+    my ($shelflist) = GetShelves( $loggedinuser, 3 );
+    my @shelvesloop;
+    my %shelvesloop;
+    foreach my $element ( sort keys %$shelflist ) {
+        push( @shelvesloop, $element );
+            $shelvesloop{$element} = $shelflist->{$element}->{'shelfname'};
+    }
+
+    my $CGIbookshelves;
+    if ( @shelvesloop > 0 ) {
+        $CGIbookshelves = CGI::scrolling_list (
+            -name     => 'shelfnumber',
+            -values   => \@shelvesloop,
+            -labels   => \%shelvesloop,
+            -size     => 1,
+            -tabindex => '',
+            -multiple => 0
+        );
+    }
+
+    if ( $multiple ) {
+        my @biblios;
+        foreach (split /\//,$biblionumber){
+            my $data = GetBiblioData($_);
+            push @biblios,$data;
+        }
+        $template->param (
+            multiple => 1,
+            biblionumber => $biblionumber,
+            total    => scalar @biblios,
+            biblios  => \@biblios,
+        );
+    }
+    else { # just one to add.
+        my $data = GetBiblioData( $biblionumber );
+        $template->param (
+            biblionumber => $biblionumber,
+            title        => $data->{'title'},
+            author       => $data->{'author'},
+        );
+    }
+
+    $template->param (
+        CGIbookshelves       => $CGIbookshelves,
+    );
+
+    output_html_with_http_headers $query, $cookie, $template->output;
+}
diff --git a/opac/opac-addbybiblionumber.pl b/opac/opac-addbybiblionumber.pl
deleted file mode 100755 (executable)
index 4747712..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-#!/usr/bin/perl
-
-#script to provide virtualshelf management
-# WARNING: This file uses 4-character tabs!
-#
-# $Header$
-#
-# Copyright 2000-2002 Katipo Communications
-#
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
-
-use strict;
-use C4::Biblio;
-use CGI;
-use C4::VirtualShelves;
-use C4::Circulation;
-use C4::Auth;
-use C4::Output;
-
-my $query        = new CGI;
-my $biblionumber = $query->param('biblionumber');
-my $shelfnumber  = $query->param('shelfnumber');
-my $newvirtualshelf = $query->param('newvirtualshelf');
-my $category     = $query->param('category');
-
-my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
-    {
-        template_name   => "opac-addbybiblionumber.tmpl",
-        query           => $query,
-        type            => "opac",
-        authnotrequired => 1,
-    }
-);
-
-$shelfnumber = AddShelf( '', $newvirtualshelf, $loggedinuser, $category ) if $newvirtualshelf;
-
-# to know if we had to add more than one biblio.
-my $multiple = 0;
-$multiple = 1 if $biblionumber =~ /^(\d*\/)*$/;
-
-
-if ($shelfnumber) {
-
-    if ($multiple){
-        foreach (split /\//,$biblionumber){
-            &AddToShelfFromBiblio($_,$shelfnumber);
-        }
-    }
-    else {
-        &AddToShelfFromBiblio( $biblionumber, $shelfnumber );
-    }
-    print $query->header;
-    print "<html><body onload=\"window.close();\"></body></html>";
-    exit;
-}
-else {
-    my ($shelflist) = GetShelves( $loggedinuser, 3 );
-    my @shelvesloop;
-    my %shelvesloop;
-    foreach my $element ( sort keys %$shelflist ) {
-        push( @shelvesloop, $element );
-            $shelvesloop{$element} = $shelflist->{$element}->{'shelfname'};
-    }
-
-    my $CGIvirtualshelves;
-    if ( @shelvesloop > 0 ) {
-        $CGIvirtualshelves = CGI::scrolling_list (
-            -name     => 'shelfnumber',
-            -values   => \@shelvesloop,
-            -labels   => \%shelvesloop,
-            -size     => 1,
-            -tabindex => '',
-            -multiple => 0
-        );
-    }
-
-    if ( $multiple ) {
-        my @biblios;
-        foreach (split /\//,$biblionumber){
-            my $data = GetBiblioData($_);
-            push @biblios,$data;
-        }
-        $template->param (
-            multiple => 1,
-            biblionumber => $biblionumber,
-            total    => scalar @biblios,
-            biblios  => \@biblios,
-        );
-    }
-    else { # just one to add.
-        my $data = GetBiblioData( $biblionumber );
-        $template->param (
-            biblionumber => $biblionumber,
-            title        => $data->{'title'},
-            author       => $data->{'author'},
-        );
-    }
-
-    $template->param (
-        CGIvirtualshelves       => $CGIvirtualshelves,
-    );
-
-    output_html_with_http_headers $query, $cookie, $template->output;
-}
index 8ec0eb0..cc42d1e 100755 (executable)
@@ -22,7 +22,7 @@ require Exporter;
 use CGI;
 use C4::Auth;    # get_template_and_user
 use C4::Output;
-use C4::VirtualShelves;
+use C4::BookShelves;
 use C4::Languages;       # getTranslatedLanguages
 use C4::Branch;          # GetBranches
 use C4::Members;         # GetMember
index 683610c..ac4a26c 100755 (executable)
@@ -25,7 +25,7 @@
 
 =head1 DESCRIPTION
 
-    this script is used to script to provide virtualshelf management
+    this script is used to script to provide bookshelf management
 
 =head1 CGI PARAMETERS
 
 use strict;
 use CGI;
 use C4::Output;
-use C4::VirtualShelves;
+use C4::BookShelves;
 use C4::Circulation;
 use C4::Auth;
 use C4::Output;
-use C4::Biblio;
 
 my $query = new CGI;
 
@@ -88,14 +87,13 @@ if ( $query->param('modifyshelfcontents') ) {
     my $shelfnumber = $query->param('viewshelf');
     my $barcode     = $query->param('addbarcode');
     my ($item) = GetItemnumberFromBarcode($barcode);
-       my ($biblio) = GetBiblioFromItemNumber($item->{'itemnumber'});
     if ( ShelfPossibleAction( $loggedinuser, $shelfnumber, 'manage' ) ) {
-        AddToShelf( $biblio->{'biblionumber'}, $shelfnumber );
+        AddToShelf( $item->{'itemnumber'}, $shelfnumber );
         foreach ( $query->param ) {
             if (/MOD-(\d*)/) {
-                my $biblionumber = $1;
+                my $itemnumber = $1;
                 if ( $query->param('remove') eq "on" ) {
-                    DelFromShelf( $biblionumber, $shelfnumber );
+                    DelFromShelf( $itemnumber, $shelfnumber );
                 }
             }
         }
@@ -185,7 +183,7 @@ SWITCH: {
         $line{'toggle'}         = $color;
         $line{'shelf'}          = $element;
         $line{'shelfname'}      = $shelflist->{$element}->{'shelfname'};
-        $line{'shelfvirtualcount'} = $shelflist->{$element}->{'count'};
+        $line{'shelfbookcount'} = $shelflist->{$element}->{'count'};
         push( @shelvesloop, \%line );
     }
     $template->param(
@@ -210,7 +208,7 @@ foreach my $element ( sort keys %$shelflist ) {
         $line{'shelfname'} = $shelflist->{$element}->{'shelfname'};
         $line{ "category" . $shelflist->{$element}->{'category'} } = 1;
         $line{'mine'} = 1 if $shelflist->{$element}->{'owner'} eq $loggedinuser;
-        $line{'shelfvirtualcount'} = $shelflist->{$element}->{'count'};
+        $line{'shelfbookcount'} = $shelflist->{$element}->{'count'};
         $line{'canmanage'}      =
           ShelfPossibleAction( $loggedinuser, $element, 'manage' );
         $line{'firstname'} = $shelflist->{$element}->{'firstname'}
@@ -267,13 +265,13 @@ output_html_with_http_headers $query, $cookie, $template->output;
 # add the link to "BiblioDefaultView systempref" and not to opac-detail.pl
 #
 # Revision 1.8.2.7  2006/12/14 17:22:55  toins
-# virtualshelves work perfectly with mod_perl and are cleaned.
+# bookshelves work perfectly with mod_perl and are cleaned.
 #
 # Revision 1.8.2.6  2006/12/14 16:04:25  toins
 # sync with intranet.
 #
 # Revision 1.8.2.5  2006/12/11 17:10:06  toins
-# fixing some bugs on virtualshelves.
+# fixing some bugs on bookshelves.
 #
 # Revision 1.8.2.4  2006/12/07 15:42:15  toins
 # synching opac & intranet.
diff --git a/t/BookShelves.t b/t/BookShelves.t
new file mode 100644 (file)
index 0000000..40c6f77
--- /dev/null
@@ -0,0 +1,159 @@
+#!/usr/bin/perl
+
+#
+# This file is a test script for C4::BookShelves.pm
+# Author : Antoine Farnault, antoine@koha-fr.org
+#
+
+use Test;
+use strict;
+use C4::Context;
+
+# Making 30 tests.
+BEGIN { plan tests => 30 }
+
+# Getting some borrowers from database.
+my $dbh = C4::Context->dbh;
+my $query = qq/
+    SELECT borrowernumber
+    FROM   borrowers
+    LIMIT  10
+/;
+my $sth = $dbh->prepare($query);
+$sth->execute;
+my @borrowers;
+while(my $borrower = $sth->fetchrow){
+    push @borrowers, $borrower;
+}
+
+# Getting some itemnumber from database
+my $query = qq/
+    SELECT itemnumber
+    FROM   items
+    LIMIT  10
+/;
+my $sth = $dbh->prepare($query);
+$sth->execute;
+my @items;
+while(my $item = $sth->fetchrow){
+    push @items, $item;
+}
+
+# Getting some biblionumbers from database
+my $query = qq/
+    SELECT biblionumber
+    FROM   biblio
+    LIMIT  10
+/;
+my $sth = $dbh->prepare($query);
+$sth->execute;
+my @biblionumbers;
+while(my $biblionumber = $sth->fetchrow){
+    push @biblionumbers, $biblionumber;
+}
+
+# ---
+my $delete_bookshelf = qq/
+    DELETE FROM  bookshelf WHERE 1
+/;
+my $delete_bookshelfcontent =qq/
+    DELETE  FROM  shelfcontents WHERE 1
+/;
+
+my $sth = $dbh->prepare($delete_bookshelf);
+$sth->execute;
+my $sth = $dbh->prepare($delete_bookshelfcontent);
+$sth->execute;
+# ---
+
+#----------------------------------------------------------------------#
+#
+#           TESTS START HERE
+#
+#----------------------------------------------------------------------#
+
+use C4::BookShelves;
+my $version = C4::BookShelves->VERSION;
+print "\n----------Testing C4::BookShelves version ".$version."--------\n";
+
+ok($version);   # First test: the module is loaded & the version is readable.
+
+
+#-----------------------TEST AddShelf function------------------------#
+# usage : $shelfnumber = &AddShelf( $shelfname, $owner, $category);
+
+# creating 10 good shelves.
+my @shelves;
+for(my $i=0; $i<10;$i++){
+     my $ShelfNumber = AddShelf("Shelf_".$i,$borrowers[$i],int(rand(3))+1);
+     die "test Not ok, remove some shelves before" if ($ShelfNumber == -1);
+     ok($ShelfNumber);   # Shelf creation successful;
+     push @shelves, $ShelfNumber if ok($ShelfNumber);
+}
+
+ok(10,scalar @shelves); # 10 shelves in @shelves;
+
+# try to create some shelf which already exists.
+for(my $i=0;$i<10;$i++){
+    my $badNumShelf = AddShelf("Shelf_".int(rand(9)),'','');
+    ok(-1,$badNumShelf);   # AddShelf returns -1 if name already exist.
+}
+
+#-----------TEST AddToShelf & &AddToShelfFromBiblio & GetShelfContents &  DelFromShelf functions--------------#
+# usage : &AddToShelf($itemnumber, $shelfnumber);
+# usage : $itemlist = &GetShelfContents($shelfnumber);
+# usage : $itemlist = GetShelfContents($shelfnumber);
+
+for(my $i=0; $i<10;$i++){
+    my $item = $items[int(rand(9))];
+    my $shelfnumber = $shelves[int(rand(9))];
+    
+    my $itemlistBefore = GetShelfContents($shelfnumber);
+    AddToShelf($item,$shelfnumber);
+    my $itemlistAfter = GetShelfContents($shelfnumber);
+    ok(scalar @$itemlistBefore,scalar (@$itemlistAfter - 1));  # the item has been successfuly added.
+
+    
+    # same thing with AddToShelfFromBiblio
+    my $biblionumber = $biblionumbers[int(rand(10))];
+    &AddToShelfFromBiblio($biblionumber, $shelfnumber);
+    my $AfterAgain = GetShelfContents($shelfnumber);
+    ok(scalar @$itemlistAfter, scalar (@$AfterAgain -1));
+}
+
+#-----------------------TEST ModShelf & GetShelf functions------------------------#
+# usage : ModShelf($shelfnumber, $shelfname, $owner, $category )
+# usage : (shelfnumber,shelfname,owner,category) = GetShelf($shelfnumber);
+
+for(my $i=0; $i<10;$i++){
+    my $rand = int(rand(9));
+    my $numA = $shelves[$rand];
+    my $nameA = "NewName_".$rand;
+    my $ownerA = $borrowers[$rand];
+    my $categoryA = int(rand(3))+1;
+    
+    ModShelf($numA,$nameA,$ownerA,$categoryA);
+    my ($numB,$nameB,$ownerB,$categoryB) = GetShelf($numA);
+    
+    ok($numA,$numB);
+    ok($nameA,$nameB);
+    ok($ownerB,$ownerA);
+    ok($categoryA,$categoryB);
+}
+
+#-----------------------TEST DelShelf & DelFromShelf functions------------------------#
+# usage : ($status) = &DelShelf($shelfnumber);
+# usage : &DelFromShelf( $itemnumber, $shelfnumber);
+
+for(my $i=0; $i<10;$i++){
+    my $shelfnumber = $shelves[$i];
+    my $status = DelShelf($shelfnumber);
+    if($status){
+        my $items = GetShelfContents($shelfnumber);
+        ok($status,scalar @$items);
+        foreach (@$items){ # delete all the item in this shelf
+            DelFromShelf($_{'itemnumber'},$shelfnumber);
+        }
+        ok(DelShelf($shelfnumber));
+    }
+}
diff --git a/t/VirtualShelves.t b/t/VirtualShelves.t
deleted file mode 100644 (file)
index f3f3b35..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-#!/usr/bin/perl
-
-#
-# This file is a test script for C4::VirtualShelves.pm
-# Author : Antoine Farnault, antoine@koha-fr.org
-#
-
-use Test;
-use strict;
-use C4::Context;
-
-# Making 30 tests.
-BEGIN { plan tests => 30 }
-
-# Getting some borrowers from database.
-my $dbh = C4::Context->dbh;
-my $query = qq/
-    SELECT borrowernumber
-    FROM   borrowers
-    LIMIT  10
-/;
-my $sth = $dbh->prepare($query);
-$sth->execute;
-my @borrowers;
-while(my $borrower = $sth->fetchrow){
-    push @borrowers, $borrower;
-}
-
-# Getting some itemnumber from database
-my $query = qq/
-    SELECT itemnumber
-    FROM   items
-    LIMIT  10
-/;
-my $sth = $dbh->prepare($query);
-$sth->execute;
-my @items;
-while(my $item = $sth->fetchrow){
-    push @items, $item;
-}
-
-# Getting some biblionumbers from database
-my $query = qq/
-    SELECT biblionumber
-    FROM   biblio
-    LIMIT  10
-/;
-my $sth = $dbh->prepare($query);
-$sth->execute;
-my @biblionumbers;
-while(my $biblionumber = $sth->fetchrow){
-    push @biblionumbers, $biblionumber;
-}
-
-# ---
-my $delete_virtualshelf = qq/
-    DELETE FROM  virtualshelf WHERE 1
-/;
-my $delete_virtualshelfcontent =qq/
-    DELETE  FROM  shelfcontents WHERE 1
-/;
-
-my $sth = $dbh->prepare($delete_virtualshelf);
-$sth->execute;
-my $sth = $dbh->prepare($delete_virtualshelfcontent);
-$sth->execute;
-# ---
-
-#----------------------------------------------------------------------#
-#
-#           TESTS START HERE
-#
-#----------------------------------------------------------------------#
-
-use C4::VirtualShelves;
-my $version = C4::VirtualShelves->VERSION;
-print "\n----------Testing C4::VirtualShelves version ".$version."--------\n";
-
-ok($version);   # First test: the module is loaded & the version is readable.
-
-
-#-----------------------TEST AddShelf function------------------------#
-# usage : $shelfnumber = &AddShelf( $shelfname, $owner, $category);
-
-# creating 10 good shelves.
-my @shelves;
-for(my $i=0; $i<10;$i++){
-     my $ShelfNumber = AddShelf("Shelf_".$i,$borrowers[$i],int(rand(3))+1);
-     die "test Not ok, remove some shelves before" if ($ShelfNumber == -1);
-     ok($ShelfNumber);   # Shelf creation successful;
-     push @shelves, $ShelfNumber if ok($ShelfNumber);
-}
-
-ok(10,scalar @shelves); # 10 shelves in @shelves;
-
-# try to create some shelf which already exists.
-for(my $i=0;$i<10;$i++){
-    my $badNumShelf = AddShelf("Shelf_".int(rand(9)),'','');
-    ok(-1,$badNumShelf);   # AddShelf returns -1 if name already exist.
-}
-
-#-----------TEST AddToShelf & &AddToShelfFromBiblio & GetShelfContents &  DelFromShelf functions--------------#
-# usage : &AddToShelf($itemnumber, $shelfnumber);
-# usage : $itemlist = &GetShelfContents($shelfnumber);
-# usage : $itemlist = GetShelfContents($shelfnumber);
-
-for(my $i=0; $i<10;$i++){
-    my $item = $items[int(rand(9))];
-    my $shelfnumber = $shelves[int(rand(9))];
-    
-    my $itemlistBefore = GetShelfContents($shelfnumber);
-    AddToShelf($item,$shelfnumber);
-    my $itemlistAfter = GetShelfContents($shelfnumber);
-    ok(scalar @$itemlistBefore,scalar (@$itemlistAfter - 1));  # the item has been successfuly added.
-
-    
-    # same thing with AddToShelfFromBiblio
-    my $biblionumber = $biblionumbers[int(rand(10))];
-    &AddToShelfFromBiblio($biblionumber, $shelfnumber);
-    my $AfterAgain = GetShelfContents($shelfnumber);
-    ok(scalar @$itemlistAfter, scalar (@$AfterAgain -1));
-}
-
-#-----------------------TEST ModShelf & GetShelf functions------------------------#
-# usage : ModShelf($shelfnumber, $shelfname, $owner, $category )
-# usage : (shelfnumber,shelfname,owner,category) = GetShelf($shelfnumber);
-
-for(my $i=0; $i<10;$i++){
-    my $rand = int(rand(9));
-    my $numA = $shelves[$rand];
-    my $nameA = "NewName_".$rand;
-    my $ownerA = $borrowers[$rand];
-    my $categoryA = int(rand(3))+1;
-    
-    ModShelf($numA,$nameA,$ownerA,$categoryA);
-    my ($numB,$nameB,$ownerB,$categoryB) = GetShelf($numA);
-    
-    ok($numA,$numB);
-    ok($nameA,$nameB);
-    ok($ownerB,$ownerA);
-    ok($categoryA,$categoryB);
-}
-
-#-----------------------TEST DelShelf & DelFromShelf functions------------------------#
-# usage : ($status) = &DelShelf($shelfnumber);
-# usage : &DelFromShelf( $itemnumber, $shelfnumber);
-
-for(my $i=0; $i<10;$i++){
-    my $shelfnumber = $shelves[$i];
-    my $status = DelShelf($shelfnumber);
-    if($status){
-        my $items = GetShelfContents($shelfnumber);
-        ok($status,scalar @$items);
-        foreach (@$items){ # delete all the item in this shelf
-            DelFromShelf($_{'itemnumber'},$shelfnumber);
-        }
-        ok(DelShelf($shelfnumber));
-    }
-}
index 2d92842..0370ee4 100755 (executable)
@@ -29,13 +29,12 @@ use C4::Branch;  # GetBranches
 
 my $query = new CGI;
 my $op=$query->param("op");
-my $filename=$query->param("filename");
 my $dbh=C4::Context->dbh;
 my $marcflavour = C4::Context->preference("marcflavour");
 
 if ($op eq "export") {
        print $query->header(   -type => 'application/octet-stream', 
-                                                       -attachment=>$filename);
+               -attachment=>'koha.mrc');
     
     my $StartingBiblionumber  = $query->param("StartingBiblionumber");
     my $EndingBiblionumber    = $query->param("EndingBiblionumber");
index ee03721..26606ed 100755 (executable)
@@ -1252,7 +1252,7 @@ my %foreign_keys = (
     ],
     shelfcontents => [
         {    key => 'shelfnumber',
-            foreigntable => 'virtualshelf',
+            foreigntable => 'bookshelf',
             foreignkey => 'shelfnumber',
             onUpdate => 'CASCADE',
             onDelete => 'CASCADE',
diff --git a/virtualshelves/addbybiblionumber.pl b/virtualshelves/addbybiblionumber.pl
deleted file mode 100755 (executable)
index 1ad5775..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-#!/usr/bin/perl
-
-#script to provide virtual shelf management
-#
-#
-# Copyright 2000-2002 Katipo Communications
-#
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
-
-# $Id$
-
-=head1 NAME
-
-    addbybiblionumber.pl
-
-=head1 DESCRIPTION
-
-    This script allow to add a virtual in a virtual shelf from a biblionumber.
-
-=head1 CGI PARAMETERS
-
-=over 4
-
-=item biblionumber
-
-    The biblionumber
-
-=item shelfnumber
-
-    the shelfnumber where to add the virtual.
-
-=item newvirtualshelf
-
-    if this parameter exists, then it must be equals to the name of the shelf
-    to add.
-
-=item category
-
-    if this script has to add a shelf, it add one with this category.
-
-=back
-
-=cut
-
-use strict;
-use C4::Biblio;
-use CGI;
-use C4::Output;
-use C4::VirtualShelves;
-use C4::Circulation;
-use C4::Auth;
-
-#use it only to debug !
-use CGI::Carp qw/fatalsToBrowser/;
-use warnings;
-
-my $query           = new CGI;
-my $biblionumber    = $query->param('biblionumber');
-my $shelfnumber     = $query->param('shelfnumber');
-my $newvirtualshelf = $query->param('newvirtualshelf');
-my $category        = $query->param('category');
-
-my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
-    {
-        template_name   => "virtualshelves/addbybiblionumber.tmpl",
-        query           => $query,
-        type            => "intranet",
-        authnotrequired => 0,
-        flagsrequired   => { catalogue => 1 },
-    }
-);
-
-$shelfnumber = AddShelf( $newvirtualshelf, $loggedinuser, $category )
-  if $newvirtualshelf;
-if ( $shelfnumber || ( $shelfnumber == -1 ) ) {    # the shelf already exist.
-    &AddToShelfFromBiblio( $biblionumber, $shelfnumber );
-    print
-"Content-Type: text/html\n\n<html><body onload=\"window.close()\"></body></html>";
-    exit;
-}
-else {    # this shelf doesn't already exist.
-    my ( $bibliocount, @biblios ) = GetBiblio($biblionumber);
-
-    my ($shelflist) = GetShelves( $loggedinuser, 3 );
-    my @shelvesloop;
-    my %shelvesloop;
-    foreach my $element ( sort keys %$shelflist ) {
-        push( @shelvesloop, $element );
-        $shelvesloop{$element} = $shelflist->{$element}->{'shelfname'};
-    }
-
-    my $CGIvirtualshelves = CGI::scrolling_list(
-        -name     => 'shelfnumber',
-        -values   => \@shelvesloop,
-        -labels   => \%shelvesloop,
-        -size     => 1,
-        -tabindex => '',
-        -multiple => 0
-    );
-
-    $template->param(
-        biblionumber      => $biblionumber,
-        title             => $biblios[0]->{'title'},
-        author            => $biblios[0]->{'author'},
-        CGIvirtualshelves => $CGIvirtualshelves,
-        intranetcolorstylesheet =>
-          C4::Context->preference("intranetcolorstylesheet"),
-        intranetstylesheet => C4::Context->preference("intranetstylesheet"),
-        IntranetNav        => C4::Context->preference("IntranetNav"),
-    );
-
-    output_html_with_http_headers $query, $cookie, $template->output;
-}
-
-# $Log$
-# Revision 1.8  2007/04/24 13:54:29  hdl
-# functions that were in C4::Interface::CGI::Output are now in C4::Output.
-# So this implies quite a change for files.
-# Sorry about conflicts which will be caused.
-# directory Interface::CGI should now be dropped.
-# I noticed that many scripts (reports ones, but also some circ/stats.pl or opac-topissues) still use Date::Manip.
-#
-# Revision 1.7  2007/04/04 16:46:22  tipaul
-# HUGE COMMIT : code cleaning circulation.
-#
-# some stuff to do, i'll write a mail on koha-devel NOW !
-#
-# Revision 1.6  2007/03/09 14:32:26  tipaul
-# rel_3_0 moved to HEAD
-#
-# Revision 1.4.2.6  2006/12/18 16:35:17  toins
-# removing use HTML::Template from *.pl.
-#
-# Revision 1.4.2.5  2006/12/05 11:35:29  toins
-# Biblio.pm cleaned.
-# additionalauthors, bibliosubject, bibliosubtitle tables are now unused.
-# Some functions renamed according to the coding guidelines.
-#
-# Revision 1.4.2.4  2006/11/30 18:23:51  toins
-# theses scripts don't need to use C4::Search.
-#
-# Revision 1.4.2.3  2006/10/30 09:48:19  tipaul
-# samll bugfix to create a virtualshelf correctly
-#
-# Revision 1.4.2.2  2006/08/30 16:13:54  toins
-# correct an error in the "if condition".
-#
-# Revision 1.4.2.1  2006/08/30 15:59:14  toins
-# Code cleaned according to coding guide lines.
-#
-# Revision 1.4  2006/07/04 14:36:51  toins
-# Head & rel_2_2 merged
-#
-# Revision 1.3.2.4  2006/06/20 16:21:42  oleonard
-# Adding "tabindex=''" to CGI:scrolling_lists to prevent incorrect tabbing. See Bug 1098
-#
-# Revision 1.3.2.3  2006/02/05 21:59:21  kados
-# Adds script support for IntranetNav ... see mail to koha-devel for
-# details
-#
-# Revision 1.3.2.2  2006/02/05 21:45:25  kados
-# Adds support for intranetstylesheet system pref in Koha scripts
-#
-
-# Local Variables:
-# tab-width: 4
-# End:
diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl
deleted file mode 100755 (executable)
index ad2dce6..0000000
+++ /dev/null
@@ -1,324 +0,0 @@
-#!/usr/bin/perl
-
-#
-# Copyright 2000-2002 Katipo Communications
-#
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
-
-=head1 NAME
-
-    shelves.pl
-
-=head1 DESCRIPTION
-
-    this script is used to script to provide virtualshelf management
-
-=head1 CGI PARAMETERS
-
-=over 4
-
-=item C<modifyshelfcontents>
-
-    if this script has to modify the shelve content.
-
-=item C<shelfnumber>
-
-    to know on which shelve this script has to work.
-
-=item C<addbarcode>
-
-=item C<op>
-
-    op can be equals to:
-        * modifsave to save change on the shelves
-        * modif to change the template to allow to modify the shelves.
-
-=item C<viewshelf>
-
-    to load the template with 'viewshelves param' which allow to read the shelves information.
-
-=item C<shelves>
-
-    if equals to 1. then call the function shelves which add
-    or delete a shelf.
-
-=item C<addshelf>
-
-    if the param shelves = 1 then addshelf must be equals to the name of the shelf to add.
-
-=back
-
-=cut
-
-use strict;
-use CGI;
-use C4::VirtualShelves;
-use C4::Biblio;
-use C4::Auth;
-use C4::Output;
-
-my $query = new CGI;
-
-my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
-    {
-        template_name   => "virtualshelves/shelves.tmpl",
-        query           => $query,
-        type            => "intranet",
-        authnotrequired => 0,
-        flagsrequired   => { catalogue => 1 },
-    }
-);
-
-if ( $query->param('modifyshelfcontents') ) {
-    my $shelfnumber = $query->param('viewshelf');
-    my $barcode     = $query->param('addbarcode');
-    my ($item) = GetItem( 0, $barcode );
-       my ($biblio) = GetBiblioFromItemNumber($item->{'itemnumber'});
-
-    if ( ShelfPossibleAction( $loggedinuser, $shelfnumber, 'manage' ) ) {
-        AddToShelf( $biblio->{'biblionumber'}, $shelfnumber );
-        foreach ( $query->param ) {
-            if (/REM-(\d*)/) {
-                my $biblionumber = $1;
-                DelFromShelf( $biblionumber, $shelfnumber );
-            }
-        }
-    }
-}
-
-# getting the Shelves list
-my $shelflist = GetShelves( $loggedinuser, 2 );
-$template->param( { loggedinuser => $loggedinuser } );
-my $op = $query->param('op');
-
-SWITCH: {
-    if ( $op && ( $op eq 'modifsave' ) ) {
-        ModShelf(
-            $query->param('shelfnumber'), $query->param('shelfname'),
-            $loggedinuser,                $query->param('category')
-        );
-        last SWITCH;
-    }
-    if ( $op && ( $op eq 'modif' ) ) {
-        my ( $shelfnumber, $shelfname, $owner, $category ) =
-          GetShelf( $query->param('shelf') );
-        $template->param(
-            edit                => 1,
-            shelfnumber         => $shelfnumber,
-            shelfname           => $shelfname,
-            "category$category" => 1
-        );
-
-        #         editshelf($query->param('shelf'));
-        last SWITCH;
-    }
-    if ( $query->param('viewshelf') ) {
-
-        #check that the user can view the shelf
-        my $shelfnumber = $query->param('viewshelf');
-        if ( ShelfPossibleAction( $loggedinuser, $shelfnumber, 'view' ) ) {
-            my $items = GetShelfContents($shelfnumber);
-            $template->param(
-                shelfname   => $shelflist->{$shelfnumber}->{'shelfname'},
-                shelfnumber => $shelfnumber,
-                viewshelf   => $query->param('viewshelf'),
-                manageshelf =>
-                  &ShelfPossibleAction( $loggedinuser, $shelfnumber, 'manage' ),
-                itemsloop => $items,
-            );
-        }
-        last SWITCH;
-    }
-    if ( $query->param('shelves') ) {
-        if ( my $newshelf = $query->param('addshelf') ) {
-            my $shelfnumber = AddShelf(
-                $newshelf,
-                $query->param('owner'),
-                $query->param('category')
-            );
-
-            if ( $shelfnumber == -1 ) {    #shelf already exists.
-                $template->param(
-                    {
-                        shelfnumber => $shelfnumber,
-                        already     => 1
-                    }
-                );
-            }
-        }
-        my @paramsloop;
-        foreach ( $query->param() ) {
-            my %line;
-            if (/DEL-(\d+)/) {
-                my $delshelf = $1;
-                my ( $status, $count ) = DelShelf($delshelf);
-                if ($status) {
-                    $line{'status'} = $status;
-                    $line{'count'}  = $count;
-                }
-            }
-
-            #if the shelf is not deleted, %line points on null
-            push( @paramsloop, \%line );
-        }
-        $template->param( paramsloop => \@paramsloop );
-        my ($shelflist) = GetShelves( $loggedinuser, 2 );
-        my $color = '';
-        my @shelvesloop;
-        foreach my $element ( sort keys %$shelflist ) {
-            my %line;
-            ( $color eq 1 ) ? ( $color = 0 ) : ( $color = 1 );
-            $line{'toggle'}            = $color;
-            $line{'shelf'}             = $element;
-            $line{'shelfname'}         = $shelflist->{$element}->{'shelfname'};
-            $line{'shelfvirtualcount'} = $shelflist->{$element}->{'count'};
-            push( @shelvesloop, \%line );
-        }
-        $template->param(
-            shelvesloop => \@shelvesloop,
-            shelves     => 1,
-        );
-        last SWITCH;
-    }
-}
-
-my $shelflist = GetShelves( $loggedinuser, 2 );
-my $color = '';
-my @shelvesloop;
-my $numberCanManage = 0;
-
-foreach my $element ( sort keys %$shelflist ) {
-    my %line;
-    ( $color eq 1 ) ? ( $color = 0 ) : ( $color = 1 );
-    $line{'toggle'}    = $color;
-    $line{'shelf'}     = $element;
-    $line{'shelfname'} = $shelflist->{$element}->{'shelfname'};
-    $line{"viewcategory$shelflist->{$element}->{'category'}"} = 1;
-    $line{'mine'} = 1 if $shelflist->{$element}->{'owner'} eq $loggedinuser;
-    $line{'shelfvirtualcount'} = $shelflist->{$element}->{'count'};
-    $line{'canmanage'} =
-      ShelfPossibleAction( $loggedinuser, $element, 'manage' );
-    $line{'firstname'} = $shelflist->{$element}->{'firstname'}
-      unless $shelflist->{$element}->{'owner'} eq $loggedinuser;
-    $line{'surname'} = $shelflist->{$element}->{'surname'}
-      unless $shelflist->{$element}->{'owner'} eq $loggedinuser;
-    $numberCanManage++ if $line{'canmanage'};
-    push( @shelvesloop, \%line );
-}
-
-$template->param(
-    shelvesloop     => \@shelvesloop,
-
-    numberCanManage => $numberCanManage,
-);
-
-output_html_with_http_headers $query, $cookie, $template->output;
-
-sub shelves {
-    my $innertemplate = shift;
-    if ( my $newshelf = $query->param('addshelf') ) {
-        my $shelfnumber = AddShelf(
-            $newshelf,
-            $query->param('owner'),
-            $query->param('category')
-        );
-
-        if ( $shelfnumber == -1 ) {    #shelf already exists.
-            $template->param(
-                {
-                    shelfnumber => $shelfnumber,
-                    already     => 1
-                }
-            );
-        }
-    }
-    my @paramsloop;
-    foreach ( $query->param() ) {
-        my %line;
-        if (/DEL-(\d+)/) {
-            my $delshelf = $1;
-            my ( $status, $count ) = DelShelf($delshelf);
-            if ($status) {
-                $line{'status'} = $status;
-                $line{'count'}  = $count;
-            }
-        }
-
-        #if the shelf is not deleted, %line points on null
-        push( @paramsloop, \%line );
-    }
-    $innertemplate->param( paramsloop => \@paramsloop );
-    my ($shelflist) = GetShelves( $loggedinuser, 2 );
-    my $color = '';
-    my @shelvesloop;
-    foreach my $element ( sort keys %$shelflist ) {
-        my %line;
-        ( $color eq 1 ) ? ( $color = 0 ) : ( $color = 1 );
-        $line{'toggle'}            = $color;
-        $line{'shelf'}             = $element;
-        $line{'shelfname'}         = $shelflist->{$element}->{'shelfname'};
-        $line{'shelfvirtualcount'} = $shelflist->{$element}->{'count'};
-        push( @shelvesloop, \%line );
-    }
-    $innertemplate->param(
-        shelvesloop => \@shelvesloop,
-        shelves     => 1,
-    );
-}
-
-#
-# $Log$
-# Revision 1.13  2007/04/24 13:54:29  hdl
-# functions that were in C4::Interface::CGI::Output are now in C4::Output.
-# So this implies quite a change for files.
-# Sorry about conflicts which will be caused.
-# directory Interface::CGI should now be dropped.
-# I noticed that many scripts (reports ones, but also some circ/stats.pl or opac-topissues) still use Date::Manip.
-#
-# Revision 1.12  2007/04/04 16:46:22  tipaul
-# HUGE COMMIT : code cleaning circulation.
-#
-# some stuff to do, i'll write a mail on koha-devel NOW !
-#
-# Revision 1.11  2007/03/09 14:32:26  tipaul
-# rel_3_0 moved to HEAD
-#
-# Revision 1.9.2.9  2007/02/05 15:54:30  toins
-# don't display "remove selected shelves" if the user logged has no shelf.
-#
-# Revision 1.9.2.8  2006/12/15 17:36:57  toins
-# - some change on the html param.
-# - Writing directly the code of a sub called only once.
-# - adding syspref: BiblioDefaultView.
-#
-# Revision 1.9.2.7  2006/12/14 17:22:55  toins
-# virtualshelves work perfectly with mod_perl and are cleaned.
-#
-# Revision 1.9.2.6  2006/12/13 10:06:05  toins
-# fix a mod_perl specific bug.
-#
-# Revision 1.9.2.5  2006/12/11 17:10:06  toins
-# fixing some bugs on virtualshelves.
-#
-# Revision 1.9.2.4  2006/11/30 18:23:51  toins
-# theses scripts don't need to use C4::Search.
-#
-# Revision 1.9.2.3  2006/10/30 09:50:45  tipaul
-# better perl writting
-#
-# Revision 1.9.2.2  2006/10/17 07:59:35  toins
-# ccode added.
-#