MediaWiki r8895 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r8894‎ | r8895 (on ViewVC)‎ | r8896 >
Date:21:00, 5 May 2005
Author:avar
Status:old
Tags:
Comment:
* (bug 2064) Configurable JavaScript mimetype with $wgJsMimeType
Modified paths:

Diff [purge]

Index: trunk/phase3/skins/Standard.php
@@ -21,11 +21,11 @@
2222 *
2323 */
2424 function getHeadScripts() {
25 - global $wgStylePath;
 25+ global $wgStylePath, $wgJsMimeType;
2626
2727 $s = parent::getHeadScripts();
2828 if ( 3 == $this->qbSetting() ) { # Floating left
29 - $s .= "<script language='javascript' type='text/javascript' " .
 29+ $s .= "<script language='javascript' type='$wgJsMimeType' " .
3030 "src='{$wgStylePath}/common/sticky.js'></script>\n";
3131 }
3232 return $s;
Index: trunk/phase3/skins/disabled/Amethyst.pt
@@ -7,13 +7,13 @@
88 <style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "${stylepath}/${stylename}/main.css"; /*]]>*/</style>
99 <link rel="stylesheet" type="text/css" media="print" href="${stylepath}/common/commonPrint.css" />
1010 <!--[if IE]><style type="text/css" media="all">@import "${stylepath}/${stylename}/IEFixes.css";</style>
11 - <script type="text/javascript" src="${stylepath}/common/IEFixes.js"></script>
 11+ <script type="${jsmimetype}" src="${stylepath}/common/IEFixes.js"></script>
1212 <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
13 - <script tal:condition="jsvarurl" type="text/javascript" tal:attributes="src jsvarurl"></script>
14 - <script type="text/javascript" src="${stylepath}/common/wikibits.js"></script>
 13+ <script tal:condition="jsvarurl" type="${jsmimetype}" tal:attributes="src jsvarurl"></script>
 14+ <script type="${jsmimetype}" src="${stylepath}/common/wikibits.js"></script>
1515 <style tal:condition="usercss" type="text/css">/*<![CDATA[*/ ${usercss} /*]]>*/</style>
16 - <script tal:condition="userjs" type="text/javascript" tal:attributes="src userjs"></script><script
17 - tal:condition="userjsprev" type="text/javascript">/*<![CDATA[*/${userjsprev}/*]]>*/</script>
 16+ <script tal:condition="userjs" type="${jsmimetype}" tal:attributes="src userjs"></script><script
 17+ tal:condition="userjsprev" type="${jsmimetype}">/*<![CDATA[*/${userjsprev}/*]]>*/</script>
1818 </head>
1919 <body tal:attributes="ondblclick body-ondblclick|default; class nsclass|default">
2020 <div id="globalWrapper">
@@ -59,7 +59,7 @@
6060 <div class="portlet" id="p-logo">
6161 <a style="background-image: url(${logopath});" href="${nav_urls/mainpage/href}" i18n:attributes="title string:mainpage"></a>
6262 </div>
63 - <script type="text/javascript"> if (window.isMSIE55) fixalpha(); </script>
 63+ <script type="${jsmimetype}"> if (window.isMSIE55) fixalpha(); </script>
6464 <div class="portlet" id="p-nav">
6565 <h5 i18n:translate="string:navigation">Navigation</h5>
6666 <div class="pBody">
Index: trunk/phase3/skins/disabled/HTMLDump.php
@@ -105,10 +105,10 @@
106106 <!--[if lt IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE50Fixes.css";</style><![endif]-->
107107 <!--[if IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE55Fixes.css";</style><![endif]-->
108108 <!--[if IE 6]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE60Fixes.css";</style><![endif]-->
109 - <!--[if IE]><script type="text/javascript" src="<?php $this->text('stylepath') ?>/common/IEFixes.js"></script>
 109+ <!--[if IE]><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath') ?>/common/IEFixes.js"></script>
110110 <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
111 - <?php if($this->data['jsvarurl' ]) { ?><script type="text/javascript" src="<?php $this->text('jsvarurl' ) ?>"></script><?php } ?>
112 - <script type="text/javascript" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js"></script>
 111+ <?php if($this->data['jsvarurl' ]) { ?><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl' ) ?>"></script><?php } ?>
 112+ <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js"></script>
113113 </head>
114114 <body
115115 <?php if($this->data['nsclass' ]) { ?>class="<?php $this->text('nsclass') ?>"<?php } ?>>
@@ -148,7 +148,7 @@
149149 href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"
150150 title="<?php $this->msg('mainpage') ?>"></a>
151151 </div>
152 - <script type="text/javascript"> if (window.isMSIE55) fixalpha(); </script>
 152+ <script type="<?php $this->text('jsmimetype') ?>"> if (window.isMSIE55) fixalpha(); </script>
153153 <div class="portlet" id="p-nav">
154154 <h5><?php $this->msg('navigation') ?></h5>
155155 <div class="pBody">
Index: trunk/phase3/skins/disabled/Chick.pt
@@ -5,11 +5,11 @@
66 <div tal:replace="structure headlinks"></div>
77 <title tal:content="pagetitle">Exciting xhtml slimfast</title>
88 <style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "${stylepath}/${stylename}/main.css"; /*]]>*/</style>
9 - <script tal:condition="jsvarurl" type="text/javascript" tal:attributes="src jsvarurl"></script>
10 - <script type="text/javascript" src="${stylepath}/common/wikibits.js"></script>
 9+ <script tal:condition="jsvarurl" type="${jsmimetype}" tal:attributes="src jsvarurl"></script>
 10+ <script type="${jsmimetype}" src="${stylepath}/common/wikibits.js"></script>
1111 <style tal:condition="usercss" tal:content="structure usercss" type="text/css"></style>
12 - <script tal:condition="userjs" type="text/javascript" tal:attributes="src userjs"></script><script
13 - tal:condition="userjsprev" tal:content="structure userjsprev" type="text/javascript"></script>
 12+ <script tal:condition="userjs" type="${jsmimetype}" tal:attributes="src userjs"></script><script
 13+ tal:condition="userjsprev" tal:content="structure userjsprev" type="${jsmimetype}"></script>
1414 </head>
1515 <body>
1616 <a name="top"></a>
Index: trunk/phase3/skins/disabled/MonoBook.pt
@@ -9,13 +9,13 @@
1010 <!--[if lt IE 5.5000]><style type="text/css"> @import "${stylepath}/${stylename}/IE50Fixes.css"; </style><![endif]-->
1111 <!--[if IE 5.5000]><style type="text/css"> @import "${stylepath}/${stylename}/IE55Fixes.css"; </style><![endif]-->
1212 <!--[if IE 6]><style type="text/css"> @import "${stylepath}/${stylename}/IE60Fixes.css"; </style><![endif]-->
13 - <!--[if IE]><script type="text/javascript" src="${stylepath}/common/IEFixes.js"></script>
 13+ <!--[if IE]><script type="${jsmimetype}" src="${stylepath}/common/IEFixes.js"></script>
1414 <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
15 - <script tal:condition="jsvarurl" type="text/javascript" tal:attributes="src jsvarurl"></script>
16 - <script type="text/javascript" src="${stylepath}/common/wikibits.js"></script>
 15+ <script tal:condition="jsvarurl" type="${jsmimetype}" tal:attributes="src jsvarurl"></script>
 16+ <script type="${jsmimetype}" src="${stylepath}/common/wikibits.js"></script>
1717 <style tal:condition="usercss" tal:content="structure usercss" type="text/css"></style>
18 - <script tal:condition="userjs" type="text/javascript" tal:attributes="src userjs"></script><script
19 - tal:condition="userjsprev" tal:content="structure userjsprev" type="text/javascript"></script>
 18+ <script tal:condition="userjs" type="${jsmimetype}" tal:attributes="src userjs"></script><script
 19+ tal:condition="userjsprev" tal:content="structure userjsprev" type="${jsmimetype}"></script>
2020 </head>
2121 <body tal:attributes="ondblclick body_ondblclick|default; class nsclass|default">
2222 <div id="globalWrapper">
@@ -61,7 +61,7 @@
6262 <div class="portlet" id="p-logo">
6363 <a style="background-image: url(${logopath});" href="${nav_urls/mainpage/href}" i18n:attributes="title string:mainpage"></a>
6464 </div>
65 - <script type="text/javascript"> if (window.isMSIE55) fixalpha(); </script>
 65+ <script type="${jsmimetype}"> if (window.isMSIE55) fixalpha(); </script>
6666 <div class="portlet" id="p-nav">
6767 <h5 i18n:translate="string:navigation">Navigation</h5>
6868 <div class="pBody">
Index: trunk/phase3/skins/disabled/WikimediaWiki.pt
@@ -7,13 +7,13 @@
88 <style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "${stylepath}/${stylename}/main.css"; /*]]>*/</style>
99 <link rel="stylesheet" type="text/css" media="print" href="${stylepath}/common/commonPrint.css" />
1010 <!--[if IE]><style type="text/css" media="all">@import "${stylepath}/${stylename}/common/IEFixes.css";</style>
11 - <script type="text/javascript" src="${stylepath}/IEFixes.js"></script>
 11+ <script type="${jsmimetype}" src="${stylepath}/IEFixes.js"></script>
1212 <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
13 - <script tal:condition="jsvarurl" type="text/javascript" tal:attributes="src jsvarurl"></script>
14 - <script type="text/javascript" src="${stylepath}/common/wikibits.js"></script>
 13+ <script tal:condition="jsvarurl" type="${jsmimetype}" tal:attributes="src jsvarurl"></script>
 14+ <script type="${jsmimetype}" src="${stylepath}/common/wikibits.js"></script>
1515 <style tal:condition="usercss" type="text/css">/*<![CDATA[*/ ${usercss} /*]]>*/</style>
16 - <script tal:condition="userjs" type="text/javascript" tal:attributes="src userjs"></script><script
17 - tal:condition="userjsprev" type="text/javascript">/*<![CDATA[*/${userjsprev}/*]]>*/</script>
 16+ <script tal:condition="userjs" type="${jsmimetype}" tal:attributes="src userjs"></script><script
 17+ tal:condition="userjsprev" type="${jsmimetype}">/*<![CDATA[*/${userjsprev}/*]]>*/</script>
1818 </head>
1919 <body tal:attributes="ondblclick body-ondblclick|default; class nsclass|default">
2020 <div id="globalWrapper">
@@ -59,7 +59,7 @@
6060 <div class="portlet" id="p-logo">
6161 <a style="background-image: url(${logopath});" href="${nav_urls/mainpage/href}" i18n:attributes="title string:mainpage"></a>
6262 </div>
63 - <script type="text/javascript"> if (window.isMSIE55) fixalpha(); </script>
 63+ <script type="${jsmimetype}"> if (window.isMSIE55) fixalpha(); </script>
6464 <div class="portlet" id="p-nav">
6565 <h5 i18n:translate="string:navigation">Navigation</h5>
6666 <div class="pBody">
Index: trunk/phase3/skins/MonoBook.php
@@ -61,13 +61,13 @@
6262 <!--[if lt IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE50Fixes.css";</style><![endif]-->
6363 <!--[if IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE55Fixes.css";</style><![endif]-->
6464 <!--[if IE 6]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE60Fixes.css";</style><![endif]-->
65 - <!--[if IE]><script type="text/javascript" src="<?php $this->text('stylepath') ?>/common/IEFixes.js"></script>
 65+ <!--[if IE]><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath') ?>/common/IEFixes.js"></script>
6666 <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
67 - <?php if($this->data['jsvarurl' ]) { ?><script type="text/javascript" src="<?php $this->text('jsvarurl' ) ?>"></script><?php } ?>
68 - <script type="text/javascript" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js"></script>
 67+ <?php if($this->data['jsvarurl' ]) { ?><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl' ) ?>"></script><?php } ?>
 68+ <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js"></script>
6969 <?php if($this->data['usercss' ]) { ?><style type="text/css"><?php $this->html('usercss' ) ?></style><?php } ?>
70 - <?php if($this->data['userjs' ]) { ?><script type="text/javascript" src="<?php $this->text('userjs' ) ?>"></script><?php } ?>
71 - <?php if($this->data['userjsprev']) { ?><script type="text/javascript"><?php $this->html('userjsprev') ?></script><?php } ?>
 70+ <?php if($this->data['userjs' ]) { ?><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('userjs' ) ?>"></script><?php } ?>
 71+ <?php if($this->data['userjsprev']) { ?><script type="<?php $this->text('jsmimetype') ?>"><?php $this->html('userjsprev') ?></script><?php } ?>
7272 </head>
7373 <body <?php if($this->data['body_ondblclick']) { ?>ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
7474 <?php if($this->data['body_onload' ]) { ?>onload="<?php $this->text('body_onload') ?>"<?php } ?>
@@ -122,7 +122,7 @@
123123 href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"
124124 title="<?php $this->msg('mainpage') ?>"></a>
125125 </div>
126 - <script type="text/javascript"> if (window.isMSIE55) fixalpha(); </script>
 126+ <script type="<?php $this->text('jsmimetype') ?>"> if (window.isMSIE55) fixalpha(); </script>
127127 <div class="portlet" id="p-nav">
128128 <h5><?php $this->msg('navigation') ?></h5>
129129 <div class="pBody">
Index: trunk/phase3/includes/Linker.php
@@ -718,11 +718,12 @@
719719
720720 /** @todo document */
721721 function tocList($toc) {
 722+ global $wgJsMimeType;
722723 return "<table id='toc' class='toc'><tr><td>"
723724 . "<div id='toctitle'><h2>" . wfMsgForContent('toc') . "</h2></div>\n"
724725 . $toc
725726 . "</ul>\n</td></tr></table>\n"
726 - . '<script type="text/javascript">'
 727+ . '<script type="'.$wgJsMimeType.'">'
727728 . ' if (window.showTocToggle) {'
728729 . ' var tocShowText = "' . wfEscapeJsString( wfMsgForContent('showtoc') ) . '";'
729730 . ' var tocHideText = "' . wfEscapeJsString( wfMsgForContent('hidetoc') ) . '";'
Index: trunk/phase3/includes/EditPage.php
@@ -628,7 +628,8 @@
629629 * it will fall through to the normal form submission method.
630630 */
631631 if( $wgLivePreview ) {
632 - $wgOut->addHTML( '<script type="text/javascript" src="' .
 632+ global $wgJsMimeType;
 633+ $wgOut->addHTML( '<script type="'.$wgJsMimeType.'" src="' .
633634 htmlspecialchars( $wgStylePath . '/common/preview.js' ) .
634635 '"></script>' . "\n" );
635636 $liveAction = $wgTitle->getLocalUrl( 'action=submit&wpPreview=true&live=true' );
@@ -923,7 +924,7 @@
924925 * The necessary JavaScript code can be found in style/wikibits.js.
925926 */
926927 function getEditToolbar() {
927 - global $wgStylePath, $wgLang, $wgMimeType;
 928+ global $wgStylePath, $wgLang, $wgMimeType, $wgJsMimeType;
928929
929930 /**
930931 * toolarray an array of arrays which each include the filename of
@@ -1015,7 +1016,7 @@
10161017 'key' => 'R'
10171018 )
10181019 );
1019 - $toolbar ="<script type='text/javascript'>\n/*<![CDATA[*/\n";
 1020+ $toolbar ="<script type='$wgJsMimeType'>\n/*<![CDATA[*/\n";
10201021
10211022 $toolbar.="document.writeln(\"<div id='toolbar'>\");\n";
10221023 foreach($toolarray as $tool) {
Index: trunk/phase3/includes/RawPage.php
@@ -20,8 +20,8 @@
2121 class RawPage {
2222
2323 function RawPage( $article ) {
24 - global $wgRequest, $wgInputEncoding, $wgSquidMaxage;
25 - $allowedCTypes = array('text/x-wiki', 'text/javascript', 'text/css', 'application/x-zope-edit');
 24+ global $wgRequest, $wgInputEncoding, $wgSquidMaxage, $wgJsMimeType;
 25+ $allowedCTypes = array('text/x-wiki', $wgJsMimeType, 'text/css', 'application/x-zope-edit');
2626 $this->mArticle =& $article;
2727 $this->mTitle =& $article->mTitle;
2828
@@ -38,7 +38,7 @@
3939 } else if ($gen == 'js') {
4040 $this->mGen = $gen;
4141 if($smaxage == '') $smaxage = $wgSquidMaxage;
42 - if($ctype == '') $ctype = 'text/javascript';
 42+ if($ctype == '') $ctype = $wgJsMimeType;
4343 } else {
4444 $this->mGen = false;
4545 }
Index: trunk/phase3/includes/SkinTemplate.php
@@ -145,7 +145,7 @@
146146 function outputPage( &$out ) {
147147 global $wgTitle, $wgArticle, $wgUser, $wgLang, $wgContLang, $wgOut;
148148 global $wgScript, $wgStylePath, $wgLanguageCode, $wgContLanguageCode, $wgUseNewInterlanguage;
149 - global $wgMimeType, $wgOutputEncoding, $wgUseDatabaseMessages, $wgRequest;
 149+ global $wgMimeType, $wgJsMimeType, $wgOutputEncoding, $wgUseDatabaseMessages, $wgRequest;
150150 global $wgDisableCounters, $wgLogo, $action, $wgFeedClasses;
151151 global $wgMaxCredits, $wgShowCreditsIfMax;
152152 global $wgPageShowWatchingUsers;
@@ -218,6 +218,7 @@
219219 $tpl->set( 'feeds', false );
220220 }
221221 $tpl->setRef( 'mimetype', $wgMimeType );
 222+ $tpl->setRef( 'jsmimetype', $wgJsMimeType );
222223 $tpl->setRef( 'charset', $wgOutputEncoding );
223224 $tpl->set( 'headlinks', $out->getHeadLinks() );
224225 $tpl->setRef( 'wgScript', $wgScript );
@@ -898,7 +899,7 @@
899900 $fname = 'SkinTemplate::setupUserJs';
900901 wfProfileIn( $fname );
901902
902 - global $wgRequest, $wgAllowUserJs;
 903+ global $wgRequest, $wgAllowUserJs, $wgJsMimeType;
903904 $action = $wgRequest->getText('action');
904905
905906 if( $wgAllowUserJs && $this->loggedin ) {
@@ -906,7 +907,7 @@
907908 # XXX: additional security check/prompt?
908909 $this->userjsprev = '/*<![CDATA[*/ ' . $wgRequest->getText('wpTextbox1') . ' /*]]>*/';
909910 } else {
910 - $this->userjs = $this->makeUrl($this->userpage.'/'.$this->skinname.'.js', 'action=raw&ctype=text/javascript&dontcountme=s');
 911+ $this->userjs = $this->makeUrl($this->userpage.'/'.$this->skinname.'.js', 'action=raw&ctype='.$wgJsMimeType.'&dontcountme=s');
911912 }
912913 }
913914 wfProfileOut( $fname );
Index: trunk/phase3/includes/DefaultSettings.php
@@ -374,6 +374,7 @@
375375 $wgLegacyEncoding = false;
376376
377377 $wgMimeType = 'text/html';
 378+$wgJsMimeType = 'text/javascript';
378379 $wgDocType = '-//W3C//DTD XHTML 1.0 Transitional//EN';
379380 $wgDTD = 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd';
380381
Index: trunk/phase3/includes/Skin.php
@@ -172,14 +172,14 @@
173173 }
174174
175175 function getHeadScripts() {
176 - global $wgStylePath, $wgUser, $wgContLang, $wgAllowUserJs;
177 - $r = "<script type=\"text/javascript\" src=\"{$wgStylePath}/common/wikibits.js\"></script>\n";
 176+ global $wgStylePath, $wgUser, $wgContLang, $wgAllowUserJs, $wgJsMimeType;
 177+ $r = "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/wikibits.js\"></script>\n";
178178 if( $wgAllowUserJs && $wgUser->isLoggedIn() ) {
179179 $userpage = $wgUser->getUserPage();
180180 $userjs = htmlspecialchars( $this->makeUrl(
181181 $userpage->getPrefixedText().'/'.$this->getSkinName().'.js',
182 - 'action=raw&ctype=text/javascript'));
183 - $r .= '<script type="text/javascript" src="'.$userjs."\"></script>\n";
 182+ 'action=raw&ctype='.$wgJsMimeType));
 183+ $r .= '<script type="'.$wgJsMimeType.'" src="'.$userjs."\"></script>\n";
184184 }
185185 return $r;
186186 }
Index: trunk/phase3/RELEASE-NOTES
@@ -147,6 +147,7 @@
148148 * (bug 1739) A new magicword, {{REVISIONID}} give you the article or diff database
149149 revision id, useful for proper citation.
150150 * (bug 1998) Updated the Russian translation.
 151+* (bug 2064) Configurable JavaScript mimetype with $wgJsMimeType
151152 * It's now possible to invert the namespace selection at Special:Allpages and Special:Contributions
152153 * No longer using sorbs.net to check for open proxies by default.
153154 * What was $wgDisableUploads is now $wgEnableUploads, and should be set to true if one wishes to enable uploads.

Status & tagging log

  • 01:56, 13 October 2010 ^demon (Talk | contribs) changed the status of r8895 [removed: new added: old]
Personal tools
Namespaces

Variants
Views
Actions
Navigation
Support
Download
Development
Communication
Toolbox