r99936 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99935‎ | r99936 | r99937 >
Date:01:48, 16 October 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
follow up to r99878
Modified paths:
  • /trunk/extensions/SemanticResultFormats/GraphViz/SRF_Graph.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/GraphViz/SRF_Graph.php
@@ -52,19 +52,19 @@
5353 'tripleoctagon',
5454 );
5555
56 - protected $m_graphName = 'QueryResult';
 56+ protected $m_graphName;
5757 protected $m_graphLabel;
5858 protected $m_graphColor;
5959 protected $m_graphLegend;
6060 protected $m_graphLink;
61 - protected $m_rankdir = "LR";
62 - protected $m_graphSize = "";
 61+ protected $m_rankdir;
 62+ protected $m_graphSize;
6363 protected $m_labelArray = array();
6464 protected $m_graphColors = array( 'black', 'red', 'green', 'blue', 'darkviolet', 'gold', 'deeppink', 'brown', 'bisque', 'darkgreen', 'yellow', 'darkblue', 'magenta', 'steelblue2' );
65 - protected $m_nameProperty = false;
66 - protected $m_nodeShape = false;
 65+ protected $m_nameProperty;
 66+ protected $m_nodeShape;
6767 protected $m_parentRelation;
68 - protected $m_wordWrapLimit = 25;
 68+ protected $m_wordWrapLimit;
6969
7070 /**
7171 * (non-PHPdoc)
@@ -79,13 +79,12 @@
8080 $this->m_graphLegend = $params['graphlegend'];
8181 $this->m_graphLabel = $params['graphlabel'];
8282
83 - $params['rankdir'] = $params['arrowdirection']; // TODO
84 - $this->m_rankdir = strtoupper( trim( $params['rankdir'] ) );
 83+ $this->m_rankdir = strtoupper( trim( $params['arrowdirection'] ) );
8584
8685 $this->m_graphLink = $params['graphlink'];
8786 $this->m_graphColor =$params['graphcolor'];
8887
89 - $this->m_nameProperty = trim( $params['nameproperty'] );
 88+ $this->m_nameProperty = $params['nameproperty'] === false ? false : trim( $params['nameproperty'] );
9089
9190 $this->m_parentRelation = strtolower( trim( $params['relation'] ) ) == 'parent';
9291
@@ -279,26 +278,48 @@
280279 public function getParameters() {
281280 $params = parent::getParameters();
282281
283 - $params['graphname'] = new Parameter( 'graphname', Parameter::TYPE_STRING, '' );
 282+ $params['graphname'] = new Parameter( 'graphname', Parameter::TYPE_STRING, 'QueryResult' );
284283 $params['graphname']->setMessage( 'srf_paramdesc_graphname' );
285284
286285 $params['graphsize'] = new Parameter( 'graphsize', Parameter::TYPE_INTEGER );
287286 $params['graphsize']->setMessage( 'srf_paramdesc_graphsize' );
288287 $params['graphsize']->setDefault( '', false );
289288
290 - return $params; // TODO
 289+ $params['graphlegend'] = new Parameter( 'graphsize', Parameter::TYPE_BOOLEAN, false );
 290+ $params['graphlegend']->setMessage( 'srf_paramdesc_graphlegend' );
291291
292 - return array(
293 - array( 'name' => 'graphlegend', 'type' => 'enumeration', 'description' => wfMsg( 'srf_paramdesc_graphlegend' ), 'values'=> array( 'yes', 'no' ) ),
294 - array( 'name' => 'graphlabel', 'type' => 'enumeration', 'description' => wfMsg( 'srf_paramdesc_graphlabel' ), 'values'=> array( 'yes', 'no' ) ),
295 - array( 'name' => 'arrowdirection', 'type' => 'string', 'description' => wfMsg( 'srf_paramdesc_rankdir' ) ),
296 - array( 'name' => 'graphlink', 'type' => 'enumeration', 'description' => wfMsg( 'srf_paramdesc_graphlink' ), 'values'=> array( 'yes', 'no' ) ),
297 - array( 'name' => 'graphcolor', 'type' => 'enumeration', 'description' => wfMsg( 'srf_paramdesc_graphcolor' ), 'values'=> array( 'yes', 'no' ) ),
298 - array( 'name' => 'nodeshape', 'type' => 'enumeration', 'description' => wfMsg( 'srf-paramdesc-graph-nodeshape' ), 'values'=> self::$NODE_SHAPES ),
299 - array( 'name' => 'nameproperty', 'type' => 'text', 'description' => wfMsg( 'srf-paramdesc-graph-nameprop' ) ),
300 - array( 'name' => 'relation', 'type' => 'enumeration', 'description' => wfMsg( 'srf-paramdesc-graph-relation' ), 'values'=> array( 'parent', 'child' ) ),
301 - array( 'name' => 'wordwraplimit', 'type' => 'int', 'description' => wfMsg( 'srf-paramdesc-graph-wwl' ) ),
302 - );
 292+ $params['graphlabel'] = new Parameter( 'graphlabel', Parameter::TYPE_BOOLEAN, false );
 293+ $params['graphlabel']->setMessage( 'srf_paramdesc_graphlabel' );
 294+
 295+ $params['graphlink'] = new Parameter( 'graphlink', Parameter::TYPE_BOOLEAN, false );
 296+ $params['graphlink']->setMessage( 'srf_paramdesc_graphlink' );
 297+
 298+ $params['graphcolor'] = new Parameter( 'graphcolor', Parameter::TYPE_BOOLEAN, false );
 299+ $params['graphcolor']->setMessage( 'srf_paramdesc_graphcolor' );
 300+
 301+ $params['arrowdirection'] = new Parameter( 'arrowdirection', Parameter::TYPE_STRING, 'LR', array( 'rankdir' ) );
 302+ $params['arrowdirection']->setMessage( 'srf_paramdesc_rankdir' );
 303+ $params['arrowdirection']->addCriteria( new CriterionInArray( 'LR', 'RL', 'TB', 'BT' ) );
 304+
 305+ $params['nodeshape'] = new Parameter( 'nodeshape' );
 306+ $params['nodeshape']->setDefault( false, false );
 307+ $params['nodeshape']->setMessage( 'srf-paramdesc-graph-nodeshape' );
 308+ $params['nodeshape']->addCriteria( new CriterionInArray( self::$NODE_SHAPES ) );
 309+
 310+ $params['relation'] = new Parameter( 'relation' );
 311+ $params['relation']->setDefault( 'child' );
 312+ $params['relation']->setMessage( 'srf-paramdesc-graph-relation' );
 313+ $params['relation']->addCriteria( new CriterionInArray( 'parent', 'child' ) );
 314+
 315+ $params['nameproperty'] = new Parameter( 'nameproperty', Parameter::TYPE_STRING, '' );
 316+ $params['nameproperty']->setMessage( 'srf-paramdesc-graph-nameprop' );
 317+ $params['nameproperty']->setDefault( false, false );
 318+
 319+ $params['wordwraplimit'] = new Parameter( 'wordwraplimit', Parameter::TYPE_INTEGER );
 320+ $params['wordwraplimit']->setMessage( 'srf-paramdesc-graph-wwl' );
 321+ $params['wordwraplimit']->setDefault( 25 );
 322+
 323+ return $params;
303324 }
304325
305326 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r99878work on smw 1.7 compatjeroendedauw11:22, 15 October 2011