r39953 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r39952‎ | r39953 | r39954 >
Date:16:39, 25 August 2008
Author:yaron
Status:old
Tags:
Comment:
Improved Javascript and HTML being output in window to avoid Javascript
errors and handle languages that go right-to-left correctly
Modified paths:
  • /trunk/extensions/SemanticForms/specials/SF_UploadWindow.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_UploadWindow.php
@@ -36,6 +36,7 @@
3737 function doSpecialUploadWindow() {
3838 global $wgRequest, $wgOut, $wgUser, $wgServer;
3939 global $wgScript, $wgJsMimeType, $wgStylePath, $wgStyleVersion;
 40+ global $wgContLang, $wgLanguageCode, $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces;
4041
4142 // disable $wgOut - we'll print out the page manually, taking the
4243 // body created by the form, plus the necessary Javascript files,
@@ -43,14 +44,28 @@
4445 $wgOut->disable();
4546 $form = new UploadWindowForm( $wgRequest );
4647 $form->execute();
47 - $user_js = "<script type=\"{$wgJsMimeType}\">" . $wgUser->getSkin()->getUserJs() . "; wgServer=\"{$wgServer}\"; wgScript=\"{$wgScript}\"</script>";
 48+ $sk = $wgUser->getSkin();
 49+ $sk->initPage($wgOut); // need to call this to set skin name correctly
 50+ $user_js = "<script type=\"{$wgJsMimeType}\">" . $sk->getUserJs() . "; wgServer=\"{$wgServer}\"; wgScript=\"{$wgScript}\"</script>";
 51+ $vars_js = Skin::makeGlobalVariablesScript(array('skinname' => $sk->getSkinName()));
4852 $wikibits_include = "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/wikibits.js?$wgStyleVersion\"></script>";
4953 $ajax_include = "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/ajax.js?$wgStyleVersion\"></script>";
5054 $ajaxwatch_include = "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/ajaxwatch.js?$wgStyleVersion\"></script>";
5155 $text = <<<END
52 -<html>
 56+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 57+<html xmlns="{$wgXhtmlDefaultNamespace}"
 58+END;
 59+ foreach($wgXhtmlNamespaces as $tag => $ns) {
 60+ $text .= "xmlns:{$tag}=\"{$ns}\" ";
 61+ }
 62+ $dir = $wgContLang->isRTL() ? "rtl" : "ltr";
 63+ $text .= "xml:lang=\"{$wgLanguageCode}\" lang=\"{$wgLanguageCode}\" dir=\"{$dir}\">";
 64+
 65+ $text .= <<<END
 66+
5367 <head>
5468 $user_js
 69+$vars_js
5570 $wikibits_include
5671 $ajax_include
5772 $ajaxwatch_include
@@ -66,7 +81,7 @@
6782 }
6883
6984 /**
70 - * implements Special:Upload
 85+ * implements Special:UploadWindow
7186 * @addtogroup SpecialPage
7287 */
7388 class UploadWindowForm {

Status & tagging log