From: Andrew Garrett Date: Sat, 6 Dec 2008 00:32:12 +0000 (+0000) Subject: Fix up Configure extension logo setting handling: X-Git-Tag: 1.31.0-rc.0~44110 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%20%22id_auteur=%24id%22%29%20.%20%22?a=commitdiff_plain;h=2f23fbac16729329ca507f45e0afe613e195641f;p=lhc%2Fweb%2Fwiklou.git Fix up Configure extension logo setting handling: * Replace annoying button with an onblur preview and server-side conversion of file names into URLs. --- diff --git a/includes/AjaxFunctions.php b/includes/AjaxFunctions.php index d18f7a975c..1a9adbcaa5 100644 --- a/includes/AjaxFunctions.php +++ b/includes/AjaxFunctions.php @@ -139,5 +139,20 @@ function wfAjaxGetThumbnailUrl( $file, $width, $height ) { $url = $file->getThumbnail( $width, $height )->url; + return $url; +} + +/** + * Called in some places (currently just extensions) + * to get the URL for a given file. + */ +function wfAjaxGetFileUrl( $file ) { + $file = wfFindFile( $file ); + + if ( !$file || !$file->exists() ) + return null; + + $url = $file->getUrl(); + return $url; } \ No newline at end of file diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 06035d4bac..4510a912d4 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3328,7 +3328,7 @@ $wgUseAjax = true; * List of Ajax-callable functions. * Extensions acting as Ajax callbacks must register here */ -$wgAjaxExportList = array( 'wfAjaxGetThumbnailUrl' ); +$wgAjaxExportList = array( 'wfAjaxGetThumbnailUrl', 'wfAjaxGetFileUrl' ); /** * Enable watching/unwatching pages using AJAX.