[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha bookshelves/shelves.pl C4/BookShelves.pm k... [rel_2_2]
From: |
Ryan Higgins |
Subject: |
[Koha-cvs] koha bookshelves/shelves.pl C4/BookShelves.pm k... [rel_2_2] |
Date: |
Mon, 05 Mar 2007 17:34:14 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: rel_2_2
Changes by: Ryan Higgins <rych> 07/03/05 17:34:14
Modified files:
bookshelves : shelves.pl
C4 : BookShelves.pm
koha-tmpl/intranet-tmpl/npl/en/bookshelves: shelves.tmpl
Log message:
allow superlibrarian to manage all virtual shelves
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/bookshelves/shelves.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.5.2.5&r2=1.5.2.6
http://cvs.savannah.gnu.org/viewcvs/koha/C4/BookShelves.pm?cvsroot=koha&only_with_tag=rel_2_2&r1=1.15.2.2&r2=1.15.2.3
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/npl/en/bookshelves/shelves.tmpl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.1.2.6&r2=1.1.2.7
Patches:
Index: bookshelves/shelves.pl
===================================================================
RCS file: /sources/koha/koha/bookshelves/shelves.pl,v
retrieving revision 1.5.2.5
retrieving revision 1.5.2.6
diff -u -b -r1.5.2.5 -r1.5.2.6
--- bookshelves/shelves.pl 5 Feb 2006 21:59:21 -0000 1.5.2.5
+++ bookshelves/shelves.pl 5 Mar 2007 17:34:14 -0000 1.5.2.6
@@ -2,7 +2,7 @@
#script to provide bookshelf management
# WARNING: This file uses 4-character tabs!
#
-# $Header: /sources/koha/koha/bookshelves/shelves.pl,v 1.5.2.5 2006/02/05
21:59:21 kados Exp $
+# $Header: /sources/koha/koha/bookshelves/shelves.pl,v 1.5.2.6 2007/03/05
17:34:14 rych Exp $
#
# Copyright 2000-2002 Katipo Communications
#
@@ -46,11 +46,18 @@
flagsrequired =>
{catalogue => 1},
});
+my $dbh=C4::Context->dbh;
+# FIXME - permissions check should be smarter.
+my $flags = C4::Auth::getuserflags($loggedinuser,$dbh);
+my $manageall = $flags->{'superlibrarian'} ;
+my $viewall = $query->param('viewall');
+my $shelfuser = ($viewall) ? -1 : $loggedinuser;
+
if ($query->param('modifyshelfcontents')) {
my $shelfnumber=$query->param('shelfnumber');
my $barcode=$query->param('addbarcode');
my ($item) = getiteminformation($env, 0, $barcode);
- if (ShelfPossibleAction($loggedinuser,$shelfnumber,'manage')) {
+ if ( $manageall ||
ShelfPossibleAction($loggedinuser,$shelfnumber,'manage')) {
AddToShelf($env, $item->{'itemnumber'}, $shelfnumber);
foreach ($query->param) {
if (/REM-(\d*)/) {
@@ -60,9 +67,10 @@
}
}
}
-my ($shelflist) = GetShelfList($loggedinuser,2);
-
+my ($shelflist) = GetShelfList($shelfuser,2);
+# FIXME - Require multipage sort for viewall=1.
$template->param({ loggedinuser => $loggedinuser,
+ viewall => $viewall,
headerbackgroundcolor =>
$headerbackgroundcolor,
circbackgroundcolor =>
$circbackgroundcolor });
SWITCH: {
@@ -89,7 +97,7 @@
}
}
-($shelflist) = GetShelfList($loggedinuser,2); # rebuild shelflist in case a
shelf has been added
+($shelflist) = GetShelfList($shelfuser,2); # rebuild shelflist in case a shelf
has been added
my $color='';
my @shelvesloop;
@@ -102,7 +110,7 @@
$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{'canmanage'} = ( $manageall ||
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;
;
@@ -112,6 +120,7 @@
intranetcolorstylesheet =>
C4::Context->preference("intranetcolorstylesheet"),
intranetstylesheet =>
C4::Context->preference("intranetstylesheet"),
IntranetNav => C4::Context->preference("IntranetNav"),
+ manageall => $manageall,
);
output_html_with_http_headers $query, $cookie, $template->output;
@@ -166,7 +175,7 @@
sub viewshelf {
my $shelfnumber=shift;
#check that the user can view the shelf
- return unless (ShelfPossibleAction($loggedinuser,$shelfnumber,'view'));
+ return unless ( $manageall ||
ShelfPossibleAction($loggedinuser,$shelfnumber,'view'));
my ($itemlist) = GetShelfContents($env, $shelfnumber);
my $item='';
my $color='';
@@ -188,12 +197,15 @@
shelfname =>
$shelflist->{$shelfnumber}->{'shelfname'},
shelfnumber => $shelfnumber,
viewshelf =>
$query->param('viewshelf'),
- manageshelf =>
&ShelfPossibleAction($loggedinuser,$shelfnumber,'manage'),
+ manageshelf => ( $manageall ||
&ShelfPossibleAction($loggedinuser,$shelfnumber,'manage')),
);
}
#
# $Log: shelves.pl,v $
+# Revision 1.5.2.6 2007/03/05 17:34:14 rych
+# allow superlibrarian to manage all virtual shelves
+#
# Revision 1.5.2.5 2006/02/05 21:59:21 kados
# Adds script support for IntranetNav ... see mail to koha-devel for
# details
Index: C4/BookShelves.pm
===================================================================
RCS file: /sources/koha/koha/C4/BookShelves.pm,v
retrieving revision 1.15.2.2
retrieving revision 1.15.2.3
diff -u -b -r1.15.2.2 -r1.15.2.3
--- C4/BookShelves.pm 8 Feb 2007 09:53:02 -0000 1.15.2.2
+++ C4/BookShelves.pm 5 Mar 2007 17:34:14 -0000 1.15.2.3
@@ -3,7 +3,7 @@
package C4::BookShelves;
-# $Id: BookShelves.pm,v 1.15.2.2 2007/02/08 09:53:02 tipaul Exp $
+# $Id: BookShelves.pm,v 1.15.2.3 2007/03/05 17:34:14 rych Exp $
# Copyright 2000-2002 Katipo Communications
#
@@ -90,10 +90,11 @@
=item GetShelfList
- $shelflist = &GetShelfList();
+ $shelflist = &GetShelfList( $owner, $mincategory);
($shelfnumber, $shelfhash) = each %{$shelflist};
-Looks up the virtual bookshelves, and returns a summary. C<$shelflist>
+Looks up the virtual bookshelves, and returns a summary.
+If C<$owner> == -1, gets all shelves. 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:
@@ -119,7 +120,18 @@
my ($owner,$mincategory) = @_;
# 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
- my $sth=$dbh->prepare("SELECT bookshelf.shelfnumber,
bookshelf.shelfname,owner,surname,firstname,category,
+ my $sth;
+ if ($owner == -1) {
+ $sth=$dbh->prepare("SELECT bookshelf.shelfnumber,
bookshelf.shelfname,owner,surname,firstname,category,
+ count(shelfcontents.itemnumber) as count
+ FROM bookshelf
+ LEFT JOIN shelfcontents
+ ON bookshelf.shelfnumber =
shelfcontents.shelfnumber
+ left join borrowers on bookshelf.owner =
borrowers.borrowernumber
+ GROUP BY bookshelf.shelfnumber order by
surname,firstname,shelfname");
+ $sth->execute();
+ } else {
+ $sth=$dbh->prepare("SELECT bookshelf.shelfnumber,
bookshelf.shelfname,owner,surname,firstname,category,
count(shelfcontents.itemnumber) as count
FROM
bookshelf
LEFT JOIN
shelfcontents
@@ -128,6 +140,7 @@
where owner=?
or category>=?
GROUP BY
bookshelf.shelfnumber order by shelfname");
$sth->execute($owner,$mincategory);
+ }
my %shelflist;
while (my ($shelfnumber,
$shelfname,$owner,$surname,$firstname,$category,$count) = $sth->fetchrow) {
$shelflist{$shelfnumber}->{'shelfname'}=$shelfname;
@@ -493,6 +506,9 @@
#
# $Log: BookShelves.pm,v $
+# Revision 1.15.2.3 2007/03/05 17:34:14 rych
+# allow superlibrarian to manage all virtual shelves
+#
# Revision 1.15.2.2 2007/02/08 09:53:02 tipaul
# BUGFIX : 2 errors that are risen during compilation.
# This should NEVER happend. Please check that what you commit works, when you
play with unstable branch it's important, when you play with stable branch,
it's MANDATORY !
Index: koha-tmpl/intranet-tmpl/npl/en/bookshelves/shelves.tmpl
===================================================================
RCS file:
/sources/koha/koha/koha-tmpl/intranet-tmpl/npl/en/bookshelves/Attic/shelves.tmpl,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -b -r1.1.2.6 -r1.1.2.7
--- koha-tmpl/intranet-tmpl/npl/en/bookshelves/shelves.tmpl 24 Aug 2005
16:30:17 -0000 1.1.2.6
+++ koha-tmpl/intranet-tmpl/npl/en/bookshelves/shelves.tmpl 5 Mar 2007
17:34:14 -0000 1.1.2.7
@@ -60,9 +60,21 @@
<input type="hidden" name="shelfnumber" value="<!--
TMPL_VAR NAME="shelfnumber" -->" />
<input type="hidden" name="modifyshelfcontents"
value="1" />
<input type="hidden" name="viewshelf" value="<!--
TMPL_VAR NAME="shelfnumber" -->" />
- <!-- TMPL_IF name="manageshelf" -->
+ <!-- TMPL_IF NAME="itemsloop" --><!-- TMPL_IF
name="manageshelf" -->
<input type="submit" value="Remove Selected
Items" class="submit" />
- <!-- /TMPL_IF --></form><br>
+ <!-- /TMPL_IF --><!-- /TMPL_IF --></form><br>
+<!-- TMPL_UNLESS NAME="itemsloop" -->
+ <div>
+ <form action="/cgi-bin/koha/bookshelves/shelves.pl" method="get">
+ <b>This shelf is empty.</b>
+ <input type="hidden" name="DEL-<!-- TMPL_VAR NAME="shelfnumber" -->" />
+ <input type="hidden" name="shelves" value="1" />
+ <input type="submit" class="submit"
+ value="Delete this Shelf"
+ onclick="return confirmDelete('Are you sure you want to delete
this shelf?')" />
+ </form>
+ </div> <br />
+ <!-- /TMPL_UNLESS -->
<!-- TMPL_IF name="manageshelf" -->
<form action="/cgi-bin/koha/bookshelves/shelves.pl"
method="get">
@@ -120,12 +132,18 @@
<input type="submit" value="Add New
Shelf" class="submit" /></form>
<form action="shelves.pl" method="get"
class="inline"><input type="submit" class="submit" value="Back to Shelf List"
/></form>
<!-- TMPL_ELSE -->
+ <h2>Virtual Shelves</h2>
+ <!-- TMPL_IF NAME="manageall" --><div class="changeview">
+ <!-- TMPL_IF NAME="viewall" --><a class="button"
href="/cgi-bin/koha/bookshelves/shelves.pl" >Manage shelves for self</a>
+ <!-- TMPL_ELSE --><a class="button"
href="/cgi-bin/koha/bookshelves/shelves.pl?viewall=1" >Manage shelves for all
users</a>
+ <!-- /TMPL_IF --></div>
+ <!-- /TMPL_IF -->
<table>
- <caption>Virtual Shelves</caption>
<tr>
<th>Shelf Name</th>
<th>Category</th>
<th>Content size</th>
+ <!-- TMPL_IF NAME="manageall" --><th>Owner</th><!-- /TMPL_IF
-->
<th> </th>
</tr>
<!-- TMPL_LOOP Name="shelvesloop" -->
@@ -149,7 +167,8 @@
<td>
<!-- TMPL_VAR
NAME="shelfbookcount" --> item(s)
</td>
- <td><!-- TMPL_IF name="mine" --><a
href="shelves.pl?op=modif&shelf=<!-- TMPL_VAR NAME="shelf"
-->">Edit</a><!-- TMPL_VAR name="surname" --><!-- TMPL_VAR name="firstname"
--><!-- TMPL_ELSE --> <!-- /TMPL_IF --></td>
+ <!-- TMPL_IF NAME="manageall" --><td><!-- TMPL_VAR
NAME="surname" --> <!-- TMPL_VAR NAME="firstname" --></td><!-- /TMPL_IF -->
+ <td><!-- TMPL_IF name="mine" --><a
href="shelves.pl?op=modif&shelf=<!-- TMPL_VAR NAME="shelf"
-->">Edit</a><!-- TMPL_VAR name="surname" --><!-- TMPL_VAR name="firstname"
--><!-- TMPL_ELSE --><!-- TMPL_IF NAME="canmanage" --><a
href="/cgi-bin/koha/bookshelves/shelves.pl?op=modif&shelf=<!-- TMPL_VAR
NAME="shelf" -->">Modify</a><!-- /TMPL_IF --> <!-- /TMPL_IF --></td>
</tr>
<!-- /TMPL_LOOP -->
</table>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] koha bookshelves/shelves.pl C4/BookShelves.pm k... [rel_2_2],
Ryan Higgins <=