r23664 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23663‎ | r23664 | r23665 >
Date:08:52, 3 July 2007
Author:proes
Status:old
Tags:
Comment:
* Introduced ViewInformation to capture the various settings that can result in different views of the same page
* Replaced parameters filterLanguageId, possiblySynonymousRelationTypeId etcetera with ViewInformation in the functions that query record sets from the database
* Replacing the same parameters for the functions that create the editors is pending
* Fixed bug: in RecordHelper.php the class Helper did not accurately return its member $record but something unknown instead
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/DefinedMeaning.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/DefinedMeaningModel.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/GetDM.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/OmegaWiki.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/RecordHelper.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/RecordHelperTest.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/RecordSetQueries.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/SaveDM.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/Test.skeleton.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/ViewInformation.php (added) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/WikiDataAPI.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/Wikidata.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/Wikidata.php
@@ -9,7 +9,6 @@
1010 protected $showRecordLifeSpan;
1111 protected $transaction;
1212 protected $queryTransactionInformation;
13 - protected $viewQueryTransactionInformation;
1413 protected $shouldShowAuthorities;
1514 protected $showCommunityContribution;
1615 protected $authoritiesToShow;
@@ -17,16 +16,16 @@
1817 // The following member variables control some application specific preferences
1918 protected $availableAuthorities = array(); // A map containing (userId => displayName) combination for authoritative contribution view
2019 protected $filterLanguageId = 0; // Filter pages on this languageId, set to 0 to show all languages
 20+ protected $possiblySynonymousRelationTypeId = 0; // Put this relation type in a special section "Possibly synonymous"
2121 protected $showLanguageSelector = true; // Show language selector at the top of each wiki data page
2222 protected $showClassicPageTitles = true; // Show classic page titles instead of prettier page titles
23 - protected $possiblySynonymousRelationTypeId = 0; // Put this relation type in a special section "Possibly synonymous"
2423
 24+ protected $viewInformation;
 25+
2526 // Show a panel to select expressions from available data-sets
2627 protected $showDataSetPanel=true;
2728
28 -
2929 public function __construct() {
30 -
3130 global
3231 $wgAvailableAuthorities, $wgFilterLanguageId, $wgShowLanguageSelector,
3332 $wgShowClassicPageTitles, $wgPossiblySynonymousRelationTypeId;
@@ -45,7 +44,6 @@
4645
4746 if (isset($wgPossiblySynonymousRelationTypeId))
4847 $this->possiblySynonymousRelationTypeId = $wgPossiblySynonymousRelationTypeId;
49 -
5048 }
5149
5250 function getLanguageSelector() {
@@ -58,7 +56,6 @@
5957 return wfMsg('ow_uilang',"<b>$userlang</b>"). " &mdash; " . $skin->makeLink("Special:Preferences", wfMsg('ow_uilang_set'));
6058 }
6159
62 -
6360 protected function outputViewHeader() {
6461 global
6562 $wgOut;
@@ -66,9 +63,8 @@
6764 if ($this->showLanguageSelector)
6865 $wgOut->addHTML($this->getLanguageSelector());
6966
70 - if($this->showDataSetPanel) {
 67+ if($this->showDataSetPanel)
7168 $wgOut->addHTML($this->getDataSetPanel());
72 - }
7369 }
7470
7571 protected function outputViewFooter() {
@@ -94,7 +90,16 @@
9591
9692 initializeOmegaWikiAttributes($this->filterLanguageId != 0);
9793 initializeObjectAttributeEditors($this->filterLanguageId, false);
98 - $this->viewQueryTransactionInformation = new QueryLatestTransactionInformation();
 94+ $this->queryTransactionInformation = new QueryLatestTransactionInformation();
 95+
 96+ $viewInformation = new ViewInformation();
 97+ $viewInformation->filterLanguageId = $this->filterLanguageId;
 98+ $viewInformation->possiblySynonymousRelationTypeId = $this->possiblySynonymousRelationTypeId;
 99+ $viewInformation->showRecordLifeSpan = false;
 100+ $viewInformation->showAuthority = $this->shouldShowAuthorities;
 101+ $viewInformation->queryTransactionInformation = $this->queryTransactionInformation;
 102+
 103+ $this->viewInformation = $viewInformation;
99104 }
100105
101106 protected function getDataSetPanel() {
@@ -119,9 +124,16 @@
120125 return $html;
121126 }
122127
123 - protected function save($referenceTransaction) {
 128+ protected function save($referenceQueryTransactionInformation) {
124129 initializeOmegaWikiAttributes($this->filterLanguageId != 0, false);
125130 initializeObjectAttributeEditors($this->filterLanguageId, false);
 131+
 132+ $viewInformation = new ViewInformation();
 133+ $viewInformation->filterLanguageId = $this->filterLanguageId;
 134+ $viewInformation->possiblySynonymousRelationTypeId = $this->possiblySynonymousRelationTypeId;
 135+ $viewInformation->queryTransactionInformation = $referenceQueryTransactionInformation;
 136+
 137+ $this->viewInformation = $viewInformation;
126138 }
127139
128140 public function saveWithinTransaction() {
@@ -168,6 +180,16 @@
169181
170182 initializeOmegaWikiAttributes($this->filterLanguageId != 0, false);
171183 initializeObjectAttributeEditors($this->filterLanguageId, false, false);
 184+
 185+ $viewInformation = new ViewInformation();
 186+ $viewInformation->filterLanguageId = $this->filterLanguageId;
 187+ $viewInformation->possiblySynonymousRelationTypeId = $this->possiblySynonymousRelationTypeId;
 188+ $viewInformation->showRecordLifeSpan = false;
 189+ $viewInformation->showAuthority = false;
 190+ $viewInformation->queryTransactionInformation = new QueryLatestTransactionInformation();
 191+
 192+ $this->viewInformation = $viewInformation;
 193+
172194 return true;
173195 }
174196
@@ -215,6 +237,15 @@
216238
217239 initializeOmegaWikiAttributes($this->filterLanguageId != 0, true);
218240 initializeObjectAttributeEditors($this->filterLanguageId, $this->showRecordLifeSpan, false);
 241+
 242+ $viewInformation = new ViewInformation();
 243+ $viewInformation->filterLanguageId = $this->filterLanguageId;
 244+ $viewInformation->possiblySynonymousRelationTypeId = $this->possiblySynonymousRelationTypeId;
 245+ $viewInformation->showRecordLifeSpan = $this->showRecordLifeSpan;
 246+ $viewInformation->showAuthority = $this->shouldShowAuthorities;
 247+ $viewInformation->queryTransactionInformation = $this->queryTransactionInformation;
 248+
 249+ $this->viewInformation = $viewInformation;
219250 }
220251
221252 protected function outputEditHeader() {
Index: trunk/extensions/Wikidata/OmegaWiki/GetDM.php
@@ -21,11 +21,11 @@
2222
2323 /* insert code here */
2424 $definedMeaningId=663665; # UnitTest
25 -$filterLanguageId=0; # ??? What does this do ???
26 -$possiblySynonymousRelationTypeId=0; # ??? What does this do ???
27 -$queryTransactionInformation= new QueryLatestTransactionInformation();
2825
29 -$model=new DefinedMeaningModel($definedMeaningId, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation);
 26+$viewInformation = new ViewInformation();
 27+$viewInformation->queryTransactionInformation = new QueryLatestTransactionInformation();
 28+
 29+$model=new DefinedMeaningModel($definedMeaningId, $viewInformation);
3030 $record=$model->getRecord();
3131 $record->finish("DefinedMeaning");
3232 echo $record;
Index: trunk/extensions/Wikidata/OmegaWiki/Test.skeleton.php
@@ -43,11 +43,10 @@
4444 $wgCommandLineMode = true;
4545 $dc = "uw";
4646 $definedMeaningId=663665; # education
47 - $filterLanguageId=0; # ??? What does this do ???
48 - $possiblySynonymousRelationTypeId=0; # ??? What does this do ???
49 - $queryTransactionInformation= new QueryLatestTransactionInformation();
 47+ $viewInformation = new ViewInformation();
 48+ $viewInformation->queryTransactionInformation= new QueryLatestTransactionInformation();
5049
51 - $model=new DefinedMeaningModel($definedMeaningId, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation);
 50+ $model=new DefinedMeaningModel($definedMeaningId, $viewInformation);
5251 $testRecord=$model->getRecord();
5352 }
5453
Index: trunk/extensions/Wikidata/OmegaWiki/RecordHelperTest.php
@@ -41,11 +41,10 @@
4242 $wgCommandLineMode = true;
4343 $dc = "uw";
4444 $definedMeaningId=663665; # education
45 - $filterLanguageId=0; # ??? What does this do ???
46 - $possiblySynonymousRelationTypeId=0; # ??? What does this do ???
47 - $queryTransactionInformation= new QueryLatestTransactionInformation();
 45+ $viewInformation = new ViewInformation();
 46+ $viewInformation->queryTransactionInformation= new QueryLatestTransactionInformation();
