r27850 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r27849‎ | r27850 | r27851 >
Date:17:08, 26 November 2007
Author:mkroetzsch
Status:old
Tags:
Comment:
Support mainlabel=- to hide main column, and "empty" printrequest "?|" to use it somewhere else
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php
@@ -46,7 +46,7 @@
4747 } else {
4848 $mainlabel = $qp->getLabel();
4949 }
50 - if ( !$desc->isSingleton() || (count($desc->getPrintRequests()) + count($extraprintouts) == 0) ) {
 50+ if ( ( !$desc->isSingleton() || (count($desc->getPrintRequests()) + count($extraprintouts) == 0) ) && ($mainlabel != '-') ) {
5151 $desc->prependPrintRequest(new SMWPrintRequest(SMW_PRINT_THIS, $mainlabel));
5252 }
5353
@@ -109,7 +109,19 @@
110110 $param = substr($param,1);
111111 $parts = explode('=',$param,2);
112112 $propparts = explode('#',$parts[0],2);
113 - if ($wgContLang->getNsText(NS_CATEGORY) != ucfirst(trim($propparts[0]))) {
 113+ if (trim($propparts[0]) == '') { // print "this"
 114+ $printmode = SMW_PRINT_THIS;
 115+ if (count($parts) == 1) { // no label found, use empty label
 116+ $parts[] = '';
 117+ }
 118+ $property = NULL;
 119+ } elseif ($wgContLang->getNsText(NS_CATEGORY) == ucfirst(trim($propparts[0]))) { // print category
 120+ $property = NULL;
 121+ $printmode = SMW_PRINT_CATS;
 122+ if (count($parts) == 1) { // no label found, use category label
 123+ $parts[] = $wgContLang->getNSText(NS_CATEGORY);
 124+ }
 125+ } else { // print property
114126 $property = Title::newFromText(trim($propparts[0]), SMW_NS_PROPERTY); // trim needed for \n
115127 if ($property === NULL) { // too bad, this is no legal property name, ignore
116128 continue;
@@ -118,12 +130,6 @@
119131 if (count($parts) == 1) { // no label found, use property name
120132 $parts[] = $property->getText();
121133 }
122 - } else {
123 - $property = NULL;
124 - $printmode = SMW_PRINT_CATS;
125 - if (count($parts) == 1) { // no label found, use category label
126 - $parts[] = $wgContLang->getNSText(NS_CATEGORY);
127 - }
128134 }
129135 if (count($propparts) == 1) { // no outputformat found, use property name
130136 $propparts[] = '';

Status & tagging log