Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_DSV.php |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | * |
7 | 7 | * @file SMW_QP_DSV.php |
8 | 8 | * @ingroup SMWQuery |
9 | | - * @since 1.5.7 |
| 9 | + * @since 1.6 |
10 | 10 | * |
11 | 11 | * @licence GNU GPL v3 |
12 | 12 | * |
— | — | @@ -17,20 +17,24 @@ |
18 | 18 | protected $separator = ':'; |
19 | 19 | protected $fileName = 'result.dsv'; |
20 | 20 | |
21 | | - protected function readParameters( $params, $outputmode ) { |
22 | | - parent::readParameters( $params, $outputmode ); |
| 21 | + /** |
| 22 | + * @see SMWResultPrinter::handleParameters |
| 23 | + * |
| 24 | + * @since 1.6 |
| 25 | + * |
| 26 | + * @param array $params |
| 27 | + * @param $outputmode |
| 28 | + */ |
| 29 | + protected function handleParameters( array $params, $outputmode ) { |
| 30 | + parent::handleParameters( $params, $outputmode ); |
23 | 31 | |
24 | | - if ( array_key_exists( 'separator', $this->m_params ) && $this->m_params['separator'] != '\\' ) { |
25 | | - $this->separator = trim( $this->m_params['separator'] ); |
26 | | - // Also support 'sep' as alias, since this is the param name for the CSV format. |
27 | | - } elseif ( array_key_exists( 'sep', $this->m_params ) && $this->m_params['sep'] != '\\' ) { |
28 | | - $this->separator = trim( $this->m_params['sep'] ); |
| 32 | + // Do not allow backspaces as delimiter, as they'll break stuff. |
| 33 | + if ( trim( $params['separator'] ) != '\\' ) { |
| 34 | + $this->separator = trim( $params['separator'] ); |
29 | 35 | } |
30 | 36 | |
31 | | - if ( isset( $this->m_params['filename'] ) ) { |
32 | | - $this->fileName = str_replace( ' ', '_', $this->m_params['filename'] ); |
33 | | - } |
34 | | - } |
| 37 | + $this->fileName = str_replace( ' ', '_', $params['increase'] ); |
| 38 | + } |
35 | 39 | |
36 | 40 | public function getMimeType( $res ) { |
37 | 41 | return 'text/dsv'; |
— | — | @@ -61,7 +65,7 @@ |
62 | 66 | /** |
63 | 67 | * Returns the query result in DSV. |
64 | 68 | * |
65 | | - * @since 1.5.7 |
| 69 | + * @since 1.6 |
66 | 70 | * |
67 | 71 | * @param SMWQueryResult $res |
68 | 72 | * |
— | — | @@ -106,7 +110,7 @@ |
107 | 111 | /** |
108 | 112 | * Returns a single DSV line. |
109 | 113 | * |
110 | | - * @since 1.5.7 |
| 114 | + * @since 1.6 |
111 | 115 | * |
112 | 116 | * @param array $fields |
113 | 117 | * |
— | — | @@ -119,7 +123,7 @@ |
120 | 124 | /** |
121 | 125 | * Encodes a single DSV. |
122 | 126 | * |
123 | | - * @since 1.5.7 |
| 127 | + * @since 1.6 |
124 | 128 | * |
125 | 129 | * @param string $value |
126 | 130 | * |
— | — | @@ -141,7 +145,7 @@ |
142 | 146 | /** |
143 | 147 | * Returns html for a link to a query that returns the DSV file. |
144 | 148 | * |
145 | | - * @since 1.5.7 |
| 149 | + * @since 1.6 |
146 | 150 | * |
147 | 151 | * @param SMWQueryResult $res |
148 | 152 | * @param $outputmode |
— | — | @@ -180,7 +184,7 @@ |
181 | 185 | public function getParameters() { |
182 | 186 | $params = array_merge( parent::getParameters(), $this->exportFormatParameters() ); |
183 | 187 | |
184 | | - $params['separator'] = new Parameter( 'separator' ); |
| 188 | + $params['separator'] = new Parameter( 'separator', 'sep' ); |
185 | 189 | $params['separator']->setDescription( wfMsg( 'smw-paramdesc-dsv-separator' ) ); |
186 | 190 | $params['separator']->setDefault( $this->separator ); |
187 | 191 | |