Index: trunk/extensions/SemanticResultFormats/GraphViz/SRF_Graph.php |
— | — | @@ -52,19 +52,19 @@ |
53 | 53 | 'tripleoctagon', |
54 | 54 | ); |
55 | 55 | |
56 | | - protected $m_graphName = 'QueryResult'; |
| 56 | + protected $m_graphName; |
57 | 57 | protected $m_graphLabel; |
58 | 58 | protected $m_graphColor; |
59 | 59 | protected $m_graphLegend; |
60 | 60 | protected $m_graphLink; |
61 | | - protected $m_rankdir = "LR"; |
62 | | - protected $m_graphSize = ""; |
| 61 | + protected $m_rankdir; |
| 62 | + protected $m_graphSize; |
63 | 63 | protected $m_labelArray = array(); |
64 | 64 | 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; |
67 | 67 | protected $m_parentRelation; |
68 | | - protected $m_wordWrapLimit = 25; |
| 68 | + protected $m_wordWrapLimit; |
69 | 69 | |
70 | 70 | /** |
71 | 71 | * (non-PHPdoc) |
— | — | @@ -79,13 +79,12 @@ |
80 | 80 | $this->m_graphLegend = $params['graphlegend']; |
81 | 81 | $this->m_graphLabel = $params['graphlabel']; |
82 | 82 | |
83 | | - $params['rankdir'] = $params['arrowdirection']; // TODO |
84 | | - $this->m_rankdir = strtoupper( trim( $params['rankdir'] ) ); |
| 83 | + $this->m_rankdir = strtoupper( trim( $params['arrowdirection'] ) ); |
85 | 84 | |
86 | 85 | $this->m_graphLink = $params['graphlink']; |
87 | 86 | $this->m_graphColor =$params['graphcolor']; |
88 | 87 | |
89 | | - $this->m_nameProperty = trim( $params['nameproperty'] ); |
| 88 | + $this->m_nameProperty = $params['nameproperty'] === false ? false : trim( $params['nameproperty'] ); |
90 | 89 | |
91 | 90 | $this->m_parentRelation = strtolower( trim( $params['relation'] ) ) == 'parent'; |
92 | 91 | |
— | — | @@ -279,26 +278,48 @@ |
280 | 279 | public function getParameters() { |
281 | 280 | $params = parent::getParameters(); |
282 | 281 | |
283 | | - $params['graphname'] = new Parameter( 'graphname', Parameter::TYPE_STRING, '' ); |
| 282 | + $params['graphname'] = new Parameter( 'graphname', Parameter::TYPE_STRING, 'QueryResult' ); |
284 | 283 | $params['graphname']->setMessage( 'srf_paramdesc_graphname' ); |
285 | 284 | |
286 | 285 | $params['graphsize'] = new Parameter( 'graphsize', Parameter::TYPE_INTEGER ); |
287 | 286 | $params['graphsize']->setMessage( 'srf_paramdesc_graphsize' ); |
288 | 287 | $params['graphsize']->setDefault( '', false ); |
289 | 288 | |
290 | | - return $params; // TODO |
| 289 | + $params['graphlegend'] = new Parameter( 'graphsize', Parameter::TYPE_BOOLEAN, false ); |
| 290 | + $params['graphlegend']->setMessage( 'srf_paramdesc_graphlegend' ); |
291 | 291 | |
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; |
303 | 324 | } |
304 | 325 | |
305 | 326 | } |