r57527 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57526‎ | r57527 | r57528 >
Date:17:46, 8 October 2009
Author:kipcool
Status:deferred
Tags:
Comment:
SpecialNeedsTranslation : the expression and definition to translate are shown in the source language if available.
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/Editor.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/SpecialNeedsTranslation.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/SpecialNeedsTranslation.php
@@ -113,30 +113,30 @@
114114
115115 $definitionAttribute = new Attribute( "definition", wfMsg( "ow_Definition" ), "definition" );
116116
117 - $recordSet = new ArrayRecordSet( new Structure( $o->definedMeaningId, $o->expressionId, $o->definedMeaningReference, $definitionAttribute ), new Structure( $o->definedMeaningId, $o->expressionId ) );
 117+ $recordSet = new ArrayRecordSet( new Structure( $o->definedMeaningId, $o->expressionId, $o->expression, $definitionAttribute ), new Structure( $o->definedMeaningId, $o->expressionId ) );
118118
119119 while ( $row = $dbr->fetchObject( $queryResult ) ) {
120 - $DMRecord = new ArrayRecord( $o->definedMeaningReferenceStructure );
121 - $DMRecord->definedMeaningId = $row->source_defined_meaning_id ;
122 - $DMRecord->definedMeaningLabel = $row->source_spelling ;
123 - $DMRecord->definedMeaningDefiningExpression = $row->source_spelling ;
124 - $DMRecord->language = $row->source_language_id;
 120+ $expressionRecord = new ArrayRecord( $o->expressionStructure );
 121+ $expressionRecord->language = $row->source_language_id;
 122+ $spellingAsLink = definedMeaningReferenceAsLink( $row->source_defined_meaning_id, $row->source_spelling, $row->source_spelling );
 123+ $expressionRecord->spelling = $spellingAsLink ;
125124
126 - $recordSet->addRecord( array( $row->source_defined_meaning_id, $row->source_expression_id, $DMRecord, getDefinedMeaningDefinition( $row->source_defined_meaning_id ) ) );
 125+ $definition = getDefinedMeaningDefinitionForLanguage( $row->source_defined_meaning_id, $row->source_language_id ) ;
 126+ if ( $definition == "" ) {
 127+ $definition = getDefinedMeaningDefinition( $row->source_defined_meaning_id ) ;
 128+ }
 129+
 130+ $recordSet->addRecord( array( $row->source_defined_meaning_id, $row->source_expression_id, $expressionRecord, $definition ) );
127131 }
128132
129 - $expressionEditor = new RecordTableCellEditor( $o->definedMeaningReference );
 133+ $expressionEditor = new RecordTableCellEditor( $o->expression );
130134 $expressionEditor->addEditor( new LanguageEditor( $o->language, new SimplePermissionController( false ), false ) );
131 - $expressionEditor->addEditor( new DefinedMeaningEditor( $o->definedMeaningId, new SimplePermissionController( false ), false ) );
 135+ $expressionEditor->addEditor( new ShortTextNoEscapeEditor( $o->spelling, new SimplePermissionController( false ), false ) );
132136
133137 $editor = new RecordSetTableEditor( null, new SimplePermissionController( false ), new ShowEditFieldChecker( true ), new AllowAddController( false ), false, false, null );
134138 $editor->addEditor( $expressionEditor );
135139 $editor->addEditor( new TextEditor( $definitionAttribute, new SimplePermissionController( false ), false, true, 75 ) );
136140
137 - // cosmetics : changing the titles of the columns
138 - $o->definedMeaningReference->name = wfMsgSc( "Expression" ) ;
139 - $o->definedMeaningId->name = wfMsgSc( "Spelling" ) ;
140 -
141141 global $wgOut;
142142
143143 $wgOut->addHTML( "Showing $nbshown out of $queryResultCount" ) ;
@@ -147,3 +147,4 @@
148148 SpecialPage::addPage( new SpecialNeedsTranslation );
149149 }
150150
 151+
Index: trunk/extensions/Wikidata/OmegaWiki/Editor.php
@@ -1175,6 +1175,12 @@
11761176 }
11771177 }
11781178
 1179+class ShortTextNoEscapeEditor extends ShortTextEditor {
 1180+ public function getViewHTML( IdStack $idPath, $value ) {
 1181+ return $value ;
 1182+ }
 1183+}
 1184+
11791185 class LinkEditor extends ShortTextEditor {
11801186 public function getViewHTML( IdStack $idPath, $value ) {
11811187 $label = htmlspecialchars( $value->linkLabel );

Status & tagging log