4847
49 - $model=new DefinedMeaningModel($definedMeaningId, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation);
 48+ $model=new DefinedMeaningModel($definedMeaningId, $viewInformation);
5049 $testRecord=$model->getRecord();
5150 }
5251
Index: trunk/extensions/Wikidata/OmegaWiki/RecordHelper.php
@@ -76,7 +76,7 @@
7777 }
7878
7979 public function getRecord() {
80 - return $record;
 80+ return $this->record;
8181 }
8282
8383 # should probably be abstract. Making non-abstract
Index: trunk/extensions/Wikidata/OmegaWiki/SaveDM.php
@@ -18,10 +18,9 @@
1919 global
2020 $wdCurrentContext;
2121 $wdCurrentContext=$dc;
22 - $filterLanguageId=0; # ??? What does this do ???
23 - $possiblySynonymousRelationTypeId=0; # ??? What does this do ???
24 - $queryTransactionInformation= new QueryLatestTransactionInformation();
25 - $model=new DefinedMeaningModel($definedMeaningId, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation);
 22+ $viewInformation = new ViewInformation();
 23+ $viewInformation->queryTransactionInformation= new QueryLatestTransactionInformation();
 24+ $model=new DefinedMeaningModel($definedMeaningId, $viewInformation);
2625 $record=$model->getRecord();
2726 $record->finish("DefinedMeaning");
2827 return $model;
Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataAPI.php
@@ -273,7 +273,7 @@
274274 }
275275
276276 function removeRelation($definedMeaning1Id, $relationTypeId, $definedMeaning2Id) {
277 - $dc=$wdGetDataSetContext();
 277+ $dc=wdGetDataSetContext();
278278 $dbr =& wfGetDB(DB_MASTER);
279279 $dbr->query("UPDATE {$dc}_meaning_relations SET remove_transaction_id=" . getUpdateTransactionId() .
280280 " WHERE meaning1_mid=$definedMeaning1Id AND meaning2_mid=$definedMeaning2Id AND relationtype_mid=$relationTypeId " .
Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaning.php
@@ -27,11 +27,7 @@
2828
2929 $wgOut->addHTML($this->getConceptPanel());
3030
31 - $dmModel=new DefinedMeaningModel(
32 - $definedMeaningId,
33 - $this->filterLanguageId,
34 - $this->possiblySynonymousRelationTypeId,
35 - $this->viewQueryTransactionInformation);
 31+ $dmModel=new DefinedMeaningModel($definedMeaningId, $this->viewInformation);
3632
3733 $wgOut->addHTML(
3834 getDefinedMeaningEditor(
@@ -52,12 +48,8 @@
5349 $definedMeaningId = $this->getDefinedMeaningIdFromTitle($wgTitle->getText());
5450
5551 $this->outputEditHeader();
56 - $dmModel=new DefinedMeaningModel(
57 - $definedMeaningId,
58 - $this->filterLanguageId,
59 - $this->possiblySynonymousRelationTypeId,
60 - new QueryLatestTransactionInformation()
61 - );
 52+ $dmModel = new DefinedMeaningModel($definedMeaningId, $this->viewInformation);
 53+
6254 $wgOut->addHTML(
6355 getDefinedMeaningEditor($this->filterLanguageId, $this->possiblySynonymousRelationTypeId, false, false)->edit(
6456 $this->getIdStack($definedMeaningId),
@@ -74,12 +66,7 @@
7567 parent::history();
7668
7769 $definedMeaningId = $this->getDefinedMeaningIdFromTitle($wgTitle->getText());
78 - $dmModel=new DefinedMeaningModel(
79 - $definedMeaningId,
80 - $this->filterLanguageId,
81 - $this->possiblySynonymousRelationTypeId,
82 - $this->queryTransactionInformation
83 - );
 70+ $dmModel=new DefinedMeaningModel($definedMeaningId, $this->viewInformation);
8471 $wgOut->addHTML(
8572 getDefinedMeaningEditor($this->filterLanguageId, $this->possiblySynonymousRelationTypeId, $this->showRecordLifeSpan, false)->view(
8673 new IdStack("defined-meaning"),
@@ -99,31 +86,21 @@
10087 $wgTitle;
10188
10289 $definedMeaningId = $this->getDefinedMeaningIdFromTitle($wgTitle->getText());
103 - $dmModel=new DefinedMeaningModel(
104 - $definedMeaningId,
105 - $this->filterLanguageId,
106 - $this->possiblySynonymousRelationTypeId,
107 - $this->viewQueryTransactionInformation
108 - );
 90+ $dmModel = new DefinedMeaningModel($definedMeaningId, $this->viewInformation);
10991 $record=$dmModel->getRecord();
11092 return $record;
11193 }
11294
113 - protected function save($referenceTransaction) {
 95+ protected function save($referenceQueryTransactionInformation) {
11496 global
11597 $wgTitle;
11698
117 - parent::save($referenceTransaction);
 99+ parent::save($referenceQueryTransactionInformation);
118100 $definedMeaningId = $this->getDefinedMeaningIdFromTitle($wgTitle->getText());
119101
120 - $dmModel=new DefinedMeaningModel(
121 - $definedMeaningId,
122 - $this->filterLanguageId,
123 - $this->possiblySynonymousRelationTypeId,
124 - $referenceTransaction
125 - );
126 -
 102+ $dmModel =new DefinedMeaningModel($definedMeaningId, $this->viewInformation);
127103 $definedMeaningId = $this->getDefinedMeaningIdFromTitle($wgTitle->getText());
 104+
128105 getDefinedMeaningEditor($this->filterLanguageId, $this->possiblySynonymousRelationTypeId, false, false)->save(
129106 $this->getIdStack($definedMeaningId),
130107 $dmModel->getRecord()
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php
@@ -8,6 +8,7 @@
99 require_once('WikiDataTables.php');
1010 require_once('RecordSetQueries.php');
1111 require_once('DefinedMeaningModel.php');
 12+require_once('ViewInformation.php');
1213
1314 function getSynonymSQLForLanguage($languageId, &$definedMeaningIds) {
1415
@@ -219,16 +220,16 @@
220221 }
221222 }
222223
223 -function expandTranslatedContentInRecord($record, $idAttribute, $translatedContentAttribute, $filterLanguageId, $queryTransactionInformation) {
 224+function expandTranslatedContentInRecord($record, $idAttribute, $translatedContentAttribute, ViewInformation $viewInformation) {
224225 $record->setAttributeValue(
225226 $translatedContentAttribute,
226 - getTranslatedContentValue($record->getAttributeValue($idAttribute), $filterLanguageId, $queryTransactionInformation)
 227+ getTranslatedContentValue($record->getAttributeValue($idAttribute), $viewInformation)
227228 );
228229 }
229230
230 -function expandTranslatedContentsInRecordSet($recordSet, $idAttribute, $translatedContentAttribute, $filterLanguageId, $queryTransactionInformation) {
 231+function expandTranslatedContentsInRecordSet($recordSet, $idAttribute, $translatedContentAttribute, ViewInformation $viewInformation) {
231232 for ($i = 0; $i < $recordSet->getRecordCount(); $i++)
232 - expandTranslatedContentInRecord($recordSet->getRecord($i), $idAttribute, $translatedContentAttribute, $filterLanguageId, $queryTransactionInformation);
 233+ expandTranslatedContentInRecord($recordSet->getRecord($i), $idAttribute, $translatedContentAttribute, $viewInformation);
233234 }
234235
235236 function getExpressionReferenceRecords($expressionIds) {
@@ -352,7 +353,7 @@
353354 }
354355 }
355356
356 -function getExpressionMeaningsRecordSet($expressionId, $exactMeaning, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation) {
 357+function getExpressionMeaningsRecordSet($expressionId, $exactMeaning, ViewInformation $viewInformation) {
357358 global
358359 $expressionMeaningStructure, $definedMeaningIdAttribute;
359360
@@ -370,7 +371,7 @@
371372
372373 while($definedMeaning = $dbr->fetchObject($queryResult)) {
373374 $definedMeaningId = $definedMeaning->defined_meaning_id;
374 - $dmModel=new DefinedMeaningModel($definedMeaningId, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation);
 375+ $dmModel=new DefinedMeaningModel($definedMeaningId, $viewInformation);
375376 $recordSet->addRecord(
376377 array(
377378 $definedMeaningId,
@@ -383,27 +384,24 @@
384385 return $recordSet;
385386 }
386387
387 -function getExpressionMeaningsRecord($expressionId, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation) {
 388+function getExpressionMeaningsRecord($expressionId, ViewInformation $viewInformation) {
388389 global
389390 $expressionMeaningsStructure, $expressionExactMeaningsAttribute, $expressionApproximateMeaningsAttribute;
390391
391392 $record = new ArrayRecord($expressionMeaningsStructure);
392 - $record->setAttributeValue($expressionExactMeaningsAttribute, getExpressionMeaningsRecordSet($expressionId, true, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation));
393 - $record->setAttributeValue($expressionApproximateMeaningsAttribute, getExpressionMeaningsRecordSet($expressionId, false, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation));
 393+ $record->setAttributeValue($expressionExactMeaningsAttribute, getExpressionMeaningsRecordSet($expressionId, true, $viewInformation));
 394+ $record->setAttributeValue($expressionApproximateMeaningsAttribute, getExpressionMeaningsRecordSet($expressionId, false, $viewInformation));
394395
395396 return $record;
396397 }
397398
398 -function getExpressionsRecordSet($spelling, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation) {
 399+function getExpressionsRecordSet($spelling, ViewInformation $viewInformation) {
399400 global
400401 $expressionIdAttribute, $expressionAttribute, $languageAttribute, $expressionMeaningsAttribute, $expressionsStructure;
401402
402403 $dc=wdGetDataSetContext();
403404
404 - if ($filterLanguageId != 0)
405 - $languageRestriction = " AND language_id=$filterLanguageId";
406 - else
407 - $languageRestriction = "";
 405+ $languageRestriction = $viewInformation->filterLanguageId != 0 ? " AND language_id=". $viewInformation->filterLanguageId : "";
408406
409407 $dbr =& wfGetDB(DB_SLAVE);
410408 $queryResult = $dbr->query(
@@ -430,7 +428,7 @@
431429 $result->addRecord(array(
432430 $expression->expression_id,
433431 $expressionRecord,
434 - getExpressionMeaningsRecord($expression->expression_id, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation)
 432+ getExpressionMeaningsRecord($expression->expression_id, $viewInformation)
435433 ));
436434 }
437435
@@ -462,14 +460,14 @@
463461 }
464462
465463
466 -function getClassAttributesRecordSet($definedMeaningId, $queryTransactionInformation) {
 464+function getClassAttributesRecordSet($definedMeaningId, ViewInformation $viewInformation) {
467465 global
468466 $classAttributesTable, $classAttributeIdAttribute, $classAttributeLevelAttribute, $classAttributeAttributeAttribute, $classAttributeTypeAttribute, $optionAttributeOptionsAttribute,
469467 $classAttributesStructure;
470468
471469 $recordSet = queryRecordSet(
472470 $classAttributesStructure->getStructureType(),
473 - $queryTransactionInformation,
 471+ $viewInformation->queryTransactionInformation,
474472 $classAttributeIdAttribute,
475473 array(
476474 'object_id' => $classAttributeIdAttribute,
@@ -482,30 +480,30 @@
483481 );
484482
485483 expandDefinedMeaningReferencesInRecordSet($recordSet, array($classAttributeLevelAttribute ,$classAttributeAttributeAttribute));
486 - expandOptionAttributeOptionsInRecordSet($recordSet, $classAttributeIdAttribute, $queryTransactionInformation);
 484+ expandOptionAttributeOptionsInRecordSet($recordSet, $classAttributeIdAttribute, $viewInformation);
487485
488486 return $recordSet;
489487 }
490488
491 -function expandOptionAttributeOptionsInRecordSet($recordSet, $attributeIdAttribute, $queryTransactionInformation) {
 489+function expandOptionAttributeOptionsInRecordSet($recordSet, $attributeIdAttribute, ViewInformation $viewInformation) {
492490 global
493491 $definedMeaningIdAttribute, $optionAttributeOptionsAttribute;
494492
495493 for ($i = 0; $i < $recordSet->getRecordCount(); $i++) {
496494 $record = $recordSet->getRecord($i);
497495
498 - $record->setAttributeValue($optionAttributeOptionsAttribute, getOptionAttributeOptionsRecordSet($record->getAttributeValue($attributeIdAttribute), $queryTransactionInformation));
 496+ $record->setAttributeValue($optionAttributeOptionsAttribute, getOptionAttributeOptionsRecordSet($record->getAttributeValue($attributeIdAttribute), $viewInformation));
499497 }
500498 }
501499
502 -function getAlternativeDefinitionsRecordSet($definedMeaningId, $filterLanguageId, $queryTransactionInformation) {
 500+function getAlternativeDefinitionsRecordSet($definedMeaningId, ViewInformation $viewInformation) {
503501 global
504502 $alternativeDefinitionsTable, $definitionIdAttribute, $alternativeDefinitionAttribute, $sourceAttribute,
505503 $alternativeDefinitionsStructure;
506504
507505 $recordSet = queryRecordSet(
508506 $alternativeDefinitionsStructure->getStructureType(),
509 - $queryTransactionInformation,
 507+ $viewInformation->queryTransactionInformation,
510508 $definitionIdAttribute,
511509 array(
512510 'meaning_text_tcid' => $definitionIdAttribute,
@@ -517,56 +515,55 @@
518516
519517 $recordSet->getStructure()->addAttribute($alternativeDefinitionAttribute);
520518
521 - expandTranslatedContentsInRecordSet($recordSet, $definitionIdAttribute, $alternativeDefinitionAttribute, $filterLanguageId, $queryTransactionInformation);
 519+ expandTranslatedContentsInRecordSet($recordSet, $definitionIdAttribute, $alternativeDefinitionAttribute, $viewInformation);
522520 expandDefinedMeaningReferencesInRecordSet($recordSet, array($sourceAttribute));
523521
524522 return $recordSet;
525523 }
526524
527 -function getDefinedMeaningDefinitionRecord($definedMeaningId, $filterLanguageId, $queryTransactionInformation) {
 525+function getDefinedMeaningDefinitionRecord($definedMeaningId, ViewInformation $viewInformation) {
528526 global
529527 $definitionAttribute, $translatedTextAttribute, $objectAttributesAttribute;
530528
531529 $definitionId = getDefinedMeaningDefinitionId($definedMeaningId);
532530 $record = new ArrayRecord(new Structure($definitionAttribute));
533 - $record->setAttributeValue($translatedTextAttribute, getTranslatedContentValue($definitionId, $filterLanguageId, $queryTransactionInformation));
534 - $record->setAttributeValue($objectAttributesAttribute, getObjectAttributesRecord($definitionId, $filterLanguageId, $queryTransactionInformation,$objectAttributesAttribute->id));
 531+ $record->setAttributeValue($translatedTextAttribute, getTranslatedContentValue($definitionId, $viewInformation));
 532+ $record->setAttributeValue($objectAttributesAttribute, getObjectAttributesRecord($definitionId, $viewInformation, $objectAttributesAttribute->id));
535533
536534 return $record;
537535 }
538536
539 -function getObjectAttributesRecord($objectId, $filterLanguageId, $queryTransactionInformation, $structuralOverride=null) {
 537+function getObjectAttributesRecord($objectId, ViewInformation $viewInformation, $structuralOverride = null) {
540538 global
541539 $objectAttributesAttribute, $objectIdAttribute,
542540 $urlAttributeValuesAttribute, $textAttributeValuesAttribute,
543541 $translatedTextAttributeValuesAttribute, $optionAttributeValuesAttribute,
544542 $definedMeaningAttributesAttribute;
545543
546 - if($structuralOverride) {
 544+ if ($structuralOverride)
547545 $record = new ArrayRecord(new Structure($structuralOverride,$definedMeaningAttributesAttribute));
548 - } else {
 546+ else
549547 $record = new ArrayRecord(new Structure($definedMeaningAttributesAttribute));
550 - }
551548
552549 $record->setAttributeValue($objectIdAttribute, $objectId);
553 - $record->setAttributeValue($textAttributeValuesAttribute, getTextAttributesValuesRecordSet(array($objectId), $filterLanguageId, $queryTransactionInformation));
554 - $record->setAttributeValue($translatedTextAttributeValuesAttribute, getTranslatedTextAttributeValuesRecordSet(array($objectId), $filterLanguageId, $queryTransactionInformation));
555 - $record->setAttributeValue($urlAttributeValuesAttribute, getURLAttributeValuesRecordSet(array($objectId), $filterLanguageId, $queryTransactionInformation));
556 - $record->setAttributeValue($optionAttributeValuesAttribute, getOptionAttributeValuesRecordSet(array($objectId), $filterLanguageId, $queryTransactionInformation));
 550+ $record->setAttributeValue($textAttributeValuesAttribute, getTextAttributesValuesRecordSet(array($objectId), $viewInformation));
 551+ $record->setAttributeValue($translatedTextAttributeValuesAttribute, getTranslatedTextAttributeValuesRecordSet(array($objectId), $viewInformation));
 552+ $record->setAttributeValue($urlAttributeValuesAttribute, getURLAttributeValuesRecordSet(array($objectId), $viewInformation));
 553+ $record->setAttributeValue($optionAttributeValuesAttribute, getOptionAttributeValuesRecordSet(array($objectId), $viewInformation));
557554
558555 return $record;
559556 }
560557
561 -function getTranslatedContentValue($translatedContentId, $filterLanguageId, $queryTransactionInformation) {
 558+function getTranslatedContentValue($translatedContentId, ViewInformation $viewInformation) {
562559 global
563560 $textAttribute;
564561
565 - if ($filterLanguageId == 0)
566 - return getTranslatedContentRecordSet($translatedContentId, $queryTransactionInformation);
 562+ if ($viewInformation->filterLanguageId == 0)
 563+ return getTranslatedContentRecordSet($translatedContentId, $viewInformation);
567564 else {
568 - $recordSet = getFilteredTranslatedContentRecordSet($translatedContentId, $filterLanguageId, $queryTransactionInformation);
 565+ $recordSet = getFilteredTranslatedContentRecordSet($translatedContentId, $viewInformation);
569566
570 - if (count($queryTransactionInformation->versioningAttributes()) > 0)
 567+ if (count($viewInformation->queryTransactionInformation->versioningAttributes()) > 0)
571568 return $recordSet;
572569 else {
573570 if ($recordSet->getRecordCount() > 0)
@@ -577,14 +574,14 @@
578575 }
579576 }
580577
581 -function getTranslatedContentRecordSet($translatedContentId, $queryTransactionInformation) {
 578+function getTranslatedContentRecordSet($translatedContentId, ViewInformation $viewInformation) {
582579 global
583580 $translatedContentTable, $languageAttribute, $textAttribute,
584581 $translatedTextStructure;
585582
586583 $recordSet = queryRecordSet(
587584 $translatedTextStructure->getStructureType(),
588 - $queryTransactionInformation,
 585+ $viewInformation->queryTransactionInformation,
589586 $languageAttribute,
590587 array(
591588 'language_id' => $languageAttribute,
@@ -599,13 +596,13 @@
600597 return $recordSet;
601598 }
602599
603 -function getFilteredTranslatedContentRecordSet($translatedContentId, $filterLanguageId, $queryTransactionInformation) {
 600+function getFilteredTranslatedContentRecordSet($translatedContentId, ViewInformation $viewInformation) {
604601 global
605602 $translatedContentTable, $languageAttribute, $textAttribute;
606603
607604 $recordSet = queryRecordSet(
608605 null,
609 - $queryTransactionInformation,
 606+ $viewInformation->queryTransactionInformation,
610607 $languageAttribute,
611608 array(
612609 'language_id' => $languageAttribute,
@@ -614,7 +611,7 @@
615612 $translatedContentTable,
616613 array(
617614 "translated_content_id=$translatedContentId",
618 - "language_id=$filterLanguageId"
 615+ "language_id=" . $viewInformation->filterLanguageId
619616 )
620617 );
621618
@@ -623,7 +620,7 @@
624621 return $recordSet;
625622 }
626623
627 -function getSynonymAndTranslationRecordSet($definedMeaningId, $filterLanguageId, $queryTransactionInformation) {
 624+function getSynonymAndTranslationRecordSet($definedMeaningId, ViewInformation $viewInformation) {
628625 global
629626 $syntransTable, $syntransIdAttribute, $expressionAttribute, $identicalMeaningAttribute, $objectAttributesAttribute,
630627 $synonymsTranslationsStructure;
@@ -631,19 +628,19 @@
632629 $dc=wdGetDataSetContext();
633630 $restrictions = array("defined_meaning_id=$definedMeaningId");
634631
635 - if ($filterLanguageId != 0)
 632+ if ($viewInformation->filterLanguageId != 0)
636633 $restrictions[] =
637634 "expression_id IN (" .
638635 "SELECT expressions.expression_id" .
639636 " FROM {$dc}_expression_ns AS expressions" .
640637 " WHERE expressions.expression_id=expression_id" .
641 - " AND language_id=$filterLanguageId" .
 638+ " AND language_id=" . $viewInformation->filterLanguageId .
642639 " AND " . getLatestTransactionRestriction('expressions') .
643640 ")";
644641
645642 $recordSet = queryRecordSet(
646643 $synonymsTranslationsStructure->getStructureType(),
647 - $queryTransactionInformation,
 644+ $viewInformation->queryTransactionInformation,
648645 $syntransIdAttribute,
649646 array(
650647 'syntrans_sid' => $syntransIdAttribute,
@@ -654,7 +651,7 @@
655652 $restrictions
656653 );
657654
658 - if ($filterLanguageId == 0)
 655+ if ($viewInformation->filterLanguageId == 0)
659656 expandExpressionReferencesInRecordSet($recordSet, array($expressionAttribute));
660657 else
661658 expandExpressionSpellingsInRecordSet($recordSet, array($expressionAttribute));
@@ -662,11 +659,11 @@
663660 //add object attributes attribute to the generated structure
664661 //and expand the records
665662 $recordSet->getStructure()->addAttribute($objectAttributesAttribute);
666 - expandObjectAttributesAttribute($recordSet, $syntransIdAttribute, $filterLanguageId, $queryTransactionInformation);
 663+ expandObjectAttributesAttribute($recordSet, $syntransIdAttribute, $viewInformation);
667664 return $recordSet;
668665 }
669666
670 -function expandObjectAttributesAttribute($recordSet, $objectIdAttribute, $filterLanguageId, $queryTransactionInformation) {
 667+function expandObjectAttributesAttribute($recordSet, $objectIdAttribute, ViewInformation $viewInformation) {
671668 global
672669 $objectAttributesAttribute,
673670 $textAttributeObjectAttribute, $textAttributeValuesAttribute,
@@ -685,7 +682,7 @@
686683 }
687684
688685 // Text attributes
689 - $allTextAttributeValuesRecordSet = getTextAttributesValuesRecordSet($objectIds, $filterLanguageId, $queryTransactionInformation);
 686+ $allTextAttributeValuesRecordSet = getTextAttributesValuesRecordSet($objectIds, $viewInformation);
690687 $textAttributeValuesRecordSets =
691688 splitRecordSet(
692689 $allTextAttributeValuesRecordSet,
@@ -695,7 +692,7 @@
696693 $emptyTextAttributesRecordSet = new ArrayRecordSet($allTextAttributeValuesRecordSet->getStructure(), $allTextAttributeValuesRecordSet->getKey());
697694
698695 // Translated text attributes
699 - $allTranslatedTextAttributeValuesRecordSet = getTranslatedTextAttributeValuesRecordSet($objectIds, $filterLanguageId, $queryTransactionInformation);
 696+ $allTranslatedTextAttributeValuesRecordSet = getTranslatedTextAttributeValuesRecordSet($objectIds, $viewInformation);
700697 $translatedTextAttributeValuesRecordSets =
701698 splitRecordSet(
702699 $allTranslatedTextAttributeValuesRecordSet,
@@ -705,7 +702,7 @@
706703 $emptyTranslatedTextAttributesRecordSet = new ArrayRecordSet($allTranslatedTextAttributeValuesRecordSet->getStructure(), $allTranslatedTextAttributeValuesRecordSet->getKey());
707704
708705 // URL attributes
709 - $allURLAttributeValuesRecordSet = getURLAttributeValuesRecordSet($objectIds, $filterLanguageId, $queryTransactionInformation);
 706+ $allURLAttributeValuesRecordSet = getURLAttributeValuesRecordSet($objectIds, $viewInformation);
710707 $urlAttributeValuesRecordSets =
711708 splitRecordSet(
712709 $allURLAttributeValuesRecordSet,
@@ -715,7 +712,7 @@
716713 $emptyURLAttributesRecordSet = new ArrayRecordSet($allURLAttributeValuesRecordSet->getStructure(), $allURLAttributeValuesRecordSet->getKey());
717714
718715 // Option attributes
719 - $allOptionAttributeValuesRecordSet = getOptionAttributeValuesRecordSet($objectIds, $filterLanguageId, $queryTransactionInformation);
 716+ $allOptionAttributeValuesRecordSet = getOptionAttributeValuesRecordSet($objectIds, $viewInformation);
720717 $optionAttributeValuesRecordSets =
721718 splitRecordSet(
722719 $allOptionAttributeValuesRecordSet,
@@ -779,7 +776,7 @@
780777 return $record;
781778 }
782779
783 -function getDefinedMeaningRelationsRecordSet($definedMeaningId, $filterLanguageId, $filterRelationTypes, $queryTransactionInformation) {
 780+function getDefinedMeaningRelationsRecordSet($definedMeaningId, $filterRelationTypes, ViewInformation $viewInformation) {
784781 global
785782 $meaningRelationsTable, $relationIdAttribute, $relationTypeAttribute,
786783 $objectAttributesAttribute, $otherDefinedMeaningAttribute,
@@ -792,7 +789,7 @@
793790
794791 $recordSet = queryRecordSet(
795792 $relationStructure->getStructureType(),
796 - $queryTransactionInformation,
 793+ $viewInformation->queryTransactionInformation,
797794 $relationIdAttribute,
798795 array(
799796 'relation_id' => $relationIdAttribute,
@@ -810,12 +807,12 @@
811808 //and expand the records
812809 $struct=$recordSet->getStructure();
813810 $struct->addAttribute($objectAttributesAttribute);
814 - expandObjectAttributesAttribute($recordSet, $relationIdAttribute, $filterLanguageId, $queryTransactionInformation);
 811+ expandObjectAttributesAttribute($recordSet, $relationIdAttribute, $viewInformation);
815812
816813 return $recordSet;
817814 }
818815
819 -function getDefinedMeaningReciprocalRelationsRecordSet($definedMeaningId, $filterLanguageId, $queryTransactionInformation) {
 816+function getDefinedMeaningReciprocalRelationsRecordSet($definedMeaningId, ViewInformation $viewInformation) {
820817 global
821818 $meaningRelationsTable, $relationIdAttribute, $relationTypeAttribute,
822819 $otherDefinedMeaningAttribute, $objectAttributesAttribute,
@@ -823,7 +820,7 @@
824821
825822 $recordSet = queryRecordSet(
826823 $reciprocalRelationsAttribute->id,
827 - $queryTransactionInformation,
 824+ $viewInformation->queryTransactionInformation,
828825 $relationIdAttribute,
829826 array(
830827 'relation_id' => $relationIdAttribute,
@@ -841,19 +838,19 @@
842839 //and expand the records
843840 $struct=$recordSet->getStructure();
844841 $struct->addAttribute($objectAttributesAttribute);
845 - expandObjectAttributesAttribute($recordSet, $relationIdAttribute, $filterLanguageId, $queryTransactionInformation);
 842+ expandObjectAttributesAttribute($recordSet, $relationIdAttribute, $viewInformation);
846843
847844 return $recordSet;
848845 }
849846
850 -function getPossiblySynonymousRecordSet($definedMeaningId, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation) {
 847+function getPossiblySynonymousRecordSet($definedMeaningId, ViewInformation $viewInformation) {
851848 global
852849 $meaningRelationsTable, $possiblySynonymousIdAttribute, $possibleSynonymAttribute,
853850 $objectAttributesAttribute, $otherDefinedMeaningAttribute;
854851
855852 $recordSet = queryRecordSet(
856853 null,
857 - $queryTransactionInformation,
 854+ $viewInformation->queryTransactionInformation,
858855 $possiblySynonymousIdAttribute,
859856 array(
860857 'relation_id' => $possiblySynonymousIdAttribute,
@@ -862,7 +859,7 @@
863860 $meaningRelationsTable,
864861 array(
865862 "meaning1_mid=$definedMeaningId",
866 - "relationtype_mid=" . $possiblySynonymousRelationTypeId
 863+ "relationtype_mid=" . $viewInformation->possiblySynonymousRelationTypeId
867864 ),
868865 array('add_transaction_id')
869866 );
@@ -873,7 +870,7 @@
874871 //and expand the records
875872 $struct=$recordSet->getStructure();
876873 $struct->addAttribute($objectAttributesAttribute);
877 - expandObjectAttributesAttribute($recordSet, $possiblySynonymousIdAttribute, $filterLanguageId, $queryTransactionInformation);
 874+ expandObjectAttributesAttribute($recordSet, $possiblySynonymousIdAttribute, $viewInformation);
878875
879876 return $recordSet;
880877 }
@@ -889,14 +886,14 @@
890887 return $result;
891888 }
892889
893 -function getDefinedMeaningCollectionMembershipRecordSet($definedMeaningId, $queryTransactionInformation) {
 890+function getDefinedMeaningCollectionMembershipRecordSet($definedMeaningId, ViewInformation $viewInformation) {
894891 global
895892 $collectionMembershipsTable, $collectionIdAttribute, $collectionMeaningAttribute, $sourceIdentifierAttribute,
896893 $gotoSourceAttribute, $collectionMembershipStructure;
897894
898895 $recordSet = queryRecordSet(
899896 $collectionMembershipStructure->getStructureType(),
900 - $queryTransactionInformation,
 897+ $viewInformation->queryTransactionInformation,
901898 $collectionIdAttribute,
902899 array(
903900 'collection_id' => $collectionIdAttribute,
@@ -919,7 +916,7 @@
920917 return $recordSet;
921918 }
922919
923 -function getTextAttributesValuesRecordSet($objectIds, $filterLanguageId, $queryTransactionInformation) {
 920+function getTextAttributesValuesRecordSet($objectIds, ViewInformation $viewInformation) {
924921 global
925922 $textAttributeValuesTable, $textAttributeIdAttribute, $textAttributeObjectAttribute,
926923 $textAttributeAttribute, $textAttribute, $objectAttributesAttribute,
@@ -927,7 +924,7 @@
928925
929926 $recordSet = queryRecordSet(
930927 $textAttributeValuesStructure->getStructureType(),
931 - $queryTransactionInformation,
 928+ $viewInformation->queryTransactionInformation,
932929 $textAttributeIdAttribute,
933930 array(
934931 'value_id' => $textAttributeIdAttribute,
@@ -944,12 +941,12 @@
945942 //add object attributes attribute to the generated structure
946943 //and expand the records
947944 $recordSet->getStructure()->addAttribute($objectAttributesAttribute);
948 - expandObjectAttributesAttribute($recordSet, $textAttributeIdAttribute, $filterLanguageId, $queryTransactionInformation);
 945+ expandObjectAttributesAttribute($recordSet, $textAttributeIdAttribute, $viewInformation);
949946
950947 return $recordSet;
951948 }
952949
953 -function getURLAttributeValuesRecordSet($objectIds, $filterLanguageId, $queryTransactionInformation) {
 950+function getURLAttributeValuesRecordSet($objectIds, ViewInformation $viewInformation) {
954951 global
955952 $urlAttributeValuesTable, $urlAttributeIdAttribute, $urlAttributeObjectAttribute,
956953 $urlAttributeAttribute, $urlAttribute, $objectAttributesAttribute,
@@ -957,7 +954,7 @@
958955
959956 $recordSet = queryRecordSet(
960957 $urlAttributeValuesStructure->getStructureType(),
961 - $queryTransactionInformation,
 958+ $viewInformation->queryTransactionInformation,
962959 $urlAttributeIdAttribute,
963960 array(
964961 'value_id' => $urlAttributeIdAttribute,
@@ -974,12 +971,12 @@
975972 //add object attributes attribute to the generated structure
976973 //and expand the records
977974 $recordSet->getStructure()->addAttribute($objectAttributesAttribute);
978 - expandObjectAttributesAttribute($recordSet, $urlAttributeIdAttribute, $filterLanguageId, $queryTransactionInformation);
 975+ expandObjectAttributesAttribute($recordSet, $urlAttributeIdAttribute, $viewInformation);
979976
980977 return $recordSet;
981978 }
982979
983 -function getTranslatedTextAttributeValuesRecordSet($objectIds, $filterLanguageId, $queryTransactionInformation) {
 980+function getTranslatedTextAttributeValuesRecordSet($objectIds, ViewInformation $viewInformation) {
984981 global
985982 $translatedTextAttributeIdAttribute, $translatedContentAttributeValuesTable, $translatedTextAttributeAttribute,
986983 $objectAttributesAttribute, $translatedTextAttributeObjectAttribute, $translatedTextValueAttribute, $translatedTextValueIdAttribute,
@@ -987,7 +984,7 @@
988985
989986 $recordSet = queryRecordSet(
990987 $translatedTextAttributeValuesStructure->getStructureType(),
991 - $queryTransactionInformation,
 988+ $viewInformation->queryTransactionInformation,
992989 $translatedTextAttributeIdAttribute,
993990 array(
994991 'value_id' => $translatedTextAttributeIdAttribute,
@@ -1001,23 +998,23 @@
1002999
10031000 $recordSet->getStructure()->addAttribute($translatedTextValueAttribute);
10041001
1005 - expandTranslatedContentsInRecordSet($recordSet, $translatedTextValueIdAttribute, $translatedTextValueAttribute, $filterLanguageId, $queryTransactionInformation);
 1002+ expandTranslatedContentsInRecordSet($recordSet, $translatedTextValueIdAttribute, $translatedTextValueAttribute, $viewInformation);
10061003 expandDefinedMeaningReferencesInRecordSet($recordSet, array($translatedTextAttributeAttribute));
10071004
10081005 //add object attributes attribute to the generated structure
10091006 //and expand the records
10101007 $recordSet->getStructure()->addAttribute($objectAttributesAttribute);
1011 - expandObjectAttributesAttribute($recordSet, $translatedTextAttributeIdAttribute, $filterLanguageId, $queryTransactionInformation);
 1008+ expandObjectAttributesAttribute($recordSet, $translatedTextAttributeIdAttribute, $viewInformation);
10121009 return $recordSet;
10131010 }
10141011
1015 -function getOptionAttributeOptionsRecordSet($attributeId, $queryTransactionInformation) {
 1012+function getOptionAttributeOptionsRecordSet($attributeId, ViewInformation $viewInformation) {
10161013 global
10171014 $optionAttributeOptionIdAttribute, $optionAttributeAttribute, $optionAttributeOptionAttribute, $languageAttribute, $optionAttributeOptionsTable;
10181015
10191016 $recordSet = queryRecordSet(
10201017 null,
1021 - $queryTransactionInformation,
 1018+ $viewInformation->queryTransactionInformation,
10221019 $optionAttributeOptionIdAttribute,
10231020 array(
10241021 'option_id' => $optionAttributeOptionIdAttribute,
@@ -1034,14 +1031,14 @@
10351032 return $recordSet;
10361033 }
10371034
1038 -function getOptionAttributeValuesRecordSet($objectIds, $filterLanguageId, $queryTransactionInformation) {
 1035+function getOptionAttributeValuesRecordSet($objectIds, ViewInformation $viewInformation) {
10391036 global
10401037 $optionAttributeIdAttribute, $optionAttributeObjectAttribute, $optionAttributeOptionIdAttribute, $optionAttributeAttribute,$optionAttributeOptionAttribute, $optionAttributeValuesTable, $objectAttributesAttribute,
10411038 $optionAttributeValuesStructure;
10421039
10431040 $recordSet = queryRecordSet(
10441041 $optionAttributeValuesStructure->getStructureType(),
1045 - $queryTransactionInformation,
 1042+ $viewInformation->queryTransactionInformation,
10461043 $optionAttributeIdAttribute,
10471044 array(
10481045 'value_id' => $optionAttributeIdAttribute,
@@ -1052,19 +1049,19 @@
10531050 array("object_id IN (" . implode(", ", $objectIds) . ")")
10541051 );
10551052
1056 - expandOptionsInRecordSet($recordSet, $queryTransactionInformation);
 1053+ expandOptionsInRecordSet($recordSet, $viewInformation);
10571054 expandDefinedMeaningReferencesInRecordSet($recordSet, array($optionAttributeAttribute, $optionAttributeOptionAttribute));
10581055
10591056 /* Add object attributes attribute to the generated structure
10601057 and expand the records. */
10611058 $recordSet->getStructure()->addAttribute($objectAttributesAttribute);
1062 - expandObjectAttributesAttribute($recordSet, $optionAttributeIdAttribute, $filterLanguageId, $queryTransactionInformation);
 1059+ expandObjectAttributesAttribute($recordSet, $optionAttributeIdAttribute, $viewInformation);
10631060
10641061 return $recordSet;
10651062 }
10661063
10671064 /* XXX: This can probably be combined with other functions. In fact, it probably should be. Do it. */
1068 -function expandOptionsInRecordSet($recordSet, $queryTransactionInformation) {
 1065+function expandOptionsInRecordSet($recordSet, ViewInformation $viewInformation) {
10691066 global
10701067 $optionAttributeOptionIdAttribute, $optionAttributeIdAttribute, $optionAttributeAttribute, $optionAttributeOptionAttribute, $optionAttributeOptionsTable, $classAttributesTable;
10711068
@@ -1073,7 +1070,7 @@
10741071
10751072 $optionRecordSet = queryRecordSet(
10761073 null,
1077 - $queryTransactionInformation,
 1074+ $viewInformation->queryTransactionInformation,
10781075 $optionAttributeOptionIdAttribute,
10791076 array(
10801077 'attribute_id' => $optionAttributeIdAttribute,
@@ -1091,7 +1088,7 @@
10921089
10931090 $optionRecordSet = queryRecordSet(
10941091 null,
1095 - $queryTransactionInformation,
 1092+ $viewInformation->queryTransactionInformation,
10961093 $optionAttributeIdAttribute,
10971094 array('attribute_mid' => $optionAttributeAttribute),
10981095 $classAttributesTable,
@@ -1106,14 +1103,14 @@
11071104 }
11081105 }
11091106
1110 -function getDefinedMeaningClassMembershipRecordSet($definedMeaningId, $queryTransactionInformation) {
 1107+function getDefinedMeaningClassMembershipRecordSet($definedMeaningId, ViewInformation $viewInformation) {
11111108 global
11121109 $classMembershipsTable, $classMembershipIdAttribute, $classAttribute,
11131110 $classMembershipStructure;
11141111
11151112 $recordSet = queryRecordSet(
11161113 $classMembershipStructure->getStructureType(),
1117 - $queryTransactionInformation,
 1114+ $viewInformation->queryTransactionInformation,
11181115 $classMembershipIdAttribute,
11191116 array(
11201117 'class_membership_id' => $classMembershipIdAttribute,
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWiki.php
@@ -10,6 +10,7 @@
1111 require_once('HTMLtable.php');
1212 require_once('OmegaWikiRecordSets.php');
1313 require_once('OmegaWikiEditors.php');
 14+require_once('ViewInformation.php');
1415 require_once('WikiDataGlobals.php');
1516
1617 /**
@@ -30,12 +31,7 @@
3132 $wgOut->addHTML(
3233 getExpressionsEditor($spelling, $this->filterLanguageId, $this->possiblySynonymousRelationTypeId, false, $this->shouldShowAuthorities)->view(
3334 $this->getIdStack(),
34 - getExpressionsRecordSet(
35 - $spelling,
36 - $this->filterLanguageId,
37 - $this->possiblySynonymousRelationTypeId,
38 - $this->viewQueryTransactionInformation
39 - )
 35+ getExpressionsRecordSet($spelling, $this->viewInformation)
4036 )
4137 );
4238
@@ -49,16 +45,11 @@
5046 parent::history();
5147
5248 $spelling = $wgTitle->getText();
53 -
 49+
5450 $wgOut->addHTML(
5551 getExpressionsEditor($spelling, $this->filterLanguageId, $this->possiblySynonymousRelationTypeId, $this->showRecordLifeSpan, false)->view(
5652 $this->getIdStack(),
57 - getExpressionsRecordSet(
58 - $spelling,
59 - $this->filterLanguageId,
60 - $this->possiblySynonymousRelationTypeId,
61 - $this->queryTransactionInformation
62 - )
 53+ getExpressionsRecordSet($spelling, $this->viewInformation)
6354 )
6455 );
6556
@@ -66,22 +57,17 @@
6758 $wgOut->addHTML("<script language='javascript'><!--\nexpandEditors();\n--></script>");
6859 }
6960
70 - protected function save($referenceTransaction) {
 61+ protected function save($referenceQueryTransactionInformation) {
7162 global
7263 $wgTitle;
7364
74 - parent::save($referenceTransaction);
 65+ parent::save($referenceQueryTransactionInformation);
7566
7667 $spelling = $wgTitle->getText();
7768
7869 getExpressionsEditor($spelling, $this->filterLanguageId, $this->possiblySynonymousRelationTypeId, false, false)->save(
7970 $this->getIdStack(),
80 - getExpressionsRecordSet(
81 - $spelling,
82 - $this->filterLanguageId,
83 - $this->possiblySynonymousRelationTypeId,
84 - $referenceTransaction
85 - )
 71+ getExpressionsRecordSet($spelling, $this->viewInformation)
8672 );
8773 }
8874
@@ -97,12 +83,7 @@
9884 $wgOut->addHTML(
9985 getExpressionsEditor($spelling, $this->filterLanguageId, $this->possiblySynonymousRelationTypeId, false, false)->edit(
10086 $this->getIdStack(),
101 - getExpressionsRecordSet(
102 - $spelling,
103 - $this->filterLanguageId,
104 - $this->possiblySynonymousRelationTypeId,
105 - new QueryLatestTransactionInformation()
106 - )
 87+ getExpressionsRecordSet($spelling, $this->viewInformation)
10788 )
10889 );
10990
Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaningModel.php
@@ -12,9 +12,9 @@
1313 protected $record=null;
1414 protected $definedMeaningID=null;
1515
16 - public function __construct($definedMeaningId, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation) {
 16+ public function __construct($definedMeaningId, $viewInformation) {
1717
18 - wfDebug("definedMeaningId:$definedMeaningId, filterLanguageId:$filterLanguageId, possiblySynonymousRelationTypeId:$possiblySynonymousRelationTypeId, queryTransactionInformation:$queryTransactionInformation\n");
 18+ wfDebug("definedMeaningId:$definedMeaningId, filterLanguageId:$viewInformation->filterLanguageId, possiblySynonymousRelationTypeId:$viewInformation->possiblySynonymousRelationTypeId, queryTransactionInformation:$viewInformation->queryTransactionInformation\n");
1919 global
2020 $definedMeaningAttribute, $definitionAttribute, $classAttributesAttribute,
2121 $alternativeDefinitionsAttribute, $synonymsAndTranslationsAttribute,
@@ -24,23 +24,23 @@
2525
2626 $this->setDefinedMeaningID($definedMeaningId);
2727 $record = new ArrayRecord($definedMeaningAttribute->type);
28 - $record->setAttributeValue($definitionAttribute, getDefinedMeaningDefinitionRecord($definedMeaningId, $filterLanguageId, $queryTransactionInformation));
29 - $record->setAttributeValue($classAttributesAttribute, getClassAttributesRecordSet($definedMeaningId, $queryTransactionInformation));
30 - $record->setAttributeValue($alternativeDefinitionsAttribute, getAlternativeDefinitionsRecordSet($definedMeaningId, $filterLanguageId, $queryTransactionInformation));
31 - $record->setAttributeValue($synonymsAndTranslationsAttribute, getSynonymAndTranslationRecordSet($definedMeaningId, $filterLanguageId, $queryTransactionInformation));
 28+ $record->setAttributeValue($definitionAttribute, getDefinedMeaningDefinitionRecord($definedMeaningId, $viewInformation));
 29+ $record->setAttributeValue($classAttributesAttribute, getClassAttributesRecordSet($definedMeaningId, $viewInformation));
 30+ $record->setAttributeValue($alternativeDefinitionsAttribute, getAlternativeDefinitionsRecordSet($definedMeaningId, $viewInformation));
 31+ $record->setAttributeValue($synonymsAndTranslationsAttribute, getSynonymAndTranslationRecordSet($definedMeaningId, $viewInformation));
3232
3333 $filterRelationTypes = array();
3434
35 - if ($possiblySynonymousRelationTypeId != 0) {
36 - $record->setAttributeValue($possiblySynonymousAttribute, getPossiblySynonymousRecordSet($definedMeaningId, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation));
37 - $filterRelationTypes[] = $possiblySynonymousRelationTypeId;
 35+ if ($viewInformation->possiblySynonymousRelationTypeId != 0) {
 36+ $record->setAttributeValue($possiblySynonymousAttribute, getPossiblySynonymousRecordSet($definedMeaningId, $viewInformation));
 37+ $filterRelationTypes[] = $viewInformation->possiblySynonymousRelationTypeId;
3838 }
3939
40 - $record->setAttributeValue($relationsAttribute, getDefinedMeaningRelationsRecordSet($definedMeaningId, $filterLanguageId, $filterRelationTypes, $queryTransactionInformation));
41 - $record->setAttributeValue($reciprocalRelationsAttribute, getDefinedMeaningReciprocalRelationsRecordSet($definedMeaningId, $filterLanguageId, $queryTransactionInformation));
42 - $record->setAttributeValue($classMembershipAttribute, getDefinedMeaningClassMembershipRecordSet($definedMeaningId, $queryTransactionInformation));
43 - $record->setAttributeValue($collectionMembershipAttribute, getDefinedMeaningCollectionMembershipRecordSet($definedMeaningId, $queryTransactionInformation));
44 - $record->setAttributeValue($definedMeaningAttributesAttribute, getObjectAttributesRecord($definedMeaningId, $filterLanguageId, $queryTransactionInformation));
 40+ $record->setAttributeValue($relationsAttribute, getDefinedMeaningRelationsRecordSet($definedMeaningId, $filterRelationTypes, $viewInformation));
 41+ $record->setAttributeValue($reciprocalRelationsAttribute, getDefinedMeaningReciprocalRelationsRecordSet($definedMeaningId, $viewInformation));
 42+ $record->setAttributeValue($classMembershipAttribute, getDefinedMeaningClassMembershipRecordSet($definedMeaningId, $viewInformation));
 43+ $record->setAttributeValue($collectionMembershipAttribute, getDefinedMeaningCollectionMembershipRecordSet($definedMeaningId, $viewInformation));
 44+ $record->setAttributeValue($definedMeaningAttributesAttribute, getObjectAttributesRecord($definedMeaningId, $viewInformation));
4545 $this->record=$record;
4646
4747 }
Index: trunk/extensions/Wikidata/OmegaWiki/ViewInformation.php
@@ -0,0 +1,19 @@
 2+<?php
 3+
 4+class ViewInformation {
 5+ public $filterLanguageId;
 6+ public $possiblySynonymousRelationTypeId;
 7+ public $queryTransactionInformation;
 8+ public $showRecordLifeSpan;
 9+ public $showAuthority;
 10+
 11+ public function __construct() {
 12+ $this->filterLanguageId = 0;
 13+ $this->possiblySynonymousRelationTypeId = 0;
 14+ $this->queryTransactionInformation;
 15+ $this->showRecordLifeSpan = false;
 16+ $this->showAuthority = false;
 17+ }
 18+}
 19+
 20+?>
Property changes on: trunk/extensions/Wikidata/OmegaWiki/ViewInformation.php
___________________________________________________________________
Added: svn:eol-style
121 + native
Index: trunk/extensions/Wikidata/OmegaWiki/RecordSetQueries.php
@@ -13,8 +13,9 @@
1414 else
1515 $groupBy = array();
1616
17 - $query = "SELECT ". implode(", ", $selectFields) .
18 - " FROM ". implode(", ", $tableNames);
 17+ $query =
 18+ "SELECT ". implode(", ", $selectFields) .
 19+ " FROM ". implode(", ", $tableNames);
1920
2021 if (count($restrictions) > 0)
2122 $query .= " WHERE ". implode(' AND ', $restrictions);
@@ -44,11 +45,12 @@
4546
4647 $query = getTransactedSQL($transactionInformation, $selectFields, $table, $restrictions, $orderBy, $count, $offset);
4748 $queryResult = $dbr->query($query);
48 - if(!is_null($recordSetStructureId)) {
 49+
 50+ if (!is_null($recordSetStructureId))
4951 $structure = new Structure($recordSetStructureId, $allAttributes);
50 - } else {
 52+ else
5153 $structure = new Structure($allAttributes);
52 - }
 54+
5355 $recordSet = new ArrayRecordSet($structure, new Structure($keyAttribute));
5456
5557 while ($row = $dbr->fetchRow($queryResult)) {

Status & tagging log