r99878 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99877‎ | r99878 | r99879 >
Date:11:22, 15 October 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
work on smw 1.7 compat
Modified paths:
  • /trunk/extensions/SemanticResultFormats/GraphViz/SRF_Graph.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/GraphViz/SRF_Graph.php
@@ -66,44 +66,31 @@
6767 protected $m_parentRelation;
6868 protected $m_wordWrapLimit = 25;
6969
70 - protected function readParameters( $params, $outputmode ) {
71 - parent::readParameters( $params, $outputmode );
72 -
73 - if ( array_key_exists( 'graphname', $params ) ) {
74 - $this->m_graphName = trim( $params['graphname'] );
75 - }
 70+ /**
 71+ * (non-PHPdoc)
 72+ * @see SMWResultPrinter::handleParameters()
 73+ */
 74+ protected function handleParameters( array $params, $outputmode ) {
 75+ parent::handleParameters( $params, $outputmode );
7676
77 - if ( array_key_exists( 'graphsize', $params ) ) {
78 - $this->m_graphSize = trim( $params['graphsize'] );
79 - }
 77+ $this->m_graphName = trim( $params['graphname'] );
 78+ $this->m_graphSize = trim( $params['graphsize'] );
8079
81 - $this->m_graphLegend = array_key_exists( 'graphlegend', $params ) && strtolower( trim( $params['graphlegend'] ) ) == 'yes';
82 - $this->m_graphLabel = array_key_exists( 'graphlabel', $params ) && strtolower( trim( $params['graphlabel'] ) ) == 'yes';
83 -
84 - if ( array_key_exists( 'arrowdirection', $params ) ) {
85 - $params['rankdir'] = $params['arrowdirection'];
86 - }
 80+ $this->m_graphLegend = $params['graphlegend'];
 81+ $this->m_graphLabel = $params['graphlabel'];
8782
88 - if ( array_key_exists( 'rankdir', $params ) ) {
89 - $this->m_rankdir = strtoupper( trim( $params['rankdir'] ) );
90 - }
 83+ $params['rankdir'] = $params['arrowdirection']; // TODO
 84+ $this->m_rankdir = strtoupper( trim( $params['rankdir'] ) );
9185
92 - $this->m_graphLink = array_key_exists( 'graphlink', $params ) && strtolower( trim( $params['graphlink'] ) ) == 'yes';
93 - $this->m_graphColor = array_key_exists( 'graphcolor', $params ) && strtolower( trim( $params['graphcolor'] ) ) == 'yes';
 86+ $this->m_graphLink = $params['graphlink'];
 87+ $this->m_graphColor =$params['graphcolor'];
9488
95 - if ( array_key_exists( 'nameproperty', $params ) ) {
96 - $this->m_nameProperty = trim( $params['nameproperty'] );
97 - }
 89+ $this->m_nameProperty = trim( $params['nameproperty'] );
9890
99 - $this->m_parentRelation = array_key_exists( 'relation', $params ) && strtolower( trim( $params['relation'] ) ) == 'parent';
 91+ $this->m_parentRelation = strtolower( trim( $params['relation'] ) ) == 'parent';
10092
101 - if ( array_key_exists( 'nodeshape', $params ) && in_array( trim( $params['nodeshape'] ), self::$NODE_SHAPES ) ) {
102 - $this->m_nodeShape = trim( $params['nodeshape'] );
103 - }
104 -
105 - if ( array_key_exists( 'wordwraplimit', $params ) && is_int( $params['wordwraplimit'] ) ) {
106 - $this->m_wordWrapLimit = (int)$params['wordwraplimit'];
107 - }
 93+ $this->m_nodeShape = $params['nodeshape'];
 94+ $this->m_wordWrapLimit = $params['wordwraplimit'];
10895 }
10996
11097 protected function getResultText( SMWQueryResult $res, $outputmode ) {
@@ -290,9 +277,18 @@
291278 }
292279
293280 public function getParameters() {
 281+ $params = parent::getParameters();
 282+
 283+ $params['graphname'] = new Parameter( 'graphname', Parameter::TYPE_STRING, '' );
 284+ $params['graphname']->setMessage( 'srf_paramdesc_graphname' );
 285+
 286+ $params['graphsize'] = new Parameter( 'graphsize', Parameter::TYPE_INTEGER );
 287+ $params['graphsize']->setMessage( 'srf_paramdesc_graphsize' );
 288+ $params['graphsize']->setDefault( '', false );
 289+
 290+ return $params; // TODO
 291+
294292 return array(
295 - array( 'name' => 'graphname', 'type' => 'string', 'description' => wfMsg( 'srf_paramdesc_graphname' ) ),
296 - array( 'name' => 'graphsize', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_graphsize' ) ),
297293 array( 'name' => 'graphlegend', 'type' => 'enumeration', 'description' => wfMsg( 'srf_paramdesc_graphlegend' ), 'values'=> array( 'yes', 'no' ) ),
298294 array( 'name' => 'graphlabel', 'type' => 'enumeration', 'description' => wfMsg( 'srf_paramdesc_graphlabel' ), 'values'=> array( 'yes', 'no' ) ),
299295 array( 'name' => 'arrowdirection', 'type' => 'string', 'description' => wfMsg( 'srf_paramdesc_rankdir' ) ),

Follow-up revisions

RevisionCommit summaryAuthorDate
r99936follow up to r99878jeroendedauw01:48, 16 October 2011