http://www.mediawiki.org/wiki/Special:Code/MediaWiki/100204

Revision: 100204
Author:   yaron
Date:     2011-10-19 02:42:34 +0000 (Wed, 19 Oct 2011)
Log Message:
-----------
Various fixes, including changing filter name from a tag to an attribute

Modified Paths:
--------------
    trunk/extensions/SemanticDrilldown/includes/SD_Filter.php
    trunk/extensions/SemanticDrilldown/includes/SD_PageSchemas.php

Modified: trunk/extensions/SemanticDrilldown/includes/SD_Filter.php
===================================================================
--- trunk/extensions/SemanticDrilldown/includes/SD_Filter.php   2011-10-19 
02:41:36 UTC (rev 100203)
+++ trunk/extensions/SemanticDrilldown/includes/SD_Filter.php   2011-10-19 
02:42:34 UTC (rev 100204)
@@ -30,8 +30,8 @@
                                if ( is_null( $filter_array ) ) {
                                        continue;
                                }
-                               if ( array_key_exists( 'Name', $filter_array ) 
) {
-                                       $f->name = $filter_array['Name'];
+                               if ( array_key_exists( 'name', $filter_array ) 
) {
+                                       $f->name = $filter_array['name'];
                                } else {
                                        $f->name = $fieldObj->getName();
                                }

Modified: trunk/extensions/SemanticDrilldown/includes/SD_PageSchemas.php
===================================================================
--- trunk/extensions/SemanticDrilldown/includes/SD_PageSchemas.php      
2011-10-19 02:41:36 UTC (rev 100203)
+++ trunk/extensions/SemanticDrilldown/includes/SD_PageSchemas.php      
2011-10-19 02:42:34 UTC (rev 100204)
@@ -25,6 +25,10 @@
                }
 
                foreach ( $xml->children() as $tag => $child ) {
+                       $filterName = $child->attributes()->name;
+                       if ( !is_null( $filterName ) ) {
+                               $sd_array['name'] = (string)$filterName;
+                       }
                        if ( $tag == $tagName ) {
                                foreach ( $child->children() as $prop => 
$value) {
                                        if( $prop == "Values" ){
@@ -48,26 +52,26 @@
        }
 
        public static function getFieldDisplayString() {
-               return 'Filter';
+               return wfMsg( 'sd-pageschemas-filter' );
        }
 
        /**
         * Returns the HTML for setting the filter options, for the
         * Semantic Drilldown section in Page Schemas' "edit schema" page
         */
-       public static function getFieldEditingHTML( $field ){
+       public static function getFieldEditingHTML( $psField ){
                //$require_filter_label = wfMsg( 
'sd_createfilter_requirefilter' );
 
                $filter_array = array();
                $hasExistingValues = false;
-               if ( !is_null( $field ) ) {
-                       $filter_array = $field->getObject( 
'semanticdrilldown_Filter' );
+               if ( !is_null( $psField ) ) {
+                       $filter_array = $psField->getObject( 
'semanticdrilldown_Filter' );
                        if ( !is_null( $filter_array ) ) {
                                $hasExistingValues = true;
                        }
                }
 
-               $filterName = PageSchemas::getValueFromObject( $filter_array, 
'Name' );
+               $filterName = PageSchemas::getValueFromObject( $filter_array, 
'name' );
                $selectedCategory = PageSchemas::getValueFromObject( 
$filter_array, 'ValuesFromCategory' );
                $fromCategoryAttrs = array();
                if ( !is_null( $selectedCategory ) ) {
@@ -171,11 +175,12 @@
                $xmlPerField = array();
                foreach ( $wgRequest->getValues() as $var => $val ) {
                        if ( substr( $var, 0, 15 ) == 'sd_filter_name_' ) {
-                               $xml = '<semanticdrilldown_Filter>';
+                               $xml = '<semanticdrilldown_Filter';
                                $fieldNum = substr( $var, 15 );
                                if ( !empty( $val ) ) {
-                                       $xml .= '<Name>' . $val . '</Name>';
+                                       $xml .= ' name="' . $val . '"';
                                }
+                               $xml .= '>';
                        } elseif ( substr( $var, 0, 17 ) == 
'sd_values_source_') {
                                if ( $val == 'category' ) {
                                        $xml .= '<ValuesFromCategory>' . 
$wgRequest->getText('sd_category_name_' . $fieldNum) . '</ValuesFromCategory>';


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to