r84024 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84023‎ | r84024 | r84025 >
Date:15:19, 15 March 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
reimplemented showtitle parameter
Modified paths:
  • /branches/SemanticMaps0.8/SM_Settings.php (modified) (history)
  • /branches/SemanticMaps0.8/includes/queryprinters/SM_MapPrinter.php (modified) (history)
  • /branches/SemanticMaps0.8/includes/queryprinters/SM_QueryHandler.php (modified) (history)

Diff [purge]

Index: branches/SemanticMaps0.8/SM_Settings.php
@@ -45,7 +45,7 @@
4646
4747 # Boolean. The default value for the forceshow parameter. Will force a map to be shown even when there are no query results
4848 # when set to true. This value will only be used when the user does not provide one.
49 - $smgQPForceShow = false;
 49+ $smgQPForceShow = true;
5050
5151 # Boolean. The default value for the showtitle parameter. Will hide the title in the marker pop-ups when set to true.
5252 # This value will only be used when the user does not provide one.
Index: branches/SemanticMaps0.8/includes/queryprinters/SM_MapPrinter.php
@@ -165,6 +165,8 @@
166166 $params = $this->parameters;
167167
168168 $queryHandler = new SMQueryHandler( $res, $outputmode );
 169+ $queryHandler->setShowSubject( $params['showtitle'] );
 170+
169171 $this->handleMarkerData( $params, $queryHandler->getLocations() );
170172 $locationAmount = count( $params['locations'] );
171173
Index: branches/SemanticMaps0.8/includes/queryprinters/SM_QueryHandler.php
@@ -93,6 +93,15 @@
9494 protected $boldSubject = true;
9595
9696 /**
 97+ * Show the subject in the text or not?
 98+ *
 99+ * @since 0.8
 100+ *
 101+ * @var boolean
 102+ */
 103+ protected $showSubject = true;
 104+
 105+ /**
97106 * Constructor.
98107 *
99108 * @since 0.7.3
@@ -162,9 +171,20 @@
163172 */
164173 public function setBoldSubject( $boldSubject ) {
165174 $this->boldSubject = $boldSubject;
166 - }
 175+ }
167176
168177 /**
 178+ * Sets if the subject should shown in the text.
 179+ *
 180+ * @since 0.8
 181+ *
 182+ * @param string $showSubject
 183+ */
 184+ public function setShowSubject( $showSubject ) {
 185+ $this->showSubject = $showSubject;
 186+ }
 187+
 188+ /**
169189 * Gets the query result as a list of locations.
170190 *
171191 * @since 0.7.3
@@ -258,28 +278,30 @@
259279 $title = $object->getLongText( $this->outputmode, null );
260280 $text = '';
261281
262 - if ( !$this->titleLinkSeperate && $this->linkAbsolute ) {
263 - $text = Html::element(
264 - 'a',
265 - array( 'href' => $object->getTitle()->getFullUrl() ),
266 - $object->getTitle()->getText()
267 - );
 282+ if ( $this->showSubject ) {
 283+ if ( !$this->titleLinkSeperate && $this->linkAbsolute ) {
 284+ $text = Html::element(
 285+ 'a',
 286+ array( 'href' => $object->getTitle()->getFullUrl() ),
 287+ $object->getTitle()->getText()
 288+ );
 289+ }
 290+ else {
 291+ $text = $object->getLongText( $this->outputmode, $wgUser->getSkin() );
 292+ }
 293+
 294+ if ( $this->boldSubject ) {
 295+ $text = '<b>' . $text . '</b>';
 296+ }
 297+
 298+ if ( $this->titleLinkSeperate ) {
 299+ $text .= Html::element(
 300+ 'a',
 301+ array( 'href' => $object->getTitle()->getFullUrl() ),
 302+ str_replace( '$1', $object->getTitle()->getText(), $this->params['pagelinktext'] )
 303+ );
 304+ }
268305 }
269 - else {
270 - $text = $object->getLongText( $this->outputmode, $wgUser->getSkin() );
271 - }
272 -
273 - if ( $this->boldSubject ) {
274 - $text = '<b>' . $text . '</b>';
275 - }
276 -
277 - if ( $this->titleLinkSeperate ) {
278 - $text .= Html::element(
279 - 'a',
280 - array( 'href' => $object->getTitle()->getFullUrl() ),
281 - str_replace( '$1', $object->getTitle()->getText(), $this->params['pagelinktext'] )
282 - );
283 - }
284306
285307 return array( $title, $text );
286308 }

Status & tagging log