[tools 3/3] testbot/web: Use SimpleCollectionPage for the patches page.
Francois Gouget
fgouget at codeweavers.com
Thu Mar 31 09:53:03 CDT 2022
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
testbot/web/PatchesList.pl | 63 ++++++++++++++++++--------------------
1 file changed, 29 insertions(+), 34 deletions(-)
diff --git a/testbot/web/PatchesList.pl b/testbot/web/PatchesList.pl
index 04ca0208c..e756a76ff 100644
--- a/testbot/web/PatchesList.pl
+++ b/testbot/web/PatchesList.pl
@@ -2,6 +2,7 @@
# Patch list page
#
# Copyright 2010 Ge van Geldorp
+# Copyright 2012-2018, 2022 Francois Gouget
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -19,34 +20,25 @@
use strict;
-package PatchesListPage;
+package PatchesBlock;
-use ObjectModel::CGI::CollectionPage;
-our @ISA = qw(ObjectModel::CGI::CollectionPage);
+use ObjectModel::CGI::CollectionBlock;
+our @ISA = qw(ObjectModel::CGI::CollectionBlock);
use URI::Escape;
use WineTestBot::Patches;
-sub _initialize($$$)
+sub Create($$)
{
- my ($self, $Request, $RequiredRole) = @_;
+ my ($Collection, $EnclosingPage) = @_;
- $self->SUPER::_initialize($Request, $RequiredRole, CreatePatches());
- $self->SetRefreshInterval(60);
+ return PatchesBlock->new($Collection, $EnclosingPage);
}
-sub SortKeys($$$)
+sub DisplayProperty($$)
{
- my ($self, $CollectionBlock, $Keys) = @_;
-
- my @SortedKeys = sort { $b <=> $a } @$Keys;
- return \@SortedKeys;
-}
-
-sub DisplayProperty($$$)
-{
- my ($self, $CollectionBlock, $PropertyDescriptor) = @_;
+ my ($self, $PropertyDescriptor) = @_;
my $PropertyName = $PropertyDescriptor->GetName();
@@ -54,21 +46,9 @@ sub DisplayProperty($$$)
$PropertyName eq "FromName" || $PropertyName eq "Subject";
}
-sub GetItemActions($$)
-{
- #my ($self, $CollectionBlock) = @_;
- return [];
-}
-
-sub GetActions($$)
-{
- #my ($self, $CollectionBlock) = @_;
- return [];
-}
-
sub GenerateDataCell($$$$$)
{
- my ($self, $CollectionBlock, $Item, $PropertyDescriptor, $DetailsPage) = @_;
+ my ($self, $Item, $PropertyDescriptor, $DetailsPage) = @_;
my $PropertyName = $PropertyDescriptor->GetName();
if ($PropertyName eq "Disposition" and $Item->Disposition =~ /job ([0-9]+)$/)
@@ -80,14 +60,29 @@ sub GenerateDataCell($$$$$)
}
else
{
- $self->SUPER::GenerateDataCell($CollectionBlock, $Item, $PropertyDescriptor, $DetailsPage);
+ $self->SUPER::GenerateDataCell($Item, $PropertyDescriptor, $DetailsPage);
}
}
+sub GetItemActions($)
+{
+ #my ($self) = @_;
+ return [];
+}
+
+sub GetActions($)
+{
+ #my ($self) = @_;
+ return [];
+}
+
package main;
-my $Request = shift;
+use ObjectModel::CGI::SimpleCollectionPage;
+use WineTestBot::Patches;
-my $PatchesListPage = PatchesListPage->new($Request, "");
-$PatchesListPage->GeneratePage();
+my $Request = shift;
+my $Page = ObjectModel::CGI::SimpleCollectionPage->new($Request, "", CreatePatches(), \&PatchesBlock::Create);
+$Page->SetRefreshInterval(60);
+$Page->GeneratePage();
--
2.30.2
More information about the wine-devel
mailing list