Index: trunk/extensions/SemanticDrilldown/includes/SD_Utils.php |
— | — | @@ -28,9 +28,10 @@ |
29 | 29 | $sdarray[$prop] = (string)$value; |
30 | 30 | } |
31 | 31 | } |
| 32 | + $object['sd'] = $sdarray; |
| 33 | + return true; |
32 | 34 | } |
33 | 35 | } |
34 | | - $object['sd'] = $sdarray; |
35 | 36 | } |
36 | 37 | return true; |
37 | 38 | } |
— | — | @@ -47,11 +48,15 @@ |
48 | 49 | // from wiki's |
49 | 50 | //$require_filter_label = wfMsg( 'sd_createfilter_requirefilter' ); |
50 | 51 | |
| 52 | + $filter_array = array(); |
51 | 53 | if ( !is_null( $field ) ) { |
52 | 54 | $sd_array = $field->getObject('semanticdrilldown_Filter'); |
53 | | - $filter_array = $sd_array['sd']; |
54 | | - } else { |
55 | | - $filter_array = array(); |
| 55 | + if ( array_key_exists( 'sd', $sd_array ) ) { |
| 56 | + $filter_array = $sd_array['sd']; |
| 57 | + $hasExistingValues = true; |
| 58 | + } else { |
| 59 | + $hasExistingValues = false; |
| 60 | + } |
56 | 61 | } |
57 | 62 | |
58 | 63 | if ( array_key_exists( 'Label', $filter_array ) ) { |
— | — | @@ -159,26 +164,26 @@ |
160 | 165 | $html_text .= Html::rawElement( 'select', array( 'name' => 'sd_input_type_num', 'id' => 'input_type_dropdown' ), $inputTypeOptionsHTML ) . "\n"; |
161 | 166 | $html_text .= "</p>\n"; |
162 | 167 | |
163 | | - $text_extensions['sd'] = array( 'Filter', '#FDD', $html_text ); |
| 168 | + $text_extensions['sd'] = array( 'Filter', '#FDD', $html_text, $hasExistingValues ); |
164 | 169 | |
165 | 170 | return true; |
166 | 171 | } |
167 | 172 | |
168 | 173 | public static function getFieldXMLForPS( $request, &$xmlArray ) { |
169 | | - $templateNum = -1; |
| 174 | + $fieldNum = -1; |
170 | 175 | $xmlPerField = array(); |
171 | 176 | foreach ( $request->getValues() as $var => $val ) { |
172 | 177 | if ( substr( $var, 0, 15 ) == 'sd_filter_name_' ) { |
173 | 178 | $xml = '<semanticdrilldown_Filter>'; |
174 | | - $templateNum = substr( $var, 15 ); |
| 179 | + $fieldNum = substr( $var, 15 ); |
175 | 180 | $xml .= '<Label>'.$val.'</Label>'; |
176 | 181 | } elseif ( substr( $var, 0, 17 ) == 'sd_values_source_') { |
177 | 182 | if ( $val == 'category' ) { |
178 | | - $xml .= '<ValuesFromCategory>' . $request->getText('sd_category_name_' . $templateNum) . '</ValuesFromCategory>'; |
| 183 | + $xml .= '<ValuesFromCategory>' . $request->getText('sd_category_name_' . $fieldNum) . '</ValuesFromCategory>'; |
179 | 184 | } elseif ( $val == 'dates' ) { |
180 | | - $xml .= '<TimePeriod>' . $request->getText('sd_time_period_' . $templateNum) . '</TimePeriod>'; |
| 185 | + $xml .= '<TimePeriod>' . $request->getText('sd_time_period_' . $fieldNum) . '</TimePeriod>'; |
181 | 186 | } elseif ( $val == 'manual' ) { |
182 | | - $filter_manual_values_str = $request->getText('sd_filter_values_'.$templateNum); |
| 187 | + $filter_manual_values_str = $request->getText('sd_filter_values_' . $fieldNum); |
183 | 188 | // replace the comma substitution character that has no chance of |
184 | 189 | // being included in the values list - namely, the ASCII beep |
185 | 190 | $listSeparator = ','; |
— | — | @@ -197,7 +202,7 @@ |
198 | 203 | $xml .= '<InputType>' . $val . '</InputType>'; |
199 | 204 | } |
200 | 205 | $xml .= '</semanticdrilldown_Filter>'; |
201 | | - $xmlPerField[] = $xml; |
| 206 | + $xmlPerField[$fieldNum] = $xml; |
202 | 207 | } |
203 | 208 | } |
204 | 209 | |
— | — | @@ -224,7 +229,7 @@ |
225 | 230 | $text .= PageSchemas::tableMessageRowHTML("paramAttrMsg", $prop, $value ); |
226 | 231 | } |
227 | 232 | } |
228 | | - $text_object['sd']=$text; |
| 233 | + $text_object['sd'] = $text; |
229 | 234 | } |
230 | 235 | } |
231 | 236 | return true; |