6 Debbugs::CGI -- General routines for the cgi scripts
10 use Debbugs::CGI qw(:url :html);
12 html_escape(bug_url($ref,mbox=>'yes',mboxstatus=>'yes'));
16 This module is a replacement for parts of common.pl; subroutines in
17 common.pl will be gradually phased out and replaced with equivalent
18 (or better) functionality here.
28 use vars qw($VERSION $DEBUG %EXPORT_TAGS @EXPORT_OK @EXPORT);
29 use base qw(Exporter);
32 use Debbugs::Common qw();
35 ($VERSION) = q$Revision: 1.3 $ =~ /^Revision:\s+([^\s+])/;
36 $DEBUG = 0 unless defined $DEBUG;
39 %EXPORT_TAGS = (url => [qw(bug_url)],
40 html => [qw(html_escape)],
41 #status => [qw(getbugstatus)],
44 Exporter::export_ok_tags(qw(url html));
45 $EXPORT_TAGS{all} = [@EXPORT_OK];
53 bug_url($ref,mbox=>'yes',mboxstat=>'yes');
55 Constructs urls which point to a specific
62 my $url = Debbugs::URI->new('bugreport.cgi?');
63 $url->query_form(bug=>$ref,%params);
64 return $url->as_string;
71 Escapes html entities by calling HTML::Entities::encode_entities;
78 return HTML::Entities::encode_entities($string)
81 my %common_bugusertags;
83 # =head2 get_bug_status
85 # my $status = getbugstatus($bug_num)
87 # my $status = getbugstatus($bug_num,$bug_index)
92 # sub get_bug_status {
93 # my ($bugnum,$bugidx) = @_;
97 # if (defined $bugidx and exists $bugidx->{$bugnum}) {
98 # %status = %{ $bugidx->{$bugnum} };
99 # $status{pending} = $status{ status };
100 # $status{id} = $bugnum;
104 # my $location = getbuglocation($bugnum, 'summary');
105 # return {} if not length $location;
106 # %status = %{ readbug( $bugnum, $location ) };
107 # $status{id} = $bugnum;
110 # if (defined $common_bugusertags{$bugnum}) {
111 # $status{keywords} = "" unless defined $status{keywords};
112 # $status{keywords} .= " " unless $status{keywords} eq "";
113 # $status{keywords} .= join(" ", @{$common_bugusertags{$bugnum}});
115 # $status{tags} = $status{keywords};
116 # my %tags = map { $_ => 1 } split ' ', $status{tags};
118 # $status{"package"} =~ s/\s*$//;
119 # $status{"package"} = 'unknown' if ($status{"package"} eq '');
120 # $status{"severity"} = 'normal' if ($status{"severity"} eq '');
122 # $status{"pending"} = 'pending';
123 # $status{"pending"} = 'forwarded' if (length($status{"forwarded"}));
124 # $status{"pending"} = 'pending-fixed' if ($tags{pending});
125 # $status{"pending"} = 'fixed' if ($tags{fixed});
128 # if (defined $common_version) {
129 # @versions = ($common_version);
130 # } elsif (defined $common_dist) {
131 # @versions = getversions($status{package}, $common_dist, $common_arch);
134 # # TODO: This should probably be handled further out for efficiency and
135 # # for more ease of distinguishing between pkg= and src= queries.
136 # my @sourceversions = makesourceversions($status{package}, $common_arch,
139 # if (@sourceversions) {
140 # # Resolve bugginess states (we might be looking at multiple
141 # # architectures, say). Found wins, then fixed, then absent.
142 # my $maxbuggy = 'absent';
143 # for my $version (@sourceversions) {
144 # my $buggy = buggyversion($bugnum, $version, \%status);
145 # if ($buggy eq 'found') {
146 # $maxbuggy = 'found';
148 # } elsif ($buggy eq 'fixed' and $maxbuggy ne 'found') {
149 # $maxbuggy = 'fixed';
152 # if ($maxbuggy eq 'absent') {
153 # $status{"pending"} = 'absent';
154 # } elsif ($maxbuggy eq 'fixed') {
155 # $status{"pending"} = 'done';
159 # if (length($status{done}) and
160 # (not @sourceversions or not @{$status{fixed_versions}})) {
161 # $status{"pending"} = 'done';