[1/2] testbot/web: Make it possible for web pages to set their page title.
Francois Gouget
fgouget at codeweavers.com
Thu Oct 25 12:14:57 CDT 2012
Previously they could set their header but not the label that appears in the Web browser's tab or title bar.
---
testbot/lib/ObjectModel/CGI/Page.pm | 14 ++++++++++++++
testbot/lib/WineTestBot/CGI/PageBase.pm | 14 +++++++++++++-
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/testbot/lib/ObjectModel/CGI/Page.pm b/testbot/lib/ObjectModel/CGI/Page.pm
index a21ad36..0661519 100644
--- a/testbot/lib/ObjectModel/CGI/Page.pm
+++ b/testbot/lib/ObjectModel/CGI/Page.pm
@@ -102,6 +102,20 @@ sub SetCookies
$self->{PageBase}->SetCookies($self);
}
+sub GetPageTitle
+{
+ my $self = shift;
+
+ return $self->{PageBase}->GetPageTitle($self);
+}
+
+sub GetTitle
+{
+ my $self = shift;
+
+ return undef;
+}
+
sub GenerateHeader
{
my $self = shift;
diff --git a/testbot/lib/WineTestBot/CGI/PageBase.pm b/testbot/lib/WineTestBot/CGI/PageBase.pm
index 141833f..5439ebf 100644
--- a/testbot/lib/WineTestBot/CGI/PageBase.pm
+++ b/testbot/lib/WineTestBot/CGI/PageBase.pm
@@ -195,16 +195,28 @@ sub SetCookies
}
}
+sub GetPageTitle
+{
+ my $self = shift;
+ my $Page = $_[0];
+
+ my $Title = $Page->GetTitle() || "";
+ $Title .= " - " if ($Title ne "");
+ $Title .= "${ProjectName} Test Bot";
+ return $Title;
+}
+
sub GenerateHeader
{
my $self = shift;
my $Page = $_[0];
+ my $Title = $Page->CGI->escapeHTML($Page->GetPageTitle());
print <<EOF;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
- <title>${ProjectName} Test Bot</title>
+ <title>$Title</title>
<link rel='icon' href='/${ProjectName}FavIcon.png' type='image/png'>
<link rel='shortcut icon' href='/${ProjectName}FavIcon.png' type='image/png'>
<link rel='stylesheet' href='/${ProjectName}TestBot.css' type='text/css' media='screen'>
--
1.7.10.4
More information about the wine-patches
mailing list