r53135 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53134‎ | r53135 | r53136 >
Date:16:01, 12 July 2009
Author:vrandezo
Status:deferred
Tags:
Comment:
Refreshed ploticus format slightly
* changed standard image format from png to gif, since ploticus binary build on windows does not support png, but all binary releases support gif
* replaced generic ploticus format with a special ploticus verical bar format (as an example)
* changed data input from wikivalue to xsdvalue, since commas in number may confuse ploticus
Modified paths:
  • /trunk/extensions/SemanticResultFormats/Ploticus/SRF_Ploticus.php (modified) (history)
  • /trunk/extensions/SemanticResultFormats/Ploticus/SRF_PloticusVBar.php (added) (history)
  • /trunk/extensions/SemanticResultFormats/SRF_Settings.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/SRF_Settings.php
@@ -27,7 +27,8 @@
2828 function srffSetup() {
2929 global $srfgFormats, $wgExtensionCredits;
3030
31 - foreach($srfgFormats as $fn) srffInitFormat($fn);
 31+ foreach($srfgFormats as $fn) srffInitFormat( $fn );
 32+
3233 $formats_list = implode(', ', $srfgFormats);
3334 $wgExtensionCredits['other'][]= array(
3435 'path' => __FILE__,
@@ -65,11 +66,11 @@
6667 case 'calendar':
6768 $class = 'SRFCalendar';
6869 $file = $srfgIP . '/Calendar/SRF_Calendar.php';
69 - breaK;
 70+ break;
7071 case 'outline':
7172 $class = 'SRFOutline';
7273 $file = $srfgIP . '/Outline/SRF_Outline.php';
73 - breaK;
 74+ break;
7475 case 'sum': case 'average': case 'min': case 'max':
7576 $class = 'SRFMath';
7677 $file = $srfgIP . '/Math/SRF_Math.php';
@@ -90,6 +91,10 @@
9192 $class = 'SRFGraph';
9293 $file = $srfgIP . '/GraphViz/SRF_Graph.php';
9394 break;
 95+ case 'ploticusvbar':
 96+ $class = 'SRFPloticusVBar';
 97+ $file = $srfgIP . '/Ploticus/SRF_PloticusVBar.php';
 98+ break;
9499 }
95100 if (($class) && ($file)) {
96101 $smwgResultFormats[$format] = $class;
Index: trunk/extensions/SemanticResultFormats/Ploticus/SRF_Ploticus.php
@@ -21,7 +21,7 @@
2222
2323 class SRFPloticus extends SMWResultPrinter {
2424 protected $m_ploticusparams = '';
25 - protected $m_imageformat = 'png';
 25+ protected $m_imageformat = 'gif';
2626 protected $m_titletext = '';
2727 protected $m_showcsv = false;
2828 protected $m_ploticusmode = 'prefab';
@@ -165,7 +165,7 @@
166166 foreach ($row as $field) {
167167 $growing = array();
168168 while (($object = $field->getNextObject()) !== false) {
169 - $text = Sanitizer::decodeCharReferences($object->getWikiValue());
 169+ $text = Sanitizer::decodeCharReferences($object->getXSDValue());
170170 // decode: CSV knows nothing of possible HTML entities
171171 $growing[] = $text;
172172 }
@@ -347,6 +347,7 @@
348348
349349 // if showrefresh is on, create link to force refresh
350350 if ($this->m_showrefresh) {
 351+ global $wgArticlePath;
351352 $rtnstr .= ' <a href="' . $wgArticlePath . '?action=purge" title="Reload"><img src="'.
352353 $srficonPath . 'reload_16.png" alt="Reload"></a>';
353354 }
Index: trunk/extensions/SemanticResultFormats/Ploticus/SRF_PloticusVBar.php
@@ -0,0 +1,41 @@
 2+<?php
 3+/**
 4+ * A query printer using Ploticus drawing vertical bars.
 5+ * loosely based on the Ploticus Extension by Flavien Scheurer
 6+ * and CSV result printer
 7+ *
 8+ * @note AUTOLOADED
 9+ * @author Joel Natividad
 10+ * @author Denny Vrandecic
 11+ */
 12+
 13+/**
 14+ * Result printer using Ploticus to plot vertical bars.
 15+ * TODO: Create expanded doxygen comments
 16+ *
 17+ * @ingroup SMWQuery
 18+ */
 19+
 20+if( !defined( 'MEDIAWIKI' ) ) {
 21+ die( 'Not an entry point.' );
 22+}
 23+
 24+include_once( "SRF_Ploticus.php" );
 25+
 26+/**
 27+ * This class only specifies the the SRFPloticus superclass. Since the
 28+ * current working of the SRFPloticus class is unsafe, this specialization
 29+ * filters out this unsecure parameter passing (and the power of Ploticus)
 30+ * and allows only for vertical bars.
 31+ */
 32+class SRFPloticusVBar extends SRFPloticus {
 33+
 34+ protected function readParameters($params, $outputmode) {
 35+ SRFPloticus::readParameters($params, $outputmode);
 36+
 37+ // All other options will be simply ignored;
 38+ $this->m_ploticusmode === 'prefab';
 39+ $this->m_ploticusparams = "-prefab vbars x=1 y=2";
 40+ }
 41+
 42+}
\ No newline at end of file

Status & tagging log