http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88410
Revision: 88410
Author: mkroetzsch
Date: 2011-05-19 16:48:13 +0000 (Thu, 19 May 2011)
Log Message:
-----------
fixed concept page to work with data items, minor style fixes in related
article pages
Modified Paths:
--------------
trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_ConceptPage.php
trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_OrderedListPage.php
trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_PropertyPage.php
Modified:
trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_ConceptPage.php
===================================================================
---
trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_ConceptPage.php
2011-05-19 15:11:52 UTC (rev 88409)
+++
trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_ConceptPage.php
2011-05-19 16:48:13 UTC (rev 88410)
@@ -26,13 +26,15 @@
}
/**
- * Fill the internal arrays with the set of articles to be displayed
(possibly plus one additional
- * article that indicates further results).
+ * Fill the internal arrays with the list of wiki page data items to be
+ * displayed (possibly plus one additional article that indicates
+ * further results).
*/
protected function doQuery() {
if ( $this->limit > 0 ) {
$store = smwfGetStore();
- $desc = new SMWConceptDescription( $this->mTitle );
+ $thisDiWikiPage = SMWDIWikiPage::newFromTitle(
$this->mTitle );
+ $desc = new SMWConceptDescription( $thisDiWikiPage );
if ( $this->from != '' ) {
$diWikiPage = new SMWDIWikiPage( $this->from,
NS_MAIN, '' ); // make a dummy wiki page as boundary
@@ -58,17 +60,17 @@
$row = $result->getNext();
while ( $row !== false ) {
- $this->articles[] = end( $row
)->getNextDataValue();
+ $this->diWikiPages[] = end( $row
)->getNextDataItem();
$row = $result->getNext();
}
if ( $order == 'DESC' ) {
- $this->articles = array_reverse(
$this->articles );
+ $this->diWikiPages = array_reverse(
$this->diWikiPages );
}
$this->m_errors = $query->getErrors();
} else {
- $this->articles = array();
+ $this->diWikiPages = array();
$this->errors = array();
}
}
@@ -86,7 +88,7 @@
$r .= '<a name="SMWResults"></a>' . $nav . "<div
id=\"mw-pages\">\n";
$r .= '<h2>' . wfMsg( 'smw_concept_header', $ti ) . "</h2>\n";
- $r .= wfMsgExt( 'smw_conceptarticlecount', array( 'parsemag' ),
min( $this->limit, count( $this->articles ) ) ) . smwfEncodeMessages(
$this->m_errors ) . "\n";
+ $r .= wfMsgExt( 'smw_conceptarticlecount', array( 'parsemag' ),
min( $this->limit, count( $this->diWikiPages ) ) ) . smwfEncodeMessages(
$this->m_errors ) . "\n";
$r .= $this->formatList();
$r .= "\n</div>" . $nav;
@@ -95,14 +97,14 @@
}
/**
- * Format a list of articles chunked by letter, either as a
- * bullet list or a columnar format, depending on the length.
+ * Format a list of wiki pages chunked by letter, either as a bullet
+ * list or a columnar format, depending on the length.
*
- * @param int $cutoff
+ * @param int $cutoff
* @return string
*/
private function formatList( $cutoff = 6 ) {
- $end = count( $this->articles );
+ $end = count( $this->diWikiPages );
if ( $end > $this->limit ) {
if ( $this->until != '' ) {
@@ -115,14 +117,13 @@
$start = 0;
}
- if ( count ( $this->articles ) > $cutoff ) {
- return $this->columnList( $start, $end, $this->articles
);
- } elseif ( count( $this->articles ) > 0 ) {
- // for short lists of articles
- return $this->shortList( $start, $end, $this->articles
);
+ if ( count ( $this->diWikiPages ) > $cutoff ) {
+ return $this->columnList( $start, $end,
$this->diWikiPages );
+ } elseif ( count( $this->diWikiPages ) > 0 ) {
+ return $this->shortList( $start, $end,
$this->diWikiPages );
+ } else {
+ return '';
}
-
- return '';
}
}
Modified:
trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_OrderedListPage.php
===================================================================
---
trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_OrderedListPage.php
2011-05-19 15:11:52 UTC (rev 88409)
+++
trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_OrderedListPage.php
2011-05-19 16:48:13 UTC (rev 88410)
@@ -69,7 +69,7 @@
// Copied from CategoryPage
$diff = $wgRequest->getVal( 'diff' );
$diffOnly = $wgRequest->getBool( 'diffonly',
$wgUser->getOption( 'diffonly' ) );
-
+
if ( isset( $diff ) && $diffOnly ) {
return Article::view();
}
@@ -83,17 +83,17 @@
*/
protected function showList() {
wfProfileIn( __METHOD__ . ' (SMW)' );
-
+
global $wgOut, $wgRequest;
-
+
$this->from = $wgRequest->getVal( 'from' );
$this->until = $wgRequest->getVal( 'until' );
-
+
if ( $this->initParameters() ) {
$wgOut->addHTML( $this->getHTML() );
SMWOutputs::commitToOutputPage( $wgOut ); // Flush
required CSS to output
}
-
+
wfProfileOut( __METHOD__ . ' (SMW)' );
}
@@ -119,7 +119,7 @@
$this->clearPageState();
$this->doQuery();
$r = "<br id=\"smwfootbr\"/>\n" . $this->getPages();
-
+
return $r;
}
@@ -196,11 +196,10 @@
* @return Skin
*/
protected function getSkin() {
+ global $wgUser;
if ( !$this->skin ) {
- global $wgUser;
$this->skin = $wgUser->getSkin();
}
-
return $this->skin;
}
@@ -233,50 +232,51 @@
// Get and display header.
$r = '<table width="100%"><tr valign="top">';
- $prev_start_char = 'none';
+ $prevStartChar = 'none';
// Loop through the chunks.
for ( $startChunk = $start, $endChunk = $chunk, $chunkIndex = 0;
$chunkIndex < 3;
- $chunkIndex++, $startChunk = $endChunk, $endChunk +=
$chunk + 1 ) {
+ ++$chunkIndex, $startChunk = $endChunk, $endChunk +=
$chunk + 1 ) {
$r .= "<td>\n";
$atColumnTop = true;
// output all diWikiPages
- for ( $index = $startChunk ; $index < $endChunk &&
$index < $end; $index++ ) {
+ for ( $index = $startChunk ; $index < $endChunk &&
$index < $end; ++$index ) {
$dataValue =
SMWDataValueFactory::newDataItemValue( $diWikiPages[$index], $this->mProperty );
// check for change of starting letter or
begining of chunk
$sortkey = smwfGetStore()->getWikiPageSortKey(
$diWikiPages[$index] );
- $start_char = $wgContLang->convert(
$wgContLang->firstChar( $sortkey ) );
-
+ $startChar = $wgContLang->convert(
$wgContLang->firstChar( $sortkey ) );
+
if ( ( $index == $startChunk ) ||
- ( $start_char != $prev_start_char ) ) {
+ ( $startChar != $prevStartChar ) ) {
if ( $atColumnTop ) {
$atColumnTop = false;
} else {
$r .= "</ul>\n";
}
-
- $cont_msg = "";
-
- if ( $start_char == $prev_start_char ) {
- $cont_msg = wfMsgHtml(
'listingcontinuesabbrev' );
+
+ if ( $startChar == $prevStartChar ) {
+ $cont_msg = ' ' . wfMsgHtml(
'listingcontinuesabbrev' );
+ } else {
+ $cont_msg = '';
}
-
- $r .= "<h3>" . htmlspecialchars(
$start_char ) . " $cont_msg</h3>\n<ul>";
- $prev_start_char = $start_char;
+
+ $r .= "<h3>" . htmlspecialchars(
$startChar ) . $cont_msg . "</h3>\n<ul>";
+
+ $prevStartChar = $startChar;
}
-
+
$r .= "<li>" . $dataValue->getLongHTMLText(
$this->getSkin() ) . "</li>\n";
}
-
+
if ( !$atColumnTop ) {
$r .= "</ul>\n";
}
-
+
$r .= "</td>\n";
}
-
+
$r .= '</tr></table>';
return $r;
@@ -296,19 +296,19 @@
$startDv = SMWDataValueFactory::newDataItemValue(
$diWikiPages[$start], $this->mProperty );
$sortkey = smwfGetStore()->getWikiPageSortKey(
$diWikiPages[$start] );
- $start_char = $wgContLang->convert( $wgContLang->firstChar(
$sortkey ) );
- $r = '<h3>' . htmlspecialchars( $start_char ) . "</h3>\n" .
+ $startChar = $wgContLang->convert( $wgContLang->firstChar(
$sortkey ) );
+ $r = '<h3>' . htmlspecialchars( $startChar ) . "</h3>\n" .
'<ul><li>' . $startDv->getLongHTMLText( $this->getSkin() )
. '</li>';
- $prev_start_char = $start_char;
+ $prevStartChar = $startChar;
for ( $index = $start + 1; $index < $end; $index++ ) {
$dataValue = SMWDataValueFactory::newDataItemValue(
$diWikiPages[$index], $this->mProperty );
$sortkey = smwfGetStore()->getWikiPageSortKey(
$diWikiPages[$index] );
- $start_char = $wgContLang->convert(
$wgContLang->firstChar( $sortkey ) );
+ $startChar = $wgContLang->convert(
$wgContLang->firstChar( $sortkey ) );
- if ( $start_char != $prev_start_char ) {
- $r .= "</ul><h3>" . htmlspecialchars(
$start_char ) . "</h3>\n<ul>";
- $prev_start_char = $start_char;
+ if ( $startChar != $prevStartChar ) {
+ $r .= "</ul><h3>" . htmlspecialchars(
$startChar ) . "</h3>\n<ul>";
+ $prevStartChar = $startChar;
}
$r .= '<li>' . $dataValue->getLongHTMLText(
$this->getSkin() ) . '</li>';
Modified:
trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_PropertyPage.php
===================================================================
---
trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_PropertyPage.php
2011-05-19 15:11:52 UTC (rev 88409)
+++
trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_PropertyPage.php
2011-05-19 16:48:13 UTC (rev 88410)
@@ -73,8 +73,8 @@
}
/**
- * Generates the headline for the page list and the HTML encoded list
of pages which
- * shall be shown.
+ * Generates the headline for the page list and the HTML encoded list
+ * of pages which shall be shown.
*/
protected function getPages() {
wfProfileIn( __METHOD__ . ' (SMW)' );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs