From 0d8e2035234e80f71e442e8aed4fd51b80ca8d40 Mon Sep 17 00:00:00 2001 From: tipaul Date: Wed, 15 Dec 2004 17:28:22 +0000 Subject: [PATCH] adding bookshelf features : * create bookshelf on the fly * modify a bookshelf (this being not finished, will commit the rest soon) --- C4/BookShelves.pm | 23 +++++++--- bookshelves/addbookbybiblionumber.pl | 26 ++++++++--- bookshelves/shelves.pl | 15 +++++++ .../en/bookshelves/addbookbybiblionumber.tmpl | 8 ++++ .../default/en/bookshelves/shelves.tmpl | 45 ++++++++++++++++++- 5 files changed, 104 insertions(+), 13 deletions(-) diff --git a/C4/BookShelves.pm b/C4/BookShelves.pm index 24adc55536..ea92992e34 100755 --- a/C4/BookShelves.pm +++ b/C4/BookShelves.pm @@ -53,7 +53,8 @@ items to and from bookshelves. =cut @ISA = qw(Exporter); -@EXPORT = qw(&GetShelfList &GetShelfContents &AddToShelf &AddToShelfFromBiblio +@EXPORT = qw(&GetShelfList &GetShelfContents &GetShelf + &AddToShelf &AddToShelfFromBiblio &RemoveFromShelf &AddShelf &RemoveShelf &ShelfPossibleAction); @@ -134,6 +135,12 @@ sub GetShelfList { return(\%shelflist); } +sub GetShelf { + my ($shelfnumber) = @_; + my $sth=$dbh->prepare("select shelfnumber,shelfname,owner,category from bookshelf where shelfnumber=?"); + $sth->execute($shelfnumber); + return $sth->fetchrow; +} =item GetShelfContents $itemlist = &GetShelfContents($env, $shelfnumber); @@ -239,11 +246,12 @@ sub AddShelf { my $sth=$dbh->prepare("select * from bookshelf where shelfname=?"); $sth->execute($shelfname); if ($sth->rows) { - return(1, "Shelf \"$shelfname\" already exists"); + return(1, "Shelf \"$shelfname\" already exists"); } else { - $sth=$dbh->prepare("insert into bookshelf (shelfname,owner,category) values (?,?,?)"); - $sth->execute($shelfname,$owner,$category); - return (0, "Done"); + $sth=$dbh->prepare("insert into bookshelf (shelfname,owner,category) values (?,?,?)"); + $sth->execute($shelfname,$owner,$category); + my $shelfnumber = $dbh->{'mysql_insertid'}; + return (0, "Done",$shelfnumber); } } @@ -282,6 +290,11 @@ END { } # module clean-up code here (global destructor) # # $Log$ +# 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) +# # Revision 1.13 2004/03/11 16:06:20 tipaul # *** empty log message *** # diff --git a/bookshelves/addbookbybiblionumber.pl b/bookshelves/addbookbybiblionumber.pl index bf955af7cc..e0426bc55e 100755 --- a/bookshelves/addbookbybiblionumber.pl +++ b/bookshelves/addbookbybiblionumber.pl @@ -36,6 +36,20 @@ my $env; 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}, + }); + +my $x; # for trash +($x,$x,$shelfnumber) = AddShelf('',$newbookshelf,$loggedinuser,$category) if $newbookshelf; + if ($shelfnumber) { &AddToShelfFromBiblio($env, $biblionumber, $shelfnumber); print "Content-Type: text/html\n\n"; @@ -43,13 +57,6 @@ if ($shelfnumber) { } else { my ( $bibliocount, @biblios ) = getbiblio($biblionumber); - my ($template, $loggedinuser, $cookie) - = get_template_and_user({template_name => "bookshelves/addbookbybiblionumber.tmpl", - query => $query, - type => "intranet", - authnotrequired => 0, - flagsrequired => {catalogue => 1}, - }); my ($shelflist) = GetShelfList($loggedinuser,3); my @shelvesloop; @@ -74,6 +81,11 @@ if ($shelfnumber) { output_html_with_http_headers $query, $cookie, $template->output; } # $Log$ +# Revision 1.3 2004/12/15 17:28:22 tipaul +# adding bookshelf features : +# * create bookshelf on the fly +# * modify a bookshelf (this being not finished, will commit the rest soon) +# # Revision 1.2 2004/11/19 16:31:30 tipaul # bugfix for bookshelves not in official CVS # diff --git a/bookshelves/shelves.pl b/bookshelves/shelves.pl index 9fb17071b7..48f66448c7 100755 --- a/bookshelves/shelves.pl +++ b/bookshelves/shelves.pl @@ -66,6 +66,7 @@ $template->param({ loggedinuser => $loggedinuser, headerbackgroundcolor => $headerbackgroundcolor, circbackgroundcolor => $circbackgroundcolor }); SWITCH: { + if ($query->param('op') eq 'modif') { editshelf($query->param('shelf')); last SWITCH;} if ($query->param('viewshelf')) { viewshelf($query->param('viewshelf')); last SWITCH;} if ($query->param('shelves')) { shelves(); last SWITCH;} } @@ -80,6 +81,7 @@ foreach my $element (sort keys %$shelflist) { $line{'color'}= $color; $line{'shelf'}=$element; $line{'shelfname'}=$shelflist->{$element}->{'shelfname'}; + $line{'mine'} = 1 if $shelflist->{$element}->{'owner'} eq $loggedinuser; $line{'shelfbookcount'}=$shelflist->{$element}->{'count'}; $line{'canmanage'} = ShelfPossibleAction($loggedinuser,$element,'manage'); ; @@ -89,6 +91,14 @@ $template->param(shelvesloop => \@shelvesloop); output_html_with_http_headers $query, $cookie, $template->output; +sub editshelf { + my ($shelfnumber) = @_; + my ($shelfnumber,$shelfname,$owner,$category) = GetShelf($shelfnumber); + warn "($shelfnumber,$shelfname,$owner,$category)"; + $template->param(edit => 1, + shelfname => $shelfname, + "category$category" => 1); +} sub shelves { if (my $newshelf=$query->param('addshelf')) { my ($status, $string) = AddShelf($env,$newshelf,$query->param('owner'),$query->param('category')); @@ -157,6 +167,11 @@ sub viewshelf { # # $Log$ +# Revision 1.4 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) +# # Revision 1.3 2004/12/02 16:38:50 tipaul # improvement in book shelves # diff --git a/koha-tmpl/intranet-tmpl/default/en/bookshelves/addbookbybiblionumber.tmpl b/koha-tmpl/intranet-tmpl/default/en/bookshelves/addbookbybiblionumber.tmpl index 5a5bd51dbe..b2a45a8e30 100644 --- a/koha-tmpl/intranet-tmpl/default/en/bookshelves/addbookbybiblionumber.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/bookshelves/addbookbybiblionumber.tmpl @@ -6,6 +6,14 @@

+

or add to a new bookshelf

+

+ +

diff --git a/koha-tmpl/intranet-tmpl/default/en/bookshelves/shelves.tmpl b/koha-tmpl/intranet-tmpl/default/en/bookshelves/shelves.tmpl index 10e650e618..dc0e48f5b0 100644 --- a/koha-tmpl/intranet-tmpl/default/en/bookshelves/shelves.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/bookshelves/shelves.tmpl @@ -110,6 +110,7 @@ Shelf name Content size + Modify @@ -119,8 +120,11 @@ "> - item(s) + item(s) + + ">" class="button catalogue">Modify + @@ -130,5 +134,44 @@ + + +
+
+ +

Modify shelf

+ "> +

">

+

">

+

+ +

+

  • a private bookshelf is managed by you & can be seen only by you.
  • +
  • A public can be seen by everybody, but managed only by you.
  • +
  • A free can be managed by any user.
  • +

    +

    + +

    + +
    +
    + -- 2.39.5