r101863 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101862‎ | r101863 | r101864 >
Date:19:43, 3 November 2011
Author:kipcool
Status:deferred (Comments)
Tags:
Comment:
Added edit links for each DM in the Expression: pages
urlencode of "?" in titles
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/Editor.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/type.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/type.php
@@ -28,6 +28,7 @@
2929 global $wgArticlePath, $wdDefaultViewDataSet;
3030
3131 $myTitle = str_replace( "&", urlencode("&") , $title ) ;
 32+ $myTitle = str_replace( "?", urlencode("?") , $title ) ;
3233 $url = str_replace( "$1", $nameSpace . ':' . $myTitle , $wgArticlePath );
3334
3435 if ( $usedc ) {
Index: trunk/extensions/Wikidata/OmegaWiki/Editor.php
@@ -1115,8 +1115,15 @@
11161116 $wgOut->addMeta( 'Description', $expression . ": " . $definition );
11171117 $isMetaDescSet = 1 ;
11181118 }
1119 -
1120 - return $definedMeaningAsLink . ": " . $escapedDefinition;
 1119+
 1120+ $DMPageName = definingExpression( $value ) . " (" . $value . ")" ;
 1121+ $DMTitle = Title::makeTitle( NS_DEFINEDMEANING , $DMPageName );
 1122+ $editURL = $DMTitle->getLocalURL( 'action=edit' ) ;
 1123+ $editLink = '<div style="float:right; font-size:60%;"><sup>['
 1124+ . createLink( $editURL , wfMsg( 'edit') )
 1125+ . ']</sup></div>' ;
 1126+
 1127+ return $editLink . $definedMeaningAsLink . ": " . $escapedDefinition ;
11211128 }
11221129
11231130 public function getEditHTML( IdStack $idPath, $value ) {
@@ -1132,8 +1139,7 @@
11331140 }
11341141
11351142 public function getInputValue( $id ) {
1136 - global
1137 - $wgRequest;
 1143+ global $wgRequest;
11381144
11391145 return trim( $wgRequest->getText( $id ) );
11401146 }

Comments

#Comment by Nikerabbit (talk | contribs)   11:14, 4 November 2011

Why are you constructing url manually? Wouldn't it be easier ans safer to just use title object?

#Comment by Kipmaster (talk | contribs)   12:14, 4 November 2011

Which is exactly what I did + $DMTitle = Title::makeTitle( NS_DEFINEDMEANING , $DMPageName ); + $editURL = $DMTitle->getLocalURL( 'action=edit' ) ;

If you have something else in mind, please explain more in details.

#Comment by Nikerabbit (talk | contribs)   12:38, 4 November 2011

I was talking about the pageAsURL function in type.php. Maybe I don't fully understand what it is used for.

Status & tagging log