Index: trunk/extensions/SemanticResultFormats/Gallery/SRF_Gallery.php |
— | — | @@ -31,30 +31,26 @@ |
32 | 32 | $ig->useSkin( $wgUser->getSkin() ); // FIXME: deprecated method usage |
33 | 33 | $ig->setCaption( $this->mIntro ); // set caption to IQ header |
34 | 34 | |
35 | | - if ( isset( $this->m_params['perrow'] ) ) { |
| 35 | + if ( $this->m_params['perrow'] !== '' ) { |
36 | 36 | $ig->setPerRow( $this->m_params['perrow'] ); |
37 | 37 | } |
38 | 38 | |
39 | | - if ( isset( $this->m_params['widths'] ) ) { |
| 39 | + if ( $this->m_params['widths'] !== '' ) { |
40 | 40 | $ig->setWidths( $this->m_params['widths'] ); |
41 | 41 | } |
42 | 42 | |
43 | | - if ( isset( $this->m_params['heights'] ) ) { |
| 43 | + if ( $this->m_params['heights'] !== '' ) { |
44 | 44 | $ig->setHeights( $this->m_params['heights'] ); |
45 | 45 | } |
46 | 46 | |
47 | | - $this->m_params['autocaptions'] = isset( $this->m_params['autocaptions'] ) ? trim( $this->m_params['autocaptions'] ) != 'off' : true; |
48 | | - $this->m_params['fileextensions'] = isset( $this->m_params['fileextensions'] ) ? trim( $this->m_params['fileextensions'] ) != 'off' : true; |
49 | | - |
50 | 47 | $printReqLabels = array(); |
51 | 48 | |
52 | | - foreach ( $results->getPrintRequests() as $printReq ) { |
| 49 | + foreach ( $results->getPrintRequests() as /* SMWPrintRequest */ $printReq ) { |
53 | 50 | $printReqLabels[] = $printReq->getLabel(); |
54 | 51 | } |
55 | 52 | |
56 | | - if ( isset( $this->m_params['imageproperty'] ) && in_array( $this->m_params['imageproperty'], $printReqLabels ) ) { |
57 | | - $captionProperty = isset( $this->m_params['captionproperty'] ) ? $this->m_params['captionproperty'] : ''; |
58 | | - $this->addImageProperties( $results, $ig, $this->m_params['imageproperty'], $captionProperty ); |
| 53 | + if ( $this->m_params['imageproperty'] !== '' && in_array( $this->m_params['imageproperty'], $printReqLabels ) ) { |
| 54 | + $this->addImageProperties( $results, $ig, $this->m_params['imageproperty'], $this->m_params['captionproperty'] ); |
59 | 55 | } |
60 | 56 | else { |
61 | 57 | $this->addImagePages( $results, $ig ); |
— | — | @@ -182,47 +178,34 @@ |
183 | 179 | public function getParameters() { |
184 | 180 | $params = parent::getParameters(); |
185 | 181 | |
186 | | - if ( defined( 'SMW_SUPPORTS_VALIDATOR' ) ) { |
187 | | - $params['perrow'] = new Parameter( 'perrow', Parameter::TYPE_INTEGER ); |
188 | | - $params['perrow']->setDescription( wfMsg( 'srf_paramdesc_perrow' ) ); |
189 | | - $params['perrow']->setDefault( '', false ); |
| 182 | + $params['perrow'] = new Parameter( 'perrow', Parameter::TYPE_INTEGER ); |
| 183 | + $params['perrow']->setMessage( 'srf_paramdesc_perrow' ); |
| 184 | + $params['perrow']->setDefault( '', false ); |
190 | 185 | |
191 | | - $params['widths'] = new Parameter( 'widths', Parameter::TYPE_INTEGER ); |
192 | | - $params['widths']->setDescription( wfMsg( 'srf_paramdesc_widths' ) ); |
193 | | - $params['widths']->setDefault( '', false ); |
| 186 | + $params['widths'] = new Parameter( 'widths', Parameter::TYPE_INTEGER ); |
| 187 | + $params['widths']->setMessage( 'srf_paramdesc_widths' ); |
| 188 | + $params['widths']->setDefault( '', false ); |
194 | 189 | |
195 | | - $params['heights'] = new Parameter( 'heights', Parameter::TYPE_INTEGER ); |
196 | | - $params['heights']->setDescription( wfMsg( 'srf_paramdesc_heights' ) ); |
197 | | - $params['heights']->setDefault( '', false ); |
| 190 | + $params['heights'] = new Parameter( 'heights', Parameter::TYPE_INTEGER ); |
| 191 | + $params['heights']->setMessage( 'srf_paramdesc_heights' ); |
| 192 | + $params['heights']->setDefault( '', false ); |
198 | 193 | |
199 | | - $params['autocaptions'] = new Parameter( 'autocaptions', Parameter::TYPE_BOOLEAN ); |
200 | | - $params['autocaptions']->setDescription( wfMsg( 'srf_paramdesc_autocaptions' ) ); |
201 | | - $params['autocaptions']->setDefault( true ); |
202 | | - |
203 | | - $params['fileextensions'] = new Parameter( 'fileextensions', Parameter::TYPE_BOOLEAN ); |
204 | | - $params['fileextensions']->setDescription( wfMsg( 'srf_paramdesc_fileextensions' ) ); |
205 | | - $params['fileextensions']->setDefault( false ); |
206 | | - |
207 | | - $params['captionproperty'] = new Parameter( 'captionproperty' ); |
208 | | - $params['captionproperty']->setDescription( wfMsg( 'srf_paramdesc_captionproperty' ) ); |
209 | | - $params['captionproperty']->setDefault( '' ); |
210 | | - |
211 | | - $params['imageproperty'] = new Parameter( 'imageproperty' ); |
212 | | - $params['imageproperty']->setDescription( wfMsg( 'srf_paramdesc_imageproperty' ) ); |
213 | | - $params['imageproperty']->setDefault( '' ); |
214 | | - } |
215 | | - else { |
216 | | - // This if for b/c with SMW 1.5.x; SMW 1.6 directly accepts Parameter objects. |
217 | | - $params[] = array( 'name' => 'perrow', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_perrow' ) ); |
218 | | - $params[] = array( 'name' => 'widths', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_widths' ) ); |
219 | | - $params[] = array( 'name' => 'heights', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_heights' ) ); |
220 | | - $params[] = array( 'name' => 'captionproperty', 'type' => 'string', 'description' => wfMsg( 'srf_paramdesc_captionproperty' ) ); |
221 | | - $params[] = array( 'name' => 'imageproperty', 'type' => 'string', 'description' => wfMsg( 'srf_paramdesc_imageproperty' ) ); |
| 194 | + $params['autocaptions'] = new Parameter( 'autocaptions', Parameter::TYPE_BOOLEAN ); |
| 195 | + $params['autocaptions']->setMessage( 'srf_paramdesc_autocaptions' ); |
| 196 | + $params['autocaptions']->setDefault( true ); |
| 197 | + |
| 198 | + $params['fileextensions'] = new Parameter( 'fileextensions', Parameter::TYPE_BOOLEAN ); |
| 199 | + $params['fileextensions']->setMessage( 'srf_paramdesc_fileextensions' ); |
| 200 | + $params['fileextensions']->setDefault( false ); |
| 201 | + |
| 202 | + $params['captionproperty'] = new Parameter( 'captionproperty' ); |
| 203 | + $params['captionproperty']->setMessage( 'srf_paramdesc_captionproperty' ); |
| 204 | + $params['captionproperty']->setDefault( '' ); |
| 205 | + |
| 206 | + $params['imageproperty'] = new Parameter( 'imageproperty' ); |
| 207 | + $params['imageproperty']->setMessage( 'srf_paramdesc_imageproperty' ); |
| 208 | + $params['imageproperty']->setDefault( '' ); |
222 | 209 | |
223 | | - $params[] = array( 'name' => 'autocaptions', 'type' => 'enumeration', 'description' => wfMsg( 'srf_paramdesc_autocaptions' ), 'values' => array( 'on', 'off' ) ); |
224 | | - $params[] = array( 'name' => 'fileextensions', 'type' => 'enumeration', 'description' => wfMsg( 'srf_paramdesc_fileextensions' ), 'values' => array( 'on', 'off' ) ); |
225 | | - } |
226 | | - |
227 | 210 | return $params; |
228 | 211 | } |
229 | 212 | |