Index: trunk/extensions/SemanticDrilldown/includes/SD_Filter.php |
— | — | @@ -30,8 +30,8 @@ |
31 | 31 | $sd_array = $object_values['sd']; |
32 | 32 | $smw_array = $fieldObj->getObject('semanticmediawiki_Property'); //this returns an array with property values filled |
33 | 33 | $prop_array = $smw_array['smw']; |
34 | | - if ( array_key_exists( 'Label', $sd_array ) ) { |
35 | | - $f->name = $sd_array['Label']; |
| 34 | + if ( array_key_exists( 'Name', $sd_array ) ) { |
| 35 | + $f->name = $sd_array['Name']; |
36 | 36 | } else { |
37 | 37 | $f->name = $prop_array['name']; |
38 | 38 | } |
Index: trunk/extensions/SemanticDrilldown/includes/SD_PageSchemas.php |
— | — | @@ -7,33 +7,33 @@ |
8 | 8 | * @author Ankit Garg |
9 | 9 | */ |
10 | 10 | |
11 | | -if ( !defined( 'MEDIAWIKI' ) ) die(); |
12 | | - |
13 | 11 | class SDPageSchemas { |
14 | 12 | |
15 | 13 | /** |
16 | | - * Return an object containing information on a filter, based on XML |
17 | | - * from the Page Schemas extensions |
| 14 | + * Returns an object containing information on a filter, based on XML |
| 15 | + * from the Page Schemas extension. |
18 | 16 | */ |
19 | 17 | public static function createPageSchemasObject( $objectName, $xmlForField, &$object ) { |
20 | 18 | $sdarray = array(); |
21 | | - if ( $objectName == "semanticdrilldown_Filter" ) { |
22 | | - foreach ( $xmlForField->children() as $tag => $child ) { |
23 | | - if ( $tag == $objectName ) { |
24 | | - foreach ( $child->children() as $prop => $value) { |
25 | | - if( $prop == "Values" ){ |
26 | | - $l_values = array(); |
27 | | - foreach ( $value->children() as $val_i => $val ) { |
28 | | - $l_values[] = (string)$val; |
29 | | - } |
30 | | - $sdarray['Values'] = $l_values; |
31 | | - } else { |
32 | | - $sdarray[$prop] = (string)$value; |
| 19 | + if ( $objectName != "semanticdrilldown_Filter" ) { |
| 20 | + return true; |
| 21 | + } |
| 22 | + |
| 23 | + foreach ( $xmlForField->children() as $tag => $child ) { |
| 24 | + if ( $tag == $objectName ) { |
| 25 | + foreach ( $child->children() as $prop => $value) { |
| 26 | + if( $prop == "Values" ){ |
| 27 | + $l_values = array(); |
| 28 | + foreach ( $value->children() as $val ) { |
| 29 | + $l_values[] = (string)$val; |
33 | 30 | } |
| 31 | + $sdarray['Values'] = $l_values; |
| 32 | + } else { |
| 33 | + $sdarray[$prop] = (string)$value; |
34 | 34 | } |
35 | | - $object['sd'] = $sdarray; |
36 | | - return true; |
37 | 35 | } |
| 36 | + $object['sd'] = $sdarray; |
| 37 | + return true; |
38 | 38 | } |
39 | 39 | } |
40 | 40 | return true; |
— | — | @@ -44,11 +44,6 @@ |
45 | 45 | * Semantic Drilldown section in Page Schemas' "edit schema" page |
46 | 46 | */ |
47 | 47 | public static function getFieldHTML( $field, &$text_extensions ){ |
48 | | - // TODO - add these options to the XML and HTML |
49 | | - //$property_label = wfMsg( 'sd_createfilter_property' ); |
50 | | - //$label_label = wfMsg( 'sd_createfilter_label' ); |
51 | | - // need both label and value, in case user's language is different |
52 | | - // from wiki's |
53 | 48 | //$require_filter_label = wfMsg( 'sd_createfilter_requirefilter' ); |
54 | 49 | |
55 | 50 | $filter_array = array(); |
— | — | @@ -61,10 +56,10 @@ |
62 | 57 | } |
63 | 58 | } |
64 | 59 | |
65 | | - if ( array_key_exists( 'Label', $filter_array ) ) { |
66 | | - $filterLabel = $filter_array['Label']; |
| 60 | + if ( array_key_exists( 'Name', $filter_array ) ) { |
| 61 | + $filterName = $filter_array['Name']; |
67 | 62 | } else { |
68 | | - $filterLabel = ''; |
| 63 | + $filterName = ''; |
69 | 64 | } |
70 | 65 | $fromCategoryAttrs = array(); |
71 | 66 | if ( array_key_exists( 'ValuesFromCategory', $filter_array ) ) { |
— | — | @@ -107,7 +102,7 @@ |
108 | 103 | $usePropertyValuesAttr['checked'] = true; |
109 | 104 | } |
110 | 105 | |
111 | | - // The "input type" field |
| 106 | + // The "input type" field. |
112 | 107 | $combo_box_value = wfMsgForContent( 'sd_filter_combobox' ); |
113 | 108 | $date_range_value = wfMsgForContent( 'sd_filter_daterange' ); |
114 | 109 | $valuesListAttrs = array( 'value' => '' ); |
— | — | @@ -127,8 +122,8 @@ |
128 | 123 | } |
129 | 124 | |
130 | 125 | $html_text = '<p>' . wfMsg( 'ps-optional-name' ) . ' '; |
131 | | - $html_text .= Html::input( 'sd_filter_name_num', $filterLabel, 'text', array( 'size' => 25 ) ) . "</p>\n"; |
132 | | - $html_text .= '<fieldset><legend>Values</legend>' . "\n"; |
| 126 | + $html_text .= Html::input( 'sd_filter_name_num', $filterName, 'text', array( 'size' => 25 ) ) . "</p>\n"; |
| 127 | + $html_text .= '<fieldset><legend>' . wfMsg( 'sd-pageschemas-values' ) . '</legend>' . "\n"; |
133 | 128 | $html_text .= '<p>' . Html::input( 'sd_values_source_num', 'property', 'radio', $usePropertyValuesAttr ) . ' '; |
134 | 129 | $html_text .= wfMsg( 'sd_createfilter_usepropertyvalues' ) . "</p>\n"; |
135 | 130 | $html_text .= "\t<p>\n"; |
— | — | @@ -179,7 +174,7 @@ |
180 | 175 | if ( substr( $var, 0, 15 ) == 'sd_filter_name_' ) { |
181 | 176 | $xml = '<semanticdrilldown_Filter>'; |
182 | 177 | $fieldNum = substr( $var, 15 ); |
183 | | - $xml .= '<Label>'.$val.'</Label>'; |
| 178 | + $xml .= '<Name>'.$val.'</Name>'; |
184 | 179 | } elseif ( substr( $var, 0, 17 ) == 'sd_values_source_') { |
185 | 180 | if ( $val == 'category' ) { |
186 | 181 | $xml .= '<ValuesFromCategory>' . $request->getText('sd_category_name_' . $fieldNum) . '</ValuesFromCategory>'; |
— | — | @@ -220,15 +215,15 @@ |
221 | 216 | public static function parseFieldElements( $field_xml, &$text_object ) { |
222 | 217 | foreach ( $field_xml->children() as $tag => $child ) { |
223 | 218 | if ( $tag == "semanticdrilldown_Filter" ) { |
224 | | - $text = ""; |
225 | | - $text = PageSchemas::tableMessageRowHTML( "paramAttr", "SemanticDrillDown", (string)$tag ); |
| 219 | + $text = PageSchemas::tableMessageRowHTML( "paramAttr", wfMsg( 'specialpages-group-sd_group' ), "Filter" ); |
226 | 220 | foreach ( $child->children() as $prop => $value) { |
227 | | - if( $prop == "Values" ){ |
228 | | - $l_values = ""; |
229 | | - foreach ( $value->children() as $val_i => $val ) { |
230 | | - $l_values .= $val.", "; |
| 221 | + if ( $prop == "Values" ) { |
| 222 | + $filterValues = array(); |
| 223 | + foreach ( $value->children() as $valTag ) { |
| 224 | + $filterValues[] = (string)$valTag; |
231 | 225 | } |
232 | | - $text .= PageSchemas::tableMessageRowHTML("paramAttrMsg", $prop, $l_values ); |
| 226 | + $valuesStr = implode( ', ', $filterValues ); |
| 227 | + $text .= PageSchemas::tableMessageRowHTML("paramAttrMsg", wfMsg( 'sd-pageschemas-values' ), $valuesStr ); |
233 | 228 | } else { |
234 | 229 | $text .= PageSchemas::tableMessageRowHTML("paramAttrMsg", $prop, $value ); |
235 | 230 | } |