r20191 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r20190‎ | r20191 | r20192 >
Date:09:21, 7 March 2007
Author:mkroetzsch
Status:old
Tags:
Comment:
This special looks up the attribute table, which may have data of diverse types for single attributes. The
output now accounts for this. There should also be a way of fixing such issues autmoatically.
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/specials/Relations/SMW_SpecialAttributes.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/Relations/SMW_SpecialAttributes.php
@@ -46,7 +46,7 @@
4747 attribute_title as value,
4848 COUNT(*) as count
4949 FROM $attributes
50 - GROUP BY attribute_title";
 50+ GROUP BY attribute_title, value_datatype";
5151 }
5252
5353 function sortDescending() {
@@ -59,19 +59,12 @@
6060 $attrtitle = Title::makeTitle( SMW_NS_ATTRIBUTE, $result->value );
6161 $attrlink = $skin->makeLinkObj( $attrtitle, $attrtitle->getText() );
6262 // The value_datatype is in title, see getSQL().
63 - if (strncmp($result->title, $wgExtraNamespaces[SMW_NS_TYPE], count($wgExtraNamespaces[SMW_NS_TYPE])) == 0) {
64 - // The value_datatype is a Type: page name.
65 - $typetitle = Title::newFromText($result->title);
66 - } else {
67 - // The value_datatype is a type ID.
68 - // Get this ID's localized label and turn it into a Type: page.
69 - $typelabel = SMWTypeHandlerFactory::getTypeLabelByID($result->title);
70 - if ($typelabel !== NULL) {
71 - $typetitle = Title::makeTitle( SMW_NS_TYPE, $typelabel);
72 - } else {
73 - $typetitle = NULL;
74 - }
 63+
 64+ $typelabel = SMWTypeHandlerFactory::getTypeLabelByID($result->title);
 65+ if ( $typelabel === NULL ) { // type unknown, maybe some upgrade problem
 66+ $typelabel = $result->title;
7567 }
 68+ $typetitle = Title::makeTitle( SMW_NS_TYPE, $typelabel );
7669 $typelink = $skin->makeLinkObj( $typetitle);
7770 // Note: It doesn't seem possible to reuse this infolink object.
7871 $searchlink = new SMWInfolink(

Status & tagging log