From 9b1caf15266188a92e1225926c589528816f0786 Mon Sep 17 00:00:00 2001 From: "myk%mozilla.org" Date: Wed, 8 May 2002 01:49:07 +0000 Subject: [PATCH] Fix for bug 142645: Tells users how to get a CVS account or file a bug report and attach their changes. --- webtools/doctor/doctor.cgi | 13 +++++++++++++ webtools/doctor/templates/committed.tmpl | 8 +++++++- webtools/doctor/templates/edit.tmpl | 10 +++++++++- webtools/doctor/templates/review.tmpl | 14 +++++++++++++- 4 files changed, 42 insertions(+), 3 deletions(-) diff --git a/webtools/doctor/doctor.cgi b/webtools/doctor/doctor.cgi index ba4918709556..911b5b7da40d 100755 --- a/webtools/doctor/doctor.cgi +++ b/webtools/doctor/doctor.cgi @@ -101,6 +101,8 @@ my $READ_CVS_SERVER = $config->get('READ_CVS_SERVER'); my $READ_CVS_USERNAME = $config->get('READ_CVS_USERNAME'); my $READ_CVS_PASSWORD = $config->get('READ_CVS_PASSWORD'); my $WRITE_CVS_SERVER = $config->get('WRITE_CVS_SERVER'); +my $WEB_BASE_URI = $config->get('WEB_BASE_URI'); +my $WEB_BASE_PATH = $config->get('WEB_BASE_PATH'); # Store the home directory so we can get back to it after changing directories # in certain places in the code. @@ -152,6 +154,7 @@ if ($action eq "edit") } elsif ($action eq "review") { + ValidateFile(); ReviewChanges(); } elsif ($action eq "commit") @@ -181,6 +184,11 @@ sub ValidateFile my $file = $request->param("file"); + # If the file name starts with the base URI for files on the web site, it is + # a URL and needs to be converted into a file path, which we do by removing + # the base URI and adding the base path. + if ($file =~ s/^\Q$WEB_BASE_URI\E(.*)$/$1/i) { $file = $WEB_BASE_PATH . $file } + # Collapse multiple consecutive slashes (i.e. dir//file.txt) # into a single slash. $file =~ s:/{2,}:/:; @@ -197,6 +205,11 @@ sub ValidateFile # Note: we don't need to validate further because CVS will tell us # whether or not the filename is valid. + + # Construct a URL to the file if possible. + my $url = $file; + if ($url =~ s/^\Q$WEB_BASE_PATH\E(.*)$/$1/i) { $vars->{'file_url'} = $WEB_BASE_URI . $url } + } sub ValidateUsername diff --git a/webtools/doctor/templates/committed.tmpl b/webtools/doctor/templates/committed.tmpl index da2317729bde..f55124b84bba 100644 --- a/webtools/doctor/templates/committed.tmpl +++ b/webtools/doctor/templates/committed.tmpl @@ -27,7 +27,13 @@ - Doctor - committed [% file FILTER html %] + Doctor - committed + [% IF file_url %] + [% file_url FILTER html %] + [% ELSE %] + [% file FILTER html %] + [% END %] + [% IF at_sign %]

diff --git a/webtools/doctor/templates/edit.tmpl b/webtools/doctor/templates/edit.tmpl index 465ad283a4b3..566d81232a30 100644 --- a/webtools/doctor/templates/edit.tmpl +++ b/webtools/doctor/templates/edit.tmpl @@ -27,7 +27,15 @@ - Doctor - edit [% file FILTER html %]

+ Doctor - edit + [% IF file_url %] + [% file_url FILTER html %] + [% ELSE %] + [% file FILTER html %] + [% END %] + + +

diff --git a/webtools/doctor/templates/review.tmpl b/webtools/doctor/templates/review.tmpl index d43c42d753f1..43aa42d3d62b 100644 --- a/webtools/doctor/templates/review.tmpl +++ b/webtools/doctor/templates/review.tmpl @@ -27,7 +27,13 @@ - Doctor - review changes to [% file FILTER html %] + Doctor - review changes to + [% IF file_url %] + [% file_url FILTER html %] + [% ELSE %] + [% file FILTER html %] + [% END %] +

You are making the following changes: @@ -71,6 +77,12 @@ the file some more.

+

+ Don't have a CVS account? + File a bug report about getting one + or file a bug report about your changes, then add them to the report as an attachment. +

+