Browse Source

Revert "new virtual shelves changes, keyed by biblionumber -- approved"

This reverts commit 8af76042d8.
3.0.x
Joshua Ferraro 17 years ago
parent
commit
81c0d9e821
  1. 53
      C4/Auth.pm
  2. 3
      C4/Branch.pm
  3. 190
      C4/VirtualShelves.pm
  4. 1
      Makefile.PL
  5. 82
      help.pl
  6. 20
      installer/kohastructure.sql
  7. 2
      koha-tmpl/intranet-tmpl/prog/en/about.tmpl
  8. 11
      koha-tmpl/intranet-tmpl/prog/en/auth.tmpl
  9. 4
      koha-tmpl/intranet-tmpl/prog/en/help/admin/systempreferences.tmpl
  10. 15
      koha-tmpl/intranet-tmpl/prog/en/help/nohelp.tmpl
  11. 2
      koha-tmpl/intranet-tmpl/prog/en/includes/action-catalogue.inc
  12. 2
      koha-tmpl/intranet-tmpl/prog/en/includes/error-top.inc
  13. 5
      koha-tmpl/intranet-tmpl/prog/en/includes/menu-bookshelves.inc
  14. 5
      koha-tmpl/intranet-tmpl/prog/en/includes/menu-virtualshelves.inc
  15. 2
      koha-tmpl/intranet-tmpl/prog/en/includes/menus.inc
  16. 7
      koha-tmpl/intranet-tmpl/prog/en/tools/export.tmpl
  17. 12
      koha-tmpl/intranet-tmpl/prog/en/virtualshelves/addbybiblionumber.tmpl
  18. 89
      koha-tmpl/intranet-tmpl/prog/en/virtualshelves/shelves.tmpl
  19. 2
      koha-tmpl/opac-tmpl/prog/en/includes/basket.js
  20. 2
      koha-tmpl/opac-tmpl/prog/en/opac-ISBDdetail.tmpl
  21. 2
      koha-tmpl/opac-tmpl/prog/en/opac-MARCdetail.tmpl
  22. 18
      koha-tmpl/opac-tmpl/prog/en/opac-addbybiblionumber.tmpl
  23. 2
      koha-tmpl/opac-tmpl/prog/en/opac-detail.tmpl
  24. 62
      koha-tmpl/opac-tmpl/prog/en/opac-shelves.tmpl
  25. 16
      opac/opac-addbybiblionumber.pl
  26. 2
      opac/opac-main.pl
  27. 20
      opac/opac-shelves.pl
  28. 18
      t/VirtualShelves.t
  29. 3
      tools/export.pl
  30. 2
      updater/updatedatabase
  31. 99
      virtualshelves/addbybiblionumber.pl
  32. 115
      virtualshelves/shelves.pl

53
C4/Auth.pm

