r107938 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107937‎ | r107938 | r107939 >
Date:21:00, 3 January 2012
Author:reedy
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.18wmf1 (modified) (history)
  • /branches/wmf/1.18wmf1/includes (modified) (history)
  • /branches/wmf/1.18wmf1/includes/specials (modified) (history)
  • /branches/wmf/1.18wmf1/includes/specials/SpecialLinkSearch.php (modified) (history)
  • /branches/wmf/1.18wmf1/resources/mediawiki.special/mediawiki.special.upload.js (modified) (history)
  • /branches/wmf/1.18wmf1/skins/modern/main.css (modified) (history)
  • /branches/wmf/1.18wmf1/skins/simple/main.css (modified) (history)
  • /branches/wmf/1.18wmf1/skins/vector (modified) (history)
  • /branches/wmf/1.18wmf1/skins/vector/screen.css (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/skins/modern/main.css
@@ -411,38 +411,36 @@
412412 }
413413
414414 #mw_content a.external,
415 -#mw_content a[href ^="gopher://"] {
 415+#mw_content a.external[href ^="gopher://"] {
416416 /* @embed */
417417 background: url(external.png) center right no-repeat;
418418 padding-right: 13px;
419419 }
420 -#mw_content a[href ^="https://"],
 420+#mw_content a.external[href ^="https://"],
421421 .link-https {
422422 /* @embed */
423423 background: url(lock_icon.gif) center right no-repeat;
424424 padding-right: 16px;
425425 }
426 -#mw_content a[href ^="mailto:"],
 426+#mw_content a.external[href ^="mailto:"],
427427 .link-mailto {
428428 /* @embed */
429429 background: url(mail_icon.gif) center right no-repeat;
430430 padding-right: 18px;
431431 }
432 -#mw_content a[href ^="news://"] {
 432+#mw_content a.external[href ^="news://"] {
433433 /* @embed */
434434 background: url(news_icon.png) center right no-repeat;
435435 padding-right: 18px;
436436 }
437 -#mw_content a[href ^="ftp://"],
 437+#mw_content a.external[href ^="ftp://"],
438438 .link-ftp {
439439 /* @embed */
440440 background: url(file_icon.gif) center right no-repeat;
441441 padding-right: 18px;
442442 }
443 -#mw_content a[href ^="irc://"],
444 -#mw_content a.extiw[href ^="irc://"],
445 -#mw_content a[href ^="ircs://"],
446 -#mw_content a.extiw[href ^="ircs://"],
 443+#mw_content a.external[href ^="irc://"],
 444+#mw_content a.external[href ^="ircs://"],
447445 .link-irc {
448446 /* @embed */
449447 background: url(discussionitem_icon.gif) center right no-repeat;
@@ -624,8 +622,6 @@
625623 #mw_content a.extiw,
626624 #mw_content a.extiw:active {
627625 color: #36b;
628 - background: none;
629 - padding: 0;
630626 }
631627 #mw_content a.external {
632628 color: #36b;
Index: branches/wmf/1.18wmf1/skins/simple/main.css
@@ -198,34 +198,32 @@
199199 h1.firstHeading, h2 {
200200 border-bottom: solid 1px black;
201201 }
202 -#bodyContent a[href ^="http://"],
203 -#bodyContent a[href ^="gopher://"] {
 202+#bodyContent a.external,
 203+#bodyContent a.external[href ^="gopher://"] {
204204 background: url("external.png") center right no-repeat;
205205 padding-right: 13px;
206206 }
207 -#bodyContent a[href ^="https://"],
 207+#bodyContent a.external[href ^="https://"],
208208 .link-https {
209209 background: url("lock_icon.gif") center right no-repeat;
210210 padding-right: 16px;
211211 }
212 -#bodyContent a[href ^="mailto:"],
 212+#bodyContent a.external[href ^="mailto:"],
213213 .link-mailto {
214214 background: url("mail_icon.gif") center right no-repeat;
215215 padding-right: 18px;
216216 }
217 -#bodyContent a[href ^="news://"] {
 217+#bodyContent a.external[href ^="news://"] {
218218 background: url("news_icon.png") center right no-repeat;
219219 padding-right: 18px;
220220 }
221 -#bodyContent a[href ^="ftp://"],
 221+#bodyContent a.external[href ^="ftp://"],
222222 .link-ftp {
223223 background: url("file_icon.gif") center right no-repeat;
224224 padding-right: 18px;
225225 }
226 -#bodyContent a[href ^="irc://"],
227 -#bodyContent a.extiw[href ^="irc://"],
228 -#bodyContent a[href ^="ircs://"],
229 -#bodyContent a.extiw[href ^="ircs://"],
 226+#bodyContent a.external[href ^="irc://"],
 227+#bodyContent a.external[href ^="ircs://"],
230228 .link-irc {
231229 background: url("discussionitem_icon.gif") center right no-repeat;
232230 padding-right: 18px;
@@ -234,8 +232,6 @@
235233 #bodyContent a.extiw,
236234 #bodyContent a.extiw:active {
237235 color: #5E7CFF;
238 - background: none;
239 - padding: 0;
240236 }
241237
242238 td.diff-addedline {
Index: branches/wmf/1.18wmf1/skins/vector/screen.css
@@ -1035,38 +1035,36 @@
10361036 padding-bottom: 0;
10371037 }
10381038 div#content a.external,
1039 -div#content a[href ^="gopher://"] {
 1039+div#content a.external[href ^="gopher://"] {
10401040 /* @embed */
10411041 background: url(images/external-link-ltr-icon.png) center right no-repeat;
10421042 padding-right: 13px;
10431043 }
1044 -div#content a[href ^="https://"],
 1044+div#content a.external[href ^="https://"],
10451045 .link-https {
10461046 /* @embed */
10471047 background: url(images/lock-icon.png) center right no-repeat;
10481048 padding-right: 13px;
10491049 }
1050 -div#content a[href ^="mailto:"],
 1050+div#content a.external[href ^="mailto:"],
10511051 .link-mailto {
10521052 /* @embed */
10531053 background: url(images/mail-icon.png) center right no-repeat;
10541054 padding-right: 13px;
10551055 }
1056 -div#content a[href ^="news://"] {
 1056+div#content a.external[href ^="news://"] {
10571057 /* @embed */
10581058 background: url(images/news-icon.png) center right no-repeat;
10591059 padding-right: 13px;
10601060 }
1061 -div#content a[href ^="ftp://"],
 1061+div#content a.external[href ^="ftp://"],
10621062 .link-ftp {
10631063 /* @embed */
10641064 background: url(images/file-icon.png) center right no-repeat;
10651065 padding-right: 13px;
10661066 }
1067 -div#content a[href ^="irc://"],
1068 -div#content a.extiw[href ^="irc://"],
1069 -div#content a[href ^="ircs://"],
1070 -div#content a.extiw[href ^="ircs://"],
 1067+div#content a.external[href ^="irc://"],
 1068+div#content a.external[href ^="ircs://"],
10711069 .link-irc {
10721070 /* @embed */
10731071 background: url(images/talk-icon.png) center right no-repeat;
Property changes on: branches/wmf/1.18wmf1/skins/vector/screen.css
___________________________________________________________________
Modified: svn:mergeinfo
10741072 Merged /trunk/phase3/skins/vector/screen.css:r98690
Property changes on: branches/wmf/1.18wmf1/skins/vector
___________________________________________________________________
Modified: svn:mergeinfo
10751073 Merged /trunk/phase3/skins/vector:r98690
Index: branches/wmf/1.18wmf1/includes/specials/SpecialLinkSearch.php
@@ -43,13 +43,18 @@
4444 }
4545
4646 function execute( $par ) {
47 - global $wgOut, $wgRequest, $wgUrlProtocols, $wgMiserMode, $wgLang;
 47+ global $wgUrlProtocols, $wgMiserMode;
 48+
4849 $this->setHeaders();
49 - $wgOut->allowClickjacking();
 50+ $this->outputHeader();
5051
51 - $target = $wgRequest->getVal( 'target', $par );
52 - $namespace = $wgRequest->getIntorNull( 'namespace', null );
 52+ $out = $this->getOutput();
 53+ $out->allowClickjacking();
5354
 55+ $request = $this->getRequest();
 56+ $target = $request->getVal( 'target', $par );
 57+ $namespace = $request->getIntorNull( 'namespace', null );
 58+
5459 $protocols_list[] = '';
5560 foreach( $wgUrlProtocols as $prot ) {
5661 $protocols_list[] = $prot;
@@ -77,11 +82,9 @@
7883 $protocol = '';
7984 }
8085
81 - $self = $this->getTitle();
82 -
83 - $wgOut->addWikiMsg( 'linksearch-text', '<nowiki>' . $wgLang->commaList( $wgUrlProtocols ) . '</nowiki>' );
 86+ $out->addWikiMsg( 'linksearch-text', '<nowiki>' . $this->getLang()->commaList( $wgUrlProtocols ) . '</nowiki>' );
8487 $s = Xml::openElement( 'form', array( 'id' => 'mw-linksearch-form', 'method' => 'get', 'action' => $GLOBALS['wgScript'] ) ) .
85 - Html::hidden( 'title', $self->getPrefixedDbKey() ) .
 88+ Html::hidden( 'title', $this->getTitle()->getPrefixedDbKey() ) .
8689 '<fieldset>' .
8790 Xml::element( 'legend', array(), wfMsg( 'linksearch' ) ) .
8891 Xml::inputLabel( wfMsg( 'linksearch-pat' ), 'target', 'target', 50, $target ) . ' ';
@@ -92,7 +95,7 @@
9396 $s .= Xml::submitButton( wfMsg( 'linksearch-ok' ) ) .
9497 '</fieldset>' .
9598 Xml::closeElement( 'form' );
96 - $wgOut->addHTML( $s );
 99+ $out->addHTML( $s );
97100
98101 if( $target != '' ) {
99102 $this->setParams( array(
@@ -101,7 +104,7 @@
102105 'protocol' => $protocol ) );
103106 parent::execute( $par );
104107 if( $this->mMungedQuery === false )
105 - $wgOut->addWikiMsg( 'linksearch-error' );
 108+ $out->addWikiMsg( 'linksearch-error' );
106109 }
107110 }
108111
@@ -172,8 +175,8 @@
173176 function formatResult( $skin, $result ) {
174177 $title = Title::makeTitle( $result->namespace, $result->title );
175178 $url = $result->url;
176 - $pageLink = $skin->linkKnown( $title );
177 - $urlLink = $skin->makeExternalLink( $url, $url );
 179+ $pageLink = Linker::linkKnown( $title );
 180+ $urlLink = Linker::makeExternalLink( $url, $url );
178181
179182 return wfMsgHtml( 'linksearch-line', $urlLink, $pageLink );
180183 }
@@ -182,14 +185,13 @@
183186 * Override to check query validity.
184187 */
185188 function doQuery( $offset = false, $limit = false ) {
186 - global $wgOut;
187189 list( $this->mMungedQuery, ) = LinkSearchPage::mungeQuery( $this->mQuery, $this->mProt );
188190 if( $this->mMungedQuery === false ) {
189 - $wgOut->addWikiMsg( 'linksearch-error' );
 191+ $this->getOutput()->addWikiMsg( 'linksearch-error' );
190192 } else {
191193 // For debugging
192194 // Generates invalid xhtml with patterns that contain --
193 - //$wgOut->addHTML( "\n<!-- " . htmlspecialchars( $this->mMungedQuery ) . " -->\n" );
 195+ //$this->getOutput()->addHTML( "\n<!-- " . htmlspecialchars( $this->mMungedQuery ) . " -->\n" );
194196 parent::doQuery( $offset, $limit );
195197 }
196198 }
Property changes on: branches/wmf/1.18wmf1/includes/specials
___________________________________________________________________
Modified: svn:mergeinfo
197199 Merged /trunk/phase3/includes/specials:r96774,98690
Property changes on: branches/wmf/1.18wmf1/includes
___________________________________________________________________
Modified: svn:mergeinfo
198200 Merged /trunk/phase3/includes:r96774,98690
Index: branches/wmf/1.18wmf1/resources/mediawiki.special/mediawiki.special.upload.js
@@ -25,7 +25,7 @@
2626 * @return boolean
2727 */
2828 function fileIsPreviewable( file ) {
29 - var known = ['image/png', 'image/gif', 'image/jpeg'],
 29+ var known = ['image/png', 'image/gif', 'image/jpeg', 'image/svg+xml'],
3030 tooHuge = 10 * 1024 * 1024;
3131 return ( $.inArray( file.type, known ) !== -1 ) && file.size > 0 && file.size < tooHuge;
3232 }
@@ -160,20 +160,33 @@
161161 */
162162 function fetchPreview( file, callback, callbackBinary ) {
163163 var reader = new FileReader();
164 - reader.onload = function() {
165 - if ( callbackBinary ) {
 164+ if ( callbackBinary ) {
 165+ // To fetch JPEG metadata we need a binary string; start there.
 166+ // todo:
 167+ reader.onload = function() {
166168 callbackBinary( reader.result );
167 - reader.onload = function() {
168 - callback( reader.result );
169 - };
170 - reader.readAsDataURL( file );
171 - } else {
172 - callback( reader.result );
173 - }
174 - };
175 - if ( callbackBinary ) {
 169+
 170+ // Now run back through the regular code path.
 171+ fetchPreview(file, callback );
 172+ };
176173 reader.readAsBinaryString( file );
 174+ } else if ('URL' in window && 'createObjectURL' in window.URL) {
 175+ // Supported in Firefox 4.0 and above <https://developer.mozilla.org/en/DOM/window.URL.createObjectURL>
 176+ // WebKit has it in a namespace for now but that's ok. ;)
 177+ //
 178+ // Lifetime of this URL is until document close, which is fine
 179+ // for Special:Upload -- if this code gets used on longer-running
 180+ // pages, add a revokeObjectURL() when it's no longer needed.
 181+ //
 182+ // Prefer this over readAsDataURL for Firefox 7 due to bug reading
 183+ // some SVG files from data URIs <https://bugzilla.mozilla.org/show_bug.cgi?id=694165>
 184+ callback(window.URL.createObjectURL(file));
177185 } else {
 186+ // This ends up decoding the file to base-64 and back again, which
 187+ // feels horribly inefficient.
 188+ reader.onload = function() {
 189+ callback( reader.result );
 190+ };
178191 reader.readAsDataURL( file );
179192 }
180193 }
Property changes on: branches/wmf/1.18wmf1
___________________________________________________________________
Modified: svn:mergeinfo
181194 Merged /trunk/phase3:r96774,98690,99840

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r96774* Use local context instead of global variables...ialex08:43, 11 September 2011
r98690Port r51457 from monobook to modern, simple and Vector....hartman16:50, 2 October 2011
r99840Followup to r99653 (bug 31643) -- reenable client-side thumbnailing of SVGs o...brion02:23, 15 October 2011

Status & tagging log