From 5eee338175a2f2bf78290ad4154639a2972077ee Mon Sep 17 00:00:00 2001 From: "terry%mozilla.org" <> Date: Sat, 15 Jan 2000 06:35:24 +0000 Subject: Patch by Ramon Felciano , with many tweaks by me. Added a footer to every page. Add some options to do things like display checkboxes instead of scrolling lists, and a new formatting for email diffs, and show list items capitalized instead of all upper case. --- CGI.pl | 214 ++++++++++++++++++++++++++++++++++++++++++++++-- bug_form.pl | 2 + buglist.cgi | 51 +++++++++++- changepassword.cgi | 6 +- colchange.cgi | 1 + createaccount.cgi | 3 + createattachment.cgi | 3 +- defparams.pl | 35 +++++++- describecomponents.cgi | 3 + describekeywords.cgi | 2 +- doeditparams.cgi | 3 + doeditvotes.cgi | 10 +-- editcomponents.cgi | 2 +- editkeywords.cgi | 2 +- editparams.cgi | 2 + editproducts.cgi | 8 +- editusers.cgi | 2 +- editversions.cgi | 2 +- enter_bug.cgi | 29 +++++-- globals.pl | 12 ++- post_bug.cgi | 4 + process_bug.cgi | 18 +++- processmail | 33 +++++++- query.cgi | 35 ++++---- relogin.cgi | 2 +- reports.cgi | 7 +- sanitycheck.cgi | 1 + show_activity.cgi | 2 + show_bug.cgi | 3 +- showdependencygraph.cgi | 2 +- showdependencytree.cgi | 2 +- showvotes.cgi | 2 +- 32 files changed, 434 insertions(+), 69 deletions(-) diff --git a/CGI.pl b/CGI.pl index 91edd28f1..fb293645b 100644 --- a/CGI.pl +++ b/CGI.pl @@ -190,6 +190,7 @@ sub CheckFormField (\%$;\@) { print "A legal $fieldname was not set; "; print Param("browserbugmessage"); + PutFooter(); exit 0; } } @@ -204,6 +205,7 @@ sub CheckFormFieldDefined (\%$) { if ( !defined $formRef->{$fieldname} ) { print "$fieldname was not defined; "; print Param("browserbugmessage"); + PutFooter(); exit 0; } } @@ -217,6 +219,7 @@ sub CheckPosInt($) { if ( $number !~ /^[1-9][0-9]*$/ ) { print "Received string \"$number\" when postive integer expected; "; print Param("browserbugmessage"); + PutFooter(); exit 0; } } @@ -269,6 +272,142 @@ sub navigation_header { print "     Enter new bug\n" } +sub make_checkboxes { + my ($src,$default,$isregexp,$name) = (@_); + my $last = ""; + my $capitalized = ""; + my $popup = ""; + my $found = 0; + $default = "" if !defined $default; + + if ($src) { + foreach my $item (@$src) { + if ($item eq "-blank-" || $item ne $last) { + if ($item eq "-blank-") { + $item = ""; + } + $last = $item; + $capitalized = $item; + $capitalized =~ tr/A-Z/a-z/; + $capitalized =~ s/^(.?)(.*)/\u$1$2/; + if ($isregexp ? $item =~ $default : $default eq $item) { + $popup .= "$capitalized
"; + $found = 1; + } else { + $popup .= "$capitalized
"; + } + } + } + } + if (!$found && $default ne "") { + $popup .= "$default"; + } + return $popup; +} + +# +# make_selection_widget: creates an HTML selection widget from a list of text strings. +# $groupname is the name of the setting (form value) that this widget will control +# $src is the list of options +# you can specify a $default value which is either a string or a regex pattern to match to +# identify the default value +# $capitalize lets you optionally capitalize the option strings; the default is the value +# of Param("capitalizelists") +# $multiple is 1 if several options are selectable (default), 0 otherwise. +# $size is used for lists to control how many items are shown. The default is 7. A list of +# size 1 becomes a popup menu. +# $preferLists is 1 if selection lists should be used in favor of radio buttons and +# checkboxes, and 0 otherwise. The default is the value of Param("preferlists"). +# +# The actual widget generated depends on the parameter settings: +# +# MULTIPLE PREFERLISTS SIZE RESULT +# 0 (single) 0 =1 Popup Menu (normal for list of size 1) +# 0 (single) 0 >1 Radio buttons +# 0 (single) 1 =1 Popup Menu (normal for list of size 1) +# 0 (single) 1 n>1 List of size n, single selection +# 1 (multi) 0 n/a Check boxes; size ignored +# 1 (multi) 1 n/a List of size n, multiple selection, of size n +# +sub make_selection_widget { + my ($groupname,$src,$default,$isregexp,$multiple, $size, $capitalize, $preferLists) = (@_); + my $last = ""; + my $popup = ""; + my $found = 0; + my $displaytext = ""; + $groupname = "" if !defined $groupname; + $default = "" if !defined $default; + $capitalize = Param("capitalizelists") if !defined $capitalize; + $multiple = 1 if !defined $multiple; + $preferLists = Param("preferlists") if !defined $preferLists; + $size = 7 if !defined $size; + my $type = "LIST"; + if (!$preferLists) { + if ($multiple) { + $type = "CHECKBOX"; + } else { + if ($size > 1) { + $type = "RADIO"; + } + } + } + + if ($type eq "LIST") { + $popup .= "$displaytext
"; + } else { + $popup .= "