@ -223,18 +223,17 @@ 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"),
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"),
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"),
"BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1,
advancedMARCEditor => C4::Context->preference("advancedMARCEditor"),
suggestion => C4::Context->preference("suggestion"),
@ -346,7 +345,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;
@ -389,7 +388,7 @@ sub checkauth {
# state variables
my $loggedin = 0;
my %info;
my ( $userid, $cookie, $sessionID, $flags, $envcookie );
my ( $userid, $cookie, $sessionID, $flags );
my $logout = $query->param('logout.x');
if ( $userid = $ENV{'REMOTE_USER'} ) {
@ -431,7 +430,7 @@ sub checkauth {
close L;
}
if ($userid) {
warn "here $userid";
# warn "here $userid";
if ( $lasttime < time() - $timeout ) {
# timed logout
@ -551,10 +550,14 @@ 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/ ) {
@ -593,7 +596,17 @@ 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;
@ -623,8 +636,16 @@ 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"),

3
C4/Branch.pm

@ -91,8 +91,7 @@ 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;

190
C4/BookShelves.pm → C4/VirtualShelves.pm

@ -1,7 +1,7 @@
# -*- tab-width: 8 -*-
# Please use 8-character tabs for this file (indents are every 4 characters)
package C4::BookShelves;
package C4::VirtualShelves;
# $Id$
@ -33,17 +33,17 @@ $VERSION = do { my @v = '$Revision$' =~ /\d+/g; shift(@v) . "." . join( "_", map
=head1 NAME
C4::BookShelves - Functions for manipulating Koha virtual bookshelves
C4::VirtualShelves - Functions for manipulating Koha virtual virtualshelves
=head1 SYNOPSIS
use C4::BookShelves;
use C4::VirtualShelves;
=head1 DESCRIPTION
This module provides functions for manipulating virtual bookshelves,
including creating and deleting bookshelves, and adding and removing
items to and from bookshelves.
This module provides functions for manipulating virtual virtualshelves,
including creating and deleting virtualshelves, and adding and removing
items to and from virtualshelves.
=head1 FUNCTIONS
@ -69,13 +69,13 @@ my $dbh = C4::Context->dbh;
$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
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 bookshelf for adding a book".
bookshelves of the owner are always selected, whatever the category
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
@ -85,7 +85,7 @@ A string. The name of the shelf.
=item C<$shelfhash-E<gt>{count}>
The number of books on that bookshelf.
The number of virtuals on that virtualshelves.
=back
@ -100,14 +100,14 @@ 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
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 bookshelf.shelfnumber
ORDER BY bookshelf.category, bookshelf.shelfname, borrowers.firstname, borrowers.surname
GROUP BY virtualshelves.shelfnumber
ORDER BY virtualshelves.category, virtualshelves.shelfname, borrowers.firstname, borrowers.surname
);
my $sth = $dbh->prepare($query);
$sth->execute( $owner, $mincategory );
@ -134,10 +134,10 @@ sub GetShelves {
(shelfnumber,shelfname,owner,category) = &GetShelf($shelfnumber);
Looks up information about the contents of virtual bookshelf number
Looks up information about the contents of virtual virtualshelves number
C<$shelfnumber>
Returns the database's information on 'bookshelf' table.
Returns the database's information on 'virtualshelves' table.
=cut
@ -145,7 +145,7 @@ sub GetShelf {
my ($shelfnumber) = @_;
my $query = qq(
SELECT shelfnumber,shelfname,owner,category
FROM bookshelf
FROM virtualshelves
WHERE shelfnumber=?
);
my $sth = $dbh->prepare($query);
@ -157,7 +157,7 @@ sub GetShelf {
$itemlist = &GetShelfContents($shelfnumber);
Looks up information about the contents of virtual bookshelf number
Looks up information about the contents of virtual virtualshelves number
C<$shelfnumber>.
Returns a reference-to-array, whose elements are references-to-hash,
@ -170,23 +170,22 @@ sub GetShelfContents {
my ( $shelfnumber ) = @_;
my @itemlist;
my $query =
" SELECT itemnumber
FROM shelfcontents
" SELECT biblionumber
FROM virtualshelfcontents
WHERE shelfnumber=?
ORDER BY itemnumber
ORDER BY biblionumber
";
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=?"
SELECT biblio.*,biblioitems.* FROM biblio
LEFT JOIN biblioitems on biblio.biblionumber=biblioitems.biblionumber
WHERE biblio.biblionumber=?"
);
while ( my ($itemnumber) = $sth->fetchrow ) {
$sth2->execute($itemnumber);
while ( my ($biblionumber) = $sth->fetchrow ) {
$sth2->execute($biblionumber);
my $item = $sth2->fetchrow_hashref;
$item->{'itemnumber'}=$itemnumber;
$item->{'biblionumber'}=$biblionumber;
push( @itemlist, $item );
}
return ( \@itemlist );
@ -196,11 +195,11 @@ sub GetShelfContents {
$shelfnumber = &AddShelf( $shelfname, $owner, $category);
Creates a new virtual bookshelf with name C<$shelfname>, owner C<$owner> and 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 bookshelf already exist.
* -1 : if this virtualshelves already exist.
* $shelfnumber : if success.
=cut
@ -209,7 +208,7 @@ sub AddShelf {
my ( $shelfname, $owner, $category ) = @_;
my $query = qq(
SELECT *
FROM bookshelf
FROM virtualshelves
WHERE shelfname=? AND owner=?
);
my $sth = $dbh->prepare($query);
@ -219,7 +218,7 @@ sub AddShelf {
}
else {
my $query = qq(
INSERT INTO bookshelf
INSERT INTO virtualshelves
(shelfname,owner,category)
VALUES (?,?,?)
);
@ -232,35 +231,35 @@ sub AddShelf {
=item AddToShelf
&AddToShelf($itemnumber, $shelfnumber);
&AddToShelf($biblionumber, $shelfnumber);
Adds item number C<$itemnumber> to virtual bookshelf number
Adds item number C<$biblionumber> to virtual virtualshelves number
C<$shelfnumber>, unless that item is already on that shelf.
=cut
#'
sub AddToShelf {
my ( $itemnumber, $shelfnumber ) = @_;
return unless $itemnumber;
my ( $biblionumber, $shelfnumber ) = @_;
return unless $biblionumber;
my $query = qq(
SELECT *
FROM shelfcontents
WHERE shelfnumber=? AND itemnumber=?
FROM virtualshelfcontents
WHERE shelfnumber=? AND biblionumber=?
);
my $sth = $dbh->prepare($query);
$sth->execute( $shelfnumber, $itemnumber );
$sth->execute( $shelfnumber, $biblionumber );
unless ( $sth->rows ) {
# already on shelf
my $query = qq(
INSERT INTO shelfcontents
(shelfnumber, itemnumber, flags)
INSERT INTO virtualshelfcontents
(shelfnumber, biblionumber, flags)
VALUES
(?, ?, 0)
);
$sth = $dbh->prepare($query);
$sth->execute( $shelfnumber, $itemnumber );
$sth->execute( $shelfnumber, $biblionumber );
}
}
@ -268,7 +267,7 @@ sub AddToShelf {
&AddToShelfFromBiblio($biblionumber, $shelfnumber)
this function allow to add a book into the shelf number $shelfnumber
this function allow to add a virtual into the shelf number $shelfnumber
from biblionumber.
=cut
@ -277,30 +276,21 @@ 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=?
FROM virtualshelfcontents
WHERE shelfnumber=? AND biblionumber=?
);
$sth = $dbh->prepare($query);
$sth->execute( $shelfnumber, $itemnumber );
my $sth = $dbh->prepare($query);
$sth->execute( $shelfnumber, $biblionumber );
unless ( $sth->rows ) {
# "already on shelf";
my $query =qq(
INSERT INTO shelfcontents
(shelfnumber, itemnumber, flags)
INSERT INTO virtualshelfcontents
(shelfnumber, biblionumber, flags)
VALUES
(?, ?, 0)
);
$sth = $dbh->prepare($query);
$sth->execute( $shelfnumber, $itemnumber );
$sth->execute( $shelfnumber, $biblionumber );
}
}
@ -308,14 +298,14 @@ sub AddToShelfFromBiblio {
ModShelf($shelfnumber, $shelfname, $owner, $category )
Modify the value into bookshelf table with values given on input arg.
Modify the value into virtualshelves table with values given on input arg.
=cut
sub ModShelf {
my ( $shelfnumber, $shelfname, $owner, $category ) = @_;
my $query = qq(
UPDATE bookshelf
UPDATE virtualshelves
SET shelfname=?,owner=?,category=?
WHERE shelfnumber=?
);
@ -327,7 +317,7 @@ sub ModShelf {
($status) = &DelShelf($shelfnumber);
Deletes virtual bookshelf number C<$shelfnumber>. The bookshelf must
Deletes virtual virtualshelves number C<$shelfnumber>. The virtualshelves must
be empty.
Returns a two-element array, where C<$status> is 0 if the operation
@ -354,7 +344,7 @@ sub ShelfPossibleAction {
my ( $user, $shelfnumber, $action ) = @_;
my $query = qq(
SELECT owner,category
FROM bookshelf
FROM virtualshelves
WHERE shelfnumber=?
);
my $sth = $dbh->prepare($query);
@ -367,23 +357,23 @@ sub ShelfPossibleAction {
=item DelFromShelf
&DelFromShelf( $itemnumber, $shelfnumber);
&DelFromShelf( $biblionumber, $shelfnumber);
Removes item number C<$itemnumber> from virtual bookshelf number
C<$shelfnumber>. If the item wasn't on that bookshelf to begin with,
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 ( $itemnumber, $shelfnumber ) = @_;
my ( $biblionumber, $shelfnumber ) = @_;
my $query = qq(
DELETE FROM shelfcontents
WHERE shelfnumber=? AND itemnumber=?
DELETE FROM virtualshelfcontents
WHERE shelfnumber=? AND biblionumber=?
);
my $sth = $dbh->prepare($query);
$sth->execute( $shelfnumber, $itemnumber );
$sth->execute( $shelfnumber, $biblionumber );
}
=head2 DelShelf
@ -397,7 +387,7 @@ sub DelFromShelf {
#'
sub DelShelf {
my ( $shelfnumber ) = @_;
my $sth = $dbh->prepare("DELETE FROM bookshelf WHERE shelfnumber=?");
my $sth = $dbh->prepare("DELETE FROM virtualshelves WHERE shelfnumber=?");
$sth->execute($shelfnumber);
return 0;
}
@ -419,53 +409,3 @@ Koha Developement team <info@koha.org>
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)

1
Makefile.PL

@ -86,6 +86,7 @@ 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,

82
help.pl

@ -1,27 +1,8 @@
#!/usr/bin/perl
# 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 HTML::Template;
use strict;
require Exporter;
use C4::Output; # contains gettemplate
use C4::Output;
use C4::Output; # contains gettemplate
# use C4::Auth;
use C4::Context;
use CGI;
@ -29,46 +10,45 @@ 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
);
return $template;
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;
}

20
installer/kohastructure.sql

@ -447,11 +447,11 @@ CREATE TABLE `biblioitems` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Table structure for table `bookshelf`
-- Table structure for table `virtualshelves`
--
DROP TABLE IF EXISTS `bookshelf`;
CREATE TABLE `bookshelf` (
DROP TABLE IF EXISTS `virtualshelves`;
CREATE TABLE `virtualshelves` (
`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 `shelfcontents`
-- Table structure for table `virtualshelfcontents`
--
DROP TABLE IF EXISTS `shelfcontents`;
CREATE TABLE `shelfcontents` (
DROP TABLE IF EXISTS `virtualshelfcontents`;
CREATE TABLE `virtualshelfcontents` (
`shelfnumber` int(11) NOT NULL default '0',
`itemnumber` int(11) NOT NULL default '0',
`biblionumber` int(11) NOT NULL default '0',
`flags` int(11) default NULL,
`dateadded` timestamp NULL default NULL,
KEY `shelfnumber` (`shelfnumber`),
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
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
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--

2
koha-tmpl/intranet-tmpl/prog/en/about.tmpl

@ -5,7 +5,7 @@
<div id="main">
<div id="mainbloc">
<h1>Data about the current version of Koha for bug reports (or general interest).</h1>
<h1>About Koha</h1>
<table>
<caption>Server information</caption>

11
koha-tmpl/intranet-tmpl/prog/en/auth.tmpl

@ -43,10 +43,17 @@
<p>
<label>Password:<br />
<input type="password" name="password" id="password" class="input" value="" size="20" tabindex="20" /></label>
</p>
</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 class="submit"><input type="submit" value="Login &raquo;" /></p>
</form>
<!-- /TMPL_IF -->
<script type="text/javascript">

4
koha-tmpl/intranet-tmpl/prog/en/help/admin/systempreferences.tmpl

@ -63,11 +63,11 @@
<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 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>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>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 bookshelves" 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 shelves" of favorite library items if this feature is turned on.</li></ul>
<!-- TMPL_INCLUDE name="intranet-bottom.inc" -->

15
koha-tmpl/intranet-tmpl/prog/en/help/nohelp.tmpl

@ -1,8 +1,13 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
<title>Online Help &rsaquo; No Help For This Topic!</title>
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<!-- TMPL_INCLUDE NAME="help-top.inc" -->
<div id="main-compact">
<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="intranet-bottom.inc" -->
<!-- TMPL_INCLUDE NAME="help-bottom.inc" -->

2
koha-tmpl/intranet-tmpl/prog/en/includes/action-catalogue.inc

@ -28,7 +28,7 @@
</div>
<div class="others">
<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;">
<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;">
Add to shelf
</a>
<a href="/cgi-bin/koha/catalogue/detailprint.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">

2
koha-tmpl/intranet-tmpl/prog/en/includes/error-top.inc

@ -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/bookshelves/shelves.pl" class="submenu">Virtual shelves</a>
<a href="/cgi-bin/koha/virtualshelves/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>

5
koha-tmpl/intranet-tmpl/prog/en/includes/menu-bookshelves.inc

@ -1,5 +0,0 @@
<div id="submenu">
<a href="/cgi-bin/koha/bookshelves/shelves.pl">Shelves</a>
</div>
<div id="main">

5
koha-tmpl/intranet-tmpl/prog/en/includes/menu-virtualshelves.inc

@ -0,0 +1,5 @@
<div id="submenu">
<a href="/cgi-bin/koha/virtualshelves/shelves.pl">Virtual Shelves</a>
</div>
<div id="main">

2
koha-tmpl/intranet-tmpl/prog/en/includes/menus.inc

@ -48,7 +48,7 @@
<input type="submit" value=" OK " class="submit" />
</form>
</li>
<li><a href="/cgi-bin/koha/bookshelves/shelves.pl">Virtual Shelves</a></li>
<li><a href="/cgi-bin/koha/virtualshelves/shelves.pl">Virtual Shelves</a></li>
</ul>
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="CAN_user_editcatalogue" -->

7
koha-tmpl/intranet-tmpl/prog/en/tools/export.tmpl

@ -38,7 +38,7 @@
</p>
<p>
<label for="branch">Branch</label>
<label for="branch">Library</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>splitted by a blank. (for example: 100a 200 606)</i>
<i>seperate by a blank. (e.g.: 100a 200 606)</i>
</p>
</fieldset>
<fieldset>
@ -84,6 +84,9 @@
</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" />

12
koha-tmpl/intranet-tmpl/prog/en/bookshelves/addbookbybiblionumber.tmpl → koha-tmpl/intranet-tmpl/prog/en/virtualshelves/addbybiblionumber.tmpl

@ -9,30 +9,32 @@
<!-- /TMPL_IF --> to a virtual shelf
</h1>
<form name="f1" method="post" action="/cgi-bin/koha/bookshelves/addbookbybiblionumber.pl">
<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="CGIbookshelves" -->
<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/bookshelves/addbookbybiblionumber.pl">
<form name="f2" method="POST" action="/cgi-bin/koha/virtualshelves/addbybiblionumber.pl">
<b>Add to a new shelf:</b>
<p>
<label for="newbookshelf">
<label for="newvirtualshelf">
Shelf name:
</label>
<input type="text" name="newbookshelf" id="newbookshelf" size="40" />
<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" />

89
koha-tmpl/intranet-tmpl/prog/en/bookshelves/shelves.tmpl → koha-tmpl/intranet-tmpl/prog/en/virtualshelves/shelves.tmpl

@ -1,26 +1,25 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
<title>Koha &rsaquo; Add to Virtual Shelf</title>
<title>Koha &rsaquo; Virtual Shelves</title>
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<!-- TMPL_INCLUDE NAME="menus.inc" -->
<!-- TMPL_INCLUDE NAME="menu-bookshelves.inc" -->
<!-- TMPL_IF Name="viewshelf" -->
<!-- TMPL_INCLUDE NAME="menu-virtualshelves.inc" -->
<!-- TMPL_IF NAME="viewshelf" -->
<div id="action">
<a class="button" href="/cgi-bin/koha/bookshelves/shelves.pl">Back to virtual Shelves</a>
<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/bookshelves/shelves.pl?op=modif&shelf=<!-- TMPL_VAR Name="shelfnumber" -->">
Modify this shelf</a>
<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>
<h3>Contents of <!-- TMPL_VAR NAME="shelfname" --></h3>
<form class="inline" action="/cgi-bin/koha/bookshelves/shelves.pl" method="post" name="mainform">
<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="viewshelf" value="<!-- TMPL_VAR NAME="shelfnumber" -->" />
<input type="hidden" name="modifyshelfcontents" value="1" />
<tr>
<th>
@ -33,10 +32,10 @@
<th>Author</th>
<th>Call No.</th>
</tr>
<!-- TMPL_LOOP Name="itemsloop" -->
<!-- TMPL_LOOP NAME="itemsloop" -->
<tr<!-- TMPL_IF name="color" --> class="highlight"<!-- /TMPL_IF -->>
<td>
<input type="checkbox" name="REM-<!-- TMPL_VAR Name="itemnumber" -->" />
<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" -->" />
@ -58,7 +57,7 @@
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
</td>
<td><!-- TMPL_VAR Name="author" --></td>
<td><!-- TMPL_VAR NAME="author" --></td>
<td><!-- TMPL_VAR NAME="classification" --></td>
</tr>
<!-- /TMPL_LOOP -->
@ -89,7 +88,7 @@
<!-- TMPL_IF name="manageshelf" -->
<br />
<form action="/cgi-bin/koha/bookshelves/shelves.pl" method="post">
<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>
@ -98,7 +97,7 @@
</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="viewshelf" value="<!-- TMPL_VAR NAME="shelfnumber" -->" />
<input type="hidden" name="modifyshelfcontents" value="1" />
<input type="submit" value="Save" />
</td>
@ -107,16 +106,16 @@
</form>
<!-- /TMPL_IF -->
<!-- TMPL_ELSE -->
<!-- TMPL_IF Name="shelves" -->
<!-- TMPL_IF Name="status1" -->
<p class="error"><!-- TMPL_VAR Name="string1" --></p>
<!-- 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_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">
<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>
@ -125,32 +124,34 @@
<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/bookshelves/shelves.pl" name="mainform">
<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_LOOP NAME="shelvesloop" -->
<!-- TMPL_IF name="canmanage" -->
<tr>
<td>
<input type="checkbox" name="DEL-<!-- TMPL_VAR Name="shelf" -->" />
<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>
<a href="/cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=<!-- TMPL_VAR NAME="shelf" -->"><!-- TMPL_VAR NAME="shelfname" --></a>
</td>
<td>
<!-- TMPL_VAR Name="shelfbookcount" --> item(s)
<!-- TMPL_VAR NAME="shelfvirtualcount" --> item(s)
</td>
</tr>
<!-- /TMPL_IF -->
@ -160,14 +161,14 @@
<!-- /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>
<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>Modify virtual shelf <!-- TMPL_VAR name="shelfname"--></h3>
<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>
@ -181,27 +182,43 @@
<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>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>
<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 -->
<!-- /TMPL_IF -->
<br clear="both" />

2
koha-tmpl/opac-tmpl/prog/en/includes/basket.js

@ -161,7 +161,7 @@ function addMultiple(){
function addSelToShelf() {
var items = document.getElementById('records').value;
document.location = "/cgi-bin/koha/opac-addbookbybiblionumber.pl?biblionumber="+items;
document.location = "/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber="+items;
}
function addSelRecords(valSel) { // function for adding a selection of biblios to the basket

2
koha-tmpl/opac-tmpl/prog/en/opac-ISBDdetail.tmpl

@ -24,7 +24,7 @@
</a>
<!-- TMPL_IF name="virtualshelves" -->
<!-- TMPL_IF NAME="loggedinusername" -->
<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;">
<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;">
Add to My Book List
</a>
<!-- /TMPL_IF -->

2
koha-tmpl/opac-tmpl/prog/en/opac-MARCdetail.tmpl

@ -24,7 +24,7 @@
</a>
<!-- TMPL_IF name="virtualshelves" -->
<!-- TMPL_IF NAME="loggedinusername" -->
<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;">
<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;">
Add to My Book List
</a>
<!-- /TMPL_IF -->

18
koha-tmpl/opac-tmpl/prog/en/opac-addbookbybiblionumber.tmpl → koha-tmpl/opac-tmpl/prog/en/opac-addbybiblionumber.tmpl

@ -1,5 +1,5 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
<!-- TMPL_VAR NAME="LibraryNameTitle" --> Catalog -- Add to My Book List
<!-- TMPL_VAR NAME="LibraryNameTitle" --> Catalog -- Add to My Virtual Shelf
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
@ -19,10 +19,10 @@
</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" -->
<!-- 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" />
@ -30,13 +30,13 @@
<p>...or...</p>
<!-- /TMPL_IF -->
<form name="f2" method="post" action="/cgi-bin/koha/opac-addbookbybiblionumber.pl">
<b>Add to a New Bookshelf:</b>
<form name="f2" method="POST" action="/cgi-bin/koha/opac-addbybiblionumber.pl">
<b>Add to a New Virtualshelf:</b>
<p>
<label for="newbookshelf">
<label for="newvirtualshelf">
Shelf Name:
</label>
<input type="text" name="newbookshelf" id="newbookshelf" size="40" />
<input type="text" name="newvirtualshelf" id="newvirtualshelf" size="40" />
</p>
<label for="category">Category:</label>
<select name="category" id="category">

2
koha-tmpl/opac-tmpl/prog/en/opac-detail.tmpl

@ -24,7 +24,7 @@
</a>
<!-- TMPL_IF name="virtualshelves" -->
<!-- TMPL_IF NAME="loggedinusername" -->
<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;">
<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;">
Add to My Book List
</a>
<!-- /TMPL_IF -->

62
koha-tmpl/opac-tmpl/prog/en/opac-shelves.tmpl

@ -13,25 +13,49 @@
<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>
<!-- 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 -->
<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_ELSE -->
<tr><td colspan="5">This Virtual Shelf is empty.</td></tr>
<!-- /TMPL_IF -->

16
opac/opac-addbookbybiblionumber.pl → opac/opac-addbybiblionumber.pl

@ -1,6 +1,6 @@
#!/usr/bin/perl
#script to provide bookshelf management
#script to provide virtualshelf management
# WARNING: This file uses 4-character tabs!
#
# $Header$
@ -25,7 +25,7 @@
use strict;
use C4::Biblio;
use CGI;
use C4::BookShelves;
use C4::VirtualShelves;
use C4::Circulation;
use C4::Auth;
use C4::Output;
@ -33,19 +33,19 @@ use C4::Output;
my $query = new CGI;
my $biblionumber = $query->param('biblionumber');
my $shelfnumber = $query->param('shelfnumber');
my $newbookshelf = $query->param('newbookshelf');
my $newvirtualshelf = $query->param('newvirtualshelf');
my $category = $query->param('category');
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "opac-addbookbybiblionumber.tmpl",
template_name => "opac-addbybiblionumber.tmpl",
query => $query,
type => "opac",
authnotrequired => 1,
}
);
$shelfnumber = AddShelf( '', $newbookshelf, $loggedinuser, $category ) if $newbookshelf;
$shelfnumber = AddShelf( '', $newvirtualshelf, $loggedinuser, $category ) if $newvirtualshelf;
# to know if we had to add more than one biblio.
my $multiple = 0;
@ -75,9 +75,9 @@ else {
$shelvesloop{$element} = $shelflist->{$element}->{'shelfname'};
}
my $CGIbookshelves;
my $CGIvirtualshelves;
if ( @shelvesloop > 0 ) {
$CGIbookshelves = CGI::scrolling_list (
$CGIvirtualshelves = CGI::scrolling_list (
-name => 'shelfnumber',
-values => \@shelvesloop,
-labels => \%shelvesloop,
@ -110,7 +110,7 @@ else {
}
$template->param (
CGIbookshelves => $CGIbookshelves,
CGIvirtualshelves => $CGIvirtualshelves,
);
output_html_with_http_headers $query, $cookie, $template->output;

2
opac/opac-main.pl

@ -22,7 +22,7 @@ require Exporter;
use CGI;
use C4::Auth; # get_template_and_user
use C4::Output;
use C4::BookShelves;
use C4::VirtualShelves;
use C4::Languages; # getTranslatedLanguages
use C4::Branch; # GetBranches
use C4::Members; # GetMember

20
opac/opac-shelves.pl

@ -25,7 +25,7 @@
=head1 DESCRIPTION
this script is used to script to provide bookshelf management
this script is used to script to provide virtualshelf management
=head1 CGI PARAMETERS
@ -67,10 +67,11 @@
use strict;
use CGI;
use C4::Output;
use C4::BookShelves;
use C4::VirtualShelves;
use C4::Circulation;
use C4::Auth;
use C4::Output;
use C4::Biblio;
my $query = new CGI;
@ -87,13 +88,14 @@ 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( $item->{'itemnumber'}, $shelfnumber );
AddToShelf( $biblio->{'biblionumber'}, $shelfnumber );
foreach ( $query->param ) {
if (/MOD-(\d*)/) {
my $itemnumber = $1;
my $biblionumber = $1;
if ( $query->param('remove') eq "on" ) {
DelFromShelf( $itemnumber, $shelfnumber );
DelFromShelf( $biblionumber, $shelfnumber );
}
}
}
@ -183,7 +185,7 @@ SWITCH: {
$line{'toggle'} = $color;
$line{'shelf'} = $element;
$line{'shelfname'} = $shelflist->{$element}->{'shelfname'};
$line{'shelfbookcount'} = $shelflist->{$element}->{'count'};
$line{'shelfvirtualcount'} = $shelflist->{$element}->{'count'};
push( @shelvesloop, \%line );
}
$template->param(
@ -208,7 +210,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{'shelfbookcount'} = $shelflist->{$element}->{'count'};
$line{'shelfvirtualcount'} = $shelflist->{$element}->{'count'};
$line{'canmanage'} =
ShelfPossibleAction( $loggedinuser, $element, 'manage' );
$line{'firstname'} = $shelflist->{$element}->{'firstname'}
@ -265,13 +267,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
# bookshelves work perfectly with mod_perl and are cleaned.
# virtualshelves 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 bookshelves.
# fixing some bugs on virtualshelves.
#
# Revision 1.8.2.4 2006/12/07 15:42:15 toins
# synching opac & intranet.

18
t/BookShelves.t → t/VirtualShelves.t

@ -1,7 +1,7 @@
#!/usr/bin/perl
#
# This file is a test script for C4::BookShelves.pm
# This file is a test script for C4::VirtualShelves.pm
# Author : Antoine Farnault, antoine@koha-fr.org
#
@ -53,16 +53,16 @@ while(my $biblionumber = $sth->fetchrow){
}
# ---
my $delete_bookshelf = qq/
DELETE FROM bookshelf WHERE 1
my $delete_virtualshelf = qq/
DELETE FROM virtualshelf WHERE 1
/;
my $delete_bookshelfcontent =qq/
my $delete_virtualshelfcontent =qq/
DELETE FROM shelfcontents WHERE 1
/;
my $sth = $dbh->prepare($delete_bookshelf);
my $sth = $dbh->prepare($delete_virtualshelf);
$sth->execute;
my $sth = $dbh->prepare($delete_bookshelfcontent);
my $sth = $dbh->prepare($delete_virtualshelfcontent);
$sth->execute;
# ---
@ -72,9 +72,9 @@ $sth->execute;
#
#----------------------------------------------------------------------#
use C4::BookShelves;
my $version = C4::BookShelves->VERSION;
print "\n----------Testing C4::BookShelves version ".$version."--------\n";
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.

3
tools/export.pl

@ -29,12 +29,13 @@ 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=>'koha.mrc');
-attachment=>$filename);
my $StartingBiblionumber = $query->param("StartingBiblionumber");
my $EndingBiblionumber = $query->param("EndingBiblionumber");

2
updater/updatedatabase

@ -1252,7 +1252,7 @@ my %foreign_keys = (
],
shelfcontents => [
{ key => 'shelfnumber',
foreigntable => 'bookshelf',
foreigntable => 'virtualshelf',
foreignkey => 'shelfnumber',
onUpdate => 'CASCADE',
onDelete => 'CASCADE',

99
bookshelves/addbookbybiblionumber.pl → virtualshelves/addbybiblionumber.pl

@ -1,6 +1,6 @@
#!/usr/bin/perl
#script to provide bookshelf management
#script to provide virtual shelf management
#
#
# Copyright 2000-2002 Katipo Communications
@ -24,11 +24,11 @@
=head1 NAME
addbookbybiblionumber.pl
addbybiblionumber.pl
=head1 DESCRIPTION
This script allow to add a book in a virtual shelf from a biblionumber.
This script allow to add a virtual in a virtual shelf from a biblionumber.
=head1 CGI PARAMETERS
@ -40,9 +40,9 @@
=item shelfnumber
the shelfnumber where to add the book.
the shelfnumber where to add the virtual.
=item newbookshelf
=item newvirtualshelf
if this parameter exists, then it must be equals to the name of the shelf
to add.
@ -59,63 +59,68 @@ use strict;
use C4::Biblio;
use CGI;
use C4::Output;
use C4::BookShelves;
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 $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>";
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);
}
else { # this shelf doesn't already exist.
my ( $bibliocount, @biblios ) = GetBiblio($biblionumber);
my ($shelflist) = GetShelves($loggedinuser,3);
my ($shelflist) = GetShelves( $loggedinuser, 3 );
my @shelvesloop;
my %shelvesloop;
foreach my $element (sort keys %$shelflist) {
push (@shelvesloop, $element);
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 );
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'},
CGIbookshelves => $CGIbookshelves,
intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
intranetstylesheet => C4::Context->preference("intranetstylesheet"),
IntranetNav => C4::Context->preference("IntranetNav"),
);
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;
}
@ -148,7 +153,7 @@ if ($shelfnumber || ($shelfnumber == -1)) { # the shelf already exist.
# 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
# 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".

115
bookshelves/shelves.pl → virtualshelves/shelves.pl

@ -24,7 +24,7 @@
=head1 DESCRIPTION
this script is used to script to provide bookshelf management
this script is used to script to provide virtualshelf management
=head1 CGI PARAMETERS
@ -65,7 +65,7 @@
use strict;
use CGI;
use C4::BookShelves;
use C4::VirtualShelves;
use C4::Biblio;
use C4::Auth;
use C4::Output;
@ -74,7 +74,7 @@ my $query = new CGI;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "bookshelves/shelves.tmpl",
template_name => "virtualshelves/shelves.tmpl",
query => $query,
type => "intranet",
authnotrequired => 0,
@ -86,12 +86,14 @@ 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( $item->{'itemnumber'}, $shelfnumber );
AddToShelf( $biblio->{'biblionumber'}, $shelfnumber );
foreach ( $query->param ) {
if (/REM-(\d*)/) {
my $itemnumber = $1;
DelFromShelf( $itemnumber, $shelfnumber );
my $biblionumber = $1;
DelFromShelf( $biblionumber, $shelfnumber );
}
}
}
@ -124,6 +126,7 @@ SWITCH: {
last SWITCH;
}
if ( $query->param('viewshelf') ) {
#check that the user can view the shelf
my $shelfnumber = $query->param('viewshelf');
if ( ShelfPossibleAction( $loggedinuser, $shelfnumber, 'view' ) ) {
@ -132,8 +135,9 @@ SWITCH: {
shelfname => $shelflist->{$shelfnumber}->{'shelfname'},
shelfnumber => $shelfnumber,
viewshelf => $query->param('viewshelf'),
manageshelf => &ShelfPossibleAction( $loggedinuser, $shelfnumber, 'manage' ),
itemsloop => $items,
manageshelf =>
&ShelfPossibleAction( $loggedinuser, $shelfnumber, 'manage' ),
itemsloop => $items,
);
}
last SWITCH;
@ -154,47 +158,44 @@ SWITCH: {
}
);
}
}
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;
}
}
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,
);
#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;
}
}
($shelflist) =
GetShelves( $loggedinuser, 2 )
; # rebuild shelflist in case a shelf has been added
my $shelflist = GetShelves( $loggedinuser, 2 );
my $color = '';
my @shelvesloop;
my $numberCanManage = 0;
@ -205,22 +206,22 @@ foreach my $element ( sort keys %$shelflist ) {
$line{'toggle'} = $color;
$line{'shelf'} = $element;
$line{'shelfname'} = $shelflist->{$element}->{'shelfname'};
$line{ "category" . $shelflist->{$element}->{'category'} } = 1;
$line{"viewcategory$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{'shelfvirtualcount'} = $shelflist->{$element}->{'count'};
$line{'canmanage'} =
ShelfPossibleAction( $loggedinuser, $element, 'manage' );
$line{'firstname'} = $shelflist->{$element}->{'firstname'}
unless $shelflist->{$element}->{'owner'} eq $loggedinuser;
unless $shelflist->{$element}->{'owner'} eq $loggedinuser;
$line{'surname'} = $shelflist->{$element}->{'surname'}
unless $shelflist->{$element}->{'owner'} eq $loggedinuser;
unless $shelflist->{$element}->{'owner'} eq $loggedinuser;
$numberCanManage++ if $line{'canmanage'};
push( @shelvesloop, \%line );
push( @shelvesloop, \%line );
}
$template->param(
shelvesloop => \@shelvesloop,
numberCanManage => $numberCanManage,
);
@ -266,10 +267,10 @@ sub shelves {
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'};
$line{'toggle'} = $color;
$line{'shelf'} = $element;
$line{'shelfname'} = $shelflist->{$element}->{'shelfname'};
$line{'shelfvirtualcount'} = $shelflist->{$element}->{'count'};
push( @shelvesloop, \%line );
}
$innertemplate->param(
@ -304,13 +305,13 @@ sub shelves {
# - adding syspref: BiblioDefaultView.
#
# Revision 1.9.2.7 2006/12/14 17:22:55 toins
# bookshelves work perfectly with mod_perl and are cleaned.
# 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 bookshelves.
# 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.
Loading…
Cancel
Save