Index: trunk/extensions/Plotters/Plotters.php |
— | — | @@ -52,6 +52,9 @@ |
53 | 53 | // sane defaults. always initialize to avoid register_globals vulnerabilities |
54 | 54 | $wgPlottersExtensionPath = $wgScriptPath . '/extensions/Plotters'; |
55 | 55 | $wgPlottersJavascriptPath = $wgScriptPath . '/extensions/Plotters'; |
| 56 | +$wgPlottersRendererFiles = array( "plotkit" => array( "/mochikit/MochiKit.js", "/plotkit/Base.js", "/plotkit/Layout.js", |
| 57 | + "/plotkit/Canvas.js", "/plotkit/SweetCanvas.js" ) |
| 58 | + ); |
56 | 59 | |
57 | 60 | function wfPlottersArticleSaveComplete( &$article, &$wgUser, &$text ) { |
58 | 61 | // update cache if MediaWiki:Plotters-definition was edited |
Index: trunk/extensions/Plotters/PlottersClass.php |
— | — | @@ -210,6 +210,7 @@ |
211 | 211 | static function setPlottersHeaders( &$outputPage, $renderer ) { |
212 | 212 | global $wgPlottersJavascriptPath; |
213 | 213 | global $wgPlottersExtensionPath; |
| 214 | + global $wgPlottersRendererFiles; |
214 | 215 | |
215 | 216 | $javascriptpath = $wgPlottersJavascriptPath; |
216 | 217 | |
— | — | @@ -217,15 +218,10 @@ |
218 | 219 | $outputPage->addScript( '<script src="' . $wgPlottersExtensionPath . '/libs/fixencoding.js" type="text/javascript"></script>' ); |
219 | 220 | $outputPage->addScript( '<script src="' . $wgPlottersExtensionPath . '/libs/excanvas.js" type="text/javascript"></script>' ); |
220 | 221 | |
221 | | - if ( $renderer == "plotkit" ) { |
222 | | - // Add mochikit (required by PlotKit) |
223 | | - $outputPage->addScript( '<script src="' . $javascriptpath . '/mochikit/MochiKit.js" type="text/javascript"></script>' ); |
224 | | - |
225 | | - // Add PlotKit javascript |
226 | | - $outputPage->addScript( '<script src="' . $javascriptpath . '/plotkit/Base.js" type="text/javascript"></script>' ); |
227 | | - $outputPage->addScript( '<script src="' . $javascriptpath . '/plotkit/Layout.js" type="text/javascript"></script>' ); |
228 | | - $outputPage->addScript( '<script src="' . $javascriptpath . '/plotkit/Canvas.js" type="text/javascript"></script>' ); |
229 | | - $outputPage->addScript( '<script src="' . $javascriptpath . '/plotkit/SweetCanvas.js" type="text/javascript"></script>' ); |
| 222 | + if ( isset( $wgPlottersRendererFiles[$renderer] ) ) { |
| 223 | + foreach ( $wgPlottersRendererFiles[$renderer] as $jsfile ) { |
| 224 | + $outputPage->addScript( '<script src="' . $javascriptpath . $jsfile . '" type="text/javascript"></script>' ); |
| 225 | + } |
230 | 226 | } |
231 | 227 | |
232 | 228 | return true; |
Index: trunk/extensions/Plotters/PlottersParser.php |
— | — | @@ -34,7 +34,7 @@ |
35 | 35 | |
36 | 36 | function parseArguments( $argv ) { |
37 | 37 | // Parse arguments, set defaults, and do sanity checks |
38 | | - $this->argumentArray = array ( "renderer" => "plotkit", "preprocessors" => array(), "preprocessorarguments" => array(), |
| 38 | + $this->argumentArray = array ( "renderer" => "generic", "preprocessors" => array(), "preprocessorarguments" => array(), |
39 | 39 | "script" => "", "scriptarguments" => array(), "datasep" => ",", "width" => "300", "height" => "300", "labels" => array(), |
40 | 40 | "name" => "plot", "tableclass" => "wikitable" ); |
41 | 41 | if ( isset( $argv["renderer"] ) ) { |