From 939b0a8e552f8e472fff16eb9d6ba752c179da93 Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Sat, 23 Feb 2008 08:01:00 +1300 Subject: [PATCH] Shelves - fixup display, in particular intranet side Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- C4/VirtualShelves.pm | 4 ++-- C4/VirtualShelves/Page.pm | 14 +++++++++----- .../prog/en/modules/virtualshelves/shelves.tmpl | 17 +++++++++-------- .../opac-tmpl/prog/en/modules/opac-shelves.tmpl | 15 ++++++++++++--- 4 files changed, 32 insertions(+), 18 deletions(-) diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm index 159881cff5..58430c379c 100644 --- a/C4/VirtualShelves.pm +++ b/C4/VirtualShelves.pm @@ -172,7 +172,7 @@ sub GetShelvesSummary { =item GetShelf - (shelfnumber,shelfname,owner,category) = &GetShelf($shelfnumber); + (shelfnumber,shelfname,owner,category,sortfield) = &GetShelf($shelfnumber); Looks up information about the contents of virtual virtualshelves number C<$shelfnumber> @@ -184,7 +184,7 @@ Returns the database's information on 'virtualshelves' table. sub GetShelf { my ($shelfnumber) = @_; my $query = qq( - SELECT shelfnumber,shelfname,owner,category,sortfield + SELECT shelfnumber, shelfname, owner, category, sortfield FROM virtualshelves WHERE shelfnumber=? ); diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm index 8aca40921f..fbfb4bf1c4 100755 --- a/C4/VirtualShelves/Page.pm +++ b/C4/VirtualShelves/Page.pm @@ -27,6 +27,7 @@ use C4::VirtualShelves qw/:DEFAULT GetShelvesSummary/; use C4::Biblio; use C4::Items; use C4::Auth qw/get_session/; +use C4::Members; use C4::Output; use Exporter; @@ -209,26 +210,29 @@ SWITCH: { # rebuild shelflist in case a shelf has been added # $shelflist = GetShelves( $loggedinuser, 2 ); $showadd and $template->param(showadd => 1); -my $i = 0; my @shelvesloop; my @shelveslooppriv; my $numberCanManage = 0; foreach my $element (sort { lc($shelflist->{$a}->{'shelfname'}) cmp lc($shelflist->{$b}->{'shelfname'}) } keys %$shelflist) { my %line; - (++$i % 2) and $shelflist->{$element}->{toggle} = 1; # $line{'toggle'} = $i; $shelflist->{$element}->{shelf} = $element; my $category = $shelflist->{$element}->{'category'}; + my $owner = $shelflist->{$element}->{ 'owner' }; my $canmanage = ShelfPossibleAction( $loggedinuser, $element, 'manage' ); $shelflist->{$element}->{"viewcategory$category"} = 1; $shelflist->{$element}->{canmanage} = $canmanage; - if ($shelflist->{$element}->{'owner'} eq $loggedinuser) { + if ($owner eq $loggedinuser or $canmanage) { $shelflist->{$element}->{'mine'} = 1; - } - $numberCanManage++ if $canmanage; + } + my $member = GetMember($owner,'borrowernumber'); + $shelflist->{$element}->{ownername} = $member->{firstname} . " " . $member->{surname}; + $numberCanManage++ if $canmanage; # possibly outmoded if ($shelflist->{$element}->{'category'} eq '1') { + (scalar(@shelveslooppriv) % 2) and $shelflist->{$element}->{toggle} = 1; push (@shelveslooppriv, $shelflist->{$element}); } else { + (scalar(@shelvesloop) % 2) and $shelflist->{$element}->{toggle} = 1; push (@shelvesloop, $shelflist->{$element}); } } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tmpl index 0d9e5df8f2..f27cd01510 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tmpl @@ -31,8 +31,8 @@ $(document).ready(function(){ } } /** - * this function checks all checkbox - * or uncheck all if there are already checked. + * This function checks all checkboxes if all are empty, + * or unchecks all if any already checked. */ function CheckAll(){ var checkboxes = document.getElementsByTagName('input'); @@ -45,7 +45,7 @@ $(document).ready(function(){ } } /** - * this function return true if all checkbox are checked + * This function returns true if ALL checkboxes are checked */ function areAllChecked(){ var checkboxes = document.getElementsByTagName('input'); @@ -232,9 +232,9 @@ $(document).ready(function(){ " /> - Edit List + Edit List
    -
  1. " />
  2. +
  3. " />
  4. " /> @@ -300,7 +302,6 @@ $(document).ready(function(){ -   diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl index eb777cada7..8232d05feb 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl @@ -153,13 +153,17 @@ - + +
    List NameContentsSort by 
    List NameContentsSort byType 
    "> item(s) Private + Public + Open +
    @@ -197,11 +201,16 @@ - + - + + +
    List NameContents
    List NameContentsType
    "> item(s)
    item(s)Private + Public + Open +
    -- 2.39.5