Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php |
— | — | @@ -158,18 +158,25 @@ |
159 | 159 | $query->sortkeys = array(); |
160 | 160 | |
161 | 161 | foreach ( $params['sort'] as $sort ) { |
162 | | - $propertyValue = SMWPropertyValue::makeUserProperty( trim( $sort ) ); |
163 | | - if ( $propertyValue->isValid() ) { |
164 | | - $sortkey = $propertyValue->getDataItem()->getKey(); |
165 | | - $order = current( $orders ); |
166 | | - if ( $order === false ) { // default |
167 | | - $order = 'ASC'; |
168 | | - } |
169 | | - $query->sortkeys[$sortkey] = $order; // should we check for duplicate sort keys? |
| 162 | + if ( trim( $sort ) === '' ) { |
| 163 | + $query->sortkeys[''] = current( $orders ); |
170 | 164 | next( $orders ); |
171 | | - } else { |
172 | | - $query->addErrors( $propertyValue->getErrors() ); |
173 | 165 | } |
| 166 | + else { |
| 167 | + $propertyValue = SMWPropertyValue::makeUserProperty( trim( $sort ) ); |
| 168 | + |
| 169 | + if ( $propertyValue->isValid() ) { |
| 170 | + $sortkey = $propertyValue->getDataItem()->getKey(); |
| 171 | + $order = current( $orders ); |
| 172 | + if ( $order === false ) { // default |
| 173 | + $order = 'ASC'; |
| 174 | + } |
| 175 | + $query->sortkeys[$sortkey] = $order; // should we check for duplicate sort keys? |
| 176 | + next( $orders ); |
| 177 | + } else { |
| 178 | + $query->addErrors( $propertyValue->getErrors() ); |
| 179 | + } |
| 180 | + } |
174 | 181 | } |
175 | 182 | |
176 | 183 | if ( current( $orders ) !== false ) { // sort key remaining, apply to page name |