Bug 188775: Doctor should offer link to download plain text version of diff - Patch by Fr�d�ric Buclin <LpSolit@gmail.com> r=myk

This commit is contained in:
lpsolit%gmail.com 2006-05-10 00:51:04 +00:00
Родитель c1a2bf4b4b
Коммит 03e3b6866f
3 изменённых файлов: 18 добавлений и 4 удалений

Просмотреть файл

@ -368,7 +368,8 @@ sub diff {
my $linebreak = $self->linebreak;
$revision =~ s/\r\n|\r|\n/$linebreak/g;
return Text::Diff::diff \$self->content, \$revision;
return Text::Diff::diff(\$self->content, \$revision,
{FILENAME_A => $self->spec, FILENAME_B => $self->spec});
}
1; # so the require or use succeeds

Просмотреть файл

@ -72,7 +72,8 @@ elsif ($action eq "download" || $action eq "display")
# Generates and returns a diff of changes between the submitted version
# of a page and the version in CVS. Called by the Show Diff panel of the
# Edit page.
elsif ($action eq "diff") { diff() }
elsif ($action eq "diff" || $action eq "download-diff")
{ diff() }
# Returns the content that was submitted to it. Useful for displaying
# the modified version of a page the user downloaded and edited locally,
@ -135,7 +136,15 @@ sub diff {
my $diff = $file->diff(GetContent())
|| "There are no differences between the version in CVS and your revision.";
print $request->header(-type=>"text/plain");
if ($action eq "diff") {
print $request->header(-type=>"text/plain");
}
else {
print $request->header(
-type => "text/html; name=\"" . $file->name . ".diff\"",
-content_disposition => "attachment; filename=\"" . $file->name . ".diff\"",
-content_length => length($file->content) );
}
print $diff;
}

Просмотреть файл

@ -74,7 +74,7 @@
<button id="originalTab" class="tab" type="button" onclick="switchToTab('original');" disabled="disabled">View Original</button>
<button id="modifiedTab" class="tab" type="button" onclick="switchToTab('modified');" disabled="disabled">View Edited</button>
<button id="diffTab" class="tab" type="button" onclick="switchToTab('diff');" disabled="disabled">Show Diff</button>
<button id="saveTab" class="tab" type="button" onclick="switchToTab('save');" disabled="disabled">Save</button>
<button id="saveTab" class="tab" type="button" onclick="switchToTab('save');" disabled="disabled">Save Changes</button>
</div>
<div id="panels">
@ -85,6 +85,10 @@
<div id="modifiedPanel" class="panel"></div>
<iframe id="diffPanel" class="panel" name="diffPanel"></iframe>
<div id="savePanel" class="panel">
<p>
<button type="submit" name="action" value="download-diff">Download Diff</button>
or commit changes to the repository:
</p>
<label for="comment">Comment:</label><br>
<textarea rows="5" cols="80" name="comment"></textarea>
<table id="submit-changes">