Proposal
The external editor daemon described in
EditorDaemonAddOn requires a two-line change to UI/Edit.pm that I usually make manually. But it would seem to be a generally useful thing that would help out other client-side application developers as well. So here's a patch proposal:
Patch
Index: Edit.pm
===================================================================
--- Edit.pm (revision 1573)
+++ Edit.pm (working copy)
@@ -46,7 +46,7 @@
| =skin= | skin to use |
| =topicparent= | what to put in the topic prent meta data |
| =text= | text that will replace the old topic text if a formtemplate is defined (what the heck is this for?) |
-
+| =contenttype= | optional parameter that defines the application type to write into the CGI header. Defaults to text/html. |
=cut
sub edit {
my ( $webName, $topic, $userName, $query ) = @_;
@@ -57,6 +57,7 @@
my $onlyNewTopic = $query->param( 'onlynewtopic' ) || "";
my $formTemplate = $query->param( "formtemplate" ) || "";
my $templateTopic = $query->param( "templatetopic" ) || "";
+ my $cgiAppType = $query->param( 'contenttype' ) || "text/html";
my $skin = $query->param( "skin" );
my $theParent = $query->param( 'topicparent' ) || "";
my $ptext = $query->param( 'text' );
@@ -229,7 +230,7 @@
$tmpl =~ s/%TEXT%/$text/go;
$tmpl =~ s/( ?) *<\/?(nop|noautolink)\/?>\n?/$1/gois; # remove <nop> and <noautolink> tags
- TWiki::writeHeaderFull ( $query, 'edit', 'text/html', length($tmpl) );
+ TWiki::writeHeaderFull ( $query, 'edit', $cgiAppType, length($tmpl) );
print $tmpl;
}
Documentation
Add the following line to the table of "edit" parameters in
TWikiTemplates:
contenttype |
Optional parameter that defines the application type to write into the CGI header. Defaults to text/html. May be used to invoke alternative client applications. |
--
CrawfordCurrie - 15 Jul 2004
This is a small and safe change without side-effects. Is now in
SVN; docs updated.
This is a prime example of a good patch: It is complete with documentation and makes it easy for the
CoreTeam to accept.
--
PeterThoeny - 15 Jul 2004
I changed the parameter name from
apptype to
contenttype to make it consistent with the view script.
Legacy
apptype is still supported but undocumented. Crawford, can we remove that or is it too late?
--
PeterThoeny - 15 Aug 2004