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

Revision: 89437
Author:   jeroendedauw
Date:     2011-06-03 20:11:37 +0000 (Fri, 03 Jun 2011)
Log Message:
-----------
several fixes, mainly to Special:BrowseByProperty

Modified Paths:
--------------
    trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Property.php
    trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DataValue.php
    
trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByProperty.php

Modified: 
trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Property.php
===================================================================
--- trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Property.php  
2011-06-03 19:55:37 UTC (rev 89436)
+++ trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Property.php  
2011-06-03 20:11:37 UTC (rev 89437)
@@ -89,7 +89,7 @@
         * original object's content.
         */
        public function __clone() {
-               if ( $this->m_wikipage !== null ) $this->m_wikipage = clone 
$this->m_wikipage;
+               if ( !is_null( $this->m_wikipage ) ) $this->m_wikipage = clone 
$this->m_wikipage;
        }
 
        /**

Modified: 
trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DataValue.php
===================================================================
--- trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DataValue.php    
2011-06-03 19:55:37 UTC (rev 89436)
+++ trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DataValue.php    
2011-06-03 20:11:37 UTC (rev 89437)
@@ -60,7 +60,6 @@
         */
        protected $m_dataitem;
 
-
        /**
         * The text label of the respective property or false if none given.
         * @var SMWDIProperty
@@ -642,7 +641,7 @@
         */
        public function isValid() {
                $this->unstub();
-               return ( ( !$this->mHasErrors ) && isset( $this->m_dataitem ) );
+               return !$this->mHasErrors && isset( $this->m_dataitem );
        }
 
        /**

Modified: 
trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByProperty.php
===================================================================
--- 
trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByProperty.php
    2011-06-03 19:55:37 UTC (rev 89436)
+++ 
trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByProperty.php
    2011-06-03 20:11:37 UTC (rev 89437)
@@ -77,7 +77,7 @@
                        $this->propertystring = '';
                } else {
                        $this->propertystring = $this->property->getWikiValue();
-                       $this->value = 
SMWDataValueFactory::newPropertyObjectValue( $this->property, 
$this->valuestring );
+                       $this->value = 
SMWDataValueFactory::newPropertyObjectValue( $this->property->getDataItem(), 
$this->valuestring );
                        
                        if ( $this->value->isValid() ) {
                                $this->valuestring = 
$this->value->getWikiValue();
@@ -201,11 +201,10 @@
                
                while ( $results && $number != 0 ) {
                        $result = array_shift( $results );
-                       $thing = $result[0]->getLongHTMLText( smwfGetLinker() );
                        
-                       $html .= '<li>' . $thing;
+                       $html .= '<li>' . $result[0]->getLongHTMLText( 
smwfGetLinker() );
                        
-                       if ( $result[0]->getTypeId() == '_wpg' ) {
+                       if ( $result[0]->getTypeID() == '_wpg' ) {
                                $html .= '&#160;&#160;' . 
SMWInfolink::newBrowsingLink( '+', $result[0]->getShortHTMLText() )->getHTML( 
smwfGetLinker() );
                        }
                        
@@ -294,11 +293,14 @@
                $options->offset = $this->offset;
                $options->sort = true;
 
-               $res = smwfGetStore()->getPropertySubjects( $this->property, 
$this->value, $options );
+               $res = smwfGetStore()->getPropertySubjects( 
$this->property->getDataItem(), $this->value->getDataItem(), $options );
                $results = array();
                
                foreach ( $res as $result ) {
-                       array_push( $results, array( $result, $this->value ) );
+                       array_push( $results, array(
+                               SMWDataValueFactory::newDataItemValue( $result 
),
+                               $this->value
+                       ) );
                }
 
                return $results;
@@ -327,10 +329,10 @@
                $params['sort'] = $this->propertystring;
                $params['order'] = 'DESC';
                if ( $greater ) $params['order'] = 'ASC';
-               $cmp = "<";
-               if ( $greater ) $cmp = ">";
+               $cmp = '<';
+               if ( $greater ) $cmp = '>';
                
-               $querystring = "[[" . $this->propertystring . "::" . $cmp . 
$this->valuestring . "]]";
+               $querystring = '[[' . $this->propertystring . '::' . $cmp . 
$this->valuestring . ']]';
                $queryobj = SMWQueryProcessor::createQuery( $querystring, 
$params, SMWQueryProcessor::SPECIAL_PAGE, 'ul', array( $printrequest ) );
                $queryobj->querymode = SMWQuery::MODE_INSTANCES;
                $queryobj->setLimit( $this->limit );


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to