r55354 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55353‎ | r55354 | r55355 >
Date:22:07, 19 August 2009
Author:roberthl
Status:deferred
Tags:
Comment:
OmegaWiki: Patch by Christophe Millet to display an indicator of how many entires are displayed on the NeedsTranslation special page.
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/SpecialNeedsTranslation.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/SpecialNeedsTranslation.php
@@ -54,6 +54,31 @@
5555
5656 $dbr = wfGetDB( DB_SLAVE );
5757
 58+ $sqlcount = 'SELECT COUNT(*)' .
 59+ " FROM ({$dc}_syntrans source_syntrans, {$dc}_expression source_expression)";
 60+
 61+ if ( $collectionId != '' )
 62+ $sqlcount .= " JOIN {$dc}_collection_contents ON source_syntrans.defined_meaning_id = member_mid";
 63+
 64+ $sqlcount .= ' WHERE source_syntrans.expression_id = source_expression.expression_id';
 65+
 66+ if ( $sourceLanguageId != '' )
 67+ $sqlcount .= ' AND source_expression.language_id = ' . $sourceLanguageId;
 68+ if ( $collectionId != '' )
 69+ $sqlcount .= " AND {$dc}_collection_contents.collection_id = " . $collectionId .
 70+ ' AND ' . getLatestTransactionRestriction( "{$dc}_collection_contents" );
 71+
 72+ $sqlcount .= ' AND NOT EXISTS (' .
 73+ " SELECT * FROM {$dc}_syntrans destination_syntrans, {$dc}_expression destination_expression" .
 74+ ' WHERE destination_syntrans.expression_id = destination_expression.expression_id AND destination_expression.language_id = ' . $destinationLanguageId .
 75+ ' AND source_syntrans.defined_meaning_id = destination_syntrans.defined_meaning_id' .
 76+ ' AND ' . getLatestTransactionRestriction( 'destination_syntrans' ) .
 77+ ' AND ' . getLatestTransactionRestriction( 'destination_expression' ) .
 78+ ')' .
 79+ ' AND ' . getLatestTransactionRestriction( 'source_syntrans' ) .
 80+ ' AND ' . getLatestTransactionRestriction( 'source_expression' ) ;
 81+
 82+
5883 $sql = 'SELECT source_expression.expression_id AS source_expression_id, source_expression.language_id AS source_language_id, source_expression.spelling AS source_spelling, source_syntrans.defined_meaning_id AS source_defined_meaning_id' .
5984 " FROM ({$dc}_syntrans source_syntrans, {$dc}_expression source_expression)";
6085
@@ -80,6 +105,13 @@
81106 ' LIMIT 100';
82107
83108 $queryResult = $dbr->query( $sql );
 109+
 110+ $queryResultCount_r = mysql_query( $sqlcount );
 111+ $queryResultCount_a = mysql_fetch_row( $queryResultCount_r );
 112+ $queryResultCount = $queryResultCount_a[0];
 113+ $nbshown = min ( 100, $queryResultCount ) ;
 114+
 115+
84116 $definitionAttribute = new Attribute( "definition", wfMsg( "ow_Definition" ), "definition" );
85117 $recordSet = new ArrayRecordSet( new Structure( $o->definedMeaningId, $o->expressionId, $o->expression, $definitionAttribute ), new Structure( $o->definedMeaningId, $o->expressionId ) );
86118
@@ -101,6 +133,7 @@
102134
103135 global $wgOut;
104136
 137+ $wgOut->addHTML( "Showing $nbshown out of $queryResultCount" ) ;
105138 $wgOut->addHTML( $editor->view( new IdStack( "expression" ), $recordSet ) );
106139 }
107140 }

Status & tagging log