* @package MediaWiki
*
* Support for external editors to modify both text and files
- * in external application. It works as follows: MediaWiki
- * sends a meta-file with the MIME type 'application/external-editor'
+ * in external applications. It works as follows: MediaWiki
+ * sends a meta-file with the MIME type 'application/x-external-editor'
* to the client. The user has to associate that MIME type with
* a helper application (a reference implementation in Perl
* can be found in extensions/ee), which will launch the editor,
}
function edit() {
- global $wgUser, $wgOut, $wgScript, $wgServer;
+ global $wgUser, $wgOut, $wgScript, $wgScriptPath, $wgServer,
+ $wgLang;
$wgOut->disable();
$name=$this->mTitle->getText();
$pos=strrpos($name,".")+1;
- header ( "Content-type: application/external-editor; charset=".$this->mCharset );
- if(!isset($this->mMode)) {
+ header ( "Content-type: application/x-external-editor; charset=".$this->mCharset );
+
+ # $type can be "Edit text", "Edit file" or "Diff text" at the moment
+ # See the protocol specifications at [[m:Help:External editors/Tech]] for
+ # details.
+ if(!isset($this->mMode)) {
$type="Edit text";
$url=$this->mTitle->getFullURL("action=edit&internaledit=true");
# *.wiki file extension is used by some editors for syntax
$extension="wiki";
} elseif($this->mMode=="file") {
$type="Edit file";
- $url=$wgServer . Image::newFromTitle( $this->mTitle )->getURL();
+ $image = Image::newFromTitle( $this->mTitle );
+ $img_url = $image->getURL();
+ if(strpos($img_url,"://")) {
+ $url = $img_url;
+ } else {
+ $url = $wgServer . $img_url;
+ }
$extension=substr($name, $pos);
- }
- $control=
-"
+ }
+ $special=$wgLang->getNsText(NS_SPECIAL);
+ $control = <<<CONTROL
[Process]
Type=$type
Engine=MediaWiki
Script={$wgServer}{$wgScript}
+Server={$wgServer}
+Path={$wgScriptPath}
+Special namespace=$special
[File]
Extension=$extension
-URL=$url";
+URL=$url
+CONTROL;
echo $control;
-
-
}
}
?>