Index: trunk/extensions/Plotters/PlottersClass.php |
— | — | @@ -35,9 +35,25 @@ |
36 | 36 | } |
37 | 37 | |
38 | 38 | function checkForErrors() { |
| 39 | + wfLoadExtensionMessages( 'Plotters' ); |
| 40 | + |
| 41 | + $errors = ''; |
| 42 | + |
39 | 43 | // Check for a script |
| 44 | + if ( $this->argumentArray["script"] == "" ) { |
| 45 | + $errors .= wfMsg( "plotters-missing-script" ) . "<br />"; |
| 46 | + } else if ( strlen( $this->argumentArray["script"] ) > 255 ) { |
| 47 | + // Check to ensure scriptname is < 255 characters |
| 48 | + $errors .= wfMsg( "plotters-excessively-long-scriptname" ) . "<br />"; |
| 49 | + } |
40 | 50 | // Check for data |
41 | | - return ''; |
| 51 | + if ( count( $this->dataArray ) == 0 ) { |
| 52 | + $errors .= wfMsg( "plotters-no-data" ) . "<br />"; |
| 53 | + } |
| 54 | + |
| 55 | + if ( $errors != '' ) { |
| 56 | + $this->errors = wfMsg( "plotters-errors" ) . " " . $errors; |
| 57 | + } |
42 | 58 | } |
43 | 59 | |
44 | 60 | function toHTML() { |
Index: trunk/extensions/Plotters/PlottersParser.php |
— | — | @@ -109,6 +109,13 @@ |
110 | 110 | } |
111 | 111 | |
112 | 112 | function parseData( $input, $parser ) { |
| 113 | + $this->dataArray = array(); |
| 114 | + |
| 115 | + Plotter::debug( 'plot script input: ', $this->argumentArray["scriptarguments"] ); |
| 116 | + if ( trim( $input ) == '' ) { |
| 117 | + return; |
| 118 | + } |
| 119 | + |
113 | 120 | // Replace escaped separators |
114 | 121 | $sep = $this->argumentArray["datasep"]; |
115 | 122 | $input = preg_replace( "/\\\\$sep/", '§UNIQ§', $input ); |
Index: trunk/extensions/Plotters/Plotters.i18n.php |
— | — | @@ -23,6 +23,10 @@ |
24 | 24 | 'plotters-pagetext' => "Below is a list of special plotters users can use in their jsplot tags, as defined by [[MediaWiki:Plotters-definition]]. |
25 | 25 | This overview provides easy access to the system message pages that define each plotter's description and code.", |
26 | 26 | 'plotters-uses' => 'Uses', |
| 27 | + 'plotters-missing-script' => 'No script was defined.', |
| 28 | + 'plotters-excessively-long-scriptname' => 'The script name is too long. Please define a script that is less than 255 characters.', |
| 29 | + 'plotters-no-data' => 'No data was provided.', |
| 30 | + 'plotters-errors' => '<b>Plotters error(s):</b>', |
27 | 31 | ); |
28 | 32 | |
29 | 33 | /** Arabic (العربية) |