r48967 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48966‎ | r48967 | r48968 >
Date:16:41, 28 March 2009
Author:demon
Status:ok
Tags:
Comment:
(bug 17617) HTML cleanup for ImagePage
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/ImagePage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ImagePage.php
@@ -115,7 +115,7 @@
116116 if( $fol != '-' && !wfEmptyMsg( 'shareddescriptionfollows', $fol ) ) {
117117 $wgOut->addWikiText( $fol );
118118 }
119 - $wgOut->addHTML( '<div id="shared-image-desc">' . $this->mExtraDescription . '</div>' );
 119+ $wgOut->addHTML( '<div id="shared-image-desc">' . $this->mExtraDescription . "</div>\n" );
120120 }
121121
122122 $this->closeShowImage();
@@ -135,7 +135,7 @@
136136 global $wgStylePath, $wgStyleVersion;
137137 $expand = htmlspecialchars( Xml::escapeJsString( wfMsg( 'metadata-expand' ) ) );
138138 $collapse = htmlspecialchars( Xml::escapeJsString( wfMsg( 'metadata-collapse' ) ) );
139 - $wgOut->addHTML( Xml::element( 'h2', array( 'id' => 'metadata' ), wfMsg( 'metadata' ) ). "\n" );
 139+ $wgOut->addHTML( Xml::element( 'h2', array( 'id' => 'metadata' ), wfMsg( 'metadata' ) ) . "\n" );
140140 $wgOut->addWikiText( $this->makeMetadataTable( $formattedMetadata ) );
141141 $wgOut->addScriptFile( 'metadata.js' );
142142 $wgOut->addHTML(
@@ -226,9 +226,9 @@
227227 $r = '<ul id="filetoc">
228228 <li><a href="#file">' . $wgLang->getNsText( NS_FILE ) . '</a></li>
229229 <li><a href="#filehistory">' . wfMsgHtml( 'filehist' ) . '</a></li>
230 - <li><a href="#filelinks">' . wfMsgHtml( 'imagelinks' ) . '</a></li>' .
231 - ($metadata ? ' <li><a href="#metadata">' . wfMsgHtml( 'metadata' ) . '</a></li>' : '') . '
232 - </ul>';
 230+ <li><a href="#filelinks">' . wfMsgHtml( 'imagelinks' ) . "</a></li>\n" .
 231+ ($metadata ? ' <li><a href="#metadata">' . wfMsgHtml( 'metadata' ) . '</a></li>' : '') . "
 232+ </ul>\n";
233233 return $r;
234234 }
235235
@@ -241,8 +241,9 @@
242242 * @return string
243243 */
244244 protected function makeMetadataTable( $metadata ) {
245 - $r = wfMsg( 'metadata-help' ) . "\n\n";
246 - $r .= "{| id=mw_metadata class=mw_metadata\n";
 245+ $r = "<div class=\"mw-imagepage-section-metadata\">\n";
 246+ $r .= wfMsg( 'metadata-help' );
 247+ $r .= "<table id=\"mw_metadata\" class=\"mw_metadata\">\n";
247248 foreach ( $metadata as $type => $stuff ) {
248249 foreach ( $stuff as $v ) {
249250 # FIXME, why is this using escapeId for a class?!
@@ -250,12 +251,12 @@
251252 if( $type == 'collapsed' ) {
252253 $class .= ' collapsable';
253254 }
254 - $r .= "|- class=\"$class\"\n";
255 - $r .= "!| {$v['name']}\n";
256 - $r .= "|| {$v['value']}\n";
 255+ $r .= "<tr class=\"$class\">\n";
 256+ $r .= "<th>{$v['name']}</th>\n";
 257+ $r .= "<td>{$v['value']}</td>\n</tr>";
257258 }
258259 }
259 - $r .= '|}';
 260+ $r .= "</table>\n</div>\n";
260261 return $r;
261262 }
262263
@@ -371,7 +372,7 @@
372373 );
373374 $wgOut->addHTML( '<div class="fullImageLink" id="file">' .
374375 $thumbnail->toHtml( $options ) .
375 - $anchorclose . '</div>' );
 376+ $anchorclose . "</div>\n" );
376377 }
377378
378379 if( $this->displayImg->isMultipage() ) {
@@ -428,7 +429,7 @@
429430
430431 $wgOut->addHTML( '<div class="fullImageLink" id="file">' .
431432 $icon->toHtml( array( 'desc-link' => true ) ) .
432 - '</div>' );
 433+ "</div>\n" );
433434 }
434435
435436 $showLink = true;
@@ -443,16 +444,16 @@
444445 $wgOut->addWikiText( <<<EOT
445446 <div class="fullMedia">
446447 <span class="dangerousLink">[[Media:$filename|$filename]]</span>$dirmark
447 -<span class="fileInfo"> $longDesc</span>
 448+<span class="fileInfo">$longDesc</span>
448449 </div>
449 -
450450 <div class="mediaWarning">$warning</div>
451451 EOT
452452 );
453453 } else {
454454 $wgOut->addWikiText( <<<EOT
455455 <div class="fullMedia">
456 -[[Media:$filename|$filename]]$dirmark <span class="fileInfo"> $longDesc</span>
 456+[[Media:$filename|$filename]]$dirmark
 457+<span class="fileInfo">$longDesc</span>
457458 </div>
458459 EOT
459460 );
@@ -484,7 +485,7 @@
485486 $descUrl = $this->img->getDescriptionUrl();
486487 $descText = $this->img->getDescriptionText();
487488
488 - $wrap = "<div class='sharedUploadNotice'>\n$1\n</div>";
 489+ $wrap = "<div class=\"sharedUploadNotice\">\n$1\n</div>\n";
489490 $repo = $this->img->getRepo()->getDisplayName();
490491
491492 $msg = '';
@@ -520,19 +521,19 @@
521522
522523 $sk = $wgUser->getSkin();
523524
524 - $wgOut->addHTML( '<br /><ul>' );
 525+ $wgOut->addHTML( "<br /><ul>\n" );
525526
526527 # "Upload a new version of this file" link
527528 if( UploadForm::userCanReUpload($wgUser,$this->img->name) ) {
528529 $ulink = $sk->makeExternalLink( $this->getUploadUrl(), wfMsg( 'uploadnewversion-linktext' ) );
529 - $wgOut->addHTML( "<li><div class='plainlinks'>{$ulink}</div></li>" );
 530+ $wgOut->addHTML( "<li id=\"mw-imagepage-reupload-link\"><div class=\"plainlinks\">{$ulink}</div></li>\n" );
530531 }
531532
532533 # External editing link
533534 $elink = $sk->makeKnownLinkObj( $this->mTitle, wfMsgHtml( 'edit-externally' ), 'action=edit&externaledit=true&mode=file' );
534 - $wgOut->addHTML( '<li>' . $elink . ' <small>' . wfMsgExt( 'edit-externally-help', array( 'parseinline' ) ) . '</small></li>' );
 535+ $wgOut->addHTML( '<li id="mw-imagepage-edit-external">' . $elink . ' <small>' . wfMsgExt( 'edit-externally-help', array( 'parseinline' ) ) . "</small></li>\n" );
535536
536 - $wgOut->addHTML( '</ul>' );
 537+ $wgOut->addHTML( "</ul>\n" );
537538 }
538539
539540 protected function closeShowImage() {} # For overloading
@@ -602,12 +603,13 @@
603604 $wgOut->addHTML( "<li>{$link}</li>\n" );
604605 }
605606 }
606 - $wgOut->addHTML( "</ul></div>\n" );
 607+ $wgOut->addHTML( "</ul>\n" );
607608 $res->free();
608609
609610 // Add a links to [[Special:Whatlinkshere]]
610611 if( $count > $limit )
611612 $wgOut->addWikiMsg( 'morelinkstoimage', $this->mTitle->getPrefixedDBkey() );
 613+ $wgOut->addHTML( "</div>\n" );
612614 }
613615
614616 protected function imageRedirects() {
@@ -746,9 +748,10 @@
747749
748750 public function beginImageHistoryList( $navLinks = '' ) {
749751 global $wgOut, $wgUser;
750 - return Xml::element( 'h2', array( 'id' => 'filehistory' ), wfMsg( 'filehist' ) )
 752+ return Xml::element( 'h2', array( 'id' => 'filehistory' ), wfMsg( 'filehist' ) ) . "\n"
 753+ . "<div id=\"mw-imagepage-section-filehistory\">\n"
751754 . $wgOut->parse( wfMsgNoTrans( 'filehist-help' ) )
752 - . $navLinks
 755+ . $navLinks . "\n"
753756 . Xml::openElement( 'table', array( 'class' => 'filehistory' ) ) . "\n"
754757 . '<tr><td></td>'
755758 . ( $this->current->isLocal() && ($wgUser->isAllowed('delete') || $wgUser->isAllowed('deleterevision') ) ? '<td></td>' : '' )
@@ -761,7 +764,7 @@
762765 }
763766
764767 public function endImageHistoryList( $navLinks = '' ) {
765 - return "</table>\n$navLinks\n";
 768+ return "</table>\n$navLinks\n</div>\n";
766769 }
767770
768771 public function imageHistoryLine( $iscur, $file ) {
Index: trunk/phase3/RELEASE-NOTES
@@ -296,6 +296,7 @@
297297 * The svn-version version numbers on Special:Version have been removed
298298 * (bug 17374) Special:Export no longer exports two copies of the same page
299299 * (bug 18190) Proper parsing in MediaWiki:Sharedupload message
 300+* (bug 17617) HTML cleanup for ImagePage
300301
301302 == API changes in 1.15 ==
302303 * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions

Status & tagging log