Module: tools
Branch: master
Commit: 1af4892ec58788f17e4ab12b92d3e16fe9fdff56
URL: https://source.winehq.org/git/tools.git/?a=commit;h=1af4892ec58788f17e4ab12…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Thu Mar 31 16:53:07 2022 +0200
testbot/cgi: Add SimpleCollectionPage.
SimpleCollectionPage embeds a single collection block. But unlike
CollectionPage it is only a Page subclass instead of implementing both
the Page and CollectionBlock interfaces. Customizing the collection
block is done by creating a CollectionBlock subclass and passing the
appropriate creator function to the page constructor.
This better separates the page customization aspects (implement a
SimpleCollectionPage subclass) from the collection block ones
(implement a CollectionBlock subclass). Most of the time only the
collection block needs to be customized and SimpleCollectionPage can
be used as is.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/lib/ObjectModel/CGI/CollectionBlock.pm | 5 +
.../lib/ObjectModel/CGI/SimpleCollectionPage.pm | 138 +++++++++++++++++++++
2 files changed, 143 insertions(+)
diff --git a/testbot/lib/ObjectModel/CGI/CollectionBlock.pm b/testbot/lib/ObjectModel/CGI/CollectionBlock.pm
index 9a52f11..200734a 100644
--- a/testbot/lib/ObjectModel/CGI/CollectionBlock.pm
+++ b/testbot/lib/ObjectModel/CGI/CollectionBlock.pm
@@ -91,6 +91,11 @@ sub _initialize($$$)
#my ($self, $Collection, $EnclosingPage) = @_;
}
+sub Create($$@)
+{
+ return ObjectModel::CGI::CollectionBlock->new(@_);
+}
+
sub CallGetDetailsPage($)
{
my ($self) = @_;
diff --git a/testbot/lib/ObjectModel/CGI/SimpleCollectionPage.pm b/testbot/lib/ObjectModel/CGI/SimpleCollectionPage.pm
new file mode 100644
index 0000000..76e4d51
--- /dev/null
+++ b/testbot/lib/ObjectModel/CGI/SimpleCollectionPage.pm
@@ -0,0 +1,138 @@
+# -*- Mode: Perl; perl-indent-level: 2; indent-tabs-mode: nil -*-
+# Base class for list pages
+#
+# Copyright 2009 Ge van Geldorp
+# Copyright 2014, 2017-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
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+
+use strict;
+
+package ObjectModel::CGI::SimpleCollectionPage;
+
+=head1 NAME
+
+ObjectModel::CGI::SimpleCollectionPage - Base class for list pages
+
+A page containing a single collection block.
+
+The SimpleCollectionPage instances have the following properties:
+=over
+=item Collection
+The collection containing the items to be shown in the CollectionBlock widget.
+
+=item CollectionBlock
+The widget showing the items in the specified collection.
+
+=item ActionPerformed
+Set to true if an action was specified and succeeded.
+=back
+
+=cut
+
+use ObjectModel::CGI::Page;
+our @ISA = qw(ObjectModel::CGI::Page);
+
+# Use require to avoid overriding Page::new()
+require ObjectModel::CGI::CollectionBlock;
+
+
+=pod
+=over 12
+
+=item C<_initialize()>
+
+Sets up the new page object.
+
+Parameters:
+=over
+
+=item Request
+=item RequiredRole
+See Page::new().
+
+=item Collection
+This is the collection of items that should be shown in the CollectionBlock
+widget.
+
+=item BlockCreator
+If undefined the page will create an instance of the CollectionBlock class.
+Otherwise it will use this function to create the CollectionBlock widget, thus
+enabling use of a CollectionBlock subclass.
+
+=back
+
+=back
+=cut
+
+sub _initialize($$$$;$)
+{
+ my ($self, $Request, $RequiredRole, $Collection, $BlockCreator) = @_;
+
+ $self->{Collection} = $Collection;
+ $BlockCreator ||= \&ObjectModel::CGI::CollectionBlock::Create;
+ $self->{CollectionBlock} = &$BlockCreator($Collection, $self);
+ $self->SUPER::_initialize($Request, $RequiredRole);
+}
+
+
+#
+# HTML page generation
+#
+
+sub GetTitle($)
+{
+ my ($self) = @_;
+
+ my $Title = ucfirst($self->{Collection}->GetCollectionName());
+ $Title =~ s/([a-z])([A-Z])/$1 $2/g;
+ return $Title;
+}
+
+sub GenerateTitle($)
+{
+ my ($self) = @_;
+
+ my $Title = $self->GetTitle();
+ if ($Title)
+ {
+ print "<h1 id='PageTitle'>", $self->escapeHTML($Title), "</h1>\n";
+ }
+}
+
+sub GenerateBody($)
+{
+ my ($self) = @_;
+
+ print "<div class='CollectionPageBody'>\n";
+ $self->GenerateTitle();
+ print "<div class='Content'>\n";
+ $self->{CollectionBlock}->GenerateList();
+ print "</div>\n";
+ print "</div>\n";
+}
+
+sub GeneratePage($)
+{
+ my ($self) = @_;
+
+ if ($self->GetParam("Action"))
+ {
+ $self->{ActionPerformed} = $self->{CollectionBlock}->OnAction($self->GetParam("Action"));
+ }
+ $self->SUPER::GeneratePage();
+}
+
+1;
Module: tools
Branch: master
Commit: 4e33e66ba1630737c7012e6a34bb2851da4a1faf
URL: https://source.winehq.org/git/tools.git/?a=commit;h=4e33e66ba1630737c7012e6…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Thu Mar 31 16:52:05 2022 +0200
testbot: Fix the spelling of a couple of Perl POD entries.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/lib/ObjectModel/CGI/CollectionBlock.pm | 2 +-
testbot/lib/ObjectModel/CGI/Page.pm | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/testbot/lib/ObjectModel/CGI/CollectionBlock.pm b/testbot/lib/ObjectModel/CGI/CollectionBlock.pm
index 58ece69..9a52f11 100644
--- a/testbot/lib/ObjectModel/CGI/CollectionBlock.pm
+++ b/testbot/lib/ObjectModel/CGI/CollectionBlock.pm
@@ -37,7 +37,7 @@ Also, because this is only one part of a web page, some methods, such as those
dealing with errors, are delegated to the EnclosingPage object which must
implement the ObjectModel::CGI::Page interface.
-Other methods are designed so they can be overriden by the enclosing page as
+Other methods are designed so they can be overridden by the enclosing page as
a way to allow it to modify how the collection block looks or behaves. These
methods can be identified by their CallXxx() trampoline. The override
mechanism works as follows:
diff --git a/testbot/lib/ObjectModel/CGI/Page.pm b/testbot/lib/ObjectModel/CGI/Page.pm
index a791559..0879557 100644
--- a/testbot/lib/ObjectModel/CGI/Page.pm
+++ b/testbot/lib/ObjectModel/CGI/Page.pm
@@ -360,7 +360,7 @@ sub GetPageTitle($)
=head1 C<GetTitle()>
This returns the title for the current web page or email section.
-Note that this may not be valid HTML and thus my need escaping.
+Note that this may not be valid HTML and thus may need escaping.
=back
=cut
Module: tools
Branch: master
Commit: 5de09acdbdcf2ac19d80e31e40a971fde04f7b08
URL: https://source.winehq.org/git/tools.git/?a=commit;h=5de09acdbdcf2ac19d80e31…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Thu Mar 31 16:06:10 2022 +0200
testbot: Remove an unneeded Fcntl import in VM::Run().
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/lib/WineTestBot/VMs.pm | 1 -
1 file changed, 1 deletion(-)
diff --git a/testbot/lib/WineTestBot/VMs.pm b/testbot/lib/WineTestBot/VMs.pm
index f850daa..65f6333 100644
--- a/testbot/lib/WineTestBot/VMs.pm
+++ b/testbot/lib/WineTestBot/VMs.pm
@@ -446,7 +446,6 @@ sub Run($$$$$$)
# So set ChildPid in the parent and synchronize with the child so it only
# execs once this is done.
- use Fcntl;
my ($fd_read, $fd_write);
pipe($fd_read, $fd_write); # For synchronization