Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialBrowse.php |
— | — | @@ -112,7 +112,11 @@ |
113 | 113 | if ( $this->showincoming ) { |
114 | 114 | list( $indata, $more ) = $this->getInData(); |
115 | 115 | global $smwgBrowseShowInverse; |
116 | | - if ( !$smwgBrowseShowInverse ) $leftside = !$leftside; |
| 116 | + |
| 117 | + if ( !$smwgBrowseShowInverse ) { |
| 118 | + $leftside = !$leftside; |
| 119 | + } |
| 120 | + |
117 | 121 | $html .= $this->displayData( $indata, $leftside, true ); |
118 | 122 | $html .= $this->displayBottom( $more ); |
119 | 123 | } |
— | — | @@ -150,7 +154,7 @@ |
151 | 155 | |
152 | 156 | $diProperties = $data->getProperties(); |
153 | 157 | $noresult = true; |
154 | | - foreach ( $diProperties as $diProperty ) { |
| 158 | + foreach ( $diProperties as $key => $diProperty ) { |
155 | 159 | $dvProperty = SMWDataValueFactory::newDataItemValue( $diProperty, null ); |
156 | 160 | |
157 | 161 | if ( $dvProperty->isVisible() ) { |
— | — | @@ -164,20 +168,25 @@ |
165 | 169 | continue; // skip this line |
166 | 170 | } |
167 | 171 | |
168 | | - $head = "<th>" . $proptext . "</th>\n"; |
| 172 | + $head = '<th>' . $proptext . "</th>\n"; |
169 | 173 | |
170 | 174 | $body = "<td>\n"; |
171 | 175 | |
172 | 176 | $values = $data->getPropertyValues( $diProperty ); |
| 177 | + |
173 | 178 | if ( $incoming && ( count( $values ) >= SMWSpecialBrowse::$incomingvaluescount ) ) { |
174 | 179 | $moreIncoming = true; |
175 | 180 | array_pop( $values ); |
176 | 181 | } else { |
177 | 182 | $moreIncoming = false; |
178 | 183 | } |
179 | | - |
| 184 | + |
180 | 185 | $first = true; |
181 | | - foreach ( $values as $di ) { |
| 186 | + foreach ( $values as /* SMWDataItem */ $di ) { |
| 187 | + if ( !$di instanceof SMWDataItem ) { |
| 188 | + throw new MWException('d'); |
| 189 | + } |
| 190 | + |
182 | 191 | if ( $first ) { |
183 | 192 | $first = false; |
184 | 193 | } else { |
— | — | @@ -189,6 +198,7 @@ |
190 | 199 | } else { |
191 | 200 | $dv = SMWDataValueFactory::newDataItemValue( $di, $diProperty ); |
192 | 201 | } |
| 202 | + |
193 | 203 | $body .= "<span class=\"{$ccsPrefix}value\">" . |
194 | 204 | $this->displayValue( $dvProperty, $dv, $incoming ) . "</span>\n"; |
195 | 205 | } |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php |
— | — | @@ -145,6 +145,17 @@ |
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
| 149 | + * |
| 150 | + * |
| 151 | + * @param Title $title |
| 152 | + * |
| 153 | + * @return array( SMWDIProperty, SMWDataItem ) |
| 154 | + */ |
| 155 | + protected static function getSpecialProperties( Title $title ) { |
| 156 | + |
| 157 | + } |
| 158 | + |
| 159 | + /** |
149 | 160 | * This function takes care of storing the collected semantic data and takes |
150 | 161 | * care of clearing out any outdated entries for the processed page. It assume that |
151 | 162 | * parsing has happened and that all relevant data is contained in the provided parser |
— | — | @@ -193,29 +204,29 @@ |
194 | 205 | } |
195 | 206 | |
196 | 207 | // Calculate property value. |
197 | | - $datum = null; |
| 208 | + $value = null; |
198 | 209 | |
199 | 210 | switch ( $propId ) { |
200 | 211 | case '_MDAT' : |
201 | 212 | $timestamp = Revision::getTimeStampFromID( $title, $title->getLatestRevID() ); |
202 | | - $datum = self::getDataItemFromMWTimestamp( $timestamp ); |
| 213 | + $value = self::getDataItemFromMWTimestamp( $timestamp ); |
203 | 214 | break; |
204 | 215 | case '_CDAT' : |
205 | 216 | $timestamp = $title->getFirstRevision()->getTimestamp(); |
206 | | - $datum = self::getDataItemFromMWTimestamp( $timestamp ); |
| 217 | + $value = self::getDataItemFromMWTimestamp( $timestamp ); |
207 | 218 | break; |
208 | 219 | case '_NEWP' : |
209 | | - $datum = new SMWDIBoolean( $title->isNewPage() ); |
| 220 | + $value = new SMWDIBoolean( $title->isNewPage() ); |
210 | 221 | break; |
211 | 222 | case '_LEDT' : |
212 | 223 | $revision = Revision::newFromId( $title->getLatestRevID() ); |
213 | 224 | $user = User::newFromId( $revision->getUser() ); |
214 | | - $datum = SMWDIWikiPage::newFromTitle( $user->getUserPage() ); |
| 225 | + $value = SMWDIWikiPage::newFromTitle( $user->getUserPage() ); |
215 | 226 | break; |
216 | 227 | } |
217 | 228 | |
218 | | - if ( !is_null( $datum ) ) { |
219 | | - $semdata->addPropertyObjectValue( $prop, $datum ); |
| 229 | + if ( !is_null( $value ) ) { |
| 230 | + $semdata->addPropertyObjectValue( $prop, $value ); |
220 | 231 | } // Issue error or warning? |
221 | 232 | |
222 | 233 | } // foreach |
— | — | @@ -414,8 +425,9 @@ |
415 | 426 | * a global/static variable appears to be the only way to get more article data to |
416 | 427 | * LinksUpdate. |
417 | 428 | */ |
418 | | - static public function onNewRevisionFromEditComplete( $article, $rev, $baseID ) { |
| 429 | + static public function onNewRevisionFromEditComplete( WikiPage $article, $rev, $baseID ) { |
419 | 430 | global $smwgPageSpecialProperties; |
| 431 | + |
420 | 432 | if ( ( $article->mPreparedEdit ) && ( $article->mPreparedEdit->output instanceof ParserOutput ) ) { |
421 | 433 | $output = $article->mPreparedEdit->output; |
422 | 434 | $title = $article->getTitle(); |
— | — | @@ -433,14 +445,28 @@ |
434 | 446 | } |
435 | 447 | |
436 | 448 | if ( in_array( '_MDAT', $smwgPageSpecialProperties ) ) { |
437 | | - $pmdat = new SMWDIProperty( '_MDAT' ); |
438 | 449 | $timestamp = $article->getTimestamp(); |
439 | 450 | $di = self::getDataItemFromMWTimestamp( $timestamp ); |
440 | 451 | |
441 | 452 | if ( !is_null( $di ) ) { |
442 | | - $semdata->addPropertyObjectValue( $pmdat, $di ); |
| 453 | + $semdata->addPropertyObjectValue( new SMWDIProperty( '_MDAT' ), $di ); |
443 | 454 | } |
444 | 455 | } |
| 456 | + |
| 457 | + if ( in_array( '_LEDT', $smwgPageSpecialProperties ) ) { |
| 458 | + $di = SMWDIWikiPage::newFromTitle( User::newFromId( $article->getRevision()->getUser() )->getUserPage() ); |
| 459 | + |
| 460 | + if ( !is_null( $di ) ) { |
| 461 | + $semdata->addPropertyObjectValue( new SMWDIProperty( '_LEDT' ), $di ); |
| 462 | + } |
| 463 | + } |
| 464 | + |
| 465 | + if ( in_array( '_NEWP', $smwgPageSpecialProperties ) ) { |
| 466 | + $semdata->addPropertyObjectValue( |
| 467 | + new SMWDIProperty( '_NEWP' ), |
| 468 | + new SMWDIBoolean( is_null( $article->getRevision()->getParentId() ) ) |
| 469 | + ); |
| 470 | + } |
445 | 471 | |
446 | 472 | return true; |
447 | 473 | } |
Index: trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exporter.php |
— | — | @@ -424,6 +424,12 @@ |
425 | 425 | } |
426 | 426 | case '_MDAT': |
427 | 427 | return self::getSpecialNsResource( 'swivt', 'wikiPageModificationDate' ); |
| 428 | + case '_CDAT': |
| 429 | + return self::getSpecialNsResource( 'swivt', 'wikiPageCreationDate' ); |
| 430 | + case '_LEDT': |
| 431 | + return self::getSpecialNsResource( 'swivt', 'wikiPageLastEditor' ); |
| 432 | + case '_NEWP': |
| 433 | + return self::getSpecialNsResource( 'swivt', 'wikiPageIsNew' ); |
428 | 434 | case '_SKEY': |
429 | 435 | return self::getSpecialNsResource( 'swivt', 'wikiPageSortKey' ); |
430 | 436 | case '_TYPE': |
Index: trunk/extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_Property.php |
— | — | @@ -331,8 +331,8 @@ |
332 | 332 | '_CONC' => array( '__con', false ), // associated concept |
333 | 333 | '_MDAT' => array( '_dat', false ), // "modification date" |
334 | 334 | '_CDAT' => array( '_dat', false ), // "creation date" |
335 | | - '_NEWP' => array( '_boo', false ), // "page is new" |
336 | | - '_LEDT' => array( '_wpg', false ), // "page is new" |
| 335 | + '_NEWP' => array( '_dat', false ), // "is a new page" |
| 336 | + '_LEDT' => array( '_wpg', false ), // "last editor is" |
337 | 337 | '_ERRP' => array( '_wpp', false ), // "has improper value for" |
338 | 338 | '_LIST' => array( '__pls', true ), // "has fields" |
339 | 339 | '_SKEY' => array( '__key', false ), // sort key of a page |