cleaning up miscellaneous crap from recent changes

git-svn-id: svn://10.0.0.236/trunk@155947 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
myk%mozilla.org 2004-05-05 00:24:32 +00:00
parent 206c95d574
commit 5d3e811b85
7 changed files with 39 additions and 312 deletions

View File

@ -11,7 +11,6 @@ use Doctor qw(:DEFAULT %CONFIG $template);
use File::Temp qw(tempfile);
# doesn't import "diff" to prevent conflicts with our own
# ??? perhaps that means we should inherit?
use Text::Diff ();
sub new {
@ -83,7 +82,45 @@ sub spec {
# The spec can only be set once.
if (@_ && !$self->{_spec}) {
$self->{_spec} = shift;
$self->_normalize();
# Canonicalize the spec:
# URL -> Spec Conversion
# Remove the absolute URI for files on the web site (if any)
# from the beginning of the path.
if ($CONFIG{WEB_BASE_URI_PATTERN}) {
$self->{_spec} =~ s/^$CONFIG{WEB_BASE_URI_PATTERN}//i;
}
else {
$self->{_spec} =~ s/^\Q$CONFIG{WEB_BASE_URI}\E//i;
}
# Entire Spec Issues
# Collapse multiple consecutive slashes (i.e. dir//file.txt) into one.
$self->{_spec} =~ s:/{2,}:/:;
# Beginning of Spec Issues
# Remove a preceding slash.
$self->{_spec} =~ s:^/::;
# Add the base path of the file in the CVS repository if necessary.
# (i.e. if the user entered a URL or a path based on the URL).
if ($self->{_spec} !~ /^\Q$CONFIG{WEB_BASE_PATH}\E/) {
$self->{_spec} = $CONFIG{WEB_BASE_PATH} . $self->{_spec};
}
# End of Spec Issues
# If the filename (the last name in the path) contains no period,
# it is probably a directory, so add a slash.
if ($self->{_spec} =~ m:^[^\./]+$: || $self->{_spec} =~ m:/[^\./]+$:) { $self->{_spec} .= "/" }
# If the file ends with a forward slash, it is a directory,
# so add the name of the default file.
if ($self->{_spec} =~ m:/$:) { $self->{_spec} .= "index.html" }
}
return $self->{_spec};
}
@ -128,55 +165,6 @@ sub relative_spec {
return $1;
}
# XXX This should just be part of the spec getter/setter.
sub _normalize {
my $self = shift;
# Make sure a path was entered.
$self->{_spec}
|| die("empty file spec");
# URL -> Path Conversion
# Remove the absolute URI for files on the web site (if any)
# from the beginning of the path.
if ($CONFIG{WEB_BASE_URI_PATTERN}) {
$self->{_spec} =~ s/^$CONFIG{WEB_BASE_URI_PATTERN}//i;
}
else {
$self->{_spec} =~ s/^\Q$CONFIG{WEB_BASE_URI}\E//i;
}
# Entire Path Issues
# Collapse multiple consecutive slashes (i.e. dir//file.txt) into one.
$self->{_spec} =~ s:/{2,}:/:;
# Beginning of Path Issues
# Remove a preceding slash.
$self->{_spec} =~ s:^/::;
# Add the base path of the file in the CVS repository if necessary.
# (i.e. if the user entered a URL or a path based on the URL).
if ($self->{_spec} !~ /^\Q$CONFIG{WEB_BASE_PATH}\E/) {
$self->{_spec} = $CONFIG{WEB_BASE_PATH} . $self->{_spec};
}
# End of Path Issues
# If the filename (the last name in the path) contains no period,
# it is probably a directory, so add a slash.
if ($self->{_spec} =~ m:^[^\./]+$: || $self->{_spec} =~ m:/[^\./]+$:) { $self->{_spec} .= "/" }
# If the file ends with a forward slash, it is a directory,
# so add the name of the default file.
if ($self->{_spec} =~ m:/$:) { $self->{_spec} .= "index.html" }
}
sub add {
my $self = shift;
my $content = shift;
@ -229,7 +217,6 @@ sub patch {
sub checkout {
my $self = shift;
# XXX Define a config constant incorporating username, password, and server.
my @args = ("-d",
":pserver:$CONFIG{READ_CVS_USERNAME}:$CONFIG{READ_CVS_PASSWORD}\@$CONFIG{READ_CVS_SERVER}",
"checkout",
@ -291,8 +278,6 @@ sub commit {
return ($rv, $output, $errors);
}
sub diff {
my $self = shift;
my $revision = shift;

View File

@ -222,60 +222,3 @@ function createHiddenField(name, value) {
field.value = value;
return field;
}
/* Not used now that we are using an iframe instead of a div for the diff panel.
function requestDiff() {
var diffPanel = document.getElementById('diffPanel');
diffPanel.innerHTML = "<p>Loading diff. Please wait..<blink>.</blink></p>";
var file = encodeURIComponent(document.getElementById('file').getAttribute('value'));
var version = encodeURIComponent(document.getElementById('version').getAttribute('value'));
var line_endings = encodeURIComponent(document.getElementById('line_endings').getAttribute('value'));
var content = encodeURIComponent(document.getElementById('content').getAttribute('value'));
var request = new XMLHttpRequest();
request.open("POST", "doctor.cgi");
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
request.onload = showDiff;
request.onerror = showDiffError;
request.send("action=" + "review" +
"&amp;raw=" + "1" +
"&amp;file=" + file +
"&amp;version=" + version +
"&amp;line_endings=" + line_endings +
"&amp;content=" + content);
}
function showDiff(evt) {
var request = evt.target;
var diffPanel = document.getElementById('diffPanel');
var pre = document.createElement("pre");
diffPanel.innerHTML = "";
diffPanel.appendChild(pre);
var diff = document.createTextNode(request.responseText);
pre.appendChild(diff);
//diffPanel.innerHTML = "<pre>" + escapeHTML(request.responseText) + "</pre>";
}
function escapeHTML(code) {
if (!code)
return code;
code = code.replace(/</g, "&lt;"); // less than
code = code.replace(/>/g, "&gt;"); // greater than
code = code.replace(/&/g, "&amp;"); // ampersand
code = code.replace(/'/g, "&apos;"); // apostrophe
code = code.replace(/"/g, "&quot;"); // quotation mark
return code;
}
function showDiffError(evt) {
var request = evt.target;
var diff = document.getElementById('diff');
// XXX Grab the error info from the request and display it.
diff.innerHTML = "Sorry, there was an error loading the diff.";
}
*/

View File

@ -41,7 +41,6 @@
[% IF is_new %]
The new file has been committed to the repository.
[% ELSE %]
[%# XXX add some useful links and UI here %]
Your changes have been committed to the repository.
[% END %]
</p>

View File

@ -1,44 +0,0 @@
[%#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is Doctor.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape
# are Copyright (C) 2002 Netscape Communications Corporation.
# All Rights Reserved.
#
# Contributor(s): Myk Melez <myk@mozilla.org>
# %]
<html>
<head>
<title>Doctor - created [% (file_url ? file_url : file) FILTER html %]</title>
</head>
<body bgcolor="white" color="black">
<big><b>Doctor - created <em>
[% IF file.url %]
<a href="[% file.url FILTER html %]">[% file.relative_spec FILTER html %]</a>
[% ELSE %]
[% file.relative_spec FILTER html %]
[% END %]
</em></b></big>
<p>
The new file has been committed to the repository.
</p>
</body>
</html>

View File

@ -50,8 +50,6 @@
<form id="form" method="post" action="doctor.cgi" enctype="multipart/form-data">
<input id="file" type="hidden" name="file" value="[% file.spec FILTER html %]">
<input id="version" type="hidden" name="version" value="[% version %]">
<input id="line_endings" type="hidden" name="line_endings" value="[% line_endings %]">
<input id="is_new" type="hidden" name="is_new" value="[% is_new %]">
<div id="bannernav">
Doctor - [% is_new ? "create" : "edit" %]

View File

@ -1,59 +0,0 @@
[%#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is Doctor.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape
# are Copyright (C) 2002 Netscape Communications Corporation.
# All Rights Reserved.
#
# Contributor(s): Myk Melez <myk@mozilla.org>
# %]
<html>
<head>
<title>Doctor - changes submitted for review</title>
<style>
th { text-align: left; }
</style>
</head>
<body bgcolor="white" color="black">
<big><b>Doctor - changes submitted for review</b></big>
<table>
<tr>
<th>ID</th>
<th>Submitter</th>
<th>Submitted</th>
<th>File</th>
<th>Version</th>
<th>Comment</th>
</tr>
[% FOREACH patch = patches %]
<tr>
<td>[% patch.id %]</td>
<td>[% patch.submitter | html %]</td>
<td>[% patch.submitted | html %]</td>
<td>[% patch.file | html %]</td>
<td>[% patch.version | html %]</td>
<td>[% patch.comment | html %]</td>
<td><a href="doctor.cgi?action=edit&amp;patch_id=[% patch.id %]">Review</a></td>
</tr>
[% END %]
</table>
</body>
</html>

View File

@ -1,95 +0,0 @@
[%#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is Doctor.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape
# are Copyright (C) 2002 Netscape Communications Corporation.
# All Rights Reserved.
#
# Contributor(s): Myk Melez <myk@mozilla.org>
# %]
<html>
<head>
<title>Doctor - review changes to [% (file_url ? file_url : file) FILTER html %]</title>
</head>
<body bgcolor="white" color="black">
<big><b>Doctor - review changes to <em>
[% IF file_url %]
<a href="[% file_url FILTER html %]">[% file_url FILTER html %]</a>
[% ELSE %]
[% file FILTER html %]
[% END %]
</em></b></big>
<p>
You are making the following changes:
</p>
<pre style="background-color: #CCCCCC;">[% diff FILTER html %]</pre>
<form method="post" action="doctor.cgi">
<input type="hidden" name="file" value="[% file FILTER html %]">
<input type="hidden" name="version" value="[% version %]">
<input type="hidden" name="line_endings" value="[% line_endings %]">
<input type="hidden" name="content" value="[% content FILTER html | linebreak %]">
<p>
If these changes are correct, enter your CVS username and password
and a check-in comment, then commit the changes.
</p>
<table>
<tr>
<th style="text-align: right;">Username:</th>
<td><input name="username" size="25"></td>
</tr>
<tr>
<th style="text-align: right;">Password:</th>
<td><input type="password" name="password" size="12"></td>
</tr>
<tr>
<th style="text-align: right;">Check-In Comment:</th>
<td><input name="comment" size="80"></td>
</tr>
<tr>
<th style="text-align: right;">&nbsp;</th>
<td><input type="submit" name="action" value="Commit"></td>
</tr>
</table>
<p>
Otherwise, go back and
<input type="submit" name="action" value="edit"> the file some more.
</p>
<p>
Don't have a CVS account?
Save your changes as a file on your computer,
<a href="http://bugzilla.mozilla.org/enter_bug.cgi?format=__default__&product=mozilla.org&component=webmaster@mozilla.org&version=other&rep_platform=All&op_sys=All&bug_file_loc=[% file_url FILTER html %]&short_desc=%3CSummarize+your+changes+here.%3E&comment=%3CDescribe+your+changes+here+in+more+detail.++After+you+commit+this+bug+report%2C%0D%0Aclick+the+%22Create+Attachment%22+link+to+add+the+changes+to+the+report+as+an%0D%0Aattachment.%3E">file a bug report about them</a>
(assign it to the page's owner if you can figure out who that is
from the <a href="http://www.mozilla.org/webtools/bonsai/cvslog.cgi?file=[% file FILTER html %]">change log</a>),
then attach the changes to the bug report.
If you're interested in contributing regularly to Mozilla documentation,
then <a href="http://bugzilla.mozilla.org/enter_bug.cgi?format=__default__&product=mozilla.org&component=CVS+Account+Request&version=other&rep_platform=All&op_sys=All&short_desc=webtree+CVS+account+for+%3Cyour+name+here%3E+-+%3Cyour+email+address+here%3E&comment=%3CEnter+a+description+of+what+you+would+like+to+edit+on+the+web+site+here.++Note%0D%0Athat+you+need+someone+who+already+has+access+to+vouch+for+you.%3E">file a bug report about getting a CVS account</a>.
</p>
</form>
</body>
</html>