Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Description.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | * @ingroup SMWQuery |
15 | 15 | */ |
16 | 16 | class SMWPrintRequest { |
17 | | - const PRINT_CATS = 0; // print all direct cateories of the current element |
| 17 | + const PRINT_CATS = 0; // print all direct categories of the current element |
18 | 18 | const PRINT_PROP = 1; // print all property values of a certain attribute of the current element |
19 | 19 | const PRINT_THIS = 2; // print the current element |
20 | 20 | const PRINT_CCAT = 3; // check whether current element is in given category |
— | — | @@ -62,7 +62,7 @@ |
63 | 63 | return htmlspecialchars($this->m_label); |
64 | 64 | } |
65 | 65 | switch ($this->m_mode) { |
66 | | - case SMWPrintRequest::PRINT_CATS: |
| 66 | + case SMWPrintRequest::PRINT_CATS: |
67 | 67 | return htmlspecialchars($this->m_label); // TODO: link to Special:Categories |
68 | 68 | case SMWPrintRequest::PRINT_CCAT: |
69 | 69 | return $linker->makeLinkObj($this->m_data->getTitle(), htmlspecialchars($this->m_label)); |
— | — | @@ -81,7 +81,8 @@ |
82 | 82 | return $this->m_label; |
83 | 83 | } else { |
84 | 84 | switch ($this->m_mode) { |
85 | | - case SMWPrintRequest::PRINT_CATS: return $this->m_label; // TODO: link to Special:Categories |
| 85 | + case SMWPrintRequest::PRINT_CATS: |
| 86 | + return $this->m_label; // TODO: link to Special:Categories |
86 | 87 | case SMWPrintRequest::PRINT_PROP: |
87 | 88 | return $this->m_data->getShortWikiText($linked); |
88 | 89 | case SMWPrintRequest::PRINT_CCAT: |
— | — | @@ -99,7 +100,7 @@ |
100 | 101 | } |
101 | 102 | |
102 | 103 | /** |
103 | | - * @deprecated Use SMWPrintRequest::getData(). |
| 104 | + * @deprecated Use SMWPrintRequest::getData(). This method will vanish in SMW 1.5. |
104 | 105 | */ |
105 | 106 | public function getTitle() { |
106 | 107 | if ($this->m_data instanceof Title) { |
— | — | @@ -140,7 +141,7 @@ |
141 | 142 | * print requests. |
142 | 143 | */ |
143 | 144 | public function getHash() { |
144 | | - $hash = $this->m_mode . ':'; |
| 145 | + $hash = $this->m_mode . ':' . $this->m_label . ':'; |
145 | 146 | if ($this->m_data instanceof Title) { |
146 | 147 | $hash .= $this->m_data->getPrefixedText() . ':'; |
147 | 148 | } elseif ($this->m_data instanceof SMWDataValue) { |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php |
— | — | @@ -171,20 +171,14 @@ |
172 | 172 | $propparts = explode('#',$parts[0],2); |
173 | 173 | if (trim($propparts[0]) == '') { // print "this" |
174 | 174 | $printmode = SMWPrintRequest::PRINT_THIS; |
175 | | - if (count($parts) == 1) { // no label found, use empty label |
176 | | - $parts[] = ''; |
177 | | - } |
178 | | - $label = ''; |
| 175 | + $label = ''; // default |
179 | 176 | $title = NULL; |
180 | 177 | $data = NULL; |
181 | 178 | } elseif ($wgContLang->getNsText(NS_CATEGORY) == ucfirst(trim($propparts[0]))) { // print categories |
182 | 179 | $title = NULL; |
183 | 180 | $data = NULL; |
184 | | - $label = ''; |
185 | 181 | $printmode = SMWPrintRequest::PRINT_CATS; |
186 | | - if (count($parts) == 1) { // no label found, use category label |
187 | | - $parts[] = $showmode?'':$wgContLang->getNSText(NS_CATEGORY); |
188 | | - } |
| 182 | + $label = $showmode?'':$wgContLang->getNSText(NS_CATEGORY); // default |
189 | 183 | } else { // print property or check category |
190 | 184 | $title = Title::newFromText(trim($propparts[0]), SMW_NS_PROPERTY); // trim needed for \n |
191 | 185 | if ($title === NULL) { // too bad, this is no legal property/category name, ignore |
— | — | @@ -194,19 +188,19 @@ |
195 | 189 | $printmode = SMWPrintRequest::PRINT_PROP; |
196 | 190 | $property = SMWPropertyValue::makeProperty($title->getDBKey()); |
197 | 191 | $data = $property; |
198 | | - $label = $showmode?'':$property->getWikiValue(); |
| 192 | + $label = $showmode?'':$property->getWikiValue(); // default |
199 | 193 | } elseif ($title->getNamespace() == NS_CATEGORY) { |
200 | 194 | $printmode = SMWPrintRequest::PRINT_CCAT; |
201 | 195 | $data = $title; |
202 | | - $label = $showmode?'':$title->getText(); |
| 196 | + $label = $showmode?'':$title->getText(); // default |
203 | 197 | } //else? |
204 | | - if (count($parts) > 1) { // no label found, use property/category name |
205 | | - $label = trim($parts[1]); |
206 | | - } |
207 | 198 | } |
208 | 199 | if (count($propparts) == 1) { // no outputformat found, leave empty |
209 | 200 | $propparts[] = ''; |
210 | 201 | } |
| 202 | + if (count($parts) > 1) { // label found, use this instead of default |
| 203 | + $label = trim($parts[1]); |
| 204 | + } |
211 | 205 | $printouts[] = new SMWPrintRequest($printmode, $label, $data, trim($propparts[1])); |
212 | 206 | } else { // parameter or query |
213 | 207 | $parts = explode('=',$param,2); |