r84899 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84898‎ | r84899 | r84900 >
Date:11:47, 28 March 2011
Author:jeroendedauw
Status:deferred (Comments)
Tags:
Comment:
comitting somewhat cleaned up patch of Stephan Robotta submitted on the SMW devel mailing list with some small fixes and extra param descriptions
Modified paths:
  • /trunk/extensions/SemanticResultFormats/GoogleCharts/SRF_GoogleBar.php (modified) (history)
  • /trunk/extensions/SemanticResultFormats/GoogleCharts/SRF_GooglePie.php (modified) (history)
  • /trunk/extensions/SemanticResultFormats/GraphViz/SRF_Graph.php (modified) (history)
  • /trunk/extensions/SemanticResultFormats/Ploticus/SRF_Ploticus.php (modified) (history)
  • /trunk/extensions/SemanticResultFormats/SRF_Messages.php (modified) (history)
  • /trunk/extensions/SemanticResultFormats/TagCloud/SRF_TagCloud.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/GoogleCharts/SRF_GoogleBar.php
@@ -28,6 +28,11 @@
2929 $this->isHTML = true;
3030
3131 $t = "";
 32+ $n = "";
 33+
 34+ // if there is only one column in the results then stop right away
 35+ if ($res->getColumnCount() == 1) return "";
 36+
3237 // print all result rows
3338 $first = true;
3439 $count = 0; // How many bars will they be? Needed to calculate the height of the image
Index: trunk/extensions/SemanticResultFormats/GoogleCharts/SRF_GooglePie.php
@@ -34,6 +34,11 @@
3535 $this->isHTML = true;
3636
3737 $t = "";
 38+ $n = "";
 39+
 40+ // if there is only one column in the results then stop right away
 41+ if ($res->getColumnCount() == 1) return "";
 42+
3843 // print all result rows
3944 $first = true;
4045 $max = 0; // the biggest value. needed for scaling
Index: trunk/extensions/SemanticResultFormats/GraphViz/SRF_Graph.php
@@ -151,4 +151,16 @@
152152 }
153153 return $result;
154154 }
 155+
 156+ function getParameters() {
 157+ return array(
 158+ array('name' => 'graphname', 'type' => 'string', 'description' => wfMsg('srf_paramdesc_graphname')),
 159+ array('name' => 'graphsize', 'type' => 'int', 'description' => wfMsg('srf_paramdesc_graphsize')),
 160+ array('name' => 'graphlegend', 'type' => 'enumeration', 'description' => wfMsg('srf_paramdesc_graphlegend'), 'values'=>array('yes', 'no')),
 161+ array('name' => 'graphlabel', 'type' => 'enumeration', 'description' => wfMsg('srf_paramdesc_graphlabel'), 'values'=>array('yes', 'no')),
 162+ array('name' => 'rankdir', 'type' => 'string', 'description' => wfMsg('srf_paramdesc_rankdir')),
 163+ array('name' => 'graphlink', 'type' => 'enumeration', 'description' => wfMsg('srf_paramdesc_graphlink'), 'values'=>array('yes', 'no')),
 164+ array('name' => 'graphcolor', 'type' => 'enumeration', 'description' => wfMsg('srf_paramdesc_graphcolor'), 'values'=>array('yes', 'no'))
 165+ );
 166+ }
155167 }
Index: trunk/extensions/SemanticResultFormats/TagCloud/SRF_TagCloud.php
@@ -173,10 +173,12 @@
174174 foreach ( $tags as &$tag ) {
175175 switch ( $this->sizeMode ) {
176176 case 'linear':
177 - $tag = $this->minTagSize + $maxSizeIncrease * ( $tag -$min ) / ( $max -$min );
 177+ $divisor = ($max == $min) ? 1 : $max - $min;
 178+ $tag = $this->minTagSize + $maxSizeIncrease * ( $tag -$min ) / $divisor;
178179 break;
179180 case 'log' : default :
180 - $tag = $this->minTagSize + $maxSizeIncrease * ( log( $tag ) -log( $min ) ) / ( log( $max ) -log( $min ) );
 181+ $divisor = ($max == $min) ? 1 : log( $max ) - log( $min );
 182+ $tag = $this->minTagSize + $maxSizeIncrease * ( log( $tag ) - log( $min ) ) / $divisor ;
181183 break;
182184 }
183185 }
Index: trunk/extensions/SemanticResultFormats/Ploticus/SRF_Ploticus.php
@@ -14,11 +14,6 @@
1515 *
1616 * @ingroup SMWQuery
1717 */
18 -
19 -if ( !defined( 'MEDIAWIKI' ) ) {
20 - die( 'Not an entry point.' );
21 -}
22 -
2318 class SRFPloticus extends SMWResultPrinter {
2419 protected $m_ploticusparams = '';
2520 protected $m_imageformat = 'gif';
@@ -342,4 +337,27 @@
343338
344339 return ( $rtnstr );
345340 }
 341+
 342+ function getParameters() {
 343+ return array(
 344+ array('name' => 'ploticusmode', 'type' => 'enumeration', 'values' => array('preftab', 'script')),
 345+ array('name' => 'ploticusparams', 'type' => 'string'),
 346+ array('name' => 'imageformat', 'type' => 'enumeration', 'values' => array('png', ' gif', 'jpeg', 'svg', 'svgz', 'swf', 'eps', 'ps', 'drawdump', 'drawdumpa'), 'defaultValue'=>'png'),
 347+ array('name' => 'titletext', 'type' => 'string'),
 348+ array('name' => 'showcsv', 'type' => 'boolean'),
 349+ array('name' => 'ploticusmode', 'type' => 'string'),
 350+ array('name' => 'debug', 'type' => 'boolean'),
 351+ array('name' => 'liveupdating', 'type' => 'boolean'),
 352+ array('name' => 'updatefrequency', 'type' => 'int'),
 353+ array('name' => 'showtimestamp', 'type' => 'boolean'),
 354+ array('name' => 'showimagelink', 'type' => 'boolean'),
 355+ array('name' => 'showrefresh', 'type' => 'boolean'),
 356+ array('name' => 'drawdumpoutput', 'type' => 'string'),
 357+ array('name' => 'tblwidth', 'type' => 'int'),
 358+ array('name' => 'tblheight', 'type' => 'int'),
 359+ array('name' => 'width', 'type' => 'int'),
 360+ array('name' => 'height', 'type' => 'int')
 361+ );
 362+ }
 363+
346364 }
Index: trunk/extensions/SemanticResultFormats/SRF_Messages.php
@@ -98,6 +98,15 @@
9999 'srf_paramdesc_recordsep' => 'Separator between values of record properties',
100100 'srf_printername_hash' => 'Hash',
101101 'srf_paramdesc_hashname' => 'If given and the HashTables extension is available this will create an hash with the specified name',
 102+
 103+ // format "graph"
 104+ 'srf_paramdesc_graphname' => 'Title',
 105+ 'srf_paramdesc_graphsize' => 'Graph size (in px)',
 106+ 'srf_paramdesc_graphlegend' => 'Show graph legend or not',
 107+ 'srf_paramdesc_graphlabel' => 'Graph label',
 108+ 'srf_paramdesc_rankdir' => 'Rank dir',
 109+ 'srf_paramdesc_graphlink' => 'Graph link',
 110+ 'srf_paramdesc_graphcolor' => 'Graph color'
102111 );
103112
104113 /** Message documentation (Message documentation)

Follow-up revisions

RevisionCommit summaryAuthorDate
r84962message fix, follow up to r84899jeroendedauw15:11, 29 March 2011

Comments

#Comment by Siebrand (talk | contribs)   10:14, 29 March 2011

Having trouble finding out what this message means:

+	'srf_paramdesc_rankdir' => 'Rank dir',

Can you please document it, or change it to something more verbose?

#Comment by Jeroen De Dauw (talk | contribs)   10:18, 29 March 2011

I don't know what it is either, but have notified the patch author to take a look at it :)

Status & tagging log