1
#!/usr/bonsaitools/bin/perl -wT
2
# -*- Mode: perl; indent-tabs-mode: nil -*-
4
# The contents of this file are subject to the Mozilla Public
5
# License Version 1.1 (the "License"); you may not use this file
6
# except in compliance with the License. You may obtain a copy of
7
# the License at http://www.mozilla.org/MPL/
9
# Software distributed under the License is distributed on an "AS
10
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
11
# implied. See the License for the specific language governing
12
# rights and limitations under the License.
14
# The Original Code is the Bugzilla Bug Tracking System.
16
# Contributor(s): Jacob Steenhagen <jake@acutex.net>
24
# Shut up "Used Only Once" errors
31
quietly_check_login();
33
###############################################################################
35
###############################################################################
37
$vars->{'username'} = $::COOKIE{'Bugzilla_login'} || '';
39
if (defined $::COOKIE{'Bugzilla_login'}) {
40
SendSQL("SELECT mybugslink, userid, blessgroupset FROM profiles " .
41
"WHERE login_name = " . SqlQuote($::COOKIE{'Bugzilla_login'}));
42
my ($mybugslink, $userid, $blessgroupset) = (FetchSQLData());
43
$vars->{'userid'} = $userid;
44
$vars->{'blessgroupset'} = $blessgroupset;
46
my $mybugstemplate = Param("mybugstemplate");
47
my %substs = ( 'userid' => url_quote($::COOKIE{'Bugzilla_login'}) );
48
$vars->{'mybugsurl'} = PerformSubsts($mybugstemplate, \%substs);
50
SendSQL("SELECT name FROM namedqueries WHERE userid = $userid AND linkinfooter");
51
while (MoreSQLData()) {
52
my ($name) = FetchSQLData();
53
push(@{$vars->{'namedqueries'}}, $name);
57
# This sidebar is currently for use with Mozilla based web browsers.
58
# Internet Explorer 6 is supposed to have a similar feature, but it
59
# most likely won't support XUL ;) When that does come out, this
60
# can be expanded to output normal HTML for IE. Until then, I like
61
# the way Scott's sidebar looks so I'm using that as the base for
63
# http://bugzilla.mozilla.org/show_bug.cgi?id=37339
65
my $useragent = $ENV{HTTP_USER_AGENT};
66
if ($useragent =~ m:Mozilla/([1-9][0-9]*):i && $1 >= 5 && $useragent !~ m/compatible/i) {
67
print "Content-type: application/vnd.mozilla.xul+xml\n\n";
68
# Generate and return the XUL from the appropriate template.
69
$template->process("sidebar.xul.tmpl", $vars)
70
|| ThrowTemplateError($template->error());
72
DisplayError("sidebar.cgi currently only supports Mozilla based web browsers");