Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaning.php |
— | — | @@ -137,12 +137,12 @@ |
138 | 138 | } |
139 | 139 | |
140 | 140 | protected function getIdStack($definedMeaningId) { |
141 | | - global |
142 | | - $definedMeaningIdAttribute; |
| 141 | + |
| 142 | + $o=OmegaWikiAttributes::getInstance(); |
143 | 143 | |
144 | | - $definedMeaningIdStructure = new Structure($definedMeaningIdAttribute); |
| 144 | + $definedMeaningIdStructure = new Structure($o->definedMeaningId); |
145 | 145 | $definedMeaningIdRecord = new ArrayRecord($definedMeaningIdStructure, $definedMeaningIdStructure); |
146 | | - $definedMeaningIdRecord->setAttributeValue($definedMeaningIdAttribute, $definedMeaningId); |
| 146 | + $definedMeaningIdRecord->definedMeaningId = $definedMeaningId; |
147 | 147 | |
148 | 148 | $idStack = new IdStack("defined-meaning"); |
149 | 149 | $idStack->pushKey($definedMeaningIdRecord); |
Index: trunk/extensions/Wikidata/OmegaWiki/SpecialDatasearch.php |
— | — | @@ -233,11 +233,11 @@ |
234 | 234 | } |
235 | 235 | |
236 | 236 | function getWordsSearchResultAsRecordSet($queryResult) { |
237 | | - global |
238 | | - $definedMeaningIdAttribute; |
| 237 | + |
| 238 | + $o=OmegaWikiAttributes::getInstance(); |
239 | 239 | |
240 | 240 | $dbr =& wfGetDB(DB_SLAVE); |
241 | | - $recordSet = new ArrayRecordSet(new Structure($definedMeaningIdAttribute, $this->expressionAttribute, $this->meaningAttribute), new Structure($definedMeaningIdAttribute)); |
| 241 | + $recordSet = new ArrayRecordSet(new Structure($o->definedMeaningId, $this->expressionAttribute, $this->meaningAttribute), new Structure($o->definedMeaningId)); |
242 | 242 | |
243 | 243 | while ($row = $dbr->fetchObject($queryResult)) { |
244 | 244 | $expressionRecord = new ArrayRecord($this->expressionStructure); |
Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataBootstrappedMeanings.php |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | $definitionMeaningName, |
8 | 8 | $relationMeaningName, |
9 | 9 | $synTransMeaningName, |
10 | | - |
| 10 | + |
11 | 11 | $classAttributeLevels; |
12 | 12 | |
13 | 13 | $definedMeaningMeaningName = "DefinedMeaning"; |
Index: trunk/extensions/Wikidata/OmegaWiki/converter.php |
— | — | @@ -56,11 +56,11 @@ |
57 | 57 | protected $attributes = array(); |
58 | 58 | |
59 | 59 | public function __construct($attribute) { |
60 | | - global |
61 | | - $expressionAttribute; |
| 60 | + |
| 61 | + $o=OmegaWikiAttributes::getInstance(); |
62 | 62 | |
63 | 63 | parent::__construct($attribute); |
64 | | - $this->structure = new Structure($expressionAttribute); |
| 64 | + $this->structure = new Structure($o->expression); |
65 | 65 | } |
66 | 66 | |
67 | 67 | public function getStructure() { |
— | — | @@ -70,8 +70,8 @@ |
71 | 71 | public function convert($record) { |
72 | 72 | $dc=wdGetDataSetContext(); |
73 | 73 | |
74 | | - global |
75 | | - $expressionAttribute, $expressionIdAttribute, $languageAttribute, $spellingAttribute; |
| 74 | + |
| 75 | + $o=OmegaWikiAttributes::getInstance(); |
76 | 76 | |
77 | 77 | $dbr =& wfGetDB(DB_SLAVE); |
78 | 78 | $expressionId = $record->getAttributeValue($this->attribute); |
— | — | @@ -79,12 +79,12 @@ |
80 | 80 | " AND ". getLatestTransactionRestriction("{$dc}_expression_ns")); |
81 | 81 | $expression = $dbr->fetchObject($queryResult); |
82 | 82 | |
83 | | - $expressionRecord = new ArrayRecord(new Structure($languageAttribute, $spellingAttribute)); |
84 | | - $expressionRecord->setAttributeValue($languageAttribute, $expression->language_id); |
85 | | - $expressionRecord->setAttributeValue($spellingAttribute, $expression->spelling); |
| 83 | + $expressionRecord = new ArrayRecord(new Structure($o->language, $o->spelling)); |
| 84 | + $expressionRecord->language = $expression->language_id; |
| 85 | + $expressionRecord->spelling = $expression->spelling; |
86 | 86 | |
87 | 87 | $result = new ArrayRecord($this->structure); |
88 | | - $result->setAttributeValue($expressionAttribute, $expressionRecord); |
| 88 | + $result->expression = $expressionRecord; |
89 | 89 | |
90 | 90 | return $result; |
91 | 91 | } |
Index: trunk/extensions/Wikidata/OmegaWiki/SpecialNeedsTranslation.php |
— | — | @@ -44,9 +44,9 @@ |
45 | 45 | } |
46 | 46 | |
47 | 47 | protected function showExpressionsNeedingTranslation($sourceLanguageId, $destinationLanguageId,$collectionId) { |
48 | | - global |
49 | | - $definedMeaningIdAttribute, $expressionIdAttribute, $expressionAttribute, $expressionStructure; |
| 48 | + |
50 | 49 | $o=OmegaWikiAttributes::getInstance(); |
| 50 | + $o=OmegaWikiAttributes::getInstance(); |
51 | 51 | |
52 | 52 | $dc=wdGetDataSetContext(); |
53 | 53 | require_once("Transaction.php"); |
— | — | @@ -84,17 +84,17 @@ |
85 | 85 | |
86 | 86 | $queryResult = $dbr->query($sql); |
87 | 87 | $definitionAttribute = new Attribute("definition", "Definition", "definition"); |
88 | | - $recordSet = new ArrayRecordSet(new Structure($definedMeaningIdAttribute, $expressionIdAttribute, $expressionAttribute, $definitionAttribute), new Structure($definedMeaningIdAttribute, $expressionIdAttribute)); |
| 88 | + $recordSet = new ArrayRecordSet(new Structure($o->definedMeaningId, $o->expressionId, $o->expression, $definitionAttribute), new Structure($o->definedMeaningId, $o->expressionId)); |
89 | 89 | |
90 | 90 | while ($row = $dbr->fetchObject($queryResult)) { |
91 | | - $expressionRecord = new ArrayRecord($expressionStructure); |
| 91 | + $expressionRecord = new ArrayRecord($o->expressionStructure); |
92 | 92 | $expressionRecord->language = $row->source_language_id; |
93 | 93 | $expressionRecord->spelling = $row->source_spelling; |
94 | 94 | |
95 | 95 | $recordSet->addRecord(array($row->source_defined_meaning_id, $row->source_expression_id, $expressionRecord, getDefinedMeaningDefinition($row->source_defined_meaning_id))); |
96 | 96 | } |
97 | 97 | |
98 | | - $expressionEditor = new RecordTableCellEditor($expressionAttribute); |
| 98 | + $expressionEditor = new RecordTableCellEditor($o->expression); |
99 | 99 | $expressionEditor->addEditor(new LanguageEditor($o->language, new SimplePermissionController(false), false)); |
100 | 100 | $expressionEditor->addEditor(new SpellingEditor($o->spelling, new SimplePermissionController(false), false)); |
101 | 101 | |
Index: trunk/extensions/Wikidata/OmegaWiki/NeedsTranslationTo.php |
— | — | @@ -47,8 +47,8 @@ |
48 | 48 | } |
49 | 49 | |
50 | 50 | protected function showExpressionsNeedingTranslation($sourceLanguageId, $destinationLanguageId) { |
51 | | - global |
52 | | - $definedMeaningIdAttribute, $expressionIdAttribute, $expressionAttribute, $expressionStructure; |
| 51 | + |
| 52 | + $o=OmegaWikiAttributes::getInstance(); |
53 | 53 | |
54 | 54 | $dc=wdGetDataSetContext(); |
55 | 55 | $o=OmegaWikiAttributes::getInstance(); |
— | — | @@ -69,17 +69,17 @@ |
70 | 70 | " LIMIT 100"); |
71 | 71 | |
72 | 72 | $definitionAttribute = new Attribute("definition", "Definition", "definition"); |
73 | | - $recordSet = new ArrayRecordSet(new Structure($definedMeaningIdAttribute, $expressionIdAttribute, $expressionAttribute, $definitionAttribute), new Structure($definedMeaningIdAttribute, $expressionIdAttribute)); |
| 73 | + $recordSet = new ArrayRecordSet(new Structure($o->definedMeaningId, $o->expressionId, $o->expression, $definitionAttribute), new Structure($o->definedMeaningId, $o->expressionId)); |
74 | 74 | |
75 | 75 | while ($row = $dbr->fetchObject($queryResult)) { |
76 | | - $expressionRecord = new ArrayRecord($expressionStructure); |
| 76 | + $expressionRecord = new ArrayRecord($o->expressionStructure); |
77 | 77 | $expressionRecord->language = $row->source_language_id; |
78 | 78 | $expressionRecord->spelling = $row->source_spelling; |
79 | 79 | |
80 | 80 | $recordSet->addRecord(array($row->source_defined_meaning_id, $row->source_expression_id, $expressionRecord, getDefinedMeaningDefinition($row->source_defined_meaning_id))); |
81 | 81 | } |
82 | 82 | |
83 | | - $expressionEditor = new RecordTableCellEditor($expressionAttribute); |
| 83 | + $expressionEditor = new RecordTableCellEditor($o->expression); |
84 | 84 | $expressionEditor->addEditor(new LanguageEditor($o->language, new SimplePermissionController(false), false)); |
85 | 85 | $expressionEditor->addEditor(new SpellingEditor($spellingAttribute, new SimplePermissionController(false), false)); |
86 | 86 | |
Index: trunk/extensions/Wikidata/OmegaWiki/SpecialSuggest.php |
— | — | @@ -38,7 +38,8 @@ |
39 | 39 | |
40 | 40 | function getSuggestions() { |
41 | 41 | |
42 | | - global $idAttribute; |
| 42 | + |
| 43 | + $o=OmegaWikiAttributes::getInstance(); |
43 | 44 | global $wgUser; |
44 | 45 | $dc=wdGetDataSetContext(); |
45 | 46 | @$search = ltrim($_GET['search-text']); |
— | — | @@ -143,7 +144,7 @@ |
144 | 145 | //wfdebug("]]]".$sql."\n"); |
145 | 146 | $queryResult = $dbr->query($sql); |
146 | 147 | |
147 | | - $idAttribute = new Attribute("id", "ID", "id"); |
| 148 | + $o->id = new Attribute("id", "ID", "id"); |
148 | 149 | |
149 | 150 | # == Process query |
150 | 151 | switch($query) { |
— | — | @@ -339,9 +340,11 @@ |
340 | 341 | } |
341 | 342 | |
342 | 343 | function getSQLForLevels($language="<ANY>") { |
| 344 | + |
343 | 345 | global |
344 | | - $definedMeaningTable, $expressionTable, $bootstrappedDefinedMeaningsTable, $classAttributeLevels; |
| 346 | + $definedMeaningTable, $expressionTable, $bootstrappedDefinedMeaningsTable; |
345 | 347 | |
| 348 | + $o=OmegaWikiAttributes::getInstance(); |
346 | 349 | // TO DO: Add support for multiple languages here |
347 | 350 | return |
348 | 351 | selectLatest( |
— | — | @@ -356,15 +359,15 @@ |
357 | 360 | } |
358 | 361 | |
359 | 362 | function getRelationTypeAsRecordSet($queryResult) { |
360 | | - global |
361 | | - $idAttribute; |
| 363 | + |
| 364 | + $o=OmegaWikiAttributes::getInstance(); |
362 | 365 | |
363 | 366 | $dbr =& wfGetDB(DB_SLAVE); |
364 | 367 | |
365 | 368 | $relationTypeAttribute = new Attribute("relation-type", "Relation type", "short-text"); |
366 | 369 | $collectionAttribute = new Attribute("collection", "Collection", "short-text"); |
367 | 370 | |
368 | | - $recordSet = new ArrayRecordSet(new Structure($idAttribute, $relationTypeAttribute, $collectionAttribute), new Structure($idAttribute)); |
| 371 | + $recordSet = new ArrayRecordSet(new Structure($o->id, $relationTypeAttribute, $collectionAttribute), new Structure($o->id)); |
369 | 372 | |
370 | 373 | while ($row = $dbr->fetchObject($queryResult)) |
371 | 374 | $recordSet->addRecord(array($row->member_mid, $row->spelling, definedMeaningExpression($row->collection_mid))); |
— | — | @@ -377,14 +380,14 @@ |
378 | 381 | } |
379 | 382 | |
380 | 383 | function getClassAsRecordSet($queryResult) { |
381 | | - global |
382 | | - $idAttribute; |
| 384 | + |
| 385 | + $o=OmegaWikiAttributes::getInstance(); |
383 | 386 | |
384 | 387 | $dbr =& wfGetDB(DB_SLAVE); |
385 | 388 | $classAttribute = new Attribute("class", "Class", "short-text"); |
386 | 389 | $collectionAttribute = new Attribute("collection", "Collection", "short-text"); |
387 | 390 | |
388 | | - $recordSet = new ArrayRecordSet(new Structure($idAttribute, $classAttribute, $collectionAttribute), new Structure($idAttribute)); |
| 391 | + $recordSet = new ArrayRecordSet(new Structure($o->id, $classAttribute, $collectionAttribute), new Structure($o->id)); |
389 | 392 | |
390 | 393 | while ($row = $dbr->fetchObject($queryResult)) |
391 | 394 | $recordSet->addRecord(array($row->member_mid, $row->spelling, definedMeaningExpression($row->collection_mid))); |
— | — | @@ -397,13 +400,13 @@ |
398 | 401 | } |
399 | 402 | |
400 | 403 | function getTextAttributeAsRecordSet($queryResult) { |
401 | | - global |
402 | | - $idAttribute; |
| 404 | + |
| 405 | + $o=OmegaWikiAttributes::getInstance(); |
403 | 406 | |
404 | 407 | $dbr =& wfGetDB(DB_SLAVE); |
405 | 408 | |
406 | 409 | $textAttributeAttribute = new Attribute("text-attribute", "Text attribute", "short-text"); |
407 | | - $recordSet = new ArrayRecordSet(new Structure($idAttribute, $textAttributeAttribute), new Structure($idAttribute)); |
| 410 | + $recordSet = new ArrayRecordSet(new Structure($o->id, $textAttributeAttribute), new Structure($o->id)); |
408 | 411 | |
409 | 412 | while ($row = $dbr->fetchObject($queryResult)) |
410 | 413 | $recordSet->addRecord(array($row->attribute_mid, $row->spelling)); |
— | — | @@ -415,13 +418,13 @@ |
416 | 419 | } |
417 | 420 | |
418 | 421 | function getLinkAttributeAsRecordSet($queryResult) { |
419 | | - global |
420 | | - $idAttribute; |
| 422 | + |
| 423 | + $o=OmegaWikiAttributes::getInstance(); |
421 | 424 | |
422 | 425 | $dbr =& wfGetDB(DB_SLAVE); |
423 | 426 | |
424 | 427 | $linkAttributeAttribute = new Attribute("link-attribute", "Link attribute", "short-text"); |
425 | | - $recordSet = new ArrayRecordSet(new Structure($idAttribute, $linkAttributeAttribute), new Structure($idAttribute)); |
| 428 | + $recordSet = new ArrayRecordSet(new Structure($o->id, $linkAttributeAttribute), new Structure($o->id)); |
426 | 429 | |
427 | 430 | while ($row = $dbr->fetchObject($queryResult)) |
428 | 431 | $recordSet->addRecord(array($row->attribute_mid, $row->spelling)); |
— | — | @@ -433,13 +436,13 @@ |
434 | 437 | } |
435 | 438 | |
436 | 439 | function getTranslatedTextAttributeAsRecordSet($queryResult) { |
437 | | - global |
438 | | - $idAttribute; |
| 440 | + |
| 441 | + $o=OmegaWikiAttributes::getInstance(); |
439 | 442 | |
440 | 443 | $dbr =& wfGetDB(DB_SLAVE); |
441 | 444 | $translatedTextAttributeAttribute = new Attribute("translated-text-attribute", "Translated text attribute", "short-text"); |
442 | 445 | |
443 | | - $recordSet = new ArrayRecordSet(new Structure($idAttribute, $translatedTextAttributeAttribute), new Structure($idAttribute)); |
| 446 | + $recordSet = new ArrayRecordSet(new Structure($o->id, $translatedTextAttributeAttribute), new Structure($o->id)); |
444 | 447 | |
445 | 448 | while ($row = $dbr->fetchObject($queryResult)) |
446 | 449 | $recordSet->addRecord(array($row->attribute_mid, $row->spelling)); |
— | — | @@ -451,13 +454,13 @@ |
452 | 455 | } |
453 | 456 | |
454 | 457 | function getOptionAttributeAsRecordSet($queryResult) { |
455 | | - global |
456 | | - $idAttribute; |
| 458 | + |
| 459 | + $o=OmegaWikiAttributes::getInstance(); |
457 | 460 | |
458 | 461 | $dbr =& wfGetDB(DB_SLAVE); |
459 | 462 | |
460 | 463 | $optionAttributeAttribute = new Attribute("option-attribute", "Option attribute", "short-text"); |
461 | | - $recordSet = new ArrayRecordSet(new Structure($idAttribute, $optionAttributeAttribute), new Structure($idAttribute)); |
| 464 | + $recordSet = new ArrayRecordSet(new Structure($o->id, $optionAttributeAttribute), new Structure($o->id)); |
462 | 465 | |
463 | 466 | while ($row = $dbr->fetchObject($queryResult)) |
464 | 467 | $recordSet->addRecord(array($row->attribute_mid, $row->spelling)); |
— | — | @@ -469,9 +472,9 @@ |
470 | 473 | } |
471 | 474 | |
472 | 475 | function getDefinedMeaningAsRecordSet($queryResult) { |
473 | | - global |
474 | | - $idAttribute; |
475 | 476 | |
| 477 | + $o=OmegaWikiAttributes::getInstance(); |
| 478 | + |
476 | 479 | $dbr =& wfGetDB(DB_SLAVE); |
477 | 480 | $spellingAttribute = new Attribute("spelling", "Spelling", "short-text"); |
478 | 481 | $languageAttribute = new Attribute("language", "Language", "language"); |
— | — | @@ -480,7 +483,7 @@ |
481 | 484 | $definedMeaningAttribute = new Attribute(null, "Defined meaning", $expressionStructure); |
482 | 485 | $definitionAttribute = new Attribute("definition", "Definition", "definition"); |
483 | 486 | |
484 | | - $recordSet = new ArrayRecordSet(new Structure($idAttribute, $definedMeaningAttribute, $definitionAttribute), new Structure($idAttribute)); |
| 487 | + $recordSet = new ArrayRecordSet(new Structure($o->id, $definedMeaningAttribute, $definitionAttribute), new Structure($o->id)); |
485 | 488 | |
486 | 489 | while ($row = $dbr->fetchObject($queryResult)) { |
487 | 490 | $definedMeaningRecord = new ArrayRecord($expressionStructure); |
— | — | @@ -502,13 +505,13 @@ |
503 | 506 | } |
504 | 507 | |
505 | 508 | function getClassAttributeLevelAsRecordSet($queryResult) { |
506 | | - global |
507 | | - $idAttribute; |
| 509 | + |
| 510 | + $o=OmegaWikiAttributes::getInstance(); |
508 | 511 | |
509 | 512 | $dbr =& wfGetDB(DB_SLAVE); |
510 | 513 | |
511 | 514 | $classAttributeLevelAttribute = new Attribute("class-attribute-level", "Level", "short-text"); |
512 | | - $recordSet = new ArrayRecordSet(new Structure($idAttribute, $classAttributeLevelAttribute), new Structure($idAttribute)); |
| 515 | + $recordSet = new ArrayRecordSet(new Structure($o->id, $classAttributeLevelAttribute), new Structure($o->id)); |
513 | 516 | |
514 | 517 | while ($row = $dbr->fetchObject($queryResult)) |
515 | 518 | $recordSet->addRecord(array($row->defined_meaning_id, $row->spelling)); |
— | — | @@ -520,13 +523,13 @@ |
521 | 524 | } |
522 | 525 | |
523 | 526 | function getCollectionAsRecordSet($queryResult) { |
524 | | - global |
525 | | - $idAttribute; |
526 | 527 | |
| 528 | + $o=OmegaWikiAttributes::getInstance(); |
| 529 | + |
527 | 530 | $dbr =& wfGetDB(DB_SLAVE); |
528 | 531 | $collectionAttribute = new Attribute("collection", "Collection", "short-text"); |
529 | 532 | |
530 | | - $recordSet = new ArrayRecordSet(new Structure($idAttribute, $collectionAttribute), new Structure($idAttribute)); |
| 533 | + $recordSet = new ArrayRecordSet(new Structure($o->id, $collectionAttribute), new Structure($o->id)); |
531 | 534 | |
532 | 535 | while ($row = $dbr->fetchObject($queryResult)) |
533 | 536 | $recordSet->addRecord(array($row->collection_id, $row->spelling)); |
— | — | @@ -538,13 +541,13 @@ |
539 | 542 | } |
540 | 543 | |
541 | 544 | function getLanguageAsRecordSet($queryResult) { |
542 | | - global |
543 | | - $idAttribute; |
544 | 545 | |
| 546 | + $o=OmegaWikiAttributes::getInstance(); |
| 547 | + |
545 | 548 | $dbr =& wfGetDB(DB_SLAVE); |
546 | 549 | $languageAttribute = new Attribute("language", "Language", "short-text"); |
547 | 550 | |
548 | | - $recordSet = new ArrayRecordSet(new Structure($idAttribute, $languageAttribute), new Structure($idAttribute)); |
| 551 | + $recordSet = new ArrayRecordSet(new Structure($o->id, $languageAttribute), new Structure($o->id)); |
549 | 552 | |
550 | 553 | while ($row = $dbr->fetchObject($queryResult)) { |
551 | 554 | $recordSet->addRecord(array($row->row_id, $row->language_name)); |
— | — | @@ -556,8 +559,8 @@ |
557 | 560 | } |
558 | 561 | |
559 | 562 | function getTransactionAsRecordSet($queryResult) { |
560 | | - global |
561 | | - $idAttribute; |
| 563 | + |
| 564 | + $o=OmegaWikiAttributes::getInstance(); |
562 | 565 | |
563 | 566 | $dbr =& wfGetDB(DB_SLAVE); |
564 | 567 | |
— | — | @@ -565,14 +568,14 @@ |
566 | 569 | $timestampAttribute = new Attribute("timestamp", "Time", "timestamp"); |
567 | 570 | $summaryAttribute = new Attribute("summary", "Summary", "short-text"); |
568 | 571 | |
569 | | - $recordSet = new ArrayRecordSet(new Structure($idAttribute, $userAttribute, $timestampAttribute, $summaryAttribute), new Structure($idAttribute)); |
| 572 | + $recordSet = new ArrayRecordSet(new Structure($o->id, $userAttribute, $timestampAttribute, $summaryAttribute), new Structure($o->id)); |
570 | 573 | |
571 | 574 | while ($row = $dbr->fetchObject($queryResult)) |
572 | 575 | $recordSet->addRecord(array($row->transaction_id, getUserLabel($row->user_id, $row->user_ip), $row->time, $row->comment)); |
573 | 576 | |
574 | 577 | $editor = createSuggestionsTableViewer(null); |
575 | 578 | $editor->addEditor(createShortTextViewer($timestampAttribute)); |
576 | | - $editor->addEditor(createShortTextViewer($idAttribute)); |
| 579 | + $editor->addEditor(createShortTextViewer($o->id)); |
577 | 580 | $editor->addEditor(createShortTextViewer($userAttribute)); |
578 | 581 | $editor->addEditor(createShortTextViewer($summaryAttribute)); |
579 | 582 | |
Index: trunk/extensions/Wikidata/OmegaWiki/Controller.php |
— | — | @@ -42,9 +42,9 @@ |
43 | 43 | |
44 | 44 | class DefinedMeaningDefinitionController implements UpdateController { |
45 | 45 | public function add($keyPath, $record) { |
46 | | - global |
47 | | - $definedMeaningIdAttribute; |
48 | | - $definedMeaningId = $keyPath->peek(0)->getAttributeValue($definedMeaningIdAttribute); |
| 46 | + |
| 47 | + $o=OmegaWikiAttributes::getInstance(); |
| 48 | + $definedMeaningId = $keyPath->peek(0)->definedMeaningId; |
49 | 49 | $languageId = $record->language; |
50 | 50 | $text = $record->text; |
51 | 51 | |
— | — | @@ -53,19 +53,19 @@ |
54 | 54 | } |
55 | 55 | |
56 | 56 | public function remove($keyPath) { |
57 | | - global |
58 | | - $definedMeaningIdAttribute; |
59 | 57 | |
60 | | - $definedMeaningId = $keyPath->peek(1)->getAttributeValue($definedMeaningIdAttribute); |
| 58 | + $o=OmegaWikiAttributes::getInstance(); |
| 59 | + |
| 60 | + $definedMeaningId = $keyPath->peek(1)->definedMeaningId; |
61 | 61 | $languageId = $keyPath->peek(0)->language; |
62 | 62 | removeDefinedMeaningDefinition($definedMeaningId, $languageId); |
63 | 63 | } |
64 | 64 | |
65 | 65 | public function update($keyPath, $record) { |
66 | | - global |
67 | | - $definedMeaningIdAttribute; |
68 | 66 | |
69 | | - $definedMeaningId = $keyPath->peek(1)->getAttributeValue($definedMeaningIdAttribute); |
| 67 | + $o=OmegaWikiAttributes::getInstance(); |
| 68 | + |
| 69 | + $definedMeaningId = $keyPath->peek(1)->definedMeaningId; |
70 | 70 | $languageId = $keyPath->peek(0)->language; |
71 | 71 | $text = $record->text; |
72 | 72 | |
— | — | @@ -82,10 +82,10 @@ |
83 | 83 | } |
84 | 84 | |
85 | 85 | public function update($keyPath, $value) { |
86 | | - global |
87 | | - $definedMeaningIdAttribute; |
88 | 86 | |
89 | | - $definedMeaningId = $keyPath->peek(0)->getAttributeValue($definedMeaningIdAttribute); |
| 87 | + $o=OmegaWikiAttributes::getInstance(); |
| 88 | + |
| 89 | + $definedMeaningId = $keyPath->peek(0)->definedMeaningId; |
90 | 90 | |
91 | 91 | if ($value != "") |
92 | 92 | updateOrAddDefinedMeaningDefinition($definedMeaningId, $this->filterLanguageId, $value); |
— | — | @@ -100,14 +100,13 @@ |
101 | 101 | } |
102 | 102 | |
103 | 103 | public function add($keyPath, $record) { |
104 | | - global |
105 | | - $definedMeaningIdAttribute, $alternativeDefinitionAttribute, |
106 | | - $sourceAttribute; |
107 | 104 | |
108 | | - $definedMeaningId = $keyPath->peek(0)->getAttributeValue($definedMeaningIdAttribute); |
109 | | - $alternativeDefinition = $record->getAttributeValue($alternativeDefinitionAttribute); |
110 | | - $sourceId = $record->getAttributeValue($sourceAttribute); |
| 105 | + $o=OmegaWikiAttributes::getInstance(); |
111 | 106 | |
| 107 | + $definedMeaningId = $keyPath->peek(0)->definedMeaningId; |
| 108 | + $alternativeDefinition = $record->alternativeDefinition; |
| 109 | + $sourceId = $record->source; |
| 110 | + |
112 | 111 | if ($this->filterLanguageId == 0) { |
113 | 112 | if ($alternativeDefinition->getRecordCount() > 0) { |
114 | 113 | $definitionRecord = $alternativeDefinition->getRecord(0); |
— | — | @@ -124,11 +123,11 @@ |
125 | 124 | } |
126 | 125 | |
127 | 126 | public function remove($keyPath) { |
128 | | - global |
129 | | - $definedMeaningIdAttribute, $definitionIdAttribute; |
130 | 127 | |
131 | | - $definedMeaningId = $keyPath->peek(1)->getAttributeValue($definedMeaningIdAttribute); |
132 | | - $definitionId = $keyPath->peek(0)->getAttributeValue($definitionIdAttribute); |
| 128 | + $o=OmegaWikiAttributes::getInstance(); |
| 129 | + |
| 130 | + $definedMeaningId = $keyPath->peek(1)->definedMeaningId; |
| 131 | + $definitionId = $keyPath->peek(0)->definitionId; |
133 | 132 | removeDefinedMeaningAlternativeDefinition($definedMeaningId, $definitionId); |
134 | 133 | } |
135 | 134 | |
— | — | @@ -138,10 +137,10 @@ |
139 | 138 | |
140 | 139 | class DefinedMeaningAlternativeDefinitionController implements UpdateController { |
141 | 140 | public function add($keyPath, $record) { |
142 | | - global |
143 | | - $expressionIdAttribute, $definitionIdAttribute ; |
144 | 141 | |
145 | | - $definitionId = $keyPath->peek(0)->getAttributeValue($definitionIdAttribute); |
| 142 | + $o=OmegaWikiAttributes::getInstance(); |
| 143 | + |
| 144 | + $definitionId = $keyPath->peek(0)->definitionId; |
146 | 145 | $languageId = $record->language; |
147 | 146 | $text = $record->text; |
148 | 147 | |
— | — | @@ -150,20 +149,20 @@ |
151 | 150 | } |
152 | 151 | |
153 | 152 | public function remove($keyPath) { |
154 | | - global |
155 | | - $definitionIdAttribute; |
156 | 153 | |
157 | | - $definitionId = $keyPath->peek(1)->getAttributeValue($definitionIdAttribute); |
| 154 | + $o=OmegaWikiAttributes::getInstance(); |
| 155 | + |
| 156 | + $definitionId = $keyPath->peek(1)->definitionId; |
158 | 157 | $languageId = $keyPath->peek(0)->language; |
159 | 158 | |
160 | 159 | removeTranslatedText($definitionId, $languageId); |
161 | 160 | } |
162 | 161 | |
163 | 162 | public function update($keyPath, $record) { |
164 | | - global |
165 | | - $definitionIdAttribute; |
166 | 163 | |
167 | | - $definitionId = $keyPath->peek(1)->getAttributeValue($definitionIdAttribute); |
| 164 | + $o=OmegaWikiAttributes::getInstance(); |
| 165 | + |
| 166 | + $definitionId = $keyPath->peek(1)->definitionId; |
168 | 167 | $languageId = $keyPath->peek(0)->language; |
169 | 168 | $text = $record->text; |
170 | 169 | |
— | — | @@ -180,11 +179,11 @@ |
181 | 180 | } |
182 | 181 | |
183 | 182 | public function update($keyPath, $value) { |
184 | | - global |
185 | | - $definitionIdAttribute; |
186 | 183 | |
187 | | - $definitionId = $keyPath->peek(0)->getAttributeValue($definitionIdAttribute); |
| 184 | + $o=OmegaWikiAttributes::getInstance(); |
188 | 185 | |
| 186 | + $definitionId = $keyPath->peek(0)->definitionId; |
| 187 | + |
189 | 188 | if ($value != "") |
190 | 189 | updateTranslatedText($definitionId, $this->filterLanguageId, $value); |
191 | 190 | } |
— | — | @@ -198,22 +197,22 @@ |
199 | 198 | } |
200 | 199 | |
201 | 200 | public function add($keyPath, $record) { |
202 | | - global |
203 | | - $definedMeaningIdAttribute, $expressionAttribute, $spellingAttribute, $identicalMeaningAttribute; |
204 | 201 | |
205 | | - $definedMeaningId = $keyPath->peek(0)->getAttributeValue($definedMeaningIdAttribute); |
206 | | - $expressionValue = $record->getAttributeValue($expressionAttribute); |
| 202 | + $o=OmegaWikiAttributes::getInstance(); |
| 203 | + |
| 204 | + $definedMeaningId = $keyPath->peek(0)->definedMeaningId; |
| 205 | + $expressionValue = $record->expression; |
207 | 206 | |
208 | 207 | if ($this->filterLanguageId == 0) { |
209 | 208 | $languageId = $expressionValue->language; |
210 | | - $spelling = $expressionValue->getAttributeValue($spellingAttribute); |
| 209 | + $spelling = $expressionValue->spelling; |
211 | 210 | } |
212 | 211 | else { |
213 | 212 | $languageId = $this->filterLanguageId; |
214 | 213 | $spelling = $expressionValue; |
215 | 214 | } |
216 | 215 | |
217 | | - $identicalMeaning = $record->getAttributeValue($identicalMeaningAttribute); |
| 216 | + $identicalMeaning = $record->identicalMeaning; |
218 | 217 | |
219 | 218 | if ($languageId != 0 && $spelling != '') { |
220 | 219 | $expression = findOrCreateExpression($spelling, $languageId); |
— | — | @@ -222,44 +221,44 @@ |
223 | 222 | } |
224 | 223 | |
225 | 224 | public function remove($keyPath) { |
226 | | - global |
227 | | - $definedMeaningIdAttribute, $syntransIdAttribute; |
228 | 225 | |
229 | | - $definedMeaningId = $keyPath->peek(1)->getAttributeValue($definedMeaningIdAttribute); |
230 | | - $syntransId = $keyPath->peek(0)->getAttributeValue($syntransIdAttribute); |
| 226 | + $o=OmegaWikiAttributes::getInstance(); |
| 227 | + |
| 228 | + $definedMeaningId = $keyPath->peek(1)->definedMeaningId; |
| 229 | + $syntransId = $keyPath->peek(0)->syntransId; |
231 | 230 | removeSynonymOrTranslationWithId($syntransId); |
232 | 231 | } |
233 | 232 | |
234 | 233 | public function update($keyPath, $record) { |
235 | | - global |
236 | | - $definedMeaningIdAttribute, $syntransIdAttribute, $identicalMeaningAttribute; |
237 | 234 | |
238 | | - $definedMeaningId = $keyPath->peek(1)->getAttributeValue($definedMeaningIdAttribute); |
239 | | - $syntransId = $keyPath->peek(0)->getAttributeValue($syntransIdAttribute); |
240 | | - $identicalMeaning = $record->getAttributeValue($identicalMeaningAttribute); |
| 235 | + $o=OmegaWikiAttributes::getInstance(); |
| 236 | + |
| 237 | + $definedMeaningId = $keyPath->peek(1)->definedMeaningId; |
| 238 | + $syntransId = $keyPath->peek(0)->syntransId; |
| 239 | + $identicalMeaning = $record->identicalMeaning; |
241 | 240 | updateSynonymOrTranslationWithId($syntransId, $identicalMeaning); |
242 | 241 | } |
243 | 242 | } |
244 | 243 | |
245 | 244 | class ClassAttributesController implements UpdateController { |
246 | 245 | public function add($keyPath, $record) { |
247 | | - global |
248 | | - $definedMeaningIdAttribute, $classAttributeLevelAttribute, $classAttributeAttributeAttribute, $classAttributeTypeAttribute; |
249 | 246 | |
250 | | - $definedMeaningId = $keyPath->peek(0)->getAttributeValue($definedMeaningIdAttribute); |
251 | | - $attributeLevelId = $record->getAttributeValue($classAttributeLevelAttribute); |
252 | | - $attributeMeaningId = $record->getAttributeValue($classAttributeAttributeAttribute); |
253 | | - $attributeType = $record->getAttributeValue($classAttributeTypeAttribute); |
| 247 | + $o=OmegaWikiAttributes::getInstance(); |
254 | 248 | |
| 249 | + $definedMeaningId = $keyPath->peek(0)->definedMeaningId; |
| 250 | + $attributeLevelId = $record->classAttributeLevel; |
| 251 | + $attributeMeaningId = $record->classAttributeAttribute; |
| 252 | + $attributeType = $record->classAttributeType; |
| 253 | + |
255 | 254 | if (($attributeLevelId != 0) && ($attributeMeaningId != 0)) |
256 | 255 | addClassAttribute($definedMeaningId, $attributeLevelId, $attributeMeaningId, $attributeType); |
257 | 256 | } |
258 | 257 | |
259 | 258 | public function remove($keyPath) { |
260 | | - global |
261 | | - $classAttributeIdAttribute; |
| 259 | + |
| 260 | + $o=OmegaWikiAttributes::getInstance(); |
262 | 261 | |
263 | | - $classAttributeId = $keyPath->peek(0)->getAttributeValue($classAttributeIdAttribute); |
| 262 | + $classAttributeId = $keyPath->peek(0)->classAttributeId; |
264 | 263 | removeClassAttributeWithId($classAttributeId); |
265 | 264 | } |
266 | 265 | |
— | — | @@ -269,22 +268,22 @@ |
270 | 269 | |
271 | 270 | class DefinedMeaningRelationController implements UpdateController { |
272 | 271 | public function add($keyPath, $record) { |
273 | | - global |
274 | | - $definedMeaningIdAttribute, $relationTypeAttribute, $otherDefinedMeaningAttribute; |
275 | 272 | |
276 | | - $definedMeaningId = $keyPath->peek(0)->getAttributeValue($definedMeaningIdAttribute); |
277 | | - $relationTypeId = $record->getAttributeValue($relationTypeAttribute); |
278 | | - $otherDefinedMeaningId = $record->getAttributeValue($otherDefinedMeaningAttribute); |
| 273 | + $o=OmegaWikiAttributes::getInstance(); |
279 | 274 | |
| 275 | + $definedMeaningId = $keyPath->peek(0)->definedMeaningId; |
| 276 | + $relationTypeId = $record->relationType; |
| 277 | + $otherDefinedMeaningId = $record->otherDefinedMeaning; |
| 278 | + |
280 | 279 | if ($relationTypeId != 0 && $otherDefinedMeaningId != 0) |
281 | 280 | addRelation($definedMeaningId, $relationTypeId, $otherDefinedMeaningId); |
282 | 281 | } |
283 | 282 | |
284 | 283 | public function remove($keyPath) { |
285 | | - global |
286 | | - $relationIdAttribute; |
| 284 | + |
| 285 | + $o=OmegaWikiAttributes::getInstance(); |
287 | 286 | |
288 | | - $relationId = $keyPath->peek(0)->getAttributeValue($relationIdAttribute); |
| 287 | + $relationId = $keyPath->peek(0)->relationId; |
289 | 288 | removeRelationWithId($relationId); |
290 | 289 | } |
291 | 290 | |
— | — | @@ -304,10 +303,10 @@ |
305 | 304 | } |
306 | 305 | |
307 | 306 | public function add($keyPath, $record) { |
308 | | - global |
309 | | - $definedMeaningIdAttribute; |
310 | 307 | |
311 | | - $definedMeaningId = $keyPath->peek(0)->getAttributeValue($definedMeaningIdAttribute); |
| 308 | + $o=OmegaWikiAttributes::getInstance(); |
| 309 | + |
| 310 | + $definedMeaningId = $keyPath->peek(0)->definedMeaningId; |
312 | 311 | $otherDefinedMeaningId = $record->getAttributeValue($this->otherDefinedMeaningAttribute); |
313 | 312 | |
314 | 313 | if ($otherDefinedMeaningId != 0) |
— | — | @@ -325,12 +324,12 @@ |
326 | 325 | |
327 | 326 | class DefinedMeaningClassMembershipController implements UpdateController { |
328 | 327 | public function add($keyPath, $record) { |
329 | | - global |
330 | | - $definedMeaningIdAttribute, $classAttribute; |
331 | 328 | |
332 | | - $definedMeaningId = $keyPath->peek(0)->getAttributeValue($definedMeaningIdAttribute); |
333 | | - $classId = $record->getAttributeValue($classAttribute); |
| 329 | + $o=OmegaWikiAttributes::getInstance(); |
334 | 330 | |
| 331 | + $definedMeaningId = $keyPath->peek(0)->definedMeaningId; |
| 332 | + $classId = $record->class; |
| 333 | + |
335 | 334 | if ($classId != 0) |
336 | 335 | addClassMembership($definedMeaningId, $classId); |
337 | 336 | } |
— | — | @@ -343,10 +342,10 @@ |
344 | 343 | // $classId = $keyPath->peek(0)->getAttributeValue($classAttribute); |
345 | 344 | // |
346 | 345 | // removeClassMembership($definedMeaningId, $classId); |
347 | | - global |
348 | | - $classMembershipIdAttribute; |
| 346 | + |
| 347 | + $o=OmegaWikiAttributes::getInstance(); |
349 | 348 | |
350 | | - removeClassMembershipWithId($keyPath->peek(0)->getAttributeValue($classMembershipIdAttribute)); |
| 349 | + removeClassMembershipWithId($keyPath->peek(0)->classMembershipId); |
351 | 350 | } |
352 | 351 | |
353 | 352 | public function update($keyPath, $record) { |
— | — | @@ -355,35 +354,35 @@ |
356 | 355 | |
357 | 356 | class DefinedMeaningCollectionController implements UpdateController { |
358 | 357 | public function add($keyPath, $record) { |
359 | | - global |
360 | | - $expressionIdAttribute, $definedMeaningIdAttribute, $collectionMeaningAttribute, $sourceIdentifierAttribute; |
361 | 358 | |
362 | | - $definedMeaningId = $keyPath->peek(0)->getAttributeValue($definedMeaningIdAttribute); |
363 | | - $collectionMeaningId = $record->getAttributeValue($collectionMeaningAttribute); |
364 | | - $internalId = $record->getAttributeValue($sourceIdentifierAttribute); |
| 359 | + $o=OmegaWikiAttributes::getInstance(); |
| 360 | + |
| 361 | + $definedMeaningId = $keyPath->peek(0)->definedMeaningId; |
| 362 | + $collectionMeaningId = $record->collectionMeaning; |
| 363 | + $internalId = $record->sourceIdentifier; |
365 | 364 | |
366 | 365 | if ($collectionMeaningId != 0) |
367 | 366 | addDefinedMeaningToCollectionIfNotPresent($definedMeaningId, $collectionMeaningId, $internalId); |
368 | 367 | } |
369 | 368 | |
370 | 369 | public function remove($keyPath) { |
371 | | - global |
372 | | - $definedMeaningIdAttribute, $collectionIdAttribute; |
373 | 370 | |
374 | | - $definedMeaningId = $keyPath->peek(1)->getAttributeValue($definedMeaningIdAttribute); |
375 | | - $collectionId = $keyPath->peek(0)->getAttributeValue($collectionIdAttribute); |
| 371 | + $o=OmegaWikiAttributes::getInstance(); |
376 | 372 | |
| 373 | + $definedMeaningId = $keyPath->peek(1)->definedMeaningId; |
| 374 | + $collectionId = $keyPath->peek(0)->collectionId; |
| 375 | + |
377 | 376 | removeDefinedMeaningFromCollection($definedMeaningId, $collectionId); |
378 | 377 | } |
379 | 378 | |
380 | 379 | public function update($keyPath, $record) { |
381 | | - global |
382 | | - $definedMeaningIdAttribute, $collectionIdAttribute, $sourceIdentifierAttribute; |
383 | 380 | |
384 | | - $definedMeaningId = $keyPath->peek(1)->getAttributeValue($definedMeaningIdAttribute); |
385 | | - $collectionId = $keyPath->peek(0)->getAttributeValue($collectionIdAttribute); |
386 | | - $sourceId = $record->getAttributeValue($sourceIdentifierAttribute); |
| 381 | + $o=OmegaWikiAttributes::getInstance(); |
387 | 382 | |
| 383 | + $definedMeaningId = $keyPath->peek(1)->definedMeaningId; |
| 384 | + $collectionId = $keyPath->peek(0)->collectionId; |
| 385 | + $sourceId = $record->sourceIdentifier; |
| 386 | + |
388 | 387 | // if ($sourceId != "") |
389 | 388 | updateDefinedMeaningInCollection($definedMeaningId, $collectionId, $sourceId); |
390 | 389 | } |
— | — | @@ -397,13 +396,13 @@ |
398 | 397 | } |
399 | 398 | |
400 | 399 | public function add($keyPath, $record) { |
401 | | - global |
402 | | - $expressionIdAttribute, $definedMeaningAttribute, $definitionAttribute, $translatedTextAttribute; |
403 | 400 | |
404 | | - $definition = $record->getAttributeValue($definedMeaningAttribute)->getAttributeValue($definitionAttribute); |
405 | | - $translatedContent = $definition->getAttributeValue($translatedTextAttribute); |
406 | | - $expressionId = $keyPath->peek(0)->getAttributeValue($expressionIdAttribute); |
| 401 | + $o=OmegaWikiAttributes::getInstance(); |
407 | 402 | |
| 403 | + $definition = $record->definedMeaning->definition; |
| 404 | + $translatedContent = $definition->translatedText; |
| 405 | + $expressionId = $keyPath->peek(0)->expressionId; |
| 406 | + |
408 | 407 | if ($this->filterLanguageId == 0) { |
409 | 408 | if ($translatedContent->getRecordCount() > 0) { |
410 | 409 | $definitionRecord = $translatedContent->getRecord(0); |
— | — | @@ -436,23 +435,21 @@ |
437 | 436 | } |
438 | 437 | |
439 | 438 | public function add($keyPath, $record) { |
440 | | - global |
441 | | - $expressionAttribute, $expressionMeaningsAttribute, $expressionExactMeaningsAttribute, |
442 | | - $definedMeaningAttribute, $definitionAttribute, |
443 | | - $translatedTextAttribute; |
444 | 439 | |
| 440 | + $o=OmegaWikiAttributes::getInstance(); |
| 441 | + |
445 | 442 | if ($this->filterLanguageId == 0) |
446 | | - $expressionLanguageId = $record->getAttributeValue($expressionAttribute)->language; |
| 443 | + $expressionLanguageId = $record->expression->language; |
447 | 444 | else |
448 | 445 | $expressionLanguageId = $this->filterLanguageId; |
449 | 446 | |
450 | | - $expressionMeanings = $record->getAttributeValue($expressionMeaningsAttribute)->getAttributeValue($expressionExactMeaningsAttribute); |
| 447 | + $expressionMeanings = $record->expressionMeanings->expressionExactMeanings; |
451 | 448 | |
452 | 449 | if ($expressionLanguageId != 0 && $expressionMeanings->getRecordCount() > 0) { |
453 | 450 | $expressionMeaning = $expressionMeanings->getRecord(0); |
454 | 451 | |
455 | | - $definition = $expressionMeaning->getAttributeValue($definedMeaningAttribute)->getAttributeValue($definitionAttribute); |
456 | | - $translatedContent = $definition->getAttributeValue($translatedTextAttribute); |
| 452 | + $definition = $expressionMeaning->definedMeaning->definition; |
| 453 | + $translatedContent = $definition->translatedText; |
457 | 454 | |
458 | 455 | if ($this->filterLanguageId == 0) { |
459 | 456 | if ($translatedContent->getRecordCount() > 0) { |
— | — | @@ -491,27 +488,27 @@ |
492 | 489 | |
493 | 490 | class TextAttributeValuesController extends ObjectAttributeValuesController { |
494 | 491 | public function add($keyPath, $record) { |
495 | | - global |
496 | | - $textAttributeAttribute; |
| 492 | + |
| 493 | + $o=OmegaWikiAttributes::getInstance(); |
497 | 494 | $objectId = $this->objectIdFetcher->fetch($keyPath); |
498 | | - $textAttributeId = $record->getAttributeValue($textAttributeAttribute); |
| 495 | + $textAttributeId = $record->textAttribute; |
499 | 496 | $text = $record->text; |
500 | 497 | if ($textAttributeId != 0 && $text != '') |
501 | 498 | addTextAttributeValue($objectId, $textAttributeId, $text); |
502 | 499 | } |
503 | 500 | |
504 | 501 | public function remove($keyPath) { |
505 | | - global |
506 | | - $textAttributeIdAttribute; |
507 | | - $textId = $keyPath->peek(0)->getAttributeValue($textAttributeIdAttribute); |
| 502 | + |
| 503 | + $o=OmegaWikiAttributes::getInstance(); |
| 504 | + $textId = $keyPath->peek(0)->textAttributeId; |
508 | 505 | removeTextAttributeValue($textId); |
509 | 506 | } |
510 | 507 | |
511 | 508 | public function update($keyPath, $record) { |
512 | | - global |
513 | | - $textAttributeIdAttribute, $textAttribute; |
| 509 | + |
| 510 | + $o=OmegaWikiAttributes::getInstance(); |
514 | 511 | |
515 | | - $textId = $keyPath->peek(0)->getAttributeValue($textAttributeIdAttribute); |
| 512 | + $textId = $keyPath->peek(0)->textAttributeId; |
516 | 513 | $text = $record->text; |
517 | 514 | |
518 | 515 | updateTextAttributeValue($text, $textId); |
— | — | @@ -527,35 +524,35 @@ |
528 | 525 | } |
529 | 526 | |
530 | 527 | public function add($keyPath, $record) { |
531 | | - global |
532 | | - $linkAttribute, $linkAttributeAttribute, $linkLabelAttribute, $linkURLAttribute; |
| 528 | + |
| 529 | + $o=OmegaWikiAttributes::getInstance(); |
533 | 530 | |
534 | 531 | $objectId = $this->objectIdFetcher->fetch($keyPath); |
535 | | - $linkAttributeId = $record->getAttributeValue($linkAttributeAttribute); |
536 | | - $linkValue = $record->getAttributeValue($linkAttribute); |
537 | | - $label = $linkValue->getAttributeValue($linkLabelAttribute); |
538 | | - $url = $linkValue->getAttributeValue($linkURLAttribute); |
| 532 | + $linkAttributeId = $record->linkAttribute; |
| 533 | + $linkValue = $record->link; |
| 534 | + $label = $linkValue->linkLabel; |
| 535 | + $url = $linkValue->linkURL; |
539 | 536 | |
540 | 537 | if ($linkAttributeId != 0 && $url != "") |
541 | 538 | addLinkAttributeValue($objectId, $linkAttributeId, $this->validateURL($url), $label); |
542 | 539 | } |
543 | 540 | |
544 | 541 | public function remove($keyPath) { |
545 | | - global |
546 | | - $linkAttributeIdAttribute; |
| 542 | + |
| 543 | + $o=OmegaWikiAttributes::getInstance(); |
547 | 544 | |
548 | | - $linkId = $keyPath->peek(0)->getAttributeValue($linkAttributeIdAttribute); |
| 545 | + $linkId = $keyPath->peek(0)->linkAttributeId; |
549 | 546 | removeLinkAttributeValue($linkId); |
550 | 547 | } |
551 | 548 | |
552 | 549 | public function update($keyPath, $record) { |
553 | | - global |
554 | | - $linkAttributeIdAttribute, $linkAttribute, $linkLabelAttribute, $linkURLAttribute; |
| 550 | + |
| 551 | + $o=OmegaWikiAttributes::getInstance(); |
555 | 552 | |
556 | | - $linkId = $keyPath->peek(0)->getAttributeValue($linkAttributeIdAttribute); |
557 | | - $linkValue = $record->getAttributeValue($linkAttribute); |
558 | | - $label = $linkValue->getAttributeValue($linkLabelAttribute); |
559 | | - $url = $linkValue->getAttributeValue($linkURLAttribute); |
| 553 | + $linkId = $keyPath->peek(0)->linkAttributeId; |
| 554 | + $linkValue = $record->link; |
| 555 | + $label = $linkValue->linkLabel; |
| 556 | + $url = $linkValue->linkURL; |
560 | 557 | |
561 | 558 | if ($url != "") { |
562 | 559 | updateLinkAttributeValue($linkId, $this->validateURL($url), $label); |
— | — | @@ -573,13 +570,12 @@ |
574 | 571 | } |
575 | 572 | |
576 | 573 | public function add($keyPath, $record) { |
577 | | - global |
578 | | - $translatedTextValueAttribute, |
579 | | - $translatedTextAttributeAttribute; |
580 | 574 | |
| 575 | + $o=OmegaWikiAttributes::getInstance(); |
| 576 | + |
581 | 577 | $objectId = $this->objectIdFetcher->fetch($keyPath); |
582 | | - $textValue = $record->getAttributeValue($translatedTextValueAttribute); |
583 | | - $textAttributeId = $record->getAttributeValue($translatedTextAttributeAttribute); |
| 578 | + $textValue = $record->translatedTextValue; |
| 579 | + $textAttributeId = $record->translatedTextAttribute; |
584 | 580 | |
585 | 581 | if ($textAttributeId != 0) { |
586 | 582 | if ($this->filterLanguageId == 0) { |
— | — | @@ -599,10 +595,10 @@ |
600 | 596 | } |
601 | 597 | |
602 | 598 | public function remove($keyPath) { |
603 | | - global |
604 | | - $translatedTextAttributeIdAttribute; |
605 | 599 | |
606 | | - $valueId = $keyPath->peek(0)->getAttributeValue($translatedTextAttributeIdAttribute); |
| 600 | + $o=OmegaWikiAttributes::getInstance(); |
| 601 | + |
| 602 | + $valueId = $keyPath->peek(0)->translatedTextAttributeId; |
607 | 603 | removeTranslatedTextAttributeValue($valueId); |
608 | 604 | } |
609 | 605 | |
— | — | @@ -612,10 +608,10 @@ |
613 | 609 | |
614 | 610 | class TranslatedTextAttributeValueController implements UpdateController { |
615 | 611 | public function add($keyPath, $record) { |
616 | | - global |
617 | | - $translatedTextAttributeIdAttribute; |
618 | 612 | |
619 | | - $valueId = $keyPath->peek(0)->getAttributeValue($translatedTextAttributeIdAttribute); |
| 613 | + $o=OmegaWikiAttributes::getInstance(); |
| 614 | + |
| 615 | + $valueId = $keyPath->peek(0)->translatedTextAttributeId; |
620 | 616 | $languageId = $record->language; |
621 | 617 | $text = $record->text; |
622 | 618 | $translatedTextAttribute = getTranslatedTextAttribute($valueId); |
— | — | @@ -625,10 +621,10 @@ |
626 | 622 | } |
627 | 623 | |
628 | 624 | public function remove($keyPath) { |
629 | | - global |
630 | | - $translatedTextAttributeIdAttribute; |
631 | 625 | |
632 | | - $valueId = $keyPath->peek(1)->getAttributeValue($translatedTextAttributeIdAttribute); |
| 626 | + $o=OmegaWikiAttributes::getInstance(); |
| 627 | + |
| 628 | + $valueId = $keyPath->peek(1)->translatedTextAttributeId; |
633 | 629 | $languageId = $keyPath->peek(0)->language; |
634 | 630 | $translatedTextAttribute = getTranslatedTextAttribute($valueId); |
635 | 631 | |
— | — | @@ -636,10 +632,10 @@ |
637 | 633 | } |
638 | 634 | |
639 | 635 | public function update($keyPath, $record) { |
640 | | - global |
641 | | - $translatedTextAttributeIdAttribute; |
642 | 636 | |
643 | | - $valueId = $keyPath->peek(1)->getAttributeValue($translatedTextAttributeIdAttribute); |
| 637 | + $o=OmegaWikiAttributes::getInstance(); |
| 638 | + |
| 639 | + $valueId = $keyPath->peek(1)->translatedTextAttributeId; |
644 | 640 | $languageId = $keyPath->peek(0)->language; |
645 | 641 | $text = $record->text; |
646 | 642 | $translatedTextAttribute = getTranslatedTextAttribute($valueId); |
— | — | @@ -657,10 +653,10 @@ |
658 | 654 | } |
659 | 655 | |
660 | 656 | public function update($keyPath, $value) { |
661 | | - global |
662 | | - $translatedTextAttributeIdAttribute ; |
663 | 657 | |
664 | | - $valueId = $keyPath->peek(0)->getAttributeValue($translatedTextAttributeIdAttribute); |
| 658 | + $o=OmegaWikiAttributes::getInstance(); |
| 659 | + |
| 660 | + $valueId = $keyPath->peek(0)->translatedTextAttributeId; |
665 | 661 | $translatedTextAttribute = getTranslatedTextAttribute($valueId); |
666 | 662 | |
667 | 663 | if ($value != "") |
— | — | @@ -670,21 +666,21 @@ |
671 | 667 | |
672 | 668 | class OptionAttributeValuesController extends ObjectAttributeValuesController { |
673 | 669 | public function add($keyPath, $record) { |
674 | | - global |
675 | | - $optionAttributeOptionAttribute; |
676 | 670 | |
| 671 | + $o=OmegaWikiAttributes::getInstance(); |
| 672 | + |
677 | 673 | $objectId = $this->objectIdFetcher->fetch($keyPath); |
678 | | - $optionId = $record->getAttributeValue($optionAttributeOptionAttribute); |
| 674 | + $optionId = $record->optionAttributeOption; |
679 | 675 | |
680 | 676 | if ($optionId) |
681 | 677 | addOptionAttributeValue($objectId,$optionId); |
682 | 678 | } |
683 | 679 | |
684 | 680 | public function remove($keyPath) { |
685 | | - global |
686 | | - $optionAttributeIdAttribute; |
687 | 681 | |
688 | | - $valueId = $keyPath->peek(0)->getAttributeValue($optionAttributeIdAttribute); |
| 682 | + $o=OmegaWikiAttributes::getInstance(); |
| 683 | + |
| 684 | + $valueId = $keyPath->peek(0)->optionAttributeId; |
689 | 685 | removeOptionAttributeValue($valueId); |
690 | 686 | } |
691 | 687 | |
— | — | @@ -693,11 +689,11 @@ |
694 | 690 | |
695 | 691 | class OptionAttributeOptionsController implements UpdateController { |
696 | 692 | public function add($keyPath, $record) { |
697 | | - global |
698 | | - $classAttributeIdAttribute, $optionAttributeOptionAttribute; |
699 | 693 | |
700 | | - $attributeId = $keyPath->peek(0)->getAttributeValue($classAttributeIdAttribute); |
701 | | - $optionMeaningId = $record->getAttributeValue($optionAttributeOptionAttribute); |
| 694 | + $o=OmegaWikiAttributes::getInstance(); |
| 695 | + |
| 696 | + $attributeId = $keyPath->peek(0)->classAttributeId; |
| 697 | + $optionMeaningId = $record->optionAttributeOption; |
702 | 698 | $languageId = $record->language; |
703 | 699 | |
704 | 700 | if ($optionMeaningId) |
— | — | @@ -705,10 +701,10 @@ |
706 | 702 | } |
707 | 703 | |
708 | 704 | public function remove($keyPath) { |
709 | | - global |
710 | | - $optionAttributeOptionIdAttribute; |
711 | 705 | |
712 | | - $optionId = $keyPath->peek(0)->getAttributeValue($optionAttributeOptionIdAttribute); |
| 706 | + $o=OmegaWikiAttributes::getInstance(); |
| 707 | + |
| 708 | + $optionId = $keyPath->peek(0)->optionAttributeOptionId; |
713 | 709 | removeOptionAttributeOption($optionId); |
714 | 710 | } |
715 | 711 | |
— | — | @@ -730,10 +726,10 @@ |
731 | 727 | } |
732 | 728 | |
733 | 729 | protected function allowAnyChangeOfValue($value) { |
734 | | - global |
735 | | - $sourceAttribute; |
| 730 | + |
| 731 | + $o=OmegaWikiAttributes::getInstance(); |
736 | 732 | |
737 | | - $source = $value->getAttributeValue($sourceAttribute); |
| 733 | + $source = $value->source; |
738 | 734 | |
739 | 735 | return $source == null || $source == 0; |
740 | 736 | } |
Index: trunk/extensions/Wikidata/OmegaWiki/SpecialTransaction.php |
— | — | @@ -127,39 +127,37 @@ |
128 | 128 | } |
129 | 129 | |
130 | 130 | function initializeAttributes() { |
131 | | - global |
132 | | - $operationAttribute, $isLatestAttribute, $definedMeaningIdAttribute, $definedMeaningReferenceAttribute, |
133 | | - $definedMeaningReferenceStructure, $rollBackStructure, $rollBackAttribute; |
134 | 131 | |
135 | 132 | $o=OmegaWikiAttributes::getInstance(); |
136 | 133 | |
137 | | - $operationAttribute = new Attribute('operation', 'Operation', 'text'); |
138 | | - $isLatestAttribute = new Attribute('is-latest', 'Is latest', 'boolean'); |
| 134 | + $o=OmegaWikiAttributes::getInstance(); |
139 | 135 | |
140 | | - $rollBackStructure = new Structure($isLatestAttribute, $operationAttribute); |
141 | | - $rollBackAttribute = new Attribute('roll-back', 'Roll back', $rollBackStructure); |
| 136 | + $o->operation = new Attribute('operation', 'Operation', 'text'); |
| 137 | + $o->isLatest = new Attribute('is-latest', 'Is latest', 'boolean'); |
| 138 | + |
| 139 | + $o->rollBackStructure = new Structure($o->isLatest, $o->operation); |
| 140 | + $o->rollBack = new Attribute('roll-back', 'Roll back', $o->rollBackStructure); |
142 | 141 | |
143 | | - global |
144 | | - $translatedContentHistoryStructure, $translatedContentHistoryKeyStructure, $translatedContentHistoryAttribute, |
145 | | - $recordLifeSpanAttribute, $addTransactionIdAttribute, $translatedContentIdAttribute; |
| 142 | + |
| 143 | + $o=OmegaWikiAttributes::getInstance(); |
146 | 144 | |
147 | | - $addTransactionIdAttribute = new Attribute('add-transaction-id', 'Add transaction ID', 'identifier'); |
| 145 | + $o->addTransactionId = new Attribute('add-transaction-id', 'Add transaction ID', 'identifier'); |
148 | 146 | |
149 | | - $translatedContentHistoryStructure = new Structure($addTransactionIdAttribute, $o->text, $recordLifeSpanAttribute); |
150 | | - $translatedContentHistoryKeyStructure = new Structure($addTransactionIdAttribute); |
151 | | - $translatedContentHistoryAttribute = new Attribute('translated-content-history', 'History', $translatedContentHistoryStructure); |
152 | | - $translatedContentIdAttribute = new Attribute('translated-content-id', 'Translated content ID', 'object-id'); |
| 147 | + $o->translatedContentHistoryStructure = new Structure($o->addTransactionId, $o->text, $o->recordLifeSpan); |
| 148 | + $o->translatedContentHistoryKeyStructure = new Structure($o->addTransactionId); |
| 149 | + $o->translatedContentHistory = new Attribute('translated-content-history', 'History', $o->translatedContentHistoryStructure); |
| 150 | + $o->translatedContentId = new Attribute('translated-content-id', 'Translated content ID', 'object-id'); |
153 | 151 | |
154 | | - global |
155 | | - $rollBackTranslatedContentStructure, $rollBackTranslatedContentAttribute; |
156 | 152 | |
157 | | - $rollBackTranslatedContentStructure = new Structure($isLatestAttribute, $operationAttribute, $translatedContentHistoryAttribute); |
158 | | - $rollBackTranslatedContentAttribute = new Attribute('roll-back', 'Roll back', $rollBackTranslatedContentStructure); |
| 153 | + $o=OmegaWikiAttributes::getInstance(); |
159 | 154 | |
160 | | - global |
161 | | - $updatedDefinitionStructure, $updatedDefinitionAttribute; |
| 155 | + $o->rollBackTranslatedContentStructure = new Structure($isLatestAttribute, $operationAttribute, $translatedContentHistoryAttribute); |
| 156 | + $o->rollBackTranslatedContent = new Attribute('roll-back', 'Roll back', $o->rollBackTranslatedContentStructure); |
| 157 | + |
| 158 | + |
| 159 | + $o=OmegaWikiAttributes::getInstance(); |
162 | 160 | |
163 | | - $updatedDefinitionStructure = new Structure( |
| 161 | + $o->updatedDefinitionStructure = new Structure( |
164 | 162 | $rollBackTranslatedContentAttribute, |
165 | 163 | $definedMeaningIdAttribute, |
166 | 164 | $definedMeaningReferenceAttribute, |
— | — | @@ -170,107 +168,103 @@ |
171 | 169 | $isLatestAttribute |
172 | 170 | ); |
173 | 171 | |
174 | | - $updatedDefinitionAttribute = new Attribute('updated-definition', 'Definition', $updatedDefinitionStructure); |
| 172 | + $o->updatedDefinition = new Attribute('updated-definition', 'Definition', $o->updatedDefinitionStructure); |
175 | 173 | |
176 | | - global |
177 | | - $expressionAttribute, $expressionIdAttribute, $identicalMeaningAttribute, $syntransIdAttribute, $updatedSyntransesAttribute, |
178 | | - $updatedSyntransesStructure; |
179 | 174 | |
180 | | - $updatedSyntransesStructure = new Structure( |
181 | | - $syntransIdAttribute, |
| 175 | + $o=OmegaWikiAttributes::getInstance(); |
| 176 | + |
| 177 | + $o->updatedSyntransesStructure = new Structure( |
| 178 | + $o->syntransId, |
182 | 179 | $definedMeaningIdAttribute, |
183 | 180 | $definedMeaningReferenceAttribute, |
184 | | - $expressionIdAttribute, |
185 | | - $expressionAttribute, |
186 | | - $identicalMeaningAttribute, |
| 181 | + $o->expressionId, |
| 182 | + $o->expression, |
| 183 | + $o->identicalMeaning, |
187 | 184 | $operationAttribute |
188 | 185 | ); |
189 | 186 | |
190 | | - $updatedSyntransesAttribute = new Attribute('updated-syntranses', 'Synonyms and translations', $updatedSyntransesStructure); |
| 187 | + $o->updatedSyntranses = new Attribute('updated-syntranses', 'Synonyms and translations', $o->updatedSyntransesStructure); |
191 | 188 | |
192 | | - global |
193 | | - $relationIdAttribute, $firstMeaningAttribute, $secondMeaningAttribute, $relationTypeAttribute, |
194 | | - $updatedRelationsStructure, $updatedRelationsAttribute; |
| 189 | + |
| 190 | + $o=OmegaWikiAttributes::getInstance(); |
195 | 191 | |
196 | | - $firstMeaningAttribute = new Attribute('first-meaning', "First defined meaning", $definedMeaningReferenceStructure); |
197 | | - $secondMeaningAttribute = new Attribute('second-meaning', "Second defined meaning", $definedMeaningReferenceStructure); |
| 192 | + $o->firstMeaning = new Attribute('first-meaning', "First defined meaning", $definedMeaningReferenceStructure); |
| 193 | + $o->secondMeaning = new Attribute('second-meaning', "Second defined meaning", $definedMeaningReferenceStructure); |
198 | 194 | |
199 | | - $updatedRelationsStructure = new Structure( |
| 195 | + $o->updatedRelationsStructure = new Structure( |
200 | 196 | $rollBackAttribute, |
201 | | - $relationIdAttribute, |
202 | | - $firstMeaningAttribute, |
203 | | - $relationTypeAttribute, |
204 | | - $secondMeaningAttribute, |
| 197 | + $o->relationId, |
| 198 | + $o->firstMeaning, |
| 199 | + $o->relationType, |
| 200 | + $o->secondMeaning, |
205 | 201 | $operationAttribute, |
206 | 202 | $isLatestAttribute |
207 | 203 | ); |
208 | 204 | |
209 | | - $updatedRelationsAttribute = new Attribute('updated-relations', 'Relations', $updatedRelationsStructure); |
| 205 | + $o->updatedRelations = new Attribute('updated-relations', 'Relations', $o->updatedRelationsStructure); |
210 | 206 | |
211 | | - global |
212 | | - $classMembershipIdAttribute, $classAttribute, $classMemberAttribute, |
213 | | - $updatedClassMembershipStructure, $updatedClassMembershipAttribute; |
| 207 | + |
| 208 | + $o=OmegaWikiAttributes::getInstance(); |
214 | 209 | |
215 | | - $classMemberAttribute = new Attribute('class-member', 'Class member', $definedMeaningReferenceStructure); |
| 210 | + $o->classMember = new Attribute('class-member', 'Class member', $definedMeaningReferenceStructure); |
216 | 211 | |
217 | | - $updatedClassMembershipStructure = new Structure( |
| 212 | + $o->updatedClassMembershipStructure = new Structure( |
218 | 213 | $rollBackAttribute, |
219 | | - $classMembershipIdAttribute, |
220 | | - $classAttribute, |
221 | | - $classMemberAttribute, |
| 214 | + $o->classMembershipId, |
| 215 | + $o->class, |
| 216 | + $o->classMember, |
222 | 217 | $operationAttribute, |
223 | 218 | $isLatestAttribute |
224 | 219 | ); |
225 | 220 | |
226 | | - $updatedClassMembershipAttribute = new Attribute('updated-class-membership', 'Class membership', $updatedClassMembershipStructure); |
| 221 | + $o->updatedClassMembership = new Attribute('updated-class-membership', 'Class membership', $o->updatedClassMembershipStructure); |
227 | 222 | |
228 | | - global |
229 | | - $collectionIdAttribute, $collectionMeaningAttribute, $collectionMemberAttribute, $sourceIdentifierAttribute, |
230 | | - $updatedCollectionMembershipStructure, $updatedCollectionMembershipAttribute, $collectionMemberIdAttribute; |
| 223 | + |
| 224 | + $o=OmegaWikiAttributes::getInstance(); |
231 | 225 | |
232 | | - $collectionMemberAttribute = new Attribute('collection-member', 'Collection member', $definedMeaningReferenceStructure); |
233 | | - $collectionMemberIdAttribute = new Attribute('collection-member-id', 'Collection member identifier', 'defined-meaning-id'); |
| 226 | + $o->collectionMember = new Attribute('collection-member', 'Collection member', $definedMeaningReferenceStructure); |
| 227 | + $o->collectionMemberId = new Attribute('collection-member-id', 'Collection member identifier', 'defined-meaning-id'); |
234 | 228 | |
235 | | - $updatedCollectionMembershipStructure = new Structure( |
| 229 | + $o->updatedCollectionMembershipStructure = new Structure( |
236 | 230 | $rollBackAttribute, |
237 | | - $collectionIdAttribute, |
238 | | - $collectionMeaningAttribute, |
239 | | - $collectionMemberIdAttribute, |
240 | | - $collectionMemberAttribute, |
241 | | - $sourceIdentifierAttribute, |
| 231 | + $o->collectionId, |
| 232 | + $o->collectionMeaning, |
| 233 | + $o->collectionMemberId, |
| 234 | + $o->collectionMember, |
| 235 | + $o->sourceIdentifier, |
242 | 236 | $operationAttribute |
243 | 237 | ); |
244 | 238 | |
245 | | - $updatedCollectionMembershipAttribute = new Attribute('updated-collection-membership', 'Collection membership', $updatedCollectionMembershipStructure); |
| 239 | + $o->updatedCollectionMembership = new Attribute('updated-collection-membership', 'Collection membership', $o->updatedCollectionMembershipStructure); |
246 | 240 | |
247 | | - global |
248 | | - $objectIdAttribute, $valueIdAttribute, $attributeAttribute; |
| 241 | + |
| 242 | + $o=OmegaWikiAttributes::getInstance(); |
249 | 243 | |
250 | | - $objectIdAttribute = new Attribute('object-id', 'Object', 'object-id'); |
251 | | - $valueIdAttribute = new Attribute('value-id', 'Value identifier', 'object-id'); |
252 | | - $attributeAttribute = new Attribute('attribute', 'Attribute', $definedMeaningReferenceStructure); |
| 244 | + $o->objectId = new Attribute('object-id', 'Object', 'object-id'); |
| 245 | + $o->valueId = new Attribute('value-id', 'Value identifier', 'object-id'); |
| 246 | + $o->attribute = new Attribute('attribute', 'Attribute', $definedMeaningReferenceStructure); |
253 | 247 | |
254 | | - global |
255 | | - $updatedLinkAttribute, $updatedLinkStructure, $linkAttribute; |
| 248 | + |
| 249 | + $o=OmegaWikiAttributes::getInstance(); |
256 | 250 | |
257 | | - $updatedLinkStructure = new Structure( |
| 251 | + $o->updatedLinkStructure = new Structure( |
258 | 252 | $rollBackAttribute, |
259 | 253 | $valueIdAttribute, |
260 | 254 | $objectIdAttribute, |
261 | 255 | $attributeAttribute, |
262 | | - $linkAttribute, |
| 256 | + $o->link, |
263 | 257 | $operationAttribute, |
264 | 258 | $isLatestAttribute |
265 | 259 | ); |
266 | 260 | |
267 | | - $updatedLinkAttribute = new Attribute('updated-link', 'Link properties', $updatedLinkStructure); |
| 261 | + $o->updatedLink = new Attribute('updated-link', 'Link properties', $o->updatedLinkStructure); |
268 | 262 | |
269 | | - global |
270 | | - $updatedTextAttribute, $updatedTextStructure; |
| 263 | + |
| 264 | + $o=OmegaWikiAttributes::getInstance(); |
271 | 265 | |
272 | 266 | $o=OmegaWikiAttributes::getInstance(); |
273 | 267 | |
274 | | - $updatedTextStructure = new Structure( |
| 268 | + $o->updatedTextStructure = new Structure( |
275 | 269 | $rollBackAttribute, |
276 | 270 | $valueIdAttribute, |
277 | 271 | $objectIdAttribute, |
— | — | @@ -280,31 +274,30 @@ |
281 | 275 | $isLatestAttribute |
282 | 276 | ); |
283 | 277 | |
284 | | - $updatedTextAttribute = new Attribute('updated-text', 'Unstructured text properties', $updatedTextStructure); |
| 278 | + $o->updatedText = new Attribute('updated-text', 'Unstructured text properties', $o->updatedTextStructure); |
285 | 279 | |
286 | | - global |
287 | | - $translatedTextStructure, |
288 | | - $updatedTranslatedTextPropertyAttribute, $updatedTranslatedTextPropertyStructure, $translatedTextTextAttribute; |
| 280 | + |
| 281 | + $o=OmegaWikiAttributes::getInstance(); |
289 | 282 | |
290 | | - $translatedTextTextAttribute = new Attribute('translated-text-property-text', 'Text', $translatedTextStructure); |
| 283 | + $o->translatedTextText = new Attribute('translated-text-property-text', 'Text', $o->translatedTextStructure); |
291 | 284 | |
292 | | - $updatedTranslatedTextPropertyStructure = new Structure( |
| 285 | + $o->updatedTranslatedTextPropertyStructure = new Structure( |
293 | 286 | $rollBackAttribute, |
294 | 287 | $valueIdAttribute, |
295 | 288 | $objectIdAttribute, |
296 | 289 | $attributeAttribute, |
297 | 290 | $translatedContentIdAttribute, |
298 | | - $translatedTextTextAttribute, |
| 291 | + $o->translatedTextText, |
299 | 292 | $operationAttribute, |
300 | 293 | $isLatestAttribute |
301 | 294 | ); |
302 | 295 | |
303 | | - $updatedTranslatedTextPropertyAttribute = new Attribute('updated-translated-text-property', 'Text properties', $updatedTranslatedTextPropertyStructure); |
| 296 | + $o->updatedTranslatedTextProperty = new Attribute('updated-translated-text-property', 'Text properties', $o->updatedTranslatedTextPropertyStructure); |
304 | 297 | |
305 | | - global |
306 | | - $updatedTranslatedTextStructure, $updatedTranslatedTextAttribute; |
| 298 | + |
| 299 | + $o=OmegaWikiAttributes::getInstance(); |
307 | 300 | |
308 | | - $updatedTranslatedTextStructure = new Structure( |
| 301 | + $o->updatedTranslatedTextStructure = new Structure( |
309 | 302 | $rollBackTranslatedContentAttribute, |
310 | 303 | $valueIdAttribute, |
311 | 304 | $objectIdAttribute, |
— | — | @@ -316,53 +309,51 @@ |
317 | 310 | $isLatestAttribute |
318 | 311 | ); |
319 | 312 | |
320 | | - $updatedTranslatedTextAttribute = new Attribute('updated-translated-text', 'Texts', $updatedTranslatedTextStructure); |
| 313 | + $o->updatedTranslatedText = new Attribute('updated-translated-text', 'Texts', $o->updatedTranslatedTextStructure); |
321 | 314 | |
322 | | - global |
323 | | - $updatedClassAttributesAttribute, $updatedClassAttributesStructure, $classAttributeId, $levelAttribute, |
324 | | - $typeAttribute; |
325 | 315 | |
326 | | - $classAttributeId = new Attribute('class-attribute-id', 'Class attribute id', 'object-id'); |
327 | | - $levelAttribute = new Attribute('level', 'Level', $definedMeaningReferenceStructure); |
328 | | - $typeAttribute = new Attribute('type', 'Type', 'text'); |
| 316 | + $o=OmegaWikiAttributes::getInstance(); |
329 | 317 | |
330 | | - $updatedClassAttributesStructure = new Structure( |
| 318 | + $o->classId = new Attribute('class-attribute-id', 'Class attribute id', 'object-id'); |
| 319 | + $o->level = new Attribute('level', 'Level', $definedMeaningReferenceStructure); |
| 320 | + $o->type = new Attribute('type', 'Type', 'text'); |
| 321 | + |
| 322 | + $o->updatedClassAttributesStructure = new Structure( |
331 | 323 | $rollBackAttribute, |
332 | | - $classAttributeId, |
333 | | - $classAttribute, |
334 | | - $levelAttribute, |
335 | | - $typeAttribute, |
| 324 | + $o->classId, |
| 325 | + $o->class, |
| 326 | + $o->level, |
| 327 | + $o->type, |
336 | 328 | $attributeAttribute, |
337 | 329 | $operationAttribute, |
338 | 330 | $isLatestAttribute |
339 | 331 | ); |
340 | 332 | |
341 | | - $updatedClassAttributesAttribute = new Attribute('updated-class-attributes', 'Class attributes', $updatedClassAttributesStructure); |
| 333 | + $o->updatedClassAttributes = new Attribute('updated-class-attributes', 'Class attributes', $o->updatedClassAttributesStructure); |
342 | 334 | |
343 | | - global |
344 | | - $updatedAlternativeDefinitionsStructure, $updatedAlternativeDefinitionsAttribute, $sourceAttribute, |
345 | | - $alternativeDefinitionTextAttribute; |
346 | 335 | |
347 | | - $alternativeDefinitionTextAttribute = new Attribute('alternative-definition-text', 'Definition', $translatedTextStructure); |
348 | | - $sourceAttribute = new Attribute('source', 'Source', $definedMeaningReferenceStructure); |
| 336 | + $o=OmegaWikiAttributes::getInstance(); |
349 | 337 | |
350 | | - $updatedAlternativeDefinitionsStructure = new Structure( |
| 338 | + $o->alternativeDefinitionText = new Attribute('alternative-definition-text', 'Definition', $translatedTextStructure); |
| 339 | + $o->source = new Attribute('source', 'Source', $definedMeaningReferenceStructure); |
| 340 | + |
| 341 | + $o->updatedAlternativeDefinitionsStructure = new Structure( |
351 | 342 | $rollBackAttribute, |
352 | 343 | $definedMeaningIdAttribute, |
353 | 344 | $translatedContentIdAttribute, |
354 | | - $alternativeDefinitionTextAttribute, |
| 345 | + $o->alternativeDefinitionText, |
355 | 346 | $definedMeaningReferenceAttribute, |
356 | | - $sourceAttribute, |
| 347 | + $o->source, |
357 | 348 | $operationAttribute, |
358 | 349 | $isLatestAttribute |
359 | 350 | ); |
360 | 351 | |
361 | | - $updatedAlternativeDefinitionsAttribute = new Attribute('updated-alternative-definitions', 'Alternative definitions', $updatedAlternativeDefinitionsStructure); |
| 352 | + $o->updatedAlternativeDefinitions = new Attribute('updated-alternative-definitions', 'Alternative definitions', $o->updatedAlternativeDefinitionsStructure); |
362 | 353 | |
363 | | - global |
364 | | - $updatedAlternativeDefinitionTextAttribute, $updatedAlternativeDefinitionTextStructure; |
| 354 | + |
| 355 | + $o=OmegaWikiAttributes::getInstance(); |
365 | 356 | |
366 | | - $updatedAlternativeDefinitionTextStructure = new Structure( |
| 357 | + $o->updatedAlternativeDefinitionTextStructure = new Structure( |
367 | 358 | $rollBackTranslatedContentAttribute, |
368 | 359 | $definedMeaningIdAttribute, |
369 | 360 | $definedMeaningReferenceAttribute, |
— | — | @@ -374,11 +365,11 @@ |
375 | 366 | $isLatestAttribute |
376 | 367 | ); |
377 | 368 | |
378 | | - $updatedAlternativeDefinitionTextAttribute = new Attribute('updated-alternative-definition-text', 'Alternative definition text', $updatedAlternativeDefinitionTextStructure); |
| 369 | + $o->updatedAlternativeDefinitionText = new Attribute('updated-alternative-definition-text', 'Alternative definition text', $o->updatedAlternativeDefinitionTextStructure); |
379 | 370 | |
380 | | - global |
381 | | - $updatesInTransactionAttribute; |
382 | 371 | |
| 372 | + $o=OmegaWikiAttributes::getInstance(); |
| 373 | + |
383 | 374 | $updatesInTransactionStructure = new Structure( |
384 | 375 | $updatedDefinitionAttribute, |
385 | 376 | $updatedSyntransesAttribute, |
— | — | @@ -390,12 +381,14 @@ |
391 | 382 | $updatedAlternativeDefinitionsAttribute |
392 | 383 | ); |
393 | 384 | |
394 | | - $updatesInTransactionAttribute = new Attribute('updates-in-transaction', 'Updates in transaction', $updatesInTransactionStructure); |
| 385 | + $o->updatesInTransaction = new Attribute('updates-in-transaction', 'Updates in transaction', $updatesInTransactionStructure); |
395 | 386 | } |
396 | 387 | |
397 | 388 | function getTransactionRecordSet($fromTransactionId, $transactionCount, $userName) { |
| 389 | + |
| 390 | + $o=OmegaWikiAttributes::getInstance(); |
398 | 391 | global |
399 | | - $transactionAttribute, $transactionIdAttribute, $transactionsTable, $updatesInTransactionAttribute; |
| 392 | + $transactionsTable; |
400 | 393 | |
401 | 394 | $dc=wdGetDataSetContext(); |
402 | 395 | $queryTransactionInformation = new QueryLatestTransactionInformation(); |
— | — | @@ -408,9 +401,9 @@ |
409 | 402 | $recordSet = queryRecordSet( |
410 | 403 | 'transaction-id', |
411 | 404 | $queryTransactionInformation, |
412 | | - $transactionIdAttribute, |
| 405 | + $o->transactionId, |
413 | 406 | new TableColumnsToAttributesMapping( |
414 | | - new TableColumnsToAttribute(array('transaction_id'), $transactionIdAttribute) |
| 407 | + new TableColumnsToAttribute(array('transaction_id'), $o->transactionId) |
415 | 408 | ), |
416 | 409 | $transactionsTable, |
417 | 410 | $restrictions, |
— | — | @@ -418,42 +411,37 @@ |
419 | 412 | $transactionCount |
420 | 413 | ); |
421 | 414 | |
422 | | - $recordSet->getStructure()->addAttribute($transactionIdAttribute); |
423 | | - expandTransactionIDsInRecordSet($recordSet, $transactionIdAttribute, $transactionAttribute); |
| 415 | + $recordSet->getStructure()->addAttribute($o->transactionId); |
| 416 | + expandTransactionIDsInRecordSet($recordSet, $o->transactionId, $o->transaction); |
424 | 417 | |
425 | | - $recordSet->getStructure()->addAttribute($updatesInTransactionAttribute); |
| 418 | + $recordSet->getStructure()->addAttribute($o->updatesInTransaction); |
426 | 419 | expandUpdatesInTransactionInRecordSet($recordSet); |
427 | 420 | |
428 | 421 | return $recordSet; |
429 | 422 | } |
430 | 423 | |
431 | 424 | function getTransactionOverview($recordSet, $showRollBackOptions) { |
432 | | - global |
433 | | - $transactionAttribute, $userAttribute, $timestampAttribute, $summaryAttribute, |
434 | | - $updatesInTransactionAttribute, $updatedDefinitionAttribute, $updatedSyntransesAttribute, |
435 | | - $updatedRelationsAttribute, $updatedClassMembershipAttribute, $updatedCollectionMembershipAttribute, |
436 | | - $updatedLinkAttribute, $updatedTextAttribute, $updatedTranslatedTextAttribute, $updatedClassAttributesAttribute, |
437 | | - $updatedAlternativeDefinitionsAttribute, $updatedAlternativeDefinitionTextAttribute, |
438 | | - $updatedTranslatedTextPropertyAttribute; |
439 | 425 | |
440 | | - $captionEditor = new RecordSpanEditor($transactionAttribute, ': ', ', ', false); |
441 | | - $captionEditor->addEditor(new TimestampEditor($timestampAttribute, new SimplePermissionController(false), false)); |
442 | | - $captionEditor->addEditor(new UserEditor($userAttribute, new SimplePermissionController(false), false)); |
443 | | - $captionEditor->addEditor(new TextEditor($summaryAttribute, new SimplePermissionController(false), false)); |
| 426 | + $o=OmegaWikiAttributes::getInstance(); |
| 427 | + |
| 428 | + $captionEditor = new RecordSpanEditor($o->transaction, ': ', ', ', false); |
| 429 | + $captionEditor->addEditor(new TimestampEditor($o->timestamp, new SimplePermissionController(false), false)); |
| 430 | + $captionEditor->addEditor(new UserEditor($o->user, new SimplePermissionController(false), false)); |
| 431 | + $captionEditor->addEditor(new TextEditor($o->summary, new SimplePermissionController(false), false)); |
444 | 432 | |
445 | | - $valueEditor = new RecordUnorderedListEditor($updatesInTransactionAttribute, 5); |
446 | | - $valueEditor->addEditor(getUpdatedDefinedMeaningDefinitionEditor($updatedDefinitionAttribute, $showRollBackOptions)); |
447 | | - $valueEditor->addEditor(getUpdatedAlternativeDefinitionsEditor($updatedAlternativeDefinitionsAttribute, $showRollBackOptions)); |
448 | | - $valueEditor->addEditor(getUpdatedAlternativeDefinitionTextEditor($updatedAlternativeDefinitionTextAttribute, $showRollBackOptions)); |
449 | | - $valueEditor->addEditor(getUpdatedSyntransesEditor($updatedSyntransesAttribute, $showRollBackOptions)); |
450 | | - $valueEditor->addEditor(getUpdatedRelationsEditor($updatedRelationsAttribute, $showRollBackOptions)); |
451 | | - $valueEditor->addEditor(getUpdatedClassAttributesEditor($updatedClassAttributesAttribute, $showRollBackOptions)); |
452 | | - $valueEditor->addEditor(getUpdatedClassMembershipEditor($updatedClassMembershipAttribute, $showRollBackOptions)); |
453 | | - $valueEditor->addEditor(getUpdatedCollectionMembershipEditor($updatedCollectionMembershipAttribute, $showRollBackOptions)); |
454 | | - $valueEditor->addEditor(getUpdatedLinkEditor($updatedLinkAttribute, $showRollBackOptions)); |
455 | | - $valueEditor->addEditor(getUpdatedTextEditor($updatedTextAttribute, $showRollBackOptions)); |
456 | | - $valueEditor->addEditor(getUpdatedTranslatedTextPropertyEditor($updatedTranslatedTextPropertyAttribute, $showRollBackOptions)); |
457 | | - $valueEditor->addEditor(getUpdatedTranslatedTextEditor($updatedTranslatedTextAttribute, $showRollBackOptions)); |
| 433 | + $valueEditor = new RecordUnorderedListEditor($o->updatesInTransaction, 5); |
| 434 | + $valueEditor->addEditor(getUpdatedDefinedMeaningDefinitionEditor($o->updatedDefinition, $showRollBackOptions)); |
| 435 | + $valueEditor->addEditor(getUpdatedAlternativeDefinitionsEditor($o->updatedAlternativeDefinitions, $showRollBackOptions)); |
| 436 | + $valueEditor->addEditor(getUpdatedAlternativeDefinitionTextEditor($o->updatedAlternativeDefinitionText, $showRollBackOptions)); |
| 437 | + $valueEditor->addEditor(getUpdatedSyntransesEditor($o->updatedSyntranses, $showRollBackOptions)); |
| 438 | + $valueEditor->addEditor(getUpdatedRelationsEditor($o->updatedRelations, $showRollBackOptions)); |
| 439 | + $valueEditor->addEditor(getUpdatedClassAttributesEditor($o->updatedClassAttributes, $showRollBackOptions)); |
| 440 | + $valueEditor->addEditor(getUpdatedClassMembershipEditor($o->updatedClassMembership, $showRollBackOptions)); |
| 441 | + $valueEditor->addEditor(getUpdatedCollectionMembershipEditor($o->updatedCollectionMembership, $showRollBackOptions)); |
| 442 | + $valueEditor->addEditor(getUpdatedLinkEditor($o->updatedLink, $showRollBackOptions)); |
| 443 | + $valueEditor->addEditor(getUpdatedTextEditor($o->updatedText, $showRollBackOptions)); |
| 444 | + $valueEditor->addEditor(getUpdatedTranslatedTextPropertyEditor($o->updatedTranslatedTextProperty, $showRollBackOptions)); |
| 445 | + $valueEditor->addEditor(getUpdatedTranslatedTextEditor($o->updatedTranslatedText, $showRollBackOptions)); |
458 | 446 | |
459 | 447 | $editor = new RecordSetListEditor(null, new SimplePermissionController(false), new ShowEditFieldChecker(true), new AllowAddController(false), false, false, null, 4, false); |
460 | 448 | $editor->setCaptionEditor($captionEditor); |
— | — | @@ -463,50 +451,42 @@ |
464 | 452 | } |
465 | 453 | |
466 | 454 | function expandUpdatesInTransactionInRecordSet($recordSet) { |
467 | | - global |
468 | | - $transactionIdAttribute, $updatesInTransactionAttribute; |
| 455 | + |
| 456 | + $o=OmegaWikiAttributes::getInstance(); |
469 | 457 | |
470 | 458 | for ($i = 0; $i < $recordSet->getRecordCount(); $i++) { |
471 | 459 | $record = $recordSet->getRecord($i); |
472 | | - $record->setAttributeValue( |
473 | | - $updatesInTransactionAttribute, |
474 | | - getUpdatesInTransactionRecord($record->getAttributeValue($transactionIdAttribute)) |
475 | | - ); |
| 460 | + $record->updatesInTransaction = getUpdatesInTransactionRecord($record->transactionId); |
476 | 461 | } |
477 | 462 | } |
478 | 463 | |
479 | 464 | function getUpdatesInTransactionRecord($transactionId) { |
480 | | - global |
481 | | - $updatesInTransactionAttribute, $updatedDefinitionAttribute, $updatedSyntransesAttribute, |
482 | | - $updatedRelationsAttribute, $updatedClassMembershipAttribute, $updatedCollectionMembershipAttribute, |
483 | | - $updatedLinkAttribute, $updatedTextAttribute, $updatedTranslatedTextAttribute, $updatedClassAttributesAttribute, |
484 | | - $updatedAlternativeDefinitionsAttribute, $updatedAlternativeDefinitionTextAttribute, |
485 | | - $updatedTranslatedTextPropertyAttribute; |
| 465 | + |
| 466 | + $o=OmegaWikiAttributes::getInstance(); |
486 | 467 | |
487 | | - $record = new ArrayRecord($updatesInTransactionAttribute->type); |
488 | | - $record->setAttributeValue($updatedDefinitionAttribute, getUpdatedDefinedMeaningDefinitionRecordSet($transactionId)); |
489 | | - $record->setAttributeValue($updatedAlternativeDefinitionsAttribute, getUpdatedAlternativeDefinitionsRecordSet($transactionId)); |
490 | | - $record->setAttributeValue($updatedAlternativeDefinitionTextAttribute, getUpdatedAlternativeDefinitionTextRecordSet($transactionId)); |
491 | | - $record->setAttributeValue($updatedSyntransesAttribute, getUpdatedSyntransesRecordSet($transactionId)); |
492 | | - $record->setAttributeValue($updatedRelationsAttribute, getUpdatedRelationsRecordSet($transactionId)); |
493 | | - $record->setAttributeValue($updatedClassMembershipAttribute, getUpdatedClassMembershipRecordSet($transactionId)); |
494 | | - $record->setAttributeValue($updatedCollectionMembershipAttribute, getUpdatedCollectionMembershipRecordSet($transactionId)); |
495 | | - $record->setAttributeValue($updatedLinkAttribute, getUpdatedLinkRecordSet($transactionId)); |
496 | | - $record->setAttributeValue($updatedTextAttribute, getUpdatedTextRecordSet($transactionId)); |
497 | | - $record->setAttributeValue($updatedTranslatedTextPropertyAttribute, getUpdatedTranslatedTextPropertyRecordSet($transactionId)); |
498 | | - $record->setAttributeValue($updatedTranslatedTextAttribute, getUpdatedTranslatedTextRecordSet($transactionId)); |
499 | | - $record->setAttributeValue($updatedClassAttributesAttribute, getUpdatedClassAttributesRecordSet($transactionId)); |
| 468 | + $record = new ArrayRecord($o->updatesInTransaction->type); |
| 469 | + $record->updatedDefinition = getUpdatedDefinedMeaningDefinitionRecordSet($transactionId); |
| 470 | + $record->updatedAlternativeDefinitions = getUpdatedAlternativeDefinitionsRecordSet($transactionId); |
| 471 | + $record->updatedAlternativeDefinitionText = getUpdatedAlternativeDefinitionTextRecordSet($transactionId); |
| 472 | + $record->updatedSyntranses = getUpdatedSyntransesRecordSet($transactionId); |
| 473 | + $record->updatedRelations = getUpdatedRelationsRecordSet($transactionId); |
| 474 | + $record->updatedClassMembership = getUpdatedClassMembershipRecordSet($transactionId); |
| 475 | + $record->updatedCollectionMembership = getUpdatedCollectionMembershipRecordSet($transactionId); |
| 476 | + $record->updatedLink = getUpdatedLinkRecordSet($transactionId); |
| 477 | + $record->updatedText = getUpdatedTextRecordSet($transactionId); |
| 478 | + $record->updatedTranslatedTextProperty = getUpdatedTranslatedTextPropertyRecordSet($transactionId); |
| 479 | + $record->updatedTranslatedText = getUpdatedTranslatedTextRecordSet($transactionId); |
| 480 | + $record->updatedClassAttributes = getUpdatedClassAttributesRecordSet($transactionId); |
500 | 481 | |
501 | 482 | return $record; |
502 | 483 | } |
503 | 484 | |
504 | 485 | function getTranslatedContentHistory($translatedContentId, $languageId, $isLatest) { |
505 | | - global |
506 | | - $translatedContentHistoryStructure, $translatedContentHistoryKeyStructure, |
507 | | - $addTransactionIdAttribute, $recordLifeSpanAttribute; |
508 | 486 | |
| 487 | + $o=OmegaWikiAttributes::getInstance(); |
| 488 | + |
509 | 489 | $dc=wdGetDataSetContext(); |
510 | | - $recordSet = new ArrayRecordSet($translatedContentHistoryStructure, $translatedContentHistoryKeyStructure); |
| 490 | + $recordSet = new ArrayRecordSet($o->translatedContentHistoryStructure, $o->translatedContentHistoryKeyStructure); |
511 | 491 | |
512 | 492 | if ($isLatest) { |
513 | 493 | $dbr = &wfGetDB(DB_SLAVE); |
— | — | @@ -520,10 +500,10 @@ |
521 | 501 | ); |
522 | 502 | |
523 | 503 | while ($row = $dbr->fetchObject($queryResult)) { |
524 | | - $record = new ArrayRecord($translatedContentHistoryStructure); |
| 504 | + $record = new ArrayRecord($o->translatedContentHistoryStructure); |
525 | 505 | $record->text = $row->text_text; |
526 | | - $record->setAttributeValue($addTransactionIdAttribute, (int) $row->add_transaction_id); |
527 | | - $record->setAttributeValue($recordLifeSpanAttribute, getRecordLifeSpanTuple((int) $row->add_transaction_id, (int) $row->remove_transaction_id)); |
| 506 | + $record->addTransactionId = (int) $row->add_transaction_id; |
| 507 | + $record->recordLifeSpan = getRecordLifeSpanTuple((int) $row->add_transaction_id, (int) $row->remove_transaction_id); |
528 | 508 | |
529 | 509 | $recordSet->add($record); |
530 | 510 | } |
— | — | @@ -533,25 +513,23 @@ |
534 | 514 | } |
535 | 515 | |
536 | 516 | function getUpdatedTextRecord($text, $history) { |
537 | | - global |
538 | | - $updatedTextStructure, $translatedContentHistoryAttribute; |
| 517 | + |
| 518 | + $o=OmegaWikiAttributes::getInstance(); |
539 | 519 | |
540 | | - $result = new ArrayRecord($updatedTextStructure); |
| 520 | + $result = new ArrayRecord($o->updatedTextStructure); |
541 | 521 | $result->text = $text; |
542 | | - $result->setAttributeValue($translatedContentHistoryAttribute, $history); |
| 522 | + $result->translatedContentHistory = $history; |
543 | 523 | |
544 | 524 | return $result; |
545 | 525 | } |
546 | 526 | |
547 | 527 | function getUpdatedDefinedMeaningDefinitionRecordSet($transactionId) { |
548 | 528 | |
549 | | - global |
550 | | - $definedMeaningIdAttribute, |
551 | | - $definedMeaningReferenceAttribute, $updatedDefinitionStructure, $translatedContentIdAttribute, |
552 | | - $operationAttribute, $isLatestAttribute, $rollBackTranslatedContentAttribute, $rollBackTranslatedContentStructure; |
553 | 529 | |
554 | 530 | $o=OmegaWikiAttributes::getInstance(); |
555 | 531 | |
| 532 | + $o=OmegaWikiAttributes::getInstance(); |
| 533 | + |
556 | 534 | $dc=wdGetDataSetContext(); |
557 | 535 | |
558 | 536 | $dbr = &wfGetDB(DB_SLAVE); |
— | — | @@ -566,18 +544,18 @@ |
567 | 545 | " AND " . getAtTransactionRestriction("{$dc}_defined_meaning", $transactionId) |
568 | 546 | ); |
569 | 547 | |
570 | | - $recordSet = new ArrayRecordSet($updatedDefinitionStructure, new Structure($definedMeaningIdAttribute, $o->language)); |
| 548 | + $recordSet = new ArrayRecordSet($o->updatedDefinitionStructure, new Structure($o->definedMeaningId, $o->language)); |
571 | 549 | |
572 | 550 | while ($row = $dbr->fetchObject($queryResult)) { |
573 | | - $record = new ArrayRecord($updatedDefinitionStructure); |
574 | | - $record->setAttributeValue($definedMeaningIdAttribute, $row->defined_meaning_id); |
575 | | - $record->setAttributeValue($definedMeaningReferenceAttribute, getDefinedMeaningReferenceRecord($row->defined_meaning_id)); |
576 | | - $record->setAttributeValue($translatedContentIdAttribute, $row->translated_content_id); |
| 551 | + $record = new ArrayRecord($o->updatedDefinitionStructure); |
| 552 | + $record->definedMeaningId = $row->defined_meaning_id; |
| 553 | + $record->definedMeaningReference = getDefinedMeaningReferenceRecord($row->defined_meaning_id); |
| 554 | + $record->translatedContentId = $row->translated_content_id; |
577 | 555 | $record->language = $row->language_id; |
578 | 556 | $record->text = $row->text_text; |
579 | | - $record->setAttributeValue($operationAttribute, $row->operation); |
580 | | - $record->setAttributeValue($isLatestAttribute, $row->is_latest); |
581 | | - $record->setAttributeValue($rollBackTranslatedContentAttribute, simpleRecord($rollBackTranslatedContentStructure, array($row->is_latest, $row->operation, getTranslatedContentHistory($row->translated_content_id, $row->language_id, $row->is_latest)))); |
| 557 | + $record->operation = $row->operation; |
| 558 | + $record->isLatest = $row->is_latest; |
| 559 | + $record->rollBackTranslatedContent = simpleRecord($o->rollBackTranslatedContentStructure, array($row->is_latest, $row->operation, getTranslatedContentHistory($row->translated_content_id, $row->language_id, $row->is_latest))); |
582 | 560 | $recordSet->add($record); |
583 | 561 | } |
584 | 562 | |
— | — | @@ -585,11 +563,9 @@ |
586 | 564 | } |
587 | 565 | |
588 | 566 | function getUpdatedAlternativeDefinitionsRecordSet($transactionId) { |
589 | | - global |
590 | | - $updatedAlternativeDefinitionsStructure, $definedMeaningIdAttribute, $definedMeaningReferenceAttribute, |
591 | | - $translatedContentIdAttribute, $sourceAttribute, $alternativeDefinitionTextAttribute, |
592 | | - $operationAttribute, $isLatestAttribute, $rollBackAttribute, $rollBackStructure; |
593 | 567 | |
| 568 | + $o=OmegaWikiAttributes::getInstance(); |
| 569 | + |
594 | 570 | $dc=wdGetDataSetContext(); |
595 | 571 | $dbr = &wfGetDB(DB_SLAVE); |
596 | 572 | $queryResult = $dbr->query( |
— | — | @@ -600,36 +576,34 @@ |
601 | 577 | " WHERE " . getInTransactionRestriction("{$dc}_alt_meaningtexts", $transactionId) |
602 | 578 | ); |
603 | 579 | |
604 | | - $recordSet = new ArrayRecordSet($updatedAlternativeDefinitionsStructure, new Structure($definedMeaningIdAttribute, $translatedContentIdAttribute)); |
| 580 | + $recordSet = new ArrayRecordSet($o->updatedAlternativeDefinitionsStructure, new Structure($o->definedMeaningId, $o->translatedContentId)); |
605 | 581 | |
606 | 582 | while ($row = $dbr->fetchObject($queryResult)) { |
607 | | - $record = new ArrayRecord($updatedAlternativeDefinitionsStructure); |
608 | | - $record->setAttributeValue($definedMeaningIdAttribute, $row->meaning_mid); |
609 | | - $record->setAttributeValue($definedMeaningReferenceAttribute, getDefinedMeaningReferenceRecord($row->meaning_mid)); |
610 | | - $record->setAttributeValue($translatedContentIdAttribute, $row->meaning_text_tcid); |
611 | | - $record->setAttributeValue($sourceAttribute, getDefinedMeaningReferenceRecord($row->source_id)); |
612 | | - $record->setAttributeValue($operationAttribute, $row->operation); |
613 | | - $record->setAttributeValue($isLatestAttribute, $row->is_latest); |
614 | | - $record->setAttributeValue($rollBackAttribute, simpleRecord($rollBackStructure, array($row->is_latest, $row->operation))); |
| 583 | + $record = new ArrayRecord($o->updatedAlternativeDefinitionsStructure); |
| 584 | + $record->definedMeaningId = $row->meaning_mid; |
| 585 | + $record->definedMeaningReference = getDefinedMeaningReferenceRecord($row->meaning_mid); |
| 586 | + $record->translatedContentId = $row->meaning_text_tcid; |
| 587 | + $record->source = getDefinedMeaningReferenceRecord($row->source_id); |
| 588 | + $record->operation = $row->operation; |
| 589 | + $record->isLatest = $row->is_latest; |
| 590 | + $record->rollBack = simpleRecord($o->rollBackStructure, array($row->is_latest, $row->operation)); |
615 | 591 | |
616 | 592 | $recordSet->add($record); |
617 | 593 | } |
618 | 594 | |
619 | 595 | $viewInformation = new ViewInformation(); |
620 | 596 | $viewInformation->queryTransactionInformation = new QueryLatestTransactionInformation(); |
621 | | - expandTranslatedContentsInRecordSet($recordSet, $translatedContentIdAttribute, $alternativeDefinitionTextAttribute, $viewInformation); |
| 597 | + expandTranslatedContentsInRecordSet($recordSet, $o->translatedContentId, $o->alternativeDefinitionText, $viewInformation); |
622 | 598 | |
623 | 599 | return $recordSet; |
624 | 600 | } |
625 | 601 | |
626 | 602 | function getUpdatedAlternativeDefinitionTextRecordSet($transactionId) { |
627 | | - global |
628 | | - $definedMeaningIdAttribute, $sourceAttribute, |
629 | | - $definedMeaningReferenceAttribute, $updatedAlternativeDefinitionTextStructure, $translatedContentIdAttribute, |
630 | | - $rollBackTranslatedContentStructure, $rollBackTranslatedContentAttribute, $operationAttribute, $isLatestAttribute; |
631 | 603 | |
632 | 604 | $o=OmegaWikiAttributes::getInstance(); |
633 | 605 | |
| 606 | + $o=OmegaWikiAttributes::getInstance(); |
| 607 | + |
634 | 608 | $dc=wdGetDataSetContext(); |
635 | 609 | $dbr = &wfGetDB(DB_SLAVE); |
636 | 610 | $queryResult = $dbr->query( |
— | — | @@ -643,19 +617,19 @@ |
644 | 618 | " AND " . getAtTransactionRestriction("{$dc}_alt_meaningtexts", $transactionId) |
645 | 619 | ); |
646 | 620 | |
647 | | - $recordSet = new ArrayRecordSet($updatedAlternativeDefinitionTextStructure, new Structure($translatedContentIdAttribute, $o->language)); |
| 621 | + $recordSet = new ArrayRecordSet($o->updatedAlternativeDefinitionTextStructure, new Structure($o->translatedContentId, $o->language)); |
648 | 622 | |
649 | 623 | while ($row = $dbr->fetchObject($queryResult)) { |
650 | | - $record = new ArrayRecord($updatedAlternativeDefinitionTextStructure); |
651 | | - $record->setAttributeValue($definedMeaningIdAttribute, $row->meaning_mid); |
652 | | - $record->setAttributeValue($definedMeaningReferenceAttribute, getDefinedMeaningReferenceRecord($row->meaning_mid)); |
653 | | - $record->setAttributeValue($translatedContentIdAttribute, $row->translated_content_id); |
654 | | - $record->setAttributeValue($sourceAttribute, getDefinedMeaningReferenceRecord($row->source_id)); |
| 624 | + $record = new ArrayRecord($o->updatedAlternativeDefinitionTextStructure); |
| 625 | + $record->definedMeaningId = $row->meaning_mid; |
| 626 | + $record->definedMeaningReference = getDefinedMeaningReferenceRecord($row->meaning_mid); |
| 627 | + $record->translatedContentId = $row->translated_content_id; |
| 628 | + $record->source = getDefinedMeaningReferenceRecord($row->source_id); |
655 | 629 | $record->language = $row->language_id; |
656 | 630 | $record->text = $row->text_text; |
657 | | - $record->setAttributeValue($operationAttribute, $row->operation); |
658 | | - $record->setAttributeValue($isLatestAttribute, $row->is_latest); |
659 | | - $record->setAttributeValue($rollBackTranslatedContentAttribute, simpleRecord($rollBackTranslatedContentStructure, array($row->is_latest, $row->operation, getTranslatedContentHistory($row->translated_content_id, $row->language_id, $row->is_latest)))); |
| 631 | + $record->operation = $row->operation; |
| 632 | + $record->isLatest = $row->is_latest; |
| 633 | + $record->rollBackTranslatedContent = simpleRecord($o->rollBackTranslatedContentStructure, array($row->is_latest, $row->operation, getTranslatedContentHistory($row->translated_content_id, $row->language_id, $row->is_latest))); |
660 | 634 | $recordSet->add($record); |
661 | 635 | } |
662 | 636 | |
— | — | @@ -663,13 +637,10 @@ |
664 | 638 | } |
665 | 639 | |
666 | 640 | function getUpdatedSyntransesRecordSet($transactionId, $dc=null) { |
667 | | - global |
668 | | - $updatedSyntransesStructure, $definedMeaningIdAttribute, $definedMeaningReferenceAttribute, |
669 | | - $expressionAttribute, $expressionStructure, $syntransIdAttribute, |
670 | | - $expressionIdAttribute, $identicalMeaningAttribute, |
671 | | - $isLatestAttribute, $operationAttribute, $rollBackAttribute, $rollBackStructure; |
672 | 641 | |
673 | 642 | $o=OmegaWikiAttributes::getInstance(); |
| 643 | + |
| 644 | + $o=OmegaWikiAttributes::getInstance(); |
674 | 645 | $dc=wdGetDataSetContext($dc); |
675 | 646 | |
676 | 647 | $dbr = &wfGetDB(DB_SLAVE); |
— | — | @@ -683,23 +654,23 @@ |
684 | 655 | " AND " . getAtTransactionRestriction("{$dc}_expression_ns", $transactionId) |
685 | 656 | ); |
686 | 657 | |
687 | | - $recordSet = new ArrayRecordSet($updatedSyntransesStructure, new Structure($syntransIdAttribute)); |
| 658 | + $recordSet = new ArrayRecordSet($o->updatedSyntransesStructure, new Structure($o->syntransId)); |
688 | 659 | |
689 | 660 | while ($row = $dbr->fetchObject($queryResult)) { |
690 | | - $expressionRecord = new ArrayRecord($expressionStructure); |
| 661 | + $expressionRecord = new ArrayRecord($o->expressionStructure); |
691 | 662 | $expressionRecord->language = $row->language_id; |
692 | 663 | $expressionRecord->spelling = $row->spelling; |
693 | 664 | |
694 | | - $record = new ArrayRecord($updatedSyntransesStructure); |
695 | | - $record->setAttributeValue($syntransIdAttribute, $row->syntrans_sid); |
696 | | - $record->setAttributeValue($definedMeaningIdAttribute, $row->defined_meaning_id); |
697 | | - $record->setAttributeValue($expressionIdAttribute, $row->expression_id); |
698 | | - $record->setAttributeValue($definedMeaningReferenceAttribute, getDefinedMeaningReferenceRecord($row->defined_meaning_id)); |
699 | | - $record->setAttributeValue($expressionAttribute, $expressionRecord); |
700 | | - $record->setAttributeValue($identicalMeaningAttribute, $row->identical_meaning); |
701 | | - $record->setAttributeValue($isLatestAttribute, $row->is_latest); |
702 | | - $record->setAttributeValue($operationAttribute, $row->operation); |
703 | | - $record->setAttributeValue($rollBackAttribute, simpleRecord($rollBackStructure, array($row->is_latest, $row->operation))); |
| 665 | + $record = new ArrayRecord($o->updatedSyntransesStructure); |
| 666 | + $record->syntransId = $row->syntrans_sid; |
| 667 | + $record->definedMeaningId = $row->defined_meaning_id; |
| 668 | + $record->expressionId = $row->expression_id; |
| 669 | + $record->definedMeaningReference = getDefinedMeaningReferenceRecord($row->defined_meaning_id); |
| 670 | + $record->expression = $expressionRecord; |
| 671 | + $record->identicalMeaning = $row->identical_meaning; |
| 672 | + $record->isLatest = $row->is_latest; |
| 673 | + $record->operation = $row->operation; |
| 674 | + $record->rollBack = simpleRecord($o->rollBackStructure, array($row->is_latest, $row->operation)); |
704 | 675 | |
705 | 676 | $recordSet->add($record); |
706 | 677 | } |
— | — | @@ -726,11 +697,10 @@ |
727 | 698 | } |
728 | 699 | |
729 | 700 | function getUpdatedRelationsRecordSet($transactionId) { |
730 | | - global |
731 | | - $updatedRelationsStructure, $relationIdAttribute, $firstMeaningAttribute, $secondMeaningAttribute, |
732 | | - $relationTypeAttribute, $operationAttribute, $isLatestAttribute, $rollBackAttribute, $rollBackStructure; |
733 | 701 | |
| 702 | + $o=OmegaWikiAttributes::getInstance(); |
734 | 703 | |
| 704 | + |
735 | 705 | $dc=wdGetDataSetContext(); |
736 | 706 | |
737 | 707 | $dbr = &wfGetDB(DB_SLAVE); |
— | — | @@ -742,17 +712,17 @@ |
743 | 713 | " WHERE " . getInTransactionRestriction("{$dc}_meaning_relations", $transactionId) |
744 | 714 | ); |
745 | 715 | |
746 | | - $recordSet = new ArrayRecordSet($updatedRelationsStructure, new Structure($relationIdAttribute)); |
| 716 | + $recordSet = new ArrayRecordSet($o->updatedRelationsStructure, new Structure($o->relationId)); |
747 | 717 | |
748 | 718 | while ($row = $dbr->fetchObject($queryResult)) { |
749 | | - $record = new ArrayRecord($updatedRelationsStructure); |
750 | | - $record->setAttributeValue($relationIdAttribute, $row->relation_id); |
751 | | - $record->setAttributeValue($firstMeaningAttribute, getDefinedMeaningReferenceRecord($row->meaning1_mid)); |
752 | | - $record->setAttributeValue($secondMeaningAttribute, getDefinedMeaningReferenceRecord($row->meaning2_mid)); |
753 | | - $record->setAttributeValue($relationTypeAttribute, getDefinedMeaningReferenceRecord($row->relationtype_mid)); |
754 | | - $record->setAttributeValue($operationAttribute, $row->operation); |
755 | | - $record->setAttributeValue($isLatestAttribute, $row->is_latest); |
756 | | - $record->setAttributeValue($rollBackAttribute, simpleRecord($rollBackStructure, array($row->is_latest, $row->operation))); |
| 719 | + $record = new ArrayRecord($o->updatedRelationsStructure); |
| 720 | + $record->relationId = $row->relation_id; |
| 721 | + $record->firstMeaning = getDefinedMeaningReferenceRecord($row->meaning1_mid); |
| 722 | + $record->secondMeaning = getDefinedMeaningReferenceRecord($row->meaning2_mid); |
| 723 | + $record->relationType = getDefinedMeaningReferenceRecord($row->relationtype_mid); |
| 724 | + $record->operation = $row->operation; |
| 725 | + $record->isLatest = $row->is_latest; |
| 726 | + $record->rollBack = simpleRecord($o->rollBackStructure, array($row->is_latest, $row->operation)); |
757 | 727 | |
758 | 728 | $recordSet->add($record); |
759 | 729 | } |
— | — | @@ -761,10 +731,9 @@ |
762 | 732 | } |
763 | 733 | |
764 | 734 | function getUpdatedClassMembershipRecordSet($transactionId) { |
765 | | - global |
766 | | - $updatedClassMembershipStructure, $classMembershipIdAttribute, $classAttribute, $classMemberAttribute, |
767 | | - $operationAttribute, $isLatestAttribute, $rollBackAttribute, $rollBackStructure; |
768 | 735 | |
| 736 | + $o=OmegaWikiAttributes::getInstance(); |
| 737 | + |
769 | 738 | $dc=wdGetDataSetContext(); |
770 | 739 | |
771 | 740 | $dbr = &wfGetDB(DB_SLAVE); |
— | — | @@ -776,16 +745,16 @@ |
777 | 746 | " WHERE " . getInTransactionRestriction("{$dc}_class_membership", $transactionId) |
778 | 747 | ); |
779 | 748 | |
780 | | - $recordSet = new ArrayRecordSet($updatedClassMembershipStructure, new Structure($classMembershipIdAttribute)); |
| 749 | + $recordSet = new ArrayRecordSet($o->updatedClassMembershipStructure, new Structure($o->classMembershipId)); |
781 | 750 | |
782 | 751 | while ($row = $dbr->fetchObject($queryResult)) { |
783 | | - $record = new ArrayRecord($updatedClassMembershipStructure); |
784 | | - $record->setAttributeValue($classMembershipIdAttribute, $row->class_membership_id); |
785 | | - $record->setAttributeValue($classAttribute, getDefinedMeaningReferenceRecord($row->class_mid)); |
786 | | - $record->setAttributeValue($classMemberAttribute, getDefinedMeaningReferenceRecord($row->class_member_mid)); |
787 | | - $record->setAttributeValue($operationAttribute, $row->operation); |
788 | | - $record->setAttributeValue($isLatestAttribute, $row->is_latest); |
789 | | - $record->setAttributeValue($rollBackAttribute, simpleRecord($rollBackStructure, array($row->is_latest, $row->operation))); |
| 752 | + $record = new ArrayRecord($o->updatedClassMembershipStructure); |
| 753 | + $record->classMembershipId = $row->class_membership_id; |
| 754 | + $record->class = getDefinedMeaningReferenceRecord($row->class_mid); |
| 755 | + $record->classMember = getDefinedMeaningReferenceRecord($row->class_member_mid); |
| 756 | + $record->operation = $row->operation; |
| 757 | + $record->isLatest = $row->is_latest; |
| 758 | + $record->rollBack = simpleRecord($o->rollBackStructure, array($row->is_latest, $row->operation)); |
790 | 759 | |
791 | 760 | $recordSet->add($record); |
792 | 761 | } |
— | — | @@ -794,11 +763,9 @@ |
795 | 764 | } |
796 | 765 | |
797 | 766 | function getUpdatedCollectionMembershipRecordSet($transactionId) { |
798 | | - global |
799 | | - $updatedCollectionMembershipStructure, $collectionIdAttribute, $collectionMeaningAttribute, |
800 | | - $collectionMemberAttribute, $sourceIdentifierAttribute, $collectionMemberIdAttribute, |
801 | | - $operationAttribute, $isLatestAttribute, $rollBackAttribute, $rollBackStructure; |
802 | 767 | |
| 768 | + $o=OmegaWikiAttributes::getInstance(); |
| 769 | + |
803 | 770 | $dc=wdGetDataSetContext(); |
804 | 771 | $dbr = &wfGetDB(DB_SLAVE); |
805 | 772 | $queryResult = $dbr->query( |
— | — | @@ -811,18 +778,18 @@ |
812 | 779 | " AND " . getAtTransactionRestriction("{$dc}_collection_ns", $transactionId) |
813 | 780 | ); |
814 | 781 | |
815 | | - $recordSet = new ArrayRecordSet($updatedCollectionMembershipStructure, new Structure($collectionIdAttribute, $collectionMemberIdAttribute)); |
| 782 | + $recordSet = new ArrayRecordSet($o->updatedCollectionMembershipStructure, new Structure($o->collectionId, $o->collectionMemberId)); |
816 | 783 | |
817 | 784 | while ($row = $dbr->fetchObject($queryResult)) { |
818 | | - $record = new ArrayRecord($updatedCollectionMembershipStructure); |
819 | | - $record->setAttributeValue($collectionIdAttribute, $row->collection_id); |
820 | | - $record->setAttributeValue($collectionMeaningAttribute, getDefinedMeaningReferenceRecord($row->collection_mid)); |
821 | | - $record->setAttributeValue($collectionMemberIdAttribute, $row->member_mid); |
822 | | - $record->setAttributeValue($collectionMemberAttribute, getDefinedMeaningReferenceRecord($row->member_mid)); |
823 | | - $record->setAttributeValue($sourceIdentifierAttribute, $row->internal_member_id); |
824 | | - $record->setAttributeValue($operationAttribute, $row->operation); |
825 | | - $record->setAttributeValue($isLatestAttribute, $row->is_latest); |
826 | | - $record->setAttributeValue($rollBackAttribute, simpleRecord($rollBackStructure, array($row->is_latest, $row->operation))); |
| 785 | + $record = new ArrayRecord($o->updatedCollectionMembershipStructure); |
| 786 | + $record->collectionId = $row->collection_id; |
| 787 | + $record->collectionMeaning = getDefinedMeaningReferenceRecord($row->collection_mid); |
| 788 | + $record->collectionMemberId = $row->member_mid; |
| 789 | + $record->collectionMember = getDefinedMeaningReferenceRecord($row->member_mid); |
| 790 | + $record->sourceIdentifier = $row->internal_member_id; |
| 791 | + $record->operation = $row->operation; |
| 792 | + $record->isLatest = $row->is_latest; |
| 793 | + $record->rollBack = simpleRecord($o->rollBackStructure, array($row->is_latest, $row->operation)); |
827 | 794 | |
828 | 795 | $recordSet->add($record); |
829 | 796 | } |
— | — | @@ -831,10 +798,9 @@ |
832 | 799 | } |
833 | 800 | |
834 | 801 | function getUpdatedClassAttributesRecordSet($transactionId) { |
835 | | - global |
836 | | - $updatedClassAttributesStructure, $classAttributeIdAttribute, $classAttribute, $levelAttribute, |
837 | | - $attributeAttribute, $typeAttribute, $operationAttribute, $isLatestAttribute, $rollBackAttribute, $rollBackStructure; |
838 | 802 | |
| 803 | + $o=OmegaWikiAttributes::getInstance(); |
| 804 | + |
839 | 805 | $dc=wdGetDataSetContext(); |
840 | 806 | $dbr = &wfGetDB(DB_SLAVE); |
841 | 807 | $queryResult = $dbr->query( |
— | — | @@ -845,18 +811,18 @@ |
846 | 812 | " WHERE " . getInTransactionRestriction("{$dc}_class_attributes", $transactionId) |
847 | 813 | ); |
848 | 814 | |
849 | | - $recordSet = new ArrayRecordSet($updatedClassAttributesStructure, new Structure($classAttributeIdAttribute)); |
| 815 | + $recordSet = new ArrayRecordSet($o->updatedClassAttributesStructure, new Structure($o->classAttributeId)); |
850 | 816 | |
851 | 817 | while ($row = $dbr->fetchObject($queryResult)) { |
852 | | - $record = new ArrayRecord($updatedClassAttributesStructure); |
853 | | - $record->setAttributeValue($classAttributeIdAttribute, $row->object_id); |
854 | | - $record->setAttributeValue($classAttribute, getDefinedMeaningReferenceRecord($row->class_mid)); |
855 | | - $record->setAttributeValue($levelAttribute, getDefinedMeaningReferenceRecord($row->level_mid)); |
856 | | - $record->setAttributeValue($attributeAttribute, getDefinedMeaningReferenceRecord($row->attribute_mid)); |
857 | | - $record->setAttributeValue($typeAttribute, $row->attribute_type); |
858 | | - $record->setAttributeValue($operationAttribute, $row->operation); |
859 | | - $record->setAttributeValue($isLatestAttribute, $row->is_latest); |
860 | | - $record->setAttributeValue($rollBackAttribute, simpleRecord($rollBackStructure, array($row->is_latest, $row->operation))); |
| 818 | + $record = new ArrayRecord($o->updatedClassAttributesStructure); |
| 819 | + $record->classAttributeId = $row->object_id; |
| 820 | + $record->class = getDefinedMeaningReferenceRecord($row->class_mid); |
| 821 | + $record->level = getDefinedMeaningReferenceRecord($row->level_mid); |
| 822 | + $record->attribute = getDefinedMeaningReferenceRecord($row->attribute_mid); |
| 823 | + $record->type = $row->attribute_type; |
| 824 | + $record->operation = $row->operation; |
| 825 | + $record->isLatest = $row->is_latest; |
| 826 | + $record->rollBack = simpleRecord($o->rollBackStructure, array($row->is_latest, $row->operation)); |
861 | 827 | |
862 | 828 | $recordSet->add($record); |
863 | 829 | } |
— | — | @@ -865,22 +831,20 @@ |
866 | 832 | } |
867 | 833 | |
868 | 834 | function createLinkRecord($url, $label) { |
869 | | - global |
870 | | - $linkAttribute, $linkLabelAttribute, $linkURLAttribute; |
| 835 | + |
| 836 | + $o=OmegaWikiAttributes::getInstance(); |
871 | 837 | |
872 | | - $result = new ArrayRecord($linkAttribute->type); |
873 | | - $result->setAttributeValue($linkLabelAttribute, $label); |
874 | | - $result->setAttributeValue($linkURLAttribute, $url); |
| 838 | + $result = new ArrayRecord($o->link->type); |
| 839 | + $result->linkLabel = $label; |
| 840 | + $result->linkURL = $url; |
875 | 841 | |
876 | 842 | return $result; |
877 | 843 | } |
878 | 844 | |
879 | 845 | function getUpdatedLinkRecordSet($transactionId) { |
880 | | - global |
881 | | - $objectIdAttribute, $valueIdAttribute, $attributeAttribute, $linkAttribute, |
882 | | - $updatedLinkStructure, $operationAttribute, $isLatestAttribute, |
883 | | - $rollBackAttribute, $rollBackStructure; |
884 | 846 | |
| 847 | + $o=OmegaWikiAttributes::getInstance(); |
| 848 | + |
885 | 849 | $dc=wdGetDataSetContext(); |
886 | 850 | $dbr = &wfGetDB(DB_SLAVE); |
887 | 851 | $queryResult = $dbr->query( |
— | — | @@ -891,17 +855,17 @@ |
892 | 856 | " WHERE " . getInTransactionRestriction("{$dc}_url_attribute_values", $transactionId) |
893 | 857 | ); |
894 | 858 | |
895 | | - $recordSet = new ArrayRecordSet($updatedLinkStructure, new Structure($valueIdAttribute)); |
| 859 | + $recordSet = new ArrayRecordSet($o->updatedLinkStructure, new Structure($o->valueId)); |
896 | 860 | |
897 | 861 | while ($row = $dbr->fetchObject($queryResult)) { |
898 | | - $record = new ArrayRecord($updatedLinkStructure); |
899 | | - $record->setAttributeValue($valueIdAttribute, $row->value_id); |
900 | | - $record->setAttributeValue($objectIdAttribute, $row->object_id); |
901 | | - $record->setAttributeValue($attributeAttribute, getDefinedMeaningReferenceRecord($row->attribute_mid)); |
902 | | - $record->setAttributeValue($linkAttribute, createLinkRecord($row->url, $row->label)); |
903 | | - $record->setAttributeValue($operationAttribute, $row->operation); |
904 | | - $record->setAttributeValue($isLatestAttribute, $row->is_latest); |
905 | | - $record->setAttributeValue($rollBackAttribute, simpleRecord($rollBackStructure, array($row->is_latest, $row->operation))); |
| 862 | + $record = new ArrayRecord($o->updatedLinkStructure); |
| 863 | + $record->valueId = $row->value_id; |
| 864 | + $record->objectId = $row->object_id; |
| 865 | + $record->attribute = getDefinedMeaningReferenceRecord($row->attribute_mid); |
| 866 | + $record->link = createLinkRecord($row->url, $row->label); |
| 867 | + $record->operation = $row->operation; |
| 868 | + $record->isLatest = $row->is_latest; |
| 869 | + $record->rollBack = simpleRecord($o->rollBackStructure, array($row->is_latest, $row->operation)); |
906 | 870 | |
907 | 871 | $recordSet->add($record); |
908 | 872 | } |
— | — | @@ -910,11 +874,9 @@ |
911 | 875 | } |
912 | 876 | |
913 | 877 | function getUpdatedTextRecordSet($transactionId) { |
914 | | - global |
915 | | - $objectIdAttribute, $valueIdAttribute, $attributeAttribute, |
916 | | - $updatedTextStructure, |
917 | | - $operationAttribute, $isLatestAttribute, $rollBackAttribute, $rollBackStructure; |
918 | 878 | |
| 879 | + $o=OmegaWikiAttributes::getInstance(); |
| 880 | + |
919 | 881 | $dc=wdGetDataSetContext(); |
920 | 882 | $dbr = &wfGetDB(DB_SLAVE); |
921 | 883 | $queryResult = $dbr->query( |
— | — | @@ -925,17 +887,17 @@ |
926 | 888 | " WHERE " . getInTransactionRestriction("{$dc}_text_attribute_values", $transactionId) |
927 | 889 | ); |
928 | 890 | |
929 | | - $recordSet = new ArrayRecordSet($updatedTextStructure, new Structure($valueIdAttribute)); |
| 891 | + $recordSet = new ArrayRecordSet($o->updatedTextStructure, new Structure($o->valueId)); |
930 | 892 | |
931 | 893 | while ($row = $dbr->fetchObject($queryResult)) { |
932 | | - $record = new ArrayRecord($updatedTextStructure); |
933 | | - $record->setAttributeValue($valueIdAttribute, $row->value_id); |
934 | | - $record->setAttributeValue($objectIdAttribute, $row->object_id); |
935 | | - $record->setAttributeValue($attributeAttribute, getDefinedMeaningReferenceRecord($row->attribute_mid)); |
| 894 | + $record = new ArrayRecord($o->updatedTextStructure); |
| 895 | + $record->valueId = $row->value_id; |
| 896 | + $record->objectId = $row->object_id; |
| 897 | + $record->attribute = getDefinedMeaningReferenceRecord($row->attribute_mid); |
936 | 898 | $record->text= $row->text; |
937 | | - $record->setAttributeValue($operationAttribute, $row->operation); |
938 | | - $record->setAttributeValue($isLatestAttribute, $row->is_latest); |
939 | | - $record->setAttributeValue($rollBackAttribute, simpleRecord($rollBackStructure, array($row->is_latest, $row->operation))); |
| 899 | + $record->operation = $row->operation; |
| 900 | + $record->isLatest = $row->is_latest; |
| 901 | + $record->rollBack = simpleRecord($o->rollBackStructure, array($row->is_latest, $row->operation)); |
940 | 902 | |
941 | 903 | $recordSet->add($record); |
942 | 904 | } |
— | — | @@ -944,11 +906,9 @@ |
945 | 907 | } |
946 | 908 | |
947 | 909 | function getUpdatedTranslatedTextPropertyRecordSet($transactionId) { |
948 | | - global |
949 | | - $updatedTranslatedTextPropertyStructure, $objectIdAttribute, $valueIdAttribute, |
950 | | - $translatedContentIdAttribute, $attributeAttribute, $translatedTextTextAttribute, |
951 | | - $operationAttribute, $isLatestAttribute, $rollBackAttribute, $rollBackStructure; |
952 | 910 | |
| 911 | + $o=OmegaWikiAttributes::getInstance(); |
| 912 | + |
953 | 913 | $dc=wdGetDataSetContext(); |
954 | 914 | $dbr = &wfGetDB(DB_SLAVE); |
955 | 915 | $queryResult = $dbr->query( |
— | — | @@ -959,33 +919,29 @@ |
960 | 920 | " WHERE " . getInTransactionRestriction("{$dc}_translated_content_attribute_values", $transactionId) |
961 | 921 | ); |
962 | 922 | |
963 | | - $recordSet = new ArrayRecordSet($updatedTranslatedTextPropertyStructure, new Structure($valueIdAttribute)); |
| 923 | + $recordSet = new ArrayRecordSet($o->updatedTranslatedTextPropertyStructure, new Structure($o->valueId)); |
964 | 924 | |
965 | 925 | while ($row = $dbr->fetchObject($queryResult)) { |
966 | | - $record = new ArrayRecord($updatedTranslatedTextPropertyStructure); |
967 | | - $record->setAttributeValue($valueIdAttribute, $row->value_id); |
968 | | - $record->setAttributeValue($objectIdAttribute, $row->object_id); |
969 | | - $record->setAttributeValue($translatedContentIdAttribute, $row->value_tcid); |
970 | | - $record->setAttributeValue($attributeAttribute, getDefinedMeaningReferenceRecord($row->attribute_mid)); |
971 | | - $record->setAttributeValue($operationAttribute, $row->operation); |
972 | | - $record->setAttributeValue($isLatestAttribute, $row->is_latest); |
973 | | - $record->setAttributeValue($rollBackAttribute, simpleRecord($rollBackStructure, array($row->is_latest, $row->operation))); |
| 926 | + $record = new ArrayRecord($o->updatedTranslatedTextPropertyStructure); |
| 927 | + $record->valueId = $row->value_id; |
| 928 | + $record->objectId = $row->object_id; |
| 929 | + $record->translatedContentId = $row->value_tcid; |
| 930 | + $record->attribute = getDefinedMeaningReferenceRecord($row->attribute_mid); |
| 931 | + $record->operation = $row->operation; |
| 932 | + $record->isLatest = $row->is_latest; |
| 933 | + $record->rollBack = simpleRecord($o->rollBackStructure, array($row->is_latest, $row->operation)); |
974 | 934 | |
975 | 935 | $recordSet->add($record); |
976 | 936 | } |
977 | 937 | |
978 | 938 | $viewInformation = new ViewInformation(); |
979 | 939 | $viewInformation->queryTransactionInformation = new QueryLatestTransactionInformation(); |
980 | | - expandTranslatedContentsInRecordSet($recordSet, $translatedContentIdAttribute, $translatedTextTextAttribute, $viewInformation); |
| 940 | + expandTranslatedContentsInRecordSet($recordSet, $o->translatedContentId, $o->translatedTextText, $viewInformation); |
981 | 941 | |
982 | 942 | return $recordSet; |
983 | 943 | } |
984 | 944 | |
985 | 945 | function getUpdatedTranslatedTextRecordSet($transactionId) { |
986 | | - global |
987 | | - $objectAttributeValues, $objectIdAttribute, $valueIdAttribute, $attributeAttribute, |
988 | | - $updatedTranslatedTextStructure, $translatedContentIdAttribute, |
989 | | - $operationAttribute, $isLatestAttribute, $rollBackTranslatedContentAttribute, $rollBackTranslatedContentStructure; |
990 | 946 | |
991 | 947 | $o=OmegaWikiAttributes::getInstance(); |
992 | 948 | |
— | — | @@ -1002,19 +958,19 @@ |
1003 | 959 | " AND " . getAtTransactionRestriction("{$dc}_translated_content_attribute_values", $transactionId) |
1004 | 960 | ); |
1005 | 961 | |
1006 | | - $recordSet = new ArrayRecordSet($updatedTranslatedTextStructure, new Structure($valueIdAttribute, $o->language)); |
| 962 | + $recordSet = new ArrayRecordSet($o->updatedTranslatedTextStructure, new Structure($o->valueId, $o->language)); |
1007 | 963 | |
1008 | 964 | while ($row = $dbr->fetchObject($queryResult)) { |
1009 | | - $record = new ArrayRecord($updatedTranslatedTextStructure); |
1010 | | - $record->setAttributeValue($valueIdAttribute, $row->value_id); |
1011 | | - $record->setAttributeValue($objectIdAttribute, $row->object_id); |
1012 | | - $record->setAttributeValue($attributeAttribute, getDefinedMeaningReferenceRecord($row->attribute_mid)); |
1013 | | - $record->setAttributeValue($translatedContentIdAttribute, $row->translated_content_id); |
| 965 | + $record = new ArrayRecord($o->updatedTranslatedTextStructure); |
| 966 | + $record->valueId = $row->value_id; |
| 967 | + $record->objectId = $row->object_id; |
| 968 | + $record->attribute = getDefinedMeaningReferenceRecord($row->attribute_mid); |
| 969 | + $record->translatedContentId = $row->translated_content_id; |
1014 | 970 | $record->language = $row->language_id; |
1015 | 971 | $record->text = $row->text_text; |
1016 | | - $record->setAttributeValue($operationAttribute, $row->operation); |
1017 | | - $record->setAttributeValue($isLatestAttribute, $row->is_latest); |
1018 | | - $record->setAttributeValue($rollBackTranslatedContentAttribute, simpleRecord($rollBackTranslatedContentStructure, array($row->is_latest, $row->operation, getTranslatedContentHistory($row->translated_content_id, $row->language_id, $row->is_latest)))); |
| 972 | + $record->operation = $row->operation; |
| 973 | + $record->isLatest = $row->is_latest; |
| 974 | + $record->rollBackTranslatedContent = simpleRecord($o->rollBackTranslatedContentStructure, array($row->is_latest, $row->operation, getTranslatedContentHistory($row->translated_content_id, $row->language_id, $row->is_latest))); |
1019 | 975 | $recordSet->add($record); |
1020 | 976 | } |
1021 | 977 | |
— | — | @@ -1022,14 +978,14 @@ |
1023 | 979 | } |
1024 | 980 | |
1025 | 981 | function getTranslatedContentHistorySelector($attribute) { |
1026 | | - global |
1027 | | - $recordLifeSpanAttribute; |
1028 | 982 | |
1029 | 983 | $o=OmegaWikiAttributes::getInstance(); |
1030 | 984 | |
| 985 | + $o=OmegaWikiAttributes::getInstance(); |
| 986 | + |
1031 | 987 | $result = createSuggestionsTableViewer($attribute); |
1032 | 988 | $result->addEditor(createLongTextViewer($o->text)); |
1033 | | - $result->addEditor(createTableLifeSpanEditor($recordLifeSpanAttribute)); |
| 989 | + $result->addEditor(createTableLifeSpanEditor($o->recordLifeSpan)); |
1034 | 990 | |
1035 | 991 | $result = new RecordSetRecordSelector($result); |
1036 | 992 | |
— | — | @@ -1037,251 +993,240 @@ |
1038 | 994 | } |
1039 | 995 | |
1040 | 996 | function getUpdatedDefinedMeaningDefinitionEditor($attribute, $showRollBackOptions) { |
1041 | | - global |
1042 | | - $definedMeaningReferenceAttribute, |
1043 | | - $operationAttribute, $isLatestAttribute, $rollBackTranslatedContentAttribute, $translatedContentHistoryAttribute; |
| 997 | + |
| 998 | + $o=OmegaWikiAttributes::getInstance(); |
1044 | 999 | |
1045 | 1000 | $o=OmegaWikiAttributes::getInstance(); |
1046 | 1001 | $editor = createTableViewer($attribute); |
1047 | 1002 | |
1048 | 1003 | if ($showRollBackOptions) { |
1049 | | - $rollBackEditor = new RollbackEditor($rollBackTranslatedContentAttribute, true); |
1050 | | - $rollBackEditor->setSuggestionsEditor(getTranslatedContentHistorySelector($translatedContentHistoryAttribute)); |
| 1004 | + $rollBackEditor = new RollbackEditor($o->rollBackTranslatedContent, true); |
| 1005 | + $rollBackEditor->setSuggestionsEditor(getTranslatedContentHistorySelector($o->translatedContentHistory)); |
1051 | 1006 | |
1052 | 1007 | $editor->addEditor($rollBackEditor); |
1053 | 1008 | } |
1054 | 1009 | |
1055 | | - $editor->addEditor(createDefinedMeaningReferenceViewer($definedMeaningReferenceAttribute)); |
| 1010 | + $editor->addEditor(createDefinedMeaningReferenceViewer($o->definedMeaningReference)); |
1056 | 1011 | $editor->addEditor(createLanguageViewer($o->language)); |
1057 | 1012 | $editor->addEditor(createLongTextViewer($o->text)); |
1058 | | - $editor->addEditor(createShortTextViewer($operationAttribute)); |
1059 | | - $editor->addEditor(createBooleanViewer($isLatestAttribute)); |
| 1013 | + $editor->addEditor(createShortTextViewer($o->operation)); |
| 1014 | + $editor->addEditor(createBooleanViewer($o->isLatest)); |
1060 | 1015 | |
1061 | 1016 | return $editor; |
1062 | 1017 | } |
1063 | 1018 | |
1064 | 1019 | function getUpdatedAlternativeDefinitionsEditor($attribute, $showRollBackOptions) { |
1065 | | - global |
1066 | | - $definedMeaningReferenceAttribute, $sourceAttribute, |
1067 | | - $alternativeDefinitionTextAttribute, $rollBackAttribute, $operationAttribute,$isLatestAttribute; |
| 1020 | + |
| 1021 | + $o=OmegaWikiAttributes::getInstance(); |
1068 | 1022 | |
1069 | 1023 | $editor = createTableViewer($attribute); |
1070 | 1024 | |
1071 | 1025 | if ($showRollBackOptions) |
1072 | | - $editor->addEditor(new RollbackEditor($rollBackAttribute, false)); |
| 1026 | + $editor->addEditor(new RollbackEditor($o->rollBack, false)); |
1073 | 1027 | |
1074 | | - $editor->addEditor(createDefinedMeaningReferenceViewer($definedMeaningReferenceAttribute)); |
1075 | | - $editor->addEditor(createTranslatedTextViewer($alternativeDefinitionTextAttribute)); |
1076 | | - $editor->addEditor(createDefinedMeaningReferenceViewer($sourceAttribute)); |
1077 | | - $editor->addEditor(createShortTextViewer($operationAttribute)); |
1078 | | - $editor->addEditor(createBooleanViewer($isLatestAttribute)); |
| 1028 | + $editor->addEditor(createDefinedMeaningReferenceViewer($o->definedMeaningReference)); |
| 1029 | + $editor->addEditor(createTranslatedTextViewer($o->alternativeDefinitionText)); |
| 1030 | + $editor->addEditor(createDefinedMeaningReferenceViewer($o->source)); |
| 1031 | + $editor->addEditor(createShortTextViewer($o->operation)); |
| 1032 | + $editor->addEditor(createBooleanViewer($o->isLatest)); |
1079 | 1033 | |
1080 | 1034 | return $editor; |
1081 | 1035 | } |
1082 | 1036 | |
1083 | 1037 | function getUpdatedAlternativeDefinitionTextEditor($attribute, $showRollBackOptions) { |
1084 | | - global |
1085 | | - $definedMeaningReferenceAttribute, $sourceAttribute, |
1086 | | - $operationAttribute, $isLatestAttribute, $rollBackTranslatedContentAttribute, $translatedContentHistoryAttribute; |
1087 | 1038 | |
1088 | 1039 | $o=OmegaWikiAttributes::getInstance(); |
| 1040 | + |
| 1041 | + $o=OmegaWikiAttributes::getInstance(); |
1089 | 1042 | |
1090 | 1043 | $editor = createTableViewer($attribute); |
1091 | 1044 | |
1092 | 1045 | if ($showRollBackOptions) { |
1093 | | - $rollBackEditor = new RollbackEditor($rollBackTranslatedContentAttribute, true); |
1094 | | - $rollBackEditor->setSuggestionsEditor(getTranslatedContentHistorySelector($translatedContentHistoryAttribute)); |
| 1046 | + $rollBackEditor = new RollbackEditor($o->rollBackTranslatedContent, true); |
| 1047 | + $rollBackEditor->setSuggestionsEditor(getTranslatedContentHistorySelector($o->translatedContentHistory)); |
1095 | 1048 | |
1096 | 1049 | $editor->addEditor($rollBackEditor); |
1097 | 1050 | } |
1098 | 1051 | |
1099 | | - $editor->addEditor(createDefinedMeaningReferenceViewer($definedMeaningReferenceAttribute)); |
| 1052 | + $editor->addEditor(createDefinedMeaningReferenceViewer($o->definedMeaningReference)); |
1100 | 1053 | $editor->addEditor(createLanguageViewer($o->language)); |
1101 | 1054 | $editor->addEditor(createLongTextViewer($o->text)); |
1102 | | - $editor->addEditor(createDefinedMeaningReferenceViewer($sourceAttribute)); |
1103 | | - $editor->addEditor(createShortTextViewer($operationAttribute)); |
1104 | | - $editor->addEditor(createBooleanViewer($isLatestAttribute)); |
| 1055 | + $editor->addEditor(createDefinedMeaningReferenceViewer($o->source)); |
| 1056 | + $editor->addEditor(createShortTextViewer($o->operation)); |
| 1057 | + $editor->addEditor(createBooleanViewer($o->isLatest)); |
1105 | 1058 | |
1106 | 1059 | return $editor; |
1107 | 1060 | } |
1108 | 1061 | |
1109 | 1062 | function getUpdatedSyntransesEditor($attribute, $showRollBackOptions) { |
1110 | | - global |
1111 | | - $definedMeaningReferenceAttribute, $expressionAttribute, $identicalMeaningAttribute, |
1112 | | - $isLatestAttribute, $operationAttribute, $rollBackAttribute; |
| 1063 | + |
| 1064 | + $o=OmegaWikiAttributes::getInstance(); |
1113 | 1065 | |
1114 | 1066 | $editor = createTableViewer($attribute); |
1115 | 1067 | |
1116 | 1068 | if ($showRollBackOptions) |
1117 | | - $editor->addEditor(new RollbackEditor($rollBackAttribute, false)); |
| 1069 | + $editor->addEditor(new RollbackEditor($o->rollBack, false)); |
1118 | 1070 | |
1119 | 1071 | $viewInformation = new ViewInformation(); |
1120 | 1072 | $viewInformation->queryTransactionInformation = new QueryLatestTransactionInformation(); |
1121 | 1073 | |
1122 | | - $editor->addEditor(createDefinedMeaningReferenceViewer($definedMeaningReferenceAttribute)); |
1123 | | - $editor->addEditor(getExpressionTableCellEditor($expressionAttribute, $viewInformation)); |
1124 | | - $editor->addEditor(new BooleanEditor($identicalMeaningAttribute, new SimplePermissionController(false), false, false)); |
1125 | | - $editor->addEditor(createShortTextViewer($operationAttribute)); |
1126 | | - $editor->addEditor(createBooleanViewer($isLatestAttribute)); |
| 1074 | + $editor->addEditor(createDefinedMeaningReferenceViewer($o->definedMeaningReference)); |
| 1075 | + $editor->addEditor(getExpressionTableCellEditor($o->expression, $viewInformation)); |
| 1076 | + $editor->addEditor(new BooleanEditor($o->identicalMeaning, new SimplePermissionController(false), false, false)); |
| 1077 | + $editor->addEditor(createShortTextViewer($o->operation)); |
| 1078 | + $editor->addEditor(createBooleanViewer($o->isLatest)); |
1127 | 1079 | |
1128 | 1080 | return $editor; |
1129 | 1081 | } |
1130 | 1082 | |
1131 | 1083 | function getUpdatedRelationsEditor($attribute, $showRollBackOptions) { |
1132 | | - global |
1133 | | - $firstMeaningAttribute, $relationTypeAttribute, $secondMeaningAttribute, $operationAttribute, |
1134 | | - $isLatestAttribute, $rollBackAttribute; |
| 1084 | + |
| 1085 | + $o=OmegaWikiAttributes::getInstance(); |
1135 | 1086 | |
1136 | 1087 | $editor = createTableViewer($attribute); |
1137 | 1088 | |
1138 | 1089 | if ($showRollBackOptions) |
1139 | | - $editor->addEditor(new RollbackEditor($rollBackAttribute, false)); |
| 1090 | + $editor->addEditor(new RollbackEditor($o->rollBack, false)); |
1140 | 1091 | |
1141 | | - $editor->addEditor(createDefinedMeaningReferenceViewer($firstMeaningAttribute)); |
1142 | | - $editor->addEditor(createDefinedMeaningReferenceViewer($relationTypeAttribute)); |
1143 | | - $editor->addEditor(createDefinedMeaningReferenceViewer($secondMeaningAttribute)); |
1144 | | - $editor->addEditor(createShortTextViewer($operationAttribute)); |
1145 | | - $editor->addEditor(createBooleanViewer($isLatestAttribute)); |
| 1092 | + $editor->addEditor(createDefinedMeaningReferenceViewer($o->firstMeaning)); |
| 1093 | + $editor->addEditor(createDefinedMeaningReferenceViewer($o->relationType)); |
| 1094 | + $editor->addEditor(createDefinedMeaningReferenceViewer($o->secondMeaning)); |
| 1095 | + $editor->addEditor(createShortTextViewer($o->operation)); |
| 1096 | + $editor->addEditor(createBooleanViewer($o->isLatest)); |
1146 | 1097 | |
1147 | 1098 | return $editor; |
1148 | 1099 | } |
1149 | 1100 | |
1150 | 1101 | function getUpdatedClassMembershipEditor($attribute, $showRollBackOptions) { |
1151 | | - global |
1152 | | - $classAttribute, $classMemberAttribute, $operationAttribute, $isLatestAttribute, $rollBackAttribute; |
| 1102 | + |
| 1103 | + $o=OmegaWikiAttributes::getInstance(); |
1153 | 1104 | |
1154 | 1105 | $editor = createTableViewer($attribute); |
1155 | 1106 | |
1156 | 1107 | if ($showRollBackOptions) |
1157 | | - $editor->addEditor(new RollbackEditor($rollBackAttribute, false)); |
| 1108 | + $editor->addEditor(new RollbackEditor($o->rollBack, false)); |
1158 | 1109 | |
1159 | | - $editor->addEditor(createDefinedMeaningReferenceViewer($classAttribute)); |
1160 | | - $editor->addEditor(createDefinedMeaningReferenceViewer($classMemberAttribute)); |
1161 | | - $editor->addEditor(createShortTextViewer($operationAttribute)); |
1162 | | - $editor->addEditor(createBooleanViewer($isLatestAttribute)); |
| 1110 | + $editor->addEditor(createDefinedMeaningReferenceViewer($o->class)); |
| 1111 | + $editor->addEditor(createDefinedMeaningReferenceViewer($o->classMember)); |
| 1112 | + $editor->addEditor(createShortTextViewer($o->operation)); |
| 1113 | + $editor->addEditor(createBooleanViewer($o->isLatest)); |
1163 | 1114 | |
1164 | 1115 | return $editor; |
1165 | 1116 | } |
1166 | 1117 | |
1167 | 1118 | function getUpdatedCollectionMembershipEditor($attribute, $showRollBackOptions) { |
1168 | | - global |
1169 | | - $collectionMeaningAttribute, $collectionMemberAttribute, $sourceIdentifierAttribute, |
1170 | | - $operationAttribute, $rollBackAttribute, $isLatestAttribute; |
| 1119 | + |
| 1120 | + $o=OmegaWikiAttributes::getInstance(); |
1171 | 1121 | |
1172 | 1122 | $editor = createTableViewer($attribute); |
1173 | 1123 | |
1174 | 1124 | if ($showRollBackOptions) |
1175 | | - $editor->addEditor(new RollbackEditor($rollBackAttribute, false)); |
| 1125 | + $editor->addEditor(new RollbackEditor($o->rollBack, false)); |
1176 | 1126 | |
1177 | | - $editor->addEditor(createDefinedMeaningReferenceViewer($collectionMeaningAttribute)); |
1178 | | - $editor->addEditor(createDefinedMeaningReferenceViewer($collectionMemberAttribute)); |
1179 | | - $editor->addEditor(createShortTextViewer($sourceIdentifierAttribute)); |
1180 | | - $editor->addEditor(createShortTextViewer($operationAttribute)); |
1181 | | - $editor->addEditor(createBooleanViewer($isLatestAttribute)); |
| 1127 | + $editor->addEditor(createDefinedMeaningReferenceViewer($o->collectionMeaning)); |
| 1128 | + $editor->addEditor(createDefinedMeaningReferenceViewer($o->collectionMember)); |
| 1129 | + $editor->addEditor(createShortTextViewer($o->sourceIdentifier)); |
| 1130 | + $editor->addEditor(createShortTextViewer($o->operation)); |
| 1131 | + $editor->addEditor(createBooleanViewer($o->isLatest)); |
1182 | 1132 | |
1183 | 1133 | return $editor; |
1184 | 1134 | } |
1185 | 1135 | |
1186 | 1136 | function getUpdatedLinkEditor($attribute, $showRollBackOptions) { |
1187 | | - global |
1188 | | - $objectIdAttribute, $valueIdAttribute, $attributeAttribute, $linkAttribute, |
1189 | | - $rollBackAttribute, $operationAttribute, $isLatestAttribute; |
| 1137 | + |
| 1138 | + $o=OmegaWikiAttributes::getInstance(); |
1190 | 1139 | |
1191 | 1140 | $editor = createTableViewer($attribute); |
1192 | 1141 | |
1193 | 1142 | if ($showRollBackOptions) |
1194 | | - $editor->addEditor(new RollbackEditor($rollBackAttribute, false)); |
| 1143 | + $editor->addEditor(new RollbackEditor($o->rollBack, false)); |
1195 | 1144 | |
1196 | | - $editor->addEditor(new ObjectPathEditor($objectIdAttribute)); |
1197 | | - $editor->addEditor(createDefinedMeaningReferenceViewer($attributeAttribute)); |
1198 | | - $editor->addEditor(createLinkViewer($linkAttribute)); |
1199 | | - $editor->addEditor(createShortTextViewer($operationAttribute)); |
1200 | | - $editor->addEditor(createBooleanViewer($isLatestAttribute)); |
| 1145 | + $editor->addEditor(new ObjectPathEditor($o->objectId)); |
| 1146 | + $editor->addEditor(createDefinedMeaningReferenceViewer($o->attribute)); |
| 1147 | + $editor->addEditor(createLinkViewer($o->link)); |
| 1148 | + $editor->addEditor(createShortTextViewer($o->operation)); |
| 1149 | + $editor->addEditor(createBooleanViewer($o->isLatest)); |
1201 | 1150 | |
1202 | 1151 | return $editor; |
1203 | 1152 | } |
1204 | 1153 | |
1205 | 1154 | function getUpdatedTextEditor($attribute, $showRollBackOptions) { |
1206 | | - global |
1207 | | - $objectIdAttribute, $valueIdAttribute, $attributeAttribute, |
1208 | | - $rollBackAttribute, $operationAttribute, $isLatestAttribute; |
| 1155 | + |
| 1156 | + $o=OmegaWikiAttributes::getInstance(); |
1209 | 1157 | |
1210 | 1158 | $o=OmegaWikiAttributes::getInstance(); |
1211 | 1159 | |
1212 | 1160 | $editor = createTableViewer($attribute); |
1213 | 1161 | |
1214 | 1162 | if ($showRollBackOptions) |
1215 | | - $editor->addEditor(new RollbackEditor($rollBackAttribute, false)); |
| 1163 | + $editor->addEditor(new RollbackEditor($o->rollBack, false)); |
1216 | 1164 | |
1217 | | - $editor->addEditor(new ObjectPathEditor($objectIdAttribute)); |
1218 | | - $editor->addEditor(createDefinedMeaningReferenceViewer($attributeAttribute)); |
| 1165 | + $editor->addEditor(new ObjectPathEditor($o->objectId)); |
| 1166 | + $editor->addEditor(createDefinedMeaningReferenceViewer($o->attribute)); |
1219 | 1167 | $editor->addEditor(createLongTextViewer($o->text)); |
1220 | | - $editor->addEditor(createShortTextViewer($operationAttribute)); |
1221 | | - $editor->addEditor(createBooleanViewer($isLatestAttribute)); |
| 1168 | + $editor->addEditor(createShortTextViewer($o->operation)); |
| 1169 | + $editor->addEditor(createBooleanViewer($o->isLatest)); |
1222 | 1170 | |
1223 | 1171 | return $editor; |
1224 | 1172 | } |
1225 | 1173 | |
1226 | 1174 | function getUpdatedTranslatedTextPropertyEditor($attribute, $showRollBackOptions) { |
1227 | | - global |
1228 | | - $objectIdAttribute, $valueIdAttribute, $attributeAttribute, $translatedTextTextAttribute, |
1229 | | - $operationAttribute, $isLatestAttribute, $rollBackAttribute; |
| 1175 | + |
| 1176 | + $o=OmegaWikiAttributes::getInstance(); |
1230 | 1177 | |
1231 | 1178 | $editor = createTableViewer($attribute); |
1232 | 1179 | |
1233 | 1180 | if ($showRollBackOptions) |
1234 | | - $editor->addEditor(new RollbackEditor($rollBackAttribute, false)); |
| 1181 | + $editor->addEditor(new RollbackEditor($o->rollBack, false)); |
1235 | 1182 | |
1236 | | - $editor->addEditor(new ObjectPathEditor($objectIdAttribute)); |
1237 | | - $editor->addEditor(createDefinedMeaningReferenceViewer($attributeAttribute)); |
1238 | | - $editor->addEditor(createTranslatedTextViewer($translatedTextTextAttribute)); |
1239 | | - $editor->addEditor(createShortTextViewer($operationAttribute)); |
1240 | | - $editor->addEditor(createBooleanViewer($isLatestAttribute)); |
| 1183 | + $editor->addEditor(new ObjectPathEditor($o->objectId)); |
| 1184 | + $editor->addEditor(createDefinedMeaningReferenceViewer($o->attribute)); |
| 1185 | + $editor->addEditor(createTranslatedTextViewer($o->translatedTextText)); |
| 1186 | + $editor->addEditor(createShortTextViewer($o->operation)); |
| 1187 | + $editor->addEditor(createBooleanViewer($o->isLatest)); |
1241 | 1188 | |
1242 | 1189 | return $editor; |
1243 | 1190 | } |
1244 | 1191 | |
1245 | 1192 | function getUpdatedTranslatedTextEditor($attribute, $showRollBackOptions) { |
1246 | | - global |
1247 | | - $objectIdAttribute, $valueIdAttribute, $attributeAttribute, |
1248 | | - $operationAttribute, $isLatestAttribute, $rollBackTranslatedContentAttribute, $translatedContentHistoryAttribute; |
| 1193 | + |
| 1194 | + $o=OmegaWikiAttributes::getInstance(); |
1249 | 1195 | |
1250 | 1196 | $o=OmegaWikiAttributes::getInstance(); |
1251 | 1197 | $editor = createTableViewer($attribute); |
1252 | 1198 | |
1253 | 1199 | if ($showRollBackOptions) { |
1254 | | - $rollBackEditor = new RollbackEditor($rollBackTranslatedContentAttribute, true); |
1255 | | - $rollBackEditor->setSuggestionsEditor(getTranslatedContentHistorySelector($translatedContentHistoryAttribute)); |
| 1200 | + $rollBackEditor = new RollbackEditor($o->rollBackTranslatedContent, true); |
| 1201 | + $rollBackEditor->setSuggestionsEditor(getTranslatedContentHistorySelector($o->translatedContentHistory)); |
1256 | 1202 | |
1257 | 1203 | $editor->addEditor($rollBackEditor); |
1258 | 1204 | } |
1259 | 1205 | |
1260 | | - $editor->addEditor(new ObjectPathEditor($objectIdAttribute)); |
1261 | | - $editor->addEditor(createDefinedMeaningReferenceViewer($attributeAttribute)); |
| 1206 | + $editor->addEditor(new ObjectPathEditor($o->objectId)); |
| 1207 | + $editor->addEditor(createDefinedMeaningReferenceViewer($o->attribute)); |
1262 | 1208 | $editor->addEditor(createLanguageViewer($o->language)); |
1263 | 1209 | $editor->addEditor(createLongTextViewer($o->text)); |
1264 | | - $editor->addEditor(createShortTextViewer($operationAttribute)); |
1265 | | - $editor->addEditor(createBooleanViewer($isLatestAttribute)); |
| 1210 | + $editor->addEditor(createShortTextViewer($o->operation)); |
| 1211 | + $editor->addEditor(createBooleanViewer($o->isLatest)); |
1266 | 1212 | |
1267 | 1213 | return $editor; |
1268 | 1214 | } |
1269 | 1215 | |
1270 | 1216 | function getUpdatedClassAttributesEditor($attribute, $showRollBackOptions) { |
1271 | | - global |
1272 | | - $classAttribute, $levelAttribute, $attributeAttribute, $typeAttribute, $operationAttribute, |
1273 | | - $isLatestAttribute, $rollBackAttribute; |
| 1217 | + |
| 1218 | + $o=OmegaWikiAttributes::getInstance(); |
1274 | 1219 | |
1275 | 1220 | $editor = createTableViewer($attribute); |
1276 | 1221 | |
1277 | 1222 | if ($showRollBackOptions) |
1278 | | - $editor->addEditor(new RollbackEditor($rollBackAttribute, false)); |
| 1223 | + $editor->addEditor(new RollbackEditor($o->rollBack, false)); |
1279 | 1224 | |
1280 | | - $editor->addEditor(createDefinedMeaningReferenceViewer($classAttribute)); |
1281 | | - $editor->addEditor(createDefinedMeaningReferenceViewer($levelAttribute)); |
1282 | | - $editor->addEditor(createDefinedMeaningReferenceViewer($attributeAttribute)); |
1283 | | - $editor->addEditor(createShortTextViewer($typeAttribute)); |
1284 | | - $editor->addEditor(createShortTextViewer($operationAttribute)); |
1285 | | - $editor->addEditor(createBooleanViewer($isLatestAttribute)); |
| 1225 | + $editor->addEditor(createDefinedMeaningReferenceViewer($o->class)); |
| 1226 | + $editor->addEditor(createDefinedMeaningReferenceViewer($o->level)); |
| 1227 | + $editor->addEditor(createDefinedMeaningReferenceViewer($o->attribute)); |
| 1228 | + $editor->addEditor(createShortTextViewer($o->type)); |
| 1229 | + $editor->addEditor(createShortTextViewer($o->operation)); |
| 1230 | + $editor->addEditor(createBooleanViewer($o->isLatest)); |
1286 | 1231 | |
1287 | 1232 | return $editor; |
1288 | 1233 | } |
— | — | @@ -1297,14 +1242,10 @@ |
1298 | 1243 | } |
1299 | 1244 | |
1300 | 1245 | function rollBackTransactions($recordSet) { |
| 1246 | + |
| 1247 | + $o=OmegaWikiAttributes::getInstance(); |
1301 | 1248 | global |
1302 | | - $wgRequest, $wgUser, |
1303 | | - $transactionIdAttribute, $updatesInTransactionAttribute, |
1304 | | - $updatedDefinitionAttribute, $updatedRelationsAttribute, $updatedClassMembershipAttribute, |
1305 | | - $updatedTranslatedTextAttribute, $updatedClassAttributesAttribute, $updatedTranslatedTextPropertyAttribute, |
1306 | | - $updatedLinkAttribute, $updatedTextAttribute, $updatedSyntransesAttribute, |
1307 | | - $updatedAlternativeDefinitionTextAttribute, $updatedAlternativeDefinitionsAttribute, |
1308 | | - $updatedCollectionMembershipAttribute; |
| 1249 | + $wgRequest, $wgUser; |
1309 | 1250 | |
1310 | 1251 | $summary = $wgRequest->getText('summary'); |
1311 | 1252 | startNewTransaction($wgUser->getID(), wfGetIP(), $summary); |
— | — | @@ -1315,69 +1256,69 @@ |
1316 | 1257 | for ($i = 0; $i < $recordSet->getRecordCount(); $i++) { |
1317 | 1258 | $transactionRecord = $recordSet->getRecord($i); |
1318 | 1259 | |
1319 | | - $transactionId = $transactionRecord->getAttributeValue($transactionIdAttribute); |
| 1260 | + $transactionId = $transactionRecord->transactionId; |
1320 | 1261 | $idStack->pushKey(simpleRecord($transactionKeyStructure, array($transactionId))); |
1321 | 1262 | |
1322 | | - $updatesInTransaction = $transactionRecord->getAttributeValue($updatesInTransactionAttribute); |
1323 | | - $idStack->pushAttribute($updatesInTransactionAttribute); |
| 1263 | + $updatesInTransaction = $transactionRecord->updatesInTransaction; |
| 1264 | + $idStack->pushAttribute($o->updatesInTransaction); |
1324 | 1265 | |
1325 | | - $updatedDefinitions = $updatesInTransaction->getAttributeValue($updatedDefinitionAttribute); |
1326 | | - $idStack->pushAttribute($updatedDefinitionAttribute); |
| 1266 | + $updatedDefinitions = $updatesInTransaction->updatedDefinition; |
| 1267 | + $idStack->pushAttribute($o->updatedDefinition); |
1327 | 1268 | rollBackDefinitions($idStack, $updatedDefinitions); |
1328 | 1269 | $idStack->popAttribute(); |
1329 | 1270 | |
1330 | | - $updatedRelations = $updatesInTransaction->getAttributeValue($updatedRelationsAttribute); |
1331 | | - $idStack->pushAttribute($updatedRelationsAttribute); |
| 1271 | + $updatedRelations = $updatesInTransaction->updatedRelations; |
| 1272 | + $idStack->pushAttribute($o->updatedRelations); |
1332 | 1273 | rollBackRelations($idStack, $updatedRelations); |
1333 | 1274 | $idStack->popAttribute(); |
1334 | 1275 | |
1335 | | - $updatedClassMemberships = $updatesInTransaction->getAttributeValue($updatedClassMembershipAttribute); |
1336 | | - $idStack->pushAttribute($updatedClassMembershipAttribute); |
| 1276 | + $updatedClassMemberships = $updatesInTransaction->updatedClassMembership; |
| 1277 | + $idStack->pushAttribute($o->updatedClassMembership); |
1337 | 1278 | rollBackClassMemberships($idStack, $updatedClassMemberships); |
1338 | 1279 | $idStack->popAttribute(); |
1339 | 1280 | |
1340 | | - $updatedClassAttributes = $updatesInTransaction->getAttributeValue($updatedClassAttributesAttribute); |
1341 | | - $idStack->pushAttribute($updatedClassAttributesAttribute); |
| 1281 | + $updatedClassAttributes = $updatesInTransaction->updatedClassAttributes; |
| 1282 | + $idStack->pushAttribute($o->updatedClassAttributes); |
1342 | 1283 | rollBackClassAttributes($idStack, $updatedClassAttributes); |
1343 | 1284 | $idStack->popAttribute(); |
1344 | 1285 | |
1345 | | - $updatedTranslatedTexts = $updatesInTransaction->getAttributeValue($updatedTranslatedTextAttribute); |
1346 | | - $idStack->pushAttribute($updatedTranslatedTextAttribute); |
| 1286 | + $updatedTranslatedTexts = $updatesInTransaction->updatedTranslatedText; |
| 1287 | + $idStack->pushAttribute($o->updatedTranslatedText); |
1347 | 1288 | rollBackTranslatedTexts($idStack, $updatedTranslatedTexts); |
1348 | 1289 | $idStack->popAttribute(); |
1349 | 1290 | |
1350 | | - $updatedTranslatedTextProperties = $updatesInTransaction->getAttributeValue($updatedTranslatedTextPropertyAttribute); |
1351 | | - $idStack->pushAttribute($updatedTranslatedTextPropertyAttribute); |
| 1291 | + $updatedTranslatedTextProperties = $updatesInTransaction->updatedTranslatedTextProperty; |
| 1292 | + $idStack->pushAttribute($o->updatedTranslatedTextProperty); |
1352 | 1293 | rollBackTranslatedTextProperties($idStack, $updatedTranslatedTextProperties); |
1353 | 1294 | $idStack->popAttribute(); |
1354 | 1295 | |
1355 | | - $updatedLinkAttributes = $updatesInTransaction->getAttributeValue($updatedLinkAttribute); |
1356 | | - $idStack->pushAttribute($updatedLinkAttribute); |
1357 | | - rollBackLinkAttributes($idStack, $updatedLinkAttributes); |
| 1296 | + $o->updatedLinks = $updatesInTransaction->updatedLink; |
| 1297 | + $idStack->pushAttribute($o->updatedLink); |
| 1298 | + rollBackLinkAttributes($idStack, $o->updatedLinks); |
1358 | 1299 | $idStack->popAttribute(); |
1359 | 1300 | |
1360 | | - $updatedTextAttributes = $updatesInTransaction->getAttributeValue($updatedTextAttribute); |
1361 | | - $idStack->pushAttribute($updatedTextAttribute); |
1362 | | - rollBackTextAttributes($idStack, $updatedTextAttributes); |
| 1301 | + $o->updatedTexts = $updatesInTransaction->updatedText; |
| 1302 | + $idStack->pushAttribute($o->updatedText); |
| 1303 | + rollBackTextAttributes($idStack, $o->updatedTexts); |
1363 | 1304 | $idStack->popAttribute(); |
1364 | 1305 | |
1365 | | - $updatedSyntranses = $updatesInTransaction->getAttributeValue($updatedSyntransesAttribute); |
1366 | | - $idStack->pushAttribute($updatedSyntransesAttribute); |
| 1306 | + $updatedSyntranses = $updatesInTransaction->updatedSyntranses; |
| 1307 | + $idStack->pushAttribute($o->updatedSyntranses); |
1367 | 1308 | rollBackSyntranses($idStack, $updatedSyntranses); |
1368 | 1309 | $idStack->popAttribute(); |
1369 | 1310 | |
1370 | | - $updatedAlternativeDefinitionTexts = $updatesInTransaction->getAttributeValue($updatedAlternativeDefinitionTextAttribute); |
1371 | | - $idStack->pushAttribute($updatedAlternativeDefinitionTextAttribute); |
| 1311 | + $updatedAlternativeDefinitionTexts = $updatesInTransaction->updatedAlternativeDefinitionText; |
| 1312 | + $idStack->pushAttribute($o->updatedAlternativeDefinitionText); |
1372 | 1313 | rollBackAlternativeDefinitionTexts($idStack, $updatedAlternativeDefinitionTexts); |
1373 | 1314 | $idStack->popAttribute(); |
1374 | 1315 | |
1375 | | - $updatedAlternativeDefinitions = $updatesInTransaction->getAttributeValue($updatedAlternativeDefinitionsAttribute); |
1376 | | - $idStack->pushAttribute($updatedAlternativeDefinitionsAttribute); |
| 1316 | + $updatedAlternativeDefinitions = $updatesInTransaction->updatedAlternativeDefinitions; |
| 1317 | + $idStack->pushAttribute($o->updatedAlternativeDefinitions); |
1377 | 1318 | rollBackAlternativeDefinitions($idStack, $updatedAlternativeDefinitions); |
1378 | 1319 | $idStack->popAttribute(); |
1379 | 1320 | |
1380 | | - $updatedCollectionMemberships = $updatesInTransaction->getAttributeValue($updatedCollectionMembershipAttribute); |
1381 | | - $idStack->pushAttribute($updatedCollectionMembershipAttribute); |
| 1321 | + $updatedCollectionMemberships = $updatesInTransaction->updatedCollectionMembership; |
| 1322 | + $idStack->pushAttribute($o->updatedCollectionMembership); |
1382 | 1323 | rollBackCollectionMemberships($idStack, $updatedCollectionMemberships); |
1383 | 1324 | $idStack->popAttribute(); |
1384 | 1325 | |
— | — | @@ -1395,35 +1336,34 @@ |
1396 | 1337 | } |
1397 | 1338 | |
1398 | 1339 | function getMeaningId($record, $referenceAttribute) { |
1399 | | - global |
1400 | | - $definedMeaningIdAttribute; |
| 1340 | + |
| 1341 | + $o=OmegaWikiAttributes::getInstance(); |
1401 | 1342 | |
1402 | | - return $record->getAttributeValue($referenceAttribute)->getAttributeValue($definedMeaningIdAttribute); |
| 1343 | + return $record->getAttributeValue($referenceAttribute)->definedMeaningId; |
1403 | 1344 | } |
1404 | 1345 | |
1405 | 1346 | function rollBackDefinitions($idStack, $definitions) { |
1406 | | - global |
1407 | | - $definedMeaningIdAttribute, $translatedContentIdAttribute, |
1408 | | - $isLatestAttribute, $operationAttribute, $rollBackTranslatedContentAttribute; |
| 1347 | + |
| 1348 | + $o=OmegaWikiAttributes::getInstance(); |
1409 | 1349 | |
1410 | 1350 | $definitionsKeyStructure = $definitions->getKey(); |
1411 | 1351 | |
1412 | 1352 | for ($i = 0; $i < $definitions->getRecordCount(); $i++) { |
1413 | 1353 | $definitionRecord = $definitions->getRecord($i); |
1414 | 1354 | |
1415 | | - $definedMeaningId = $definitionRecord->getAttributeValue($definedMeaningIdAttribute); |
| 1355 | + $definedMeaningId = $definitionRecord->definedMeaningId; |
1416 | 1356 | $languageId = $definitionRecord->language; |
1417 | | - $isLatest = $definitionRecord->getAttributeValue($isLatestAttribute); |
| 1357 | + $isLatest = $definitionRecord->isLatest; |
1418 | 1358 | |
1419 | 1359 | if ($isLatest) { |
1420 | 1360 | $idStack->pushKey(simpleRecord($definitionsKeyStructure, array($definedMeaningId, $languageId))); |
1421 | 1361 | |
1422 | 1362 | rollBackTranslatedContent( |
1423 | 1363 | $idStack, |
1424 | | - getRollBackAction($idStack, $rollBackTranslatedContentAttribute), |
1425 | | - $definitionRecord->getAttributeValue($translatedContentIdAttribute), |
| 1364 | + getRollBackAction($idStack, $o->rollBackTranslatedContent), |
| 1365 | + $definitionRecord->translatedContentId, |
1426 | 1366 | $languageId, |
1427 | | - $definitionRecord->getAttributeValue($operationAttribute) |
| 1367 | + $definitionRecord->operation |
1428 | 1368 | ); |
1429 | 1369 | |
1430 | 1370 | $idStack->popKey(); |
— | — | @@ -1432,28 +1372,27 @@ |
1433 | 1373 | } |
1434 | 1374 | |
1435 | 1375 | function rollBackTranslatedTexts($idStack, $translatedTexts) { |
1436 | | - global |
1437 | | - $valueIdAttribute, $translatedContentIdAttribute, |
1438 | | - $isLatestAttribute, $operationAttribute, $rollBackTranslatedContentAttribute; |
| 1376 | + |
| 1377 | + $o=OmegaWikiAttributes::getInstance(); |
1439 | 1378 | |
1440 | 1379 | $translatedTextsKeyStructure = $translatedTexts->getKey(); |
1441 | 1380 | |
1442 | 1381 | for ($i = 0; $i < $translatedTexts->getRecordCount(); $i++) { |
1443 | 1382 | $translatedTextRecord = $translatedTexts->getRecord($i); |
1444 | 1383 | |
1445 | | - $valueId = $translatedTextRecord->getAttributeValue($valueIdAttribute); |
| 1384 | + $valueId = $translatedTextRecord->valueId; |
1446 | 1385 | $languageId = $translatedTextRecord->language; |
1447 | | - $isLatest = $translatedTextRecord->getAttributeValue($isLatestAttribute); |
| 1386 | + $isLatest = $translatedTextRecord->isLatest; |
1448 | 1387 | |
1449 | 1388 | if ($isLatest) { |
1450 | 1389 | $idStack->pushKey(simpleRecord($translatedTextsKeyStructure, array($valueId, $languageId))); |
1451 | 1390 | |
1452 | 1391 | rollBackTranslatedContent( |
1453 | 1392 | $idStack, |
1454 | | - getRollBackAction($idStack, $rollBackTranslatedContentAttribute), |
1455 | | - $translatedTextRecord->getAttributeValue($translatedContentIdAttribute), |
| 1393 | + getRollBackAction($idStack, $o->rollBackTranslatedContent), |
| 1394 | + $translatedTextRecord->translatedContentId, |
1456 | 1395 | $languageId, |
1457 | | - $translatedTextRecord->getAttributeValue($operationAttribute) |
| 1396 | + $translatedTextRecord->operation |
1458 | 1397 | ); |
1459 | 1398 | |
1460 | 1399 | $idStack->popKey(); |
— | — | @@ -1462,12 +1401,12 @@ |
1463 | 1402 | } |
1464 | 1403 | |
1465 | 1404 | function rollBackTranslatedContent($idStack, $rollBackAction, $translatedContentId, $languageId, $operation) { |
1466 | | - global |
1467 | | - $rollBackTranslatedContentAttribute, $translatedContentHistoryAttribute; |
| 1405 | + |
| 1406 | + $o=OmegaWikiAttributes::getInstance(); |
1468 | 1407 | |
1469 | 1408 | if ($rollBackAction == 'previous-version') { |
1470 | | - $idStack->pushAttribute($rollBackTranslatedContentAttribute); |
1471 | | - $idStack->pushAttribute($translatedContentHistoryAttribute); |
| 1409 | + $idStack->pushAttribute($o->rollBackTranslatedContent); |
| 1410 | + $idStack->pushAttribute($o->translatedContentHistory); |
1472 | 1411 | |
1473 | 1412 | $version = (int) $_POST[$idStack->getId()]; |
1474 | 1413 | |
— | — | @@ -1507,28 +1446,27 @@ |
1508 | 1447 | } |
1509 | 1448 | |
1510 | 1449 | function rollBackRelations($idStack, $relations) { |
1511 | | - global |
1512 | | - $relationIdAttribute, $isLatestAttribute, $firstMeaningAttribute, $secondMeaningAttribute, $relationTypeAttribute, |
1513 | | - $operationAttribute, $rollBackAttribute; |
| 1450 | + |
| 1451 | + $o=OmegaWikiAttributes::getInstance(); |
1514 | 1452 | |
1515 | 1453 | $relationsKeyStructure = $relations->getKey(); |
1516 | 1454 | |
1517 | 1455 | for ($i = 0; $i < $relations->getRecordCount(); $i++) { |
1518 | 1456 | $relationRecord = $relations->getRecord($i); |
1519 | 1457 | |
1520 | | - $relationId = $relationRecord->getAttributeValue($relationIdAttribute); |
1521 | | - $isLatest = $relationRecord->getAttributeValue($isLatestAttribute); |
| 1458 | + $relationId = $relationRecord->relationId; |
| 1459 | + $isLatest = $relationRecord->isLatest; |
1522 | 1460 | |
1523 | 1461 | if ($isLatest) { |
1524 | 1462 | $idStack->pushKey(simpleRecord($relationsKeyStructure, array($relationId))); |
1525 | 1463 | |
1526 | 1464 | rollBackRelation( |
1527 | | - getRollBackAction($idStack, $rollBackAttribute), |
| 1465 | + getRollBackAction($idStack, $o->rollBack), |
1528 | 1466 | $relationId, |
1529 | | - getMeaningId($relationRecord, $firstMeaningAttribute), |
1530 | | - getMeaningId($relationRecord, $relationTypeAttribute), |
1531 | | - getMeaningId($relationRecord, $secondMeaningAttribute), |
1532 | | - $relationRecord->getAttributeValue($operationAttribute) |
| 1467 | + getMeaningId($relationRecord, $o->firstMeaning), |
| 1468 | + getMeaningId($relationRecord, $o->relationType), |
| 1469 | + getMeaningId($relationRecord, $o->secondMeaning), |
| 1470 | + $relationRecord->operation |
1533 | 1471 | ); |
1534 | 1472 | |
1535 | 1473 | $idStack->popKey(); |
— | — | @@ -1552,27 +1490,26 @@ |
1553 | 1491 | } |
1554 | 1492 | |
1555 | 1493 | function rollBackClassMemberships($idStack, $classMemberships) { |
1556 | | - global |
1557 | | - $classMembershipIdAttribute, $isLatestAttribute, $classAttribute, $classMemberAttribute, |
1558 | | - $operationAttribute, $rollBackAttribute; |
| 1494 | + |
| 1495 | + $o=OmegaWikiAttributes::getInstance(); |
1559 | 1496 | |
1560 | 1497 | $classMembershipsKeyStructure = $classMemberships->getKey(); |
1561 | 1498 | |
1562 | 1499 | for ($i = 0; $i < $classMemberships->getRecordCount(); $i++) { |
1563 | 1500 | $classMembershipRecord = $classMemberships->getRecord($i); |
1564 | 1501 | |
1565 | | - $classMembershipId = $classMembershipRecord->getAttributeValue($classMembershipIdAttribute); |
1566 | | - $isLatest = $classMembershipRecord->getAttributeValue($isLatestAttribute); |
| 1502 | + $classMembershipId = $classMembershipRecord->classMembershipId; |
| 1503 | + $isLatest = $classMembershipRecord->isLatest; |
1567 | 1504 | |
1568 | 1505 | if ($isLatest) { |
1569 | 1506 | $idStack->pushKey(simpleRecord($classMembershipsKeyStructure, array($classMembershipId))); |
1570 | 1507 | |
1571 | 1508 | rollBackClassMembership( |
1572 | | - getRollBackAction($idStack, $rollBackAttribute), |
| 1509 | + getRollBackAction($idStack, $o->rollBack), |
1573 | 1510 | $classMembershipId, |
1574 | | - getMeaningId($classMembershipRecord, $classAttribute), |
1575 | | - getMeaningId($classMembershipRecord, $classMemberAttribute), |
1576 | | - $classMembershipRecord->getAttributeValue($operationAttribute) |
| 1511 | + getMeaningId($classMembershipRecord, $o->class), |
| 1512 | + getMeaningId($classMembershipRecord, $o->classMember), |
| 1513 | + $classMembershipRecord->operation |
1577 | 1514 | ); |
1578 | 1515 | |
1579 | 1516 | $idStack->popKey(); |
— | — | @@ -1588,29 +1525,28 @@ |
1589 | 1526 | } |
1590 | 1527 | |
1591 | 1528 | function rollBackClassAttributes($idStack, $classAttributes) { |
1592 | | - global |
1593 | | - $isLatestAttribute, $classAttribute, $levelAttribute, $attributeAttribute, $typeAttribute, |
1594 | | - $operationAttribute, $classAttributeIdAttribute, $rollBackAttribute; |
| 1529 | + |
| 1530 | + $o=OmegaWikiAttributes::getInstance(); |
1595 | 1531 | |
1596 | | - $classAttributesKeyStructure = $classAttributes->getKey(); |
| 1532 | + $o->classsKeyStructure = $o->classs->getKey(); |
1597 | 1533 | |
1598 | | - for ($i = 0; $i < $classAttributes->getRecordCount(); $i++) { |
1599 | | - $classAttributeRecord = $classAttributes->getRecord($i); |
| 1534 | + for ($i = 0; $i < $o->classs->getRecordCount(); $i++) { |
| 1535 | + $o->classRecord = $o->classs->getRecord($i); |
1600 | 1536 | |
1601 | | - $classAttributeId = $classAttributeRecord->getAttributeValue($classAttributeIdAttribute); |
1602 | | - $isLatest = $classAttributeRecord->getAttributeValue($isLatestAttribute); |
| 1537 | + $o->classId = $o->classRecord->classIdAttribute; |
| 1538 | + $isLatest = $o->classRecord->isLatest; |
1603 | 1539 | |
1604 | 1540 | if ($isLatest) { |
1605 | | - $idStack->pushKey(simpleRecord($classAttributesKeyStructure, array($classAttributeId))); |
| 1541 | + $idStack->pushKey(simpleRecord($o->classsKeyStructure, array($o->classId))); |
1606 | 1542 | |
1607 | 1543 | rollBackClassAttribute( |
1608 | | - getRollBackAction($idStack, $rollBackAttribute), |
1609 | | - $classAttributeId, |
1610 | | - getMeaningId($classAttributeRecord, $classAttribute), |
1611 | | - getMeaningId($classAttributeRecord, $levelAttribute), |
1612 | | - getMeaningId($classAttributeRecord, $attributeAttribute), |
1613 | | - $classAttributeRecord->getAttributeValue($typeAttribute), |
1614 | | - $classAttributeRecord->getAttributeValue($operationAttribute) |
| 1544 | + getRollBackAction($idStack, $o->rollBack), |
| 1545 | + $o->classId, |
| 1546 | + getMeaningId($o->classRecord, $o->class), |
| 1547 | + getMeaningId($o->classRecord, $o->level), |
| 1548 | + getMeaningId($o->classRecord, $o->attribute), |
| 1549 | + $o->classRecord->type, |
| 1550 | + $o->classRecord->operation |
1615 | 1551 | ); |
1616 | 1552 | |
1617 | 1553 | $idStack->popKey(); |
— | — | @@ -1626,28 +1562,27 @@ |
1627 | 1563 | } |
1628 | 1564 | |
1629 | 1565 | function rollBackTranslatedTextProperties($idStack, $translatedTextProperties) { |
1630 | | - global |
1631 | | - $isLatestAttribute, $operationAttribute, $rollBackAttribute, |
1632 | | - $valueIdAttribute, $objectIdAttribute, $attributeAttribute, $translatedContentIdAttribute; |
| 1566 | + |
| 1567 | + $o=OmegaWikiAttributes::getInstance(); |
1633 | 1568 | |
1634 | 1569 | $translatedTextPropertiesKeyStructure = $translatedTextProperties->getKey(); |
1635 | 1570 | |
1636 | 1571 | for ($i = 0; $i < $translatedTextProperties->getRecordCount(); $i++) { |
1637 | 1572 | $translatedTextPropertyRecord = $translatedTextProperties->getRecord($i); |
1638 | 1573 | |
1639 | | - $valueId = $translatedTextPropertyRecord->getAttributeValue($valueIdAttribute); |
1640 | | - $isLatest = $translatedTextPropertyRecord->getAttributeValue($isLatestAttribute); |
| 1574 | + $valueId = $translatedTextPropertyRecord->valueId; |
| 1575 | + $isLatest = $translatedTextPropertyRecord->isLatest; |
1641 | 1576 | |
1642 | 1577 | if ($isLatest) { |
1643 | 1578 | $idStack->pushKey(simpleRecord($translatedTextPropertiesKeyStructure, array($valueId))); |
1644 | 1579 | |
1645 | 1580 | rollBackTranslatedTextProperty( |
1646 | | - getRollBackAction($idStack, $rollBackAttribute), |
| 1581 | + getRollBackAction($idStack, $o->rollBack), |
1647 | 1582 | $valueId, |
1648 | | - $translatedTextPropertyRecord->getAttributeValue($objectIdAttribute), |
1649 | | - getMeaningId($translatedTextPropertyRecord, $attributeAttribute), |
1650 | | - $translatedTextPropertyRecord->getAttributeValue($translatedContentIdAttribute), |
1651 | | - $translatedTextPropertyRecord->getAttributeValue($operationAttribute) |
| 1583 | + $translatedTextPropertyRecord->objectId, |
| 1584 | + getMeaningId($translatedTextPropertyRecord, $o->attribute), |
| 1585 | + $translatedTextPropertyRecord->translatedContentId, |
| 1586 | + $translatedTextPropertyRecord->operation |
1652 | 1587 | ); |
1653 | 1588 | |
1654 | 1589 | $idStack->popKey(); |
— | — | @@ -1663,31 +1598,29 @@ |
1664 | 1599 | } |
1665 | 1600 | |
1666 | 1601 | function rollBackLinkAttributes($idStack, $linkAttributes) { |
1667 | | - global |
1668 | | - $isLatestAttribute, $operationAttribute, $rollBackAttribute, $linkAttribute, |
1669 | | - $valueIdAttribute, $objectIdAttribute, $attributeAttribute, $translatedContentIdAttribute, |
1670 | | - $linkURLAttribute, $linkLabelAttribute; |
| 1602 | + |
| 1603 | + $o=OmegaWikiAttributes::getInstance(); |
1671 | 1604 | |
1672 | | - $linkAttributesKeyStructure = $linkAttributes->getKey(); |
| 1605 | + $o->linksKeyStructure = $o->links->getKey(); |
1673 | 1606 | |
1674 | | - for ($i = 0; $i < $linkAttributes->getRecordCount(); $i++) { |
1675 | | - $linkAttributeRecord = $linkAttributes->getRecord($i); |
| 1607 | + for ($i = 0; $i < $o->links->getRecordCount(); $i++) { |
| 1608 | + $o->linkRecord = $o->links->getRecord($i); |
1676 | 1609 | |
1677 | | - $valueId = $linkAttributeRecord->getAttributeValue($valueIdAttribute); |
1678 | | - $isLatest = $linkAttributeRecord->getAttributeValue($isLatestAttribute); |
| 1610 | + $valueId = $o->linkRecord->valueId; |
| 1611 | + $isLatest = $o->linkRecord->isLatest; |
1679 | 1612 | |
1680 | 1613 | if ($isLatest) { |
1681 | | - $idStack->pushKey(simpleRecord($linkAttributesKeyStructure, array($valueId))); |
1682 | | - $link = $linkAttributeRecord->getAttributeValue($linkAttribute); |
| 1614 | + $idStack->pushKey(simpleRecord($o->linksKeyStructure, array($valueId))); |
| 1615 | + $link = $o->linkRecord->link; |
1683 | 1616 | |
1684 | 1617 | rollBackLinkAttribute( |
1685 | | - getRollBackAction($idStack, $rollBackAttribute), |
| 1618 | + getRollBackAction($idStack, $o->rollBack), |
1686 | 1619 | $valueId, |
1687 | | - $linkAttributeRecord->getAttributeValue($objectIdAttribute), |
1688 | | - getMeaningId($linkAttributeRecord, $attributeAttribute), |
1689 | | - $link->getAttributeValue($linkURLAttribute), |
1690 | | - $link->getAttributeValue($linkLabelAttribute), |
1691 | | - $linkAttributeRecord->getAttributeValue($operationAttribute) |
| 1620 | + $o->linkRecord->objectId, |
| 1621 | + getMeaningId($o->linkRecord, $o->attribute), |
| 1622 | + $link->linkURL, |
| 1623 | + $link->linkLabel, |
| 1624 | + $o->linkRecord->operation |
1692 | 1625 | ); |
1693 | 1626 | |
1694 | 1627 | $idStack->popKey(); |
— | — | @@ -1703,28 +1636,27 @@ |
1704 | 1637 | } |
1705 | 1638 | |
1706 | 1639 | function rollBackTextAttributes($idStack, $textAttributes) { |
1707 | | - global |
1708 | | - $isLatestAttribute, $operationAttribute, $rollBackAttribute, |
1709 | | - $valueIdAttribute, $objectIdAttribute, $attributeAttribute, $translatedContentIdAttribute; |
| 1640 | + |
| 1641 | + $o=OmegaWikiAttributes::getInstance(); |
1710 | 1642 | |
1711 | 1643 | $textAttributesKeyStructure = $textAttributes->getKey(); |
1712 | 1644 | |
1713 | 1645 | for ($i = 0; $i < $textAttributes->getRecordCount(); $i++) { |
1714 | 1646 | $textAttributeRecord = $textAttributes->getRecord($i); |
1715 | 1647 | |
1716 | | - $valueId = $textAttributeRecord->getAttributeValue($valueIdAttribute); |
1717 | | - $isLatest = $textAttributeRecord->getAttributeValue($isLatestAttribute); |
| 1648 | + $valueId = $textAttributeRecord->valueId; |
| 1649 | + $isLatest = $textAttributeRecord->isLatest; |
1718 | 1650 | |
1719 | 1651 | if ($isLatest) { |
1720 | 1652 | $idStack->pushKey(simpleRecord($textAttributesKeyStructure, array($valueId))); |
1721 | 1653 | |
1722 | 1654 | rollBackTextAttribute( |
1723 | | - getRollBackAction($idStack, $rollBackAttribute), |
| 1655 | + getRollBackAction($idStack, $o->rollBack), |
1724 | 1656 | $valueId, |
1725 | | - $textAttributeRecord->getAttributeValue($objectIdAttribute), |
1726 | | - getMeaningId($textAttributeRecord, $attributeAttribute), |
| 1657 | + $textAttributeRecord->objectId, |
| 1658 | + getMeaningId($textAttributeRecord, $o->attribute), |
1727 | 1659 | $textAttributeRecord->text, |
1728 | | - $textAttributeRecord->getAttributeValue($operationAttribute) |
| 1660 | + $textAttributeRecord->operation |
1729 | 1661 | ); |
1730 | 1662 | |
1731 | 1663 | $idStack->popKey(); |
— | — | @@ -1740,28 +1672,27 @@ |
1741 | 1673 | } |
1742 | 1674 | |
1743 | 1675 | function rollBackSyntranses($idStack, $syntranses) { |
1744 | | - global |
1745 | | - $isLatestAttribute, $operationAttribute, $rollBackAttribute, $syntransIdAttribute, $identicalMeaningAttribute, |
1746 | | - $expressionAttribute, $definedMeaningIdAttribute, $expressionIdAttribute; |
| 1676 | + |
| 1677 | + $o=OmegaWikiAttributes::getInstance(); |
1747 | 1678 | |
1748 | 1679 | $syntransesKeyStructure = $syntranses->getKey(); |
1749 | 1680 | |
1750 | 1681 | for ($i = 0; $i < $syntranses->getRecordCount(); $i++) { |
1751 | 1682 | $syntransRecord = $syntranses->getRecord($i); |
1752 | 1683 | |
1753 | | - $syntransId = $syntransRecord->getAttributeValue($syntransIdAttribute); |
1754 | | - $isLatest = $syntransRecord->getAttributeValue($isLatestAttribute); |
| 1684 | + $syntransId = $syntransRecord->syntransId; |
| 1685 | + $isLatest = $syntransRecord->isLatest; |
1755 | 1686 | |
1756 | 1687 | if ($isLatest) { |
1757 | 1688 | $idStack->pushKey(simpleRecord($syntransesKeyStructure, array($syntransId))); |
1758 | 1689 | |
1759 | 1690 | rollBackSyntrans( |
1760 | | - getRollBackAction($idStack, $rollBackAttribute), |
| 1691 | + getRollBackAction($idStack, $o->rollBack), |
1761 | 1692 | $syntransId, |
1762 | | - $syntransRecord->getAttributeValue($definedMeaningIdAttribute), |
1763 | | - $syntransRecord->getAttributeValue($expressionIdAttribute), |
1764 | | - $syntransRecord->getAttributeValue($identicalMeaningAttribute), |
1765 | | - $syntransRecord->getAttributeValue($operationAttribute) |
| 1693 | + $syntransRecord->definedMeaningId, |
| 1694 | + $syntransRecord->expressionId, |
| 1695 | + $syntransRecord->identicalMeaning, |
| 1696 | + $syntransRecord->operation |
1766 | 1697 | ); |
1767 | 1698 | |
1768 | 1699 | $idStack->popKey(); |
— | — | @@ -1777,28 +1708,27 @@ |
1778 | 1709 | } |
1779 | 1710 | |
1780 | 1711 | function rollBackAlternativeDefinitionTexts($idStack, $alternativeDefinitionTexts) { |
1781 | | - global |
1782 | | - $definedMeaningIdAttribute, $translatedContentIdAttribute, |
1783 | | - $isLatestAttribute, $operationAttribute, $rollBackTranslatedContentAttribute; |
| 1712 | + |
| 1713 | + $o=OmegaWikiAttributes::getInstance(); |
1784 | 1714 | |
1785 | 1715 | $alternativeDefinitionTextsKeyStructure = $alternativeDefinitionTexts->getKey(); |
1786 | 1716 | |
1787 | 1717 | for ($i = 0; $i < $alternativeDefinitionTexts->getRecordCount(); $i++) { |
1788 | 1718 | $alternativeDefinitionTextRecord = $alternativeDefinitionTexts->getRecord($i); |
1789 | 1719 | |
1790 | | - $translatedContentId = $alternativeDefinitionTextRecord->getAttributeValue($translatedContentIdAttribute); |
| 1720 | + $translatedContentId = $alternativeDefinitionTextRecord->translatedContentId; |
1791 | 1721 | $languageId = $alternativeDefinitionTextRecord->language; |
1792 | | - $isLatest = $alternativeDefinitionTextRecord->getAttributeValue($isLatestAttribute); |
| 1722 | + $isLatest = $alternativeDefinitionTextRecord->isLatest; |
1793 | 1723 | |
1794 | 1724 | if ($isLatest) { |
1795 | 1725 | $idStack->pushKey(simpleRecord($alternativeDefinitionTextsKeyStructure, array($translatedContentId, $languageId))); |
1796 | 1726 | |
1797 | 1727 | rollBackTranslatedContent( |
1798 | 1728 | $idStack, |
1799 | | - getRollBackAction($idStack, $rollBackTranslatedContentAttribute), |
| 1729 | + getRollBackAction($idStack, $o->rollBackTranslatedContent), |
1800 | 1730 | $translatedContentId, |
1801 | 1731 | $languageId, |
1802 | | - $alternativeDefinitionTextRecord->getAttributeValue($operationAttribute) |
| 1732 | + $alternativeDefinitionTextRecord->operation |
1803 | 1733 | ); |
1804 | 1734 | |
1805 | 1735 | $idStack->popKey(); |
— | — | @@ -1807,28 +1737,27 @@ |
1808 | 1738 | } |
1809 | 1739 | |
1810 | 1740 | function rollBackAlternativeDefinitions($idStack, $alternativeDefinitions) { |
1811 | | - global |
1812 | | - $isLatestAttribute, $operationAttribute, $rollBackAttribute, |
1813 | | - $definedMeaningIdAttribute, $translatedContentIdAttribute, $sourceAttribute; |
| 1741 | + |
| 1742 | + $o=OmegaWikiAttributes::getInstance(); |
1814 | 1743 | |
1815 | 1744 | $alternativeDefinitionsKeyStructure = $alternativeDefinitions->getKey(); |
1816 | 1745 | |
1817 | 1746 | for ($i = 0; $i < $alternativeDefinitions->getRecordCount(); $i++) { |
1818 | 1747 | $alternativeDefinitionRecord = $alternativeDefinitions->getRecord($i); |
1819 | 1748 | |
1820 | | - $definedMeaningId = $alternativeDefinitionRecord->getAttributeValue($definedMeaningIdAttribute); |
1821 | | - $translatedContentId = $alternativeDefinitionRecord->getAttributeValue($translatedContentIdAttribute); |
1822 | | - $isLatest = $alternativeDefinitionRecord->getAttributeValue($isLatestAttribute); |
| 1749 | + $definedMeaningId = $alternativeDefinitionRecord->definedMeaningId; |
| 1750 | + $translatedContentId = $alternativeDefinitionRecord->translatedContentId; |
| 1751 | + $isLatest = $alternativeDefinitionRecord->isLatest; |
1823 | 1752 | |
1824 | 1753 | if ($isLatest) { |
1825 | 1754 | $idStack->pushKey(simpleRecord($alternativeDefinitionsKeyStructure, array($definedMeaningId, $translatedContentId))); |
1826 | 1755 | |
1827 | 1756 | rollBackAlternativeDefinition( |
1828 | | - getRollBackAction($idStack, $rollBackAttribute), |
| 1757 | + getRollBackAction($idStack, $o->rollBack), |
1829 | 1758 | $definedMeaningId, |
1830 | 1759 | $translatedContentId, |
1831 | | - getMeaningId($alternativeDefinitionRecord, $sourceAttribute), |
1832 | | - $alternativeDefinitionRecord->getAttributeValue($operationAttribute) |
| 1760 | + getMeaningId($alternativeDefinitionRecord, $o->source), |
| 1761 | + $alternativeDefinitionRecord->operation |
1833 | 1762 | ); |
1834 | 1763 | |
1835 | 1764 | $idStack->popKey(); |
— | — | @@ -1844,29 +1773,27 @@ |
1845 | 1774 | } |
1846 | 1775 | |
1847 | 1776 | function rollBackCollectionMemberships($idStack, $collectionMemberships) { |
1848 | | - global |
1849 | | - $classMembershipIdAttribute, $isLatestAttribute, $collectionIdAttribute, |
1850 | | - $collectionMemberIdAttribute, $sourceIdentifierAttribute, |
1851 | | - $operationAttribute, $rollBackAttribute; |
| 1777 | + |
| 1778 | + $o=OmegaWikiAttributes::getInstance(); |
1852 | 1779 | |
1853 | 1780 | $collectionMembershipsKeyStructure = $collectionMemberships->getKey(); |
1854 | 1781 | |
1855 | 1782 | for ($i = 0; $i < $collectionMemberships->getRecordCount(); $i++) { |
1856 | 1783 | $collectionMembershipRecord = $collectionMemberships->getRecord($i); |
1857 | 1784 | |
1858 | | - $collectionId = $collectionMembershipRecord->getAttributeValue($collectionIdAttribute); |
1859 | | - $collectionMemberId = $collectionMembershipRecord->getAttributeValue($collectionMemberIdAttribute); |
1860 | | - $isLatest = $collectionMembershipRecord->getAttributeValue($isLatestAttribute); |
| 1785 | + $collectionId = $collectionMembershipRecord->collectionId; |
| 1786 | + $collectionMemberId = $collectionMembershipRecord->collectionMemberId; |
| 1787 | + $isLatest = $collectionMembershipRecord->isLatest; |
1861 | 1788 | |
1862 | 1789 | if ($isLatest) { |
1863 | 1790 | $idStack->pushKey(simpleRecord($collectionMembershipsKeyStructure, array($collectionId, $collectionMemberId))); |
1864 | 1791 | |
1865 | 1792 | rollBackCollectionMembership( |
1866 | | - getRollBackAction($idStack, $rollBackAttribute), |
| 1793 | + getRollBackAction($idStack, $o->rollBack), |
1867 | 1794 | $collectionId, |
1868 | 1795 | $collectionMemberId, |
1869 | | - $collectionMembershipRecord->getAttributeValue($sourceIdentifierAttribute), |
1870 | | - $collectionMembershipRecord->getAttributeValue($operationAttribute) |
| 1796 | + $collectionMembershipRecord->sourceIdentifier, |
| 1797 | + $collectionMembershipRecord->operation |
1871 | 1798 | ); |
1872 | 1799 | |
1873 | 1800 | $idStack->popKey(); |
Index: trunk/extensions/Wikidata/OmegaWiki/Search.php |
— | — | @@ -43,8 +43,10 @@ |
44 | 44 | } |
45 | 45 | |
46 | 46 | function getSearchResultAsRecordSet($queryResult) { |
| 47 | + |
| 48 | + $o=OmegaWikiAttributes::getInstance(); |
47 | 49 | global |
48 | | - $definedMeaningIdAttribute, $definedMeaningReferenceType; |
| 50 | + $definedMeaningReferenceType; |
49 | 51 | |
50 | 52 | $dbr =& wfGetDB(DB_SLAVE); |
51 | 53 | $spellingAttribute = new Attribute("found-word", "Found word", "short-text"); |
— | — | @@ -59,7 +61,7 @@ |
60 | 62 | $meaningStructure = new Structure($definedMeaningAttribute, $definitionAttribute); |
61 | 63 | $meaningAttribute = new Attribute("meaning", "Meaning", $meaningStructure); |
62 | 64 | |
63 | | - $recordSet = new ArrayRecordSet(new Structure($definedMeaningIdAttribute, $expressionAttribute, $meaningAttribute), new Structure($definedMeaningIdAttribute)); |
| 65 | + $recordSet = new ArrayRecordSet(new Structure($o->definedMeaningId, $expressionAttribute, $meaningAttribute), new Structure($o->definedMeaningId)); |
64 | 66 | |
65 | 67 | while ($row = $dbr->fetchObject($queryResult)) { |
66 | 68 | $expressionRecord = new ArrayRecord($expressionStructure); |
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiEditors.php |
— | — | @@ -42,10 +42,10 @@ |
43 | 43 | foreach ($viewInformation->getPropertyToColumnFilters() as $propertyToColumnFilter) |
44 | 44 | $this->recordSetTableEditor->addEditor(new DummyViewer($propertyToColumnFilter->getAttribute())); |
45 | 45 | |
46 | | - global |
47 | | - $objectAttributesAttribute; |
| 46 | + |
| 47 | + $o=OmegaWikiAttributes::getInstance(); |
48 | 48 | |
49 | | - $this->recordSetTableEditor->addEditor(new DummyViewer($objectAttributesAttribute)); |
| 49 | + $this->recordSetTableEditor->addEditor(new DummyViewer($o->objectAttributes)); |
50 | 50 | addTableMetadataEditors($this->recordSetTableEditor, $viewInformation); |
51 | 51 | } |
52 | 52 | |
— | — | @@ -179,12 +179,14 @@ |
180 | 180 | } |
181 | 181 | |
182 | 182 | function initializeObjectAttributeEditors(ViewInformation $viewInformation) { |
| 183 | + |
| 184 | + $o=OmegaWikiAttributes::getInstance(); |
183 | 185 | global |
184 | | - $objectAttributesAttribute, $definedMeaningIdAttribute, |
185 | | - $textValueObjectAttributesEditors, $textAttributeIdAttribute, |
186 | | - $linkValueObjectAttributesEditors, $linkAttributeIdAttribute, |
187 | | - $translatedTextValueObjectAttributesEditors, $translatedTextAttributeIdAttribute, |
188 | | - $optionValueObjectAttributesEditors, $optionAttributeIdAttribute, $annotationMeaningName, |
| 186 | + |
| 187 | + $textValueObjectAttributesEditors, |
| 188 | + $linkValueObjectAttributesEditors, |
| 189 | + $translatedTextValueObjectAttributesEditors, |
| 190 | + $optionValueObjectAttributesEditors, $annotationMeaningName, |
189 | 191 | $wgPropertyAttributeName; |
190 | 192 | |
191 | 193 | $linkValueObjectAttributesEditors = array(); |
— | — | @@ -202,54 +204,56 @@ |
203 | 205 | $optionValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $viewInformation); |
204 | 206 | } |
205 | 207 | |
206 | | - $textValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($objectAttributesAttribute, $wgPropertyAttributeName, $viewInformation); |
207 | | - $linkValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($objectAttributesAttribute, $wgPropertyAttributeName, $viewInformation); |
208 | | - $translatedTextValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($objectAttributesAttribute, $wgPropertyAttributeName, $viewInformation); |
209 | | - $optionValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($objectAttributesAttribute, $wgPropertyAttributeName, $viewInformation); |
| 208 | + $textValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($o->objectAttributes, $wgPropertyAttributeName, $viewInformation); |
| 209 | + $linkValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($o->objectAttributes, $wgPropertyAttributeName, $viewInformation); |
| 210 | + $translatedTextValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($o->objectAttributes, $wgPropertyAttributeName, $viewInformation); |
| 211 | + $optionValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($o->objectAttributes, $wgPropertyAttributeName, $viewInformation); |
210 | 212 | |
211 | 213 | foreach ($textValueObjectAttributesEditors as $textValueObjectAttributesEditor) |
212 | | - addObjectAttributesEditors($textValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $textAttributeIdAttribute), $annotationMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute)); |
| 214 | + addObjectAttributesEditors($textValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $o->textAttributeId), $annotationMeaningName, new ObjectIdFetcher(1, $o->definedMeaningId)); |
213 | 215 | |
214 | 216 | foreach ($linkValueObjectAttributesEditors as $linkValueObjectAttributesEditor) |
215 | | - addObjectAttributesEditors($linkValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $linkAttributeIdAttribute), $annotationMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute)); |
| 217 | + addObjectAttributesEditors($linkValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $o->linkAttributeId), $annotationMeaningName, new ObjectIdFetcher(1, $o->definedMeaningId)); |
216 | 218 | |
217 | 219 | foreach ($translatedTextValueObjectAttributesEditors as $translatedTextValueObjectAttributesEditor) |
218 | | - addObjectAttributesEditors($translatedTextValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $translatedTextAttributeIdAttribute), $annotationMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute)); |
| 220 | + addObjectAttributesEditors($translatedTextValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $o->translatedTextAttributeId), $annotationMeaningName, new ObjectIdFetcher(1, $o->definedMeaningId)); |
219 | 221 | |
220 | 222 | foreach ($optionValueObjectAttributesEditors as $optionValueObjectAttributesEditor) |
221 | | - addObjectAttributesEditors($optionValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $optionAttributeIdAttribute), $annotationMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute)); |
| 223 | + addObjectAttributesEditors($optionValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $o->optionAttributeId), $annotationMeaningName, new ObjectIdFetcher(1, $o->definedMeaningId)); |
222 | 224 | } |
223 | 225 | |
224 | 226 | function getTransactionEditor(Attribute $attribute) { |
225 | | - global |
226 | | - $userAttribute, $timestampAttribute; |
227 | 227 | |
| 228 | + $o=OmegaWikiAttributes::getInstance(); |
| 229 | + |
228 | 230 | $transactionEditor = new RecordTableCellEditor($attribute); |
229 | | - $transactionEditor->addEditor(createUserViewer($userAttribute)); |
230 | | - $transactionEditor->addEditor(new TimestampEditor($timestampAttribute, new SimplePermissionController(false), true)); |
| 231 | + $transactionEditor->addEditor(createUserViewer($o->user)); |
| 232 | + $transactionEditor->addEditor(new TimestampEditor($o->timestamp, new SimplePermissionController(false), true)); |
231 | 233 | |
232 | 234 | return $transactionEditor; |
233 | 235 | } |
234 | 236 | |
235 | 237 | function createTableLifeSpanEditor(Attribute $attribute) { |
236 | | - global |
237 | | - $addTransactionAttribute, $removeTransactionAttribute; |
| 238 | + |
| 239 | + $o=OmegaWikiAttributes::getInstance(); |
238 | 240 | |
239 | 241 | $result = new RecordTableCellEditor($attribute); |
240 | | - $result->addEditor(getTransactionEditor($addTransactionAttribute)); |
241 | | - $result->addEditor(getTransactionEditor($removeTransactionAttribute)); |
| 242 | + $result->addEditor(getTransactionEditor($o->addTransaction)); |
| 243 | + $result->addEditor(getTransactionEditor($o->removeTransaction)); |
242 | 244 | |
243 | 245 | return $result; |
244 | 246 | } |
245 | 247 | |
246 | 248 | function getTableLifeSpanEditor($showRecordLifeSpan) { |
| 249 | + |
| 250 | + $o=OmegaWikiAttributes::getInstance(); |
247 | 251 | global |
248 | | - $recordLifeSpanAttribute, $addTransactionAttribute, $removeTransactionAttribute, $wgRequest; |
| 252 | + $wgRequest; |
249 | 253 | |
250 | 254 | $result = array(); |
251 | 255 | |
252 | 256 | if ($wgRequest->getText('action') == 'history' && $showRecordLifeSpan) |
253 | | - $result[] = createTableLifeSpanEditor($recordLifeSpanAttribute); |
| 257 | + $result[] = createTableLifeSpanEditor($o->recordLifeSpan); |
254 | 258 | |
255 | 259 | return $result; |
256 | 260 | } |
— | — | @@ -266,14 +270,16 @@ |
267 | 271 | } |
268 | 272 | |
269 | 273 | function getDefinitionEditor(ViewInformation $viewInformation) { |
| 274 | + |
| 275 | + $o=OmegaWikiAttributes::getInstance(); |
270 | 276 | global |
271 | | - $definitionAttribute, $translatedTextAttribute, $wgPopupAnnotationName, |
272 | | - $objectAttributesAttribute, $definedMeaningIdAttribute, $definitionMeaningName, $objectAttributesAttribute, |
| 277 | + $wgPopupAnnotationName, |
| 278 | + $definitionMeaningName, |
273 | 279 | $wgPropertyAttributeName; |
274 | 280 | |
275 | | - $editor = new RecordDivListEditor($definitionAttribute); |
| 281 | + $editor = new RecordDivListEditor($o->definition); |
276 | 282 | $editor->addEditor(getTranslatedTextEditor( |
277 | | - $translatedTextAttribute, |
| 283 | + $o->translatedText, |
278 | 284 | new DefinedMeaningDefinitionController(), |
279 | 285 | new DefinedMeaningFilteredDefinitionController($viewInformation->filterLanguageId), |
280 | 286 | $viewInformation |
— | — | @@ -283,13 +289,13 @@ |
284 | 290 | $attribute = $propertyToColumnFilter->getAttribute(); |
285 | 291 | $propertyCaption = $propertyToColumnFilter->getPropertyCaption(); |
286 | 292 | $editor->addEditor(new PopUpEditor( |
287 | | - createDefinitionObjectAttributesEditor($viewInformation, $attribute, $propertyCaption, $definedMeaningIdAttribute, 0, $definitionMeaningName), |
| 293 | + createDefinitionObjectAttributesEditor($viewInformation, $attribute, $propertyCaption, $o->definedMeaningId, 0, $definitionMeaningName), |
288 | 294 | $attribute->name |
289 | 295 | )); |
290 | 296 | } |
291 | 297 | |
292 | 298 | $editor->addEditor(new PopUpEditor( |
293 | | - createDefinitionObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $wgPropertyAttributeName, $definedMeaningIdAttribute, 0, $definitionMeaningName), |
| 299 | + createDefinitionObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->definedMeaningId, 0, $definitionMeaningName), |
294 | 300 | $wgPopupAnnotationName |
295 | 301 | )); |
296 | 302 | |
— | — | @@ -340,8 +346,8 @@ |
341 | 347 | } |
342 | 348 | |
343 | 349 | function createObjectAttributesEditor(ViewInformation $viewInformation, Attribute $attribute, $propertyCaption, Attribute $idAttribute, $levelsFromDefinedMeaning, $levelName) { |
344 | | - global |
345 | | - $objectAttributesAttribute, $definedMeaningIdAttribute; |
| 350 | + |
| 351 | + $o=OmegaWikiAttributes::getInstance(); |
346 | 352 | |
347 | 353 | $result = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $viewInformation); |
348 | 354 | |
— | — | @@ -350,15 +356,15 @@ |
351 | 357 | $viewInformation, |
352 | 358 | new ObjectIdFetcher(0, $idAttribute), |
353 | 359 | $levelName, |
354 | | - new ObjectIdFetcher($levelsFromDefinedMeaning, $definedMeaningIdAttribute) |
| 360 | + new ObjectIdFetcher($levelsFromDefinedMeaning, $o->definedMeaningId) |
355 | 361 | ); |
356 | 362 | |
357 | 363 | return $result; |
358 | 364 | } |
359 | 365 | |
360 | 366 | function createDefinitionObjectAttributesEditor(ViewInformation $viewInformation, Attribute $attribute, $propertyCaption, Attribute $idAttribute, $levelsFromDefinedMeaning, $levelName) { |
361 | | - global |
362 | | - $objectAttributesAttribute, $definedMeaningIdAttribute; |
| 367 | + |
| 368 | + $o=OmegaWikiAttributes::getInstance(); |
363 | 369 | |
364 | 370 | $result = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $viewInformation); |
365 | 371 | |
— | — | @@ -367,18 +373,18 @@ |
368 | 374 | $viewInformation, |
369 | 375 | new DefinitionObjectIdFetcher(0, $idAttribute), |
370 | 376 | $levelName, |
371 | | - new ObjectIdFetcher($levelsFromDefinedMeaning, $definedMeaningIdAttribute) |
| 377 | + new ObjectIdFetcher($levelsFromDefinedMeaning, $o->definedMeaningId) |
372 | 378 | ); |
373 | 379 | |
374 | 380 | return $result; |
375 | 381 | } |
376 | 382 | |
377 | 383 | function getAlternativeDefinitionsEditor(ViewInformation $viewInformation) { |
378 | | - global |
379 | | - $alternativeDefinitionsAttribute, $alternativeDefinitionAttribute, $sourceAttribute; |
380 | 384 | |
| 385 | + $o=OmegaWikiAttributes::getInstance(); |
| 386 | + |
381 | 387 | $editor = new RecordSetTableEditor( |
382 | | - $alternativeDefinitionsAttribute, |
| 388 | + $o->alternativeDefinitions, |
383 | 389 | new SimplePermissionController(true), |
384 | 390 | new ShowEditFieldChecker(true), |
385 | 391 | new AllowAddController(true), |
— | — | @@ -388,12 +394,12 @@ |
389 | 395 | ); |
390 | 396 | |
391 | 397 | $editor->addEditor(getTranslatedTextEditor( |
392 | | - $alternativeDefinitionAttribute, |
| 398 | + $o->alternativeDefinition, |
393 | 399 | new DefinedMeaningAlternativeDefinitionController(), |
394 | 400 | new DefinedMeaningFilteredAlternativeDefinitionController($viewInformation), |
395 | 401 | $viewInformation) |
396 | 402 | ); |
397 | | - $editor->addEditor(new DefinedMeaningReferenceEditor($sourceAttribute, new SimplePermissionController(false), true)); |
| 403 | + $editor->addEditor(new DefinedMeaningReferenceEditor($o->source, new SimplePermissionController(false), true)); |
398 | 404 | |
399 | 405 | addTableMetadataEditors($editor, $viewInformation); |
400 | 406 | |
— | — | @@ -416,13 +422,13 @@ |
417 | 423 | } |
418 | 424 | |
419 | 425 | function getClassAttributesEditor(ViewInformation $viewInformation) { |
420 | | - global |
421 | | - $definedMeaningIdAttribute, $classAttributesAttribute, $classAttributeLevelAttribute, $classAttributeAttributeAttribute, $classAttributeTypeAttribute; |
422 | 426 | |
423 | | - $tableEditor = new RecordSetTableEditor($classAttributesAttribute, new SimplePermissionController(true), new ShowEditFieldForClassesChecker(0, $definedMeaningIdAttribute), new AllowAddController(true), true, false, new ClassAttributesController()); |
424 | | - $tableEditor->addEditor(new ClassAttributesLevelDefinedMeaningEditor($classAttributeLevelAttribute, new SimplePermissionController(false), true)); |
425 | | - $tableEditor->addEditor(new DefinedMeaningReferenceEditor($classAttributeAttributeAttribute, new SimplePermissionController(false), true)); |
426 | | - $tableEditor->addEditor(new ClassAttributesTypeEditor($classAttributeTypeAttribute, new SimplePermissionController(false), true)); |
| 427 | + $o=OmegaWikiAttributes::getInstance(); |
| 428 | + |
| 429 | + $tableEditor = new RecordSetTableEditor($o->classAttributes, new SimplePermissionController(true), new ShowEditFieldForClassesChecker(0, $o->definedMeaningId), new AllowAddController(true), true, false, new ClassAttributesController()); |
| 430 | + $tableEditor->addEditor(new ClassAttributesLevelDefinedMeaningEditor($o->classAttributeLevel, new SimplePermissionController(false), true)); |
| 431 | + $tableEditor->addEditor(new DefinedMeaningReferenceEditor($o->classAttributeAttribute, new SimplePermissionController(false), true)); |
| 432 | + $tableEditor->addEditor(new ClassAttributesTypeEditor($o->classAttributeType, new SimplePermissionController(false), true)); |
427 | 433 | $tableEditor->addEditor(new PopupEditor(getOptionAttributeOptionsEditor(), 'Options')); |
428 | 434 | |
429 | 435 | addTableMetadataEditors($tableEditor, $viewInformation); |
— | — | @@ -431,14 +437,16 @@ |
432 | 438 | } |
433 | 439 | |
434 | 440 | function getSynonymsAndTranslationsEditor(ViewInformation $viewInformation) { |
| 441 | + |
| 442 | + $o=OmegaWikiAttributes::getInstance(); |
435 | 443 | global |
436 | | - $synonymsAndTranslationsAttribute, $identicalMeaningAttribute, $expressionIdAttribute, |
437 | | - $expressionAttribute, $wgPopupAnnotationName, |
438 | | - $syntransIdAttribute, $synTransMeaningName, $objectAttributesAttribute, |
| 444 | + |
| 445 | + $wgPopupAnnotationName, |
| 446 | + $synTransMeaningName, |
439 | 447 | $wgPropertyAttributeName; |
440 | 448 | |
441 | 449 | $tableEditor = new RecordSetTableEditor( |
442 | | - $synonymsAndTranslationsAttribute, |
| 450 | + $o->synonymsAndTranslations, |
443 | 451 | new SimplePermissionController(true), |
444 | 452 | new ShowEditFieldChecker(true), |
445 | 453 | new AllowAddController(true), |
— | — | @@ -447,13 +455,13 @@ |
448 | 456 | new SynonymTranslationController($viewInformation->filterLanguageId) |
449 | 457 | ); |
450 | 458 | |
451 | | - $tableEditor->addEditor(getExpressionTableCellEditor($expressionAttribute, $viewInformation)); |
452 | | - $tableEditor->addEditor(new BooleanEditor($identicalMeaningAttribute, new SimplePermissionController(true), true, true)); |
| 459 | + $tableEditor->addEditor(getExpressionTableCellEditor($o->expression, $viewInformation)); |
| 460 | + $tableEditor->addEditor(new BooleanEditor($o->identicalMeaning, new SimplePermissionController(true), true, true)); |
453 | 461 | |
454 | | - addPropertyToColumnFilterEditors($tableEditor, $viewInformation, $syntransIdAttribute, 1, $synTransMeaningName); |
| 462 | + addPropertyToColumnFilterEditors($tableEditor, $viewInformation, $o->syntransId, 1, $synTransMeaningName); |
455 | 463 | |
456 | 464 | $tableEditor->addEditor(new PopUpEditor( |
457 | | - createObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $wgPropertyAttributeName, $syntransIdAttribute, 1, $synTransMeaningName), |
| 465 | + createObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->syntransId, 1, $synTransMeaningName), |
458 | 466 | $wgPopupAnnotationName |
459 | 467 | )); |
460 | 468 | |
— | — | @@ -463,19 +471,21 @@ |
464 | 472 | } |
465 | 473 | |
466 | 474 | function getDefinedMeaningRelationsEditor(ViewInformation $viewInformation) { |
| 475 | + |
| 476 | + $o=OmegaWikiAttributes::getInstance(); |
467 | 477 | global |
468 | | - $relationsAttribute, $relationTypeAttribute, $otherDefinedMeaningAttribute, $objectAttributesAttribute, |
469 | | - $relationsObjectAttributesEditor, $relationIdAttribute, $relationMeaningName, $wgPopupAnnotationName, |
| 478 | + |
| 479 | + $relationsObjectAttributesEditor, $relationMeaningName, $wgPopupAnnotationName, |
470 | 480 | $wgPropertyAttributeName; |
471 | 481 | |
472 | | - $editor = new RecordSetTableEditor($relationsAttribute, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, new DefinedMeaningRelationController()); |
473 | | - $editor->addEditor(new RelationTypeReferenceEditor($relationTypeAttribute, new SimplePermissionController(false), true)); |
474 | | - $editor->addEditor(new DefinedMeaningReferenceEditor($otherDefinedMeaningAttribute, new SimplePermissionController(false), true)); |
| 482 | + $editor = new RecordSetTableEditor($o->relations, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, new DefinedMeaningRelationController()); |
| 483 | + $editor->addEditor(new RelationTypeReferenceEditor($o->relationType, new SimplePermissionController(false), true)); |
| 484 | + $editor->addEditor(new DefinedMeaningReferenceEditor($o->otherDefinedMeaning, new SimplePermissionController(false), true)); |
475 | 485 | |
476 | | - addPropertyToColumnFilterEditors($editor, $viewInformation, $relationIdAttribute, 1, $relationMeaningName); |
| 486 | + addPropertyToColumnFilterEditors($editor, $viewInformation, $o->relationId, 1, $relationMeaningName); |
477 | 487 | |
478 | 488 | $editor->addEditor(new PopUpEditor( |
479 | | - createObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $wgPropertyAttributeName, $relationIdAttribute, 1, $relationMeaningName), |
| 489 | + createObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->relationId, 1, $relationMeaningName), |
480 | 490 | $wgPopupAnnotationName |
481 | 491 | )); |
482 | 492 | |
— | — | @@ -485,19 +495,21 @@ |
486 | 496 | } |
487 | 497 | |
488 | 498 | function getDefinedMeaningReciprocalRelationsEditor(ViewInformation $viewInformation) { |
| 499 | + |
| 500 | + $o=OmegaWikiAttributes::getInstance(); |
489 | 501 | global |
490 | | - $reciprocalRelationsAttribute, $relationTypeAttribute, $otherDefinedMeaningAttribute, $objectAttributesAttribute, |
491 | | - $relationsObjectAttributesEditor, $relationIdAttribute, $relationMeaningName, $wgPopupAnnotationName, |
| 502 | + |
| 503 | + $relationsObjectAttributesEditor, $relationMeaningName, $wgPopupAnnotationName, |
492 | 504 | $wgPropertyAttributeName; |
493 | 505 | |
494 | | - $editor = new RecordSetTableEditor($reciprocalRelationsAttribute, new SimplePermissionController(false), new ShowEditFieldChecker(true), new AllowAddController(false), false, false, null); |
495 | | - $editor->addEditor(new DefinedMeaningReferenceEditor($otherDefinedMeaningAttribute, new SimplePermissionController(false), true)); |
496 | | - $editor->addEditor(new RelationTypeReferenceEditor($relationTypeAttribute, new SimplePermissionController(false), true)); |
| 506 | + $editor = new RecordSetTableEditor($o->reciprocalRelations, new SimplePermissionController(false), new ShowEditFieldChecker(true), new AllowAddController(false), false, false, null); |
| 507 | + $editor->addEditor(new DefinedMeaningReferenceEditor($o->otherDefinedMeaning, new SimplePermissionController(false), true)); |
| 508 | + $editor->addEditor(new RelationTypeReferenceEditor($o->relationType, new SimplePermissionController(false), true)); |
497 | 509 | |
498 | | - addPropertyToColumnFilterEditors($editor, $viewInformation, $relationIdAttribute, 1, $relationMeaningName); |
| 510 | + addPropertyToColumnFilterEditors($editor, $viewInformation, $o->relationId, 1, $relationMeaningName); |
499 | 511 | |
500 | 512 | $editor->addEditor(new PopUpEditor( |
501 | | - createObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $wgPropertyAttributeName, $relationIdAttribute, 1, $relationMeaningName), |
| 513 | + createObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->relationId, 1, $relationMeaningName), |
502 | 514 | $wgPopupAnnotationName |
503 | 515 | )); |
504 | 516 | |
— | — | @@ -507,12 +519,12 @@ |
508 | 520 | } |
509 | 521 | |
510 | 522 | function getDefinedMeaningClassMembershipEditor(ViewInformation $viewInformation) { |
511 | | - global |
512 | | - $classMembershipAttribute, $classAttribute; |
513 | 523 | |
514 | | - $editor = new RecordSetTableEditor($classMembershipAttribute, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, new DefinedMeaningClassMembershipController()); |
515 | | - $editor->addEditor(new ClassReferenceEditor($classAttribute, new SimplePermissionController(false), true)); |
| 524 | + $o=OmegaWikiAttributes::getInstance(); |
516 | 525 | |
| 526 | + $editor = new RecordSetTableEditor($o->classMembership, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, new DefinedMeaningClassMembershipController()); |
| 527 | + $editor->addEditor(new ClassReferenceEditor($o->class, new SimplePermissionController(false), true)); |
| 528 | + |
517 | 529 | addTableMetadataEditors($editor, $viewInformation); |
518 | 530 | |
519 | 531 | return $editor; |
— | — | @@ -543,16 +555,18 @@ |
544 | 556 | } |
545 | 557 | |
546 | 558 | function getDefinedMeaningCollectionMembershipEditor(ViewInformation $viewInformation) { |
| 559 | + |
| 560 | + $o=OmegaWikiAttributes::getInstance(); |
547 | 561 | global |
548 | | - $collectionMembershipAttribute, $collectionMeaningAttribute, $sourceIdentifierAttribute, |
549 | | - $gotoSourceAttribute, $wgGotoSourceTemplates; |
550 | 562 | |
551 | | - $editor = new RecordSetTableEditor($collectionMembershipAttribute, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, new DefinedMeaningCollectionController()); |
552 | | - $editor->addEditor(new CollectionReferenceEditor($collectionMeaningAttribute, new SimplePermissionController(false), true)); |
553 | | - $editor->addEditor(new ShortTextEditor($sourceIdentifierAttribute, new SimplePermissionController(true), true)); |
| 563 | + $wgGotoSourceTemplates; |
| 564 | + |
| 565 | + $editor = new RecordSetTableEditor($o->collectionMembership, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, new DefinedMeaningCollectionController()); |
| 566 | + $editor->addEditor(new CollectionReferenceEditor($o->collectionMeaning, new SimplePermissionController(false), true)); |
| 567 | + $editor->addEditor(new ShortTextEditor($o->sourceIdentifier, new SimplePermissionController(true), true)); |
554 | 568 | |
555 | 569 | if (count($wgGotoSourceTemplates) > 0) |
556 | | - $editor->addEditor(new GotoSourceEditor($gotoSourceAttribute, new SimplePermissionController(true), true)); |
| 570 | + $editor->addEditor(new GotoSourceEditor($o->gotoSource, new SimplePermissionController(true), true)); |
557 | 571 | |
558 | 572 | addTableMetadataEditors($editor, $viewInformation); |
559 | 573 | |
— | — | @@ -565,12 +579,14 @@ |
566 | 580 | } |
567 | 581 | |
568 | 582 | function getTextAttributeValuesEditor(ViewInformation $viewInformation, $controller, $levelDefinedMeaningName, Fetcher $objectIdFetcher) { |
| 583 | + |
| 584 | + $o=OmegaWikiAttributes::getInstance(); |
569 | 585 | global |
570 | | - $textAttributeAttribute, $textAttribute, $textAttributeValuesAttribute, $textValueObjectAttributesEditors; |
| 586 | + $textValueObjectAttributesEditors; |
571 | 587 | |
572 | | - $editor = new RecordSetTableEditor($textAttributeValuesAttribute, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, $controller); |
573 | | - $editor->addEditor(new TextAttributeEditor($textAttributeAttribute, new SimplePermissionController(false), true, $levelDefinedMeaningName, $objectIdFetcher)); |
574 | | - $editor->addEditor(new TextEditor($textAttribute, new SimplePermissionController(true), true)); |
| 588 | + $editor = new RecordSetTableEditor($o->textAttributeValues, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, $controller); |
| 589 | + $editor->addEditor(new TextAttributeEditor($o->textAttribute, new SimplePermissionController(false), true, $levelDefinedMeaningName, $objectIdFetcher)); |
| 590 | + $editor->addEditor(new TextEditor($o->text, new SimplePermissionController(true), true)); |
575 | 591 | |
576 | 592 | addPopupEditors($editor, $textValueObjectAttributesEditors); |
577 | 593 | addTableMetadataEditors($editor, $viewInformation); |
— | — | @@ -579,19 +595,20 @@ |
580 | 596 | } |
581 | 597 | |
582 | 598 | function getLinkAttributeValuesEditor(ViewInformation $viewInformation, UpdateController $controller, $levelDefinedMeaningName, Fetcher $objectIdFetcher) { |
| 599 | + |
| 600 | + $o=OmegaWikiAttributes::getInstance(); |
583 | 601 | global |
584 | | - $linkAttributeAttribute, $linkAttribute, $linkAttributeValuesAttribute, $linkValueObjectAttributesEditors, |
585 | | - $linkLabelAttribute, $linkURLAttribute; |
| 602 | + $linkValueObjectAttributesEditors; |
586 | 603 | |
587 | | - $editor = new RecordSetTableEditor($linkAttributeValuesAttribute, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, $controller); |
588 | | - $editor->addEditor(new LinkAttributeEditor($linkAttributeAttribute, new SimplePermissionController(false), true, $levelDefinedMeaningName, $objectIdFetcher)); |
| 604 | + $editor = new RecordSetTableEditor($o->linkAttributeValues, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, $controller); |
| 605 | + $editor->addEditor(new LinkAttributeEditor($o->linkAttribute, new SimplePermissionController(false), true, $levelDefinedMeaningName, $objectIdFetcher)); |
589 | 606 | |
590 | 607 | if ($viewInformation->viewOrEdit == "view") |
591 | | - $linkEditor = new LinkEditor($linkAttribute, new SimplePermissionController(true), true); |
| 608 | + $linkEditor = new LinkEditor($o->link, new SimplePermissionController(true), true); |
592 | 609 | else { |
593 | | - $linkEditor = new RecordTableCellEditor($linkAttribute); |
594 | | - $linkEditor->addEditor(new ShortTextEditor($linkURLAttribute, new SimplePermissionController(true), true, "urlFieldChanged(this);")); |
595 | | - $linkEditor->addEditor(new ShortTextEditor($linkLabelAttribute, new SimplePermissionController(true), true)); |
| 610 | + $linkEditor = new RecordTableCellEditor($o->link); |
| 611 | + $linkEditor->addEditor(new ShortTextEditor($o->linkURL, new SimplePermissionController(true), true, "urlFieldChanged(this);")); |
| 612 | + $linkEditor->addEditor(new ShortTextEditor($o->linkLabel, new SimplePermissionController(true), true)); |
596 | 613 | } |
597 | 614 | |
598 | 615 | $editor->addEditor($linkEditor); |
— | — | @@ -603,14 +620,16 @@ |
604 | 621 | } |
605 | 622 | |
606 | 623 | function getTranslatedTextAttributeValuesEditor(ViewInformation $viewInformation, UpdateController $controller, $levelDefinedMeaningName, Fetcher $objectIdFetcher) { |
| 624 | + |
| 625 | + $o=OmegaWikiAttributes::getInstance(); |
607 | 626 | global |
608 | | - $translatedTextAttributeAttribute, $translatedTextValueAttribute, $translatedTextAttributeValuesAttribute, |
| 627 | + |
609 | 628 | $translatedTextValueObjectAttributesEditors; |
610 | 629 | |
611 | | - $editor = new RecordSetTableEditor($translatedTextAttributeValuesAttribute, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, $controller); |
612 | | - $editor->addEditor(new TranslatedTextAttributeEditor($translatedTextAttributeAttribute, new SimplePermissionController(false), true, $levelDefinedMeaningName, $objectIdFetcher)); |
| 630 | + $editor = new RecordSetTableEditor($o->translatedTextAttributeValues, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, $controller); |
| 631 | + $editor->addEditor(new TranslatedTextAttributeEditor($o->translatedTextAttribute, new SimplePermissionController(false), true, $levelDefinedMeaningName, $objectIdFetcher)); |
613 | 632 | $editor->addEditor(getTranslatedTextEditor( |
614 | | - $translatedTextValueAttribute, |
| 633 | + $o->translatedTextValue, |
615 | 634 | new TranslatedTextAttributeValueController(), |
616 | 635 | new FilteredTranslatedTextAttributeValueController($viewInformation->filterLanguageId), |
617 | 636 | $viewInformation |
— | — | @@ -623,14 +642,16 @@ |
624 | 643 | } |
625 | 644 | |
626 | 645 | function getOptionAttributeValuesEditor(ViewInformation $viewInformation, UpdateController $controller, $levelDefinedMeaningName, Fetcher $objectIdFetcher) { |
| 646 | + |
| 647 | + $o=OmegaWikiAttributes::getInstance(); |
627 | 648 | global |
628 | | - $optionAttributeAttribute, $optionAttributeOptionAttribute, $optionAttributeValuesAttribute, |
| 649 | + |
629 | 650 | $optionValueObjectAttributesEditors; |
630 | 651 | |
631 | | - $editor = new RecordSetTableEditor($optionAttributeValuesAttribute, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, $controller); |
| 652 | + $editor = new RecordSetTableEditor($o->optionAttributeValues, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, $controller); |
632 | 653 | |
633 | | - $editor->addEditor(new OptionAttributeEditor($optionAttributeAttribute, new SimplePermissionController(false), true, $levelDefinedMeaningName, $objectIdFetcher)); |
634 | | - $editor->addEditor(new OptionSelectEditor($optionAttributeOptionAttribute, new SimplePermissionController(false), true)); |
| 654 | + $editor->addEditor(new OptionAttributeEditor($o->optionAttribute, new SimplePermissionController(false), true, $levelDefinedMeaningName, $objectIdFetcher)); |
| 655 | + $editor->addEditor(new OptionSelectEditor($o->optionAttributeOption, new SimplePermissionController(false), true)); |
635 | 656 | |
636 | 657 | addPopupEditors($editor, $optionValueObjectAttributesEditors); |
637 | 658 | addTableMetadataEditors($editor, $viewInformation); |
— | — | @@ -639,24 +660,24 @@ |
640 | 661 | } |
641 | 662 | |
642 | 663 | function getOptionAttributeOptionsEditor() { |
643 | | - global |
644 | | - $optionAttributeAttribute, $optionAttributeOptionAttribute, $optionAttributeOptionsAttribute; |
| 664 | + |
645 | 665 | $o=OmegaWikiAttributes::getInstance(); |
| 666 | + $o=OmegaWikiAttributes::getInstance(); |
646 | 667 | |
647 | | - $editor = new RecordSetTableEditor($optionAttributeOptionsAttribute, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, new OptionAttributeOptionsController()); |
648 | | - $editor->addEditor(new DefinedMeaningReferenceEditor($optionAttributeOptionAttribute, new SimplePermissionController(false), true)); |
| 668 | + $editor = new RecordSetTableEditor($o->optionAttributeOptions, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, new OptionAttributeOptionsController()); |
| 669 | + $editor->addEditor(new DefinedMeaningReferenceEditor($o->optionAttributeOption, new SimplePermissionController(false), true)); |
649 | 670 | $editor->addEditor(new LanguageEditor($o->language, new SimplePermissionController(false), true)); |
650 | 671 | |
651 | 672 | return $editor; |
652 | 673 | } |
653 | 674 | |
654 | 675 | function getExpressionMeaningsEditor(Attribute $attribute, $allowAdd, ViewInformation $viewInformation) { |
655 | | - global |
656 | | - $definedMeaningIdAttribute; |
| 676 | + |
| 677 | + $o=OmegaWikiAttributes::getInstance(); |
657 | 678 | |
658 | 679 | $definedMeaningEditor = getDefinedMeaningEditor($viewInformation); |
659 | 680 | |
660 | | - $definedMeaningCaptionEditor = new DefinedMeaningHeaderEditor($definedMeaningIdAttribute, new SimplePermissionController(false), true, 75); |
| 681 | + $definedMeaningCaptionEditor = new DefinedMeaningHeaderEditor($o->definedMeaningId, new SimplePermissionController(false), true, 75); |
661 | 682 | $definedMeaningCaptionEditor->setAddText("New exact meaning"); |
662 | 683 | |
663 | 684 | $expressionMeaningsEditor = new RecordSetListEditor($attribute, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController($allowAdd), false, $allowAdd, new ExpressionMeaningController($viewInformation->filterLanguageId), 3, false); |
— | — | @@ -667,25 +688,25 @@ |
668 | 689 | } |
669 | 690 | |
670 | 691 | function getExpressionsEditor($spelling, ViewInformation $viewInformation) { |
671 | | - global |
672 | | - $expressionMeaningsAttribute, $expressionExactMeaningsAttribute, $expressionApproximateMeaningsAttribute, $expressionAttribute, $expressionsAttribute; |
673 | 692 | |
674 | 693 | $o=OmegaWikiAttributes::getInstance(); |
675 | 694 | |
676 | | - $expressionMeaningsRecordEditor = new RecordUnorderedListEditor($expressionMeaningsAttribute, 3); |
| 695 | + $o=OmegaWikiAttributes::getInstance(); |
| 696 | + |
| 697 | + $expressionMeaningsRecordEditor = new RecordUnorderedListEditor($o->expressionMeanings, 3); |
677 | 698 | |
678 | | - $exactMeaningsEditor = getExpressionMeaningsEditor($expressionExactMeaningsAttribute, true, $viewInformation); |
| 699 | + $exactMeaningsEditor = getExpressionMeaningsEditor($o->expressionExactMeanings, true, $viewInformation); |
679 | 700 | $expressionMeaningsRecordEditor->addEditor($exactMeaningsEditor); |
680 | | - $expressionMeaningsRecordEditor->addEditor(getExpressionMeaningsEditor($expressionApproximateMeaningsAttribute, false, $viewInformation)); |
| 701 | + $expressionMeaningsRecordEditor->addEditor(getExpressionMeaningsEditor($o->expressionApproximateMeanings, false, $viewInformation)); |
681 | 702 | |
682 | 703 | $expressionMeaningsRecordEditor->expandEditor($exactMeaningsEditor); |
683 | 704 | |
684 | 705 | if ($viewInformation->filterLanguageId == 0) { |
685 | | - $expressionEditor = new RecordSpanEditor($expressionAttribute, ': ', ' - '); |
| 706 | + $expressionEditor = new RecordSpanEditor($o->expression, ': ', ' - '); |
686 | 707 | $expressionEditor->addEditor(new LanguageEditor($o->language, new SimplePermissionController(false), true)); |
687 | 708 | |
688 | 709 | $expressionsEditor = new RecordSetListEditor( |
689 | | - $expressionsAttribute, |
| 710 | + $o->expressions, |
690 | 711 | new SimplePermissionController(true), |
691 | 712 | new ShowEditFieldChecker(true), |
692 | 713 | new AllowAddController(true), |
— | — | @@ -699,11 +720,11 @@ |
700 | 721 | $expressionsEditor->setValueEditor($expressionMeaningsRecordEditor); |
701 | 722 | } |
702 | 723 | else { |
703 | | - $expressionEditor = new RecordSubRecordEditor($expressionAttribute); |
| 724 | + $expressionEditor = new RecordSubRecordEditor($o->expression); |
704 | 725 | $expressionEditor->setSubRecordEditor($expressionMeaningsRecordEditor); |
705 | 726 | |
706 | 727 | $expressionsEditor = new RecordSetFirstRecordEditor( |
707 | | - $expressionsAttribute, |
| 728 | + $o->expressions, |
708 | 729 | new SimplePermissionController(true), |
709 | 730 | new ShowEditFieldChecker(true), |
710 | 731 | new AllowAddController(true), |
— | — | @@ -718,10 +739,12 @@ |
719 | 740 | } |
720 | 741 | |
721 | 742 | function getDefinedMeaningEditor(ViewInformation $viewInformation) { |
| 743 | + |
| 744 | + $o=OmegaWikiAttributes::getInstance(); |
722 | 745 | global |
723 | | - $wdDefinedMeaningAttributesOrder, $definedMeaningIdAttribute, $definedMeaningMeaningName, |
724 | | - $definedMeaningAttribute, $possiblySynonymousIdAttribute, $possiblySynonymousAttribute, |
725 | | - $possibleSynonymAttribute, $relationMeaningName, $objectAttributesAttribute, $definedMeaningAttributesAttribute, |
| 746 | + $wdDefinedMeaningAttributesOrder, $definedMeaningMeaningName, |
| 747 | + |
| 748 | + $relationMeaningName, |
726 | 749 | $wgPropertyAttributeName; |
727 | 750 | |
728 | 751 | $definitionEditor = getDefinitionEditor($viewInformation); |
— | — | @@ -734,12 +757,12 @@ |
735 | 758 | $collectionMembershipEditor = getDefinedMeaningCollectionMembershipEditor($viewInformation); |
736 | 759 | |
737 | 760 | $possiblySynonymousEditor = getGroupedRelationTypeEditor( |
738 | | - $possiblySynonymousAttribute, |
739 | | - $possiblySynonymousIdAttribute, |
740 | | - $possibleSynonymAttribute, |
| 761 | + $o->possiblySynonymous, |
| 762 | + $o->possiblySynonymousId, |
| 763 | + $o->possibleSynonym, |
741 | 764 | $viewInformation->possiblySynonymousRelationTypeId, |
742 | 765 | $viewInformation, |
743 | | - createObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $wgPropertyAttributeName, $possiblySynonymousIdAttribute, 1, $relationMeaningName) |
| 766 | + createObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->possiblySynonymousId, 1, $relationMeaningName) |
744 | 767 | ); |
745 | 768 | |
746 | 769 | $availableEditors = new AttributeEditorMap(); |
— | — | @@ -752,15 +775,15 @@ |
753 | 776 | $availableEditors->addEditor($classMembershipEditor); |
754 | 777 | $availableEditors->addEditor($collectionMembershipEditor); |
755 | 778 | |
756 | | - foreach (createPropertyToColumnFilterEditors($viewInformation, $definedMeaningIdAttribute, 0, $definedMeaningMeaningName) as $propertyToColumnEditor) |
| 779 | + foreach (createPropertyToColumnFilterEditors($viewInformation, $o->definedMeaningId, 0, $definedMeaningMeaningName) as $propertyToColumnEditor) |
757 | 780 | $availableEditors->addEditor($propertyToColumnEditor); |
758 | 781 | |
759 | | - $availableEditors->addEditor(createObjectAttributesEditor($viewInformation, $definedMeaningAttributesAttribute, $wgPropertyAttributeName, $definedMeaningIdAttribute, 0, $definedMeaningMeaningName)); |
| 782 | + $availableEditors->addEditor(createObjectAttributesEditor($viewInformation, $o->definedMeaningAttributes, $wgPropertyAttributeName, $o->definedMeaningId, 0, $definedMeaningMeaningName)); |
760 | 783 | |
761 | 784 | if ($viewInformation->possiblySynonymousRelationTypeId != 0) |
762 | 785 | $availableEditors->addEditor($possiblySynonymousEditor); |
763 | 786 | |
764 | | - $definedMeaningEditor = new RecordUnorderedListEditor($definedMeaningAttribute, 4); |
| 787 | + $definedMeaningEditor = new RecordUnorderedListEditor($o->definedMeaning, 4); |
765 | 788 | |
766 | 789 | foreach ($wdDefinedMeaningAttributesOrder as $attributeId) { |
767 | 790 | $editor = $availableEditors->getEditorForAttributeId($attributeId); |
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php |
— | — | @@ -64,10 +64,9 @@ |
65 | 65 | function fetchDefinedMeaningReferenceRecords($sql, array &$definedMeaningIds, array &$definedMeaningReferenceRecords, $usedAs='defined-meaning') { |
66 | 66 | $dc=wdGetDataSetContext(); |
67 | 67 | |
68 | | - global |
69 | | - $definedMeaningReferenceStructure, $definedMeaningIdAttribute, $definedMeaningLabelAttribute, |
70 | | - $definedMeaningDefiningExpressionAttribute; |
71 | 68 | |
| 69 | + $o=OmegaWikiAttributes::getInstance(); |
| 70 | + |
72 | 71 | $foundDefinedMeaningIds = array(); |
73 | 72 | |
74 | 73 | $dbr =& wfGetDB(DB_SLAVE); |
— | — | @@ -76,11 +75,11 @@ |
77 | 76 | while ($row = $dbr->fetchObject($queryResult)) { |
78 | 77 | $definedMeaningId = $row->defined_meaning_id; |
79 | 78 | |
80 | | - $specificStructure=clone $definedMeaningReferenceStructure; |
| 79 | + $specificStructure=clone $o->definedMeaningReferenceStructure; |
81 | 80 | $specificStructure->setStructureType($usedAs); |
82 | 81 | $record = new ArrayRecord($specificStructure); |
83 | | - $record->setAttributeValue($definedMeaningIdAttribute, $definedMeaningId); |
84 | | - $record->setAttributeValue($definedMeaningLabelAttribute, $row->label); |
| 82 | + $record->definedMeaningId = $definedMeaningId; |
| 83 | + $record->definedMeaningLabel = $row->label; |
85 | 84 | |
86 | 85 | $definedMeaningReferenceRecords[$definedMeaningId] = $record; |
87 | 86 | $foundDefinedMeaningIds[] = $definedMeaningId; |
— | — | @@ -90,10 +89,9 @@ |
91 | 90 | } |
92 | 91 | |
93 | 92 | function fetchDefinedMeaningDefiningExpressions(array &$definedMeaningIds, array &$definedMeaningReferenceRecords) { |
94 | | - global |
95 | | - $definedMeaningReferenceStructure, $definedMeaningIdAttribute, $definedMeaningLabelAttribute, |
96 | | - $definedMeaningDefiningExpressionAttribute; |
97 | 93 | |
| 94 | + $o=OmegaWikiAttributes::getInstance(); |
| 95 | + |
98 | 96 | $dc=wdGetDataSetContext(); |
99 | 97 | |
100 | 98 | $dbr =& wfGetDB(DB_SLAVE); |
— | — | @@ -110,25 +108,24 @@ |
111 | 109 | $definedMeaningReferenceRecord = $definedMeaningReferenceRecords[$row->defined_meaning_id]; |
112 | 110 | |
113 | 111 | if ($definedMeaningReferenceRecord == null) { |
114 | | - $definedMeaningReferenceRecord = new ArrayRecord($definedMeaningReferenceStructure); |
115 | | - $definedMeaningReferenceRecord->setAttributeValue($definedMeaningIdAttribute, $row->defined_meaning_id); |
116 | | - $definedMeaningReferenceRecord->setAttributeValue($definedMeaningLabelAttribute, $row->spelling); |
| 112 | + $definedMeaningReferenceRecord = new ArrayRecord($o->definedMeaningReferenceStructure); |
| 113 | + $definedMeaningReferenceRecord->definedMeaningId = $row->defined_meaning_id; |
| 114 | + $definedMeaningReferenceRecord->definedMeaningLabel = $row->spelling; |
117 | 115 | $definedMeaningReferenceRecords[$row->defined_meaning_id] = $definedMeaningReferenceRecord; |
118 | 116 | } |
119 | 117 | |
120 | | - $definedMeaningReferenceRecord->setAttributeValue($definedMeaningDefiningExpressionAttribute, $row->spelling); |
| 118 | + $definedMeaningReferenceRecord->definedMeaningDefiningExpression = $row->spelling; |
121 | 119 | } |
122 | 120 | } |
123 | 121 | |
124 | 122 | function getNullDefinedMeaningReferenceRecord() { |
125 | | - global |
126 | | - $definedMeaningReferenceStructure, $definedMeaningIdAttribute, $definedMeaningLabelAttribute, |
127 | | - $definedMeaningDefiningExpressionAttribute; |
| 123 | + |
| 124 | + $o=OmegaWikiAttributes::getInstance(); |
128 | 125 | |
129 | | - $record = new ArrayRecord($definedMeaningReferenceStructure); |
130 | | - $record->setAttributeValue($definedMeaningIdAttribute, 0); |
131 | | - $record->setAttributeValue($definedMeaningLabelAttribute, ""); |
132 | | - $record->setAttributeValue($definedMeaningDefiningExpressionAttribute, ""); |
| 126 | + $record = new ArrayRecord($o->definedMeaningReferenceStructure); |
| 127 | + $record->definedMeaningId = 0; |
| 128 | + $record->definedMeaningLabel = ""; |
| 129 | + $record->definedMeaningDefiningExpression = ""; |
133 | 130 | |
134 | 131 | return $record; |
135 | 132 | } |
— | — | @@ -228,8 +225,8 @@ |
229 | 226 | } |
230 | 227 | |
231 | 228 | function getExpressionReferenceRecords($expressionIds) { |
232 | | - global |
233 | | - $expressionStructure; |
| 229 | + |
| 230 | + $o=OmegaWikiAttributes::getInstance(); |
234 | 231 | |
235 | 232 | $dc=wdGetDataSetContext(); |
236 | 233 | |
— | — | @@ -245,7 +242,7 @@ |
246 | 243 | $result = array(); |
247 | 244 | |
248 | 245 | while ($row = $dbr->fetchObject($queryResult)) { |
249 | | - $record = new ArrayRecord($expressionStructure); |
| 246 | + $record = new ArrayRecord($o->expressionStructure); |
250 | 247 | $record->language = $row->language_id; |
251 | 248 | $record->spelling = $row->spelling; |
252 | 249 | |
— | — | @@ -273,8 +270,8 @@ |
274 | 271 | } |
275 | 272 | |
276 | 273 | function getExpressionSpellings(array $expressionIds) { |
277 | | - global |
278 | | - $expressionAttribute; |
| 274 | + |
| 275 | + $o=OmegaWikiAttributes::getInstance(); |
279 | 276 | |
280 | 277 | $dc=wdGetDataSetContext(); |
281 | 278 | |
— | — | @@ -353,13 +350,13 @@ |
354 | 351 | } |
355 | 352 | |
356 | 353 | function getExpressionMeaningsRecordSet($expressionId, $exactMeaning, ViewInformation $viewInformation) { |
357 | | - global |
358 | | - $expressionMeaningStructure, $definedMeaningIdAttribute; |
359 | 354 | |
| 355 | + $o=OmegaWikiAttributes::getInstance(); |
| 356 | + |
360 | 357 | $dc=wdGetDataSetContext(); |
361 | 358 | $identicalMeaning = $exactMeaning ? 1 : 0; |
362 | 359 | |
363 | | - $recordSet = new ArrayRecordSet($expressionMeaningStructure, new Structure($definedMeaningIdAttribute)); |
| 360 | + $recordSet = new ArrayRecordSet($o->expressionMeaningStructure, new Structure($o->definedMeaningId)); |
364 | 361 | |
365 | 362 | $dbr =& wfGetDB(DB_SLAVE); |
366 | 363 | $queryResult = $dbr->query( |
— | — | @@ -384,12 +381,12 @@ |
385 | 382 | } |
386 | 383 | |
387 | 384 | function getExpressionMeaningsRecord($expressionId, ViewInformation $viewInformation) { |
388 | | - global |
389 | | - $expressionMeaningsStructure, $expressionExactMeaningsAttribute, $expressionApproximateMeaningsAttribute; |
| 385 | + |
| 386 | + $o=OmegaWikiAttributes::getInstance(); |
390 | 387 | |
391 | | - $record = new ArrayRecord($expressionMeaningsStructure); |
392 | | - $record->setAttributeValue($expressionExactMeaningsAttribute, getExpressionMeaningsRecordSet($expressionId, true, $viewInformation)); |
393 | | - $record->setAttributeValue($expressionApproximateMeaningsAttribute, getExpressionMeaningsRecordSet($expressionId, false, $viewInformation)); |
| 388 | + $record = new ArrayRecord($o->expressionMeaningsStructure); |
| 389 | + $record->expressionExactMeanings = getExpressionMeaningsRecordSet($expressionId, true, $viewInformation); |
| 390 | + $record->expressionApproximateMeanings = getExpressionMeaningsRecordSet($expressionId, false, $viewInformation); |
394 | 391 | |
395 | 392 | return $record; |
396 | 393 | } |
— | — | @@ -459,76 +456,78 @@ |
460 | 457 | |
461 | 458 | |
462 | 459 | function getClassAttributesRecordSet($definedMeaningId, ViewInformation $viewInformation) { |
| 460 | + |
| 461 | + $o=OmegaWikiAttributes::getInstance(); |
463 | 462 | global |
464 | | - $classAttributesTable, $classAttributeIdAttribute, $classAttributeLevelAttribute, $classAttributeAttributeAttribute, $classAttributeTypeAttribute, $optionAttributeOptionsAttribute, |
465 | | - $classAttributesStructure; |
| 463 | + $classAttributesTable; |
466 | 464 | |
467 | 465 | $recordSet = queryRecordSet( |
468 | | - $classAttributesStructure->getStructureType(), |
| 466 | + $o->classAttributesStructure->getStructureType(), |
469 | 467 | $viewInformation->queryTransactionInformation, |
470 | | - $classAttributeIdAttribute, |
| 468 | + $o->classAttributeId, |
471 | 469 | new TableColumnsToAttributesMapping( |
472 | | - new TableColumnsToAttribute(array('object_id'), $classAttributeIdAttribute), |
473 | | - new TableColumnsToAttribute(array('level_mid'), $classAttributeLevelAttribute), |
474 | | - new TableColumnsToAttribute(array('attribute_mid'), $classAttributeAttributeAttribute), |
475 | | - new TableColumnsToAttribute(array('attribute_type'),$classAttributeTypeAttribute) |
| 470 | + new TableColumnsToAttribute(array('object_id'), $o->classAttributeId), |
| 471 | + new TableColumnsToAttribute(array('level_mid'), $o->classAttributeLevel), |
| 472 | + new TableColumnsToAttribute(array('attribute_mid'), $o->classAttributeAttribute), |
| 473 | + new TableColumnsToAttribute(array('attribute_type'),$o->classAttributeType) |
476 | 474 | ), |
477 | 475 | $classAttributesTable, |
478 | 476 | array("class_mid=$definedMeaningId") |
479 | 477 | ); |
480 | 478 | |
481 | | - expandDefinedMeaningReferencesInRecordSet($recordSet, array($classAttributeLevelAttribute ,$classAttributeAttributeAttribute)); |
482 | | - expandOptionAttributeOptionsInRecordSet($recordSet, $classAttributeIdAttribute, $viewInformation); |
| 479 | + expandDefinedMeaningReferencesInRecordSet($recordSet, array($o->classAttributeLevel ,$o->classAttributeAttribute)); |
| 480 | + expandOptionAttributeOptionsInRecordSet($recordSet, $o->classAttributeId, $viewInformation); |
483 | 481 | |
484 | 482 | return $recordSet; |
485 | 483 | } |
486 | 484 | |
487 | 485 | function expandOptionAttributeOptionsInRecordSet(RecordSet $recordSet, Attribute $attributeIdAttribute, ViewInformation $viewInformation) { |
488 | | - global |
489 | | - $definedMeaningIdAttribute, $optionAttributeOptionsAttribute; |
490 | 486 | |
| 487 | + $o=OmegaWikiAttributes::getInstance(); |
| 488 | + |
491 | 489 | for ($i = 0; $i < $recordSet->getRecordCount(); $i++) { |
492 | 490 | $record = $recordSet->getRecord($i); |
493 | 491 | |
494 | | - $record->setAttributeValue($optionAttributeOptionsAttribute, getOptionAttributeOptionsRecordSet($record->getAttributeValue($attributeIdAttribute), $viewInformation)); |
| 492 | + $record->optionAttributeOptions = getOptionAttributeOptionsRecordSet($record->getAttributeValue($attributeIdAttribute), $viewInformation); |
495 | 493 | } |
496 | 494 | } |
497 | 495 | |
498 | 496 | function getAlternativeDefinitionsRecordSet($definedMeaningId, ViewInformation $viewInformation) { |
| 497 | + |
| 498 | + $o=OmegaWikiAttributes::getInstance(); |
499 | 499 | global |
500 | | - $alternativeDefinitionsTable, $definitionIdAttribute, $alternativeDefinitionAttribute, $sourceAttribute, |
501 | | - $alternativeDefinitionsStructure; |
| 500 | + $alternativeDefinitionsTable; |
502 | 501 | |
503 | 502 | $recordSet = queryRecordSet( |
504 | | - $alternativeDefinitionsStructure->getStructureType(), |
| 503 | + $o->alternativeDefinitionsStructure->getStructureType(), |
505 | 504 | $viewInformation->queryTransactionInformation, |
506 | | - $definitionIdAttribute, |
| 505 | + $o->definitionId, |
507 | 506 | new TableColumnsToAttributesMapping( |
508 | | - new TableColumnsToAttribute(array('meaning_text_tcid'), $definitionIdAttribute), |
509 | | - new TableColumnsToAttribute(array('source_id'), $sourceAttribute) |
| 507 | + new TableColumnsToAttribute(array('meaning_text_tcid'), $o->definitionId), |
| 508 | + new TableColumnsToAttribute(array('source_id'), $o->source) |
510 | 509 | ), |
511 | 510 | $alternativeDefinitionsTable, |
512 | 511 | array("meaning_mid=$definedMeaningId") |
513 | 512 | ); |
514 | 513 | |
515 | | - $recordSet->getStructure()->addAttribute($alternativeDefinitionAttribute); |
| 514 | + $recordSet->getStructure()->addAttribute($o->alternativeDefinition); |
516 | 515 | |
517 | | - expandTranslatedContentsInRecordSet($recordSet, $definitionIdAttribute, $alternativeDefinitionAttribute, $viewInformation); |
518 | | - expandDefinedMeaningReferencesInRecordSet($recordSet, array($sourceAttribute)); |
| 516 | + expandTranslatedContentsInRecordSet($recordSet, $o->definitionId, $o->alternativeDefinition, $viewInformation); |
| 517 | + expandDefinedMeaningReferencesInRecordSet($recordSet, array($o->source)); |
519 | 518 | |
520 | 519 | return $recordSet; |
521 | 520 | } |
522 | 521 | |
523 | 522 | function getDefinedMeaningDefinitionRecord($definedMeaningId, ViewInformation $viewInformation) { |
524 | | - global |
525 | | - $definitionAttribute, $translatedTextAttribute, $objectAttributesAttribute; |
| 523 | + |
| 524 | + $o=OmegaWikiAttributes::getInstance(); |
526 | 525 | |
527 | 526 | $definitionId = getDefinedMeaningDefinitionId($definedMeaningId); |
528 | | - $record = new ArrayRecord(new Structure($definitionAttribute)); |
529 | | - $record->setAttributeValue($translatedTextAttribute, getTranslatedContentValue($definitionId, $viewInformation)); |
| 527 | + $record = new ArrayRecord(new Structure($o->definition)); |
| 528 | + $record->translatedText = getTranslatedContentValue($definitionId, $viewInformation); |
530 | 529 | |
531 | | - $objectAttributesRecord = getObjectAttributesRecord($definitionId, $viewInformation, $objectAttributesAttribute->id); |
532 | | - $record->setAttributeValue($objectAttributesAttribute, $objectAttributesRecord); |
| 530 | + $objectAttributesRecord = getObjectAttributesRecord($definitionId, $viewInformation, $o->objectAttributes->id); |
| 531 | + $record->objectAttributes = $objectAttributesRecord; |
533 | 532 | |
534 | 533 | applyPropertyToColumnFiltersToRecord($record, $objectAttributesRecord, $viewInformation); |
535 | 534 | |
— | — | @@ -554,29 +553,26 @@ |
555 | 554 | } |
556 | 555 | |
557 | 556 | function getObjectAttributesRecord($objectId, ViewInformation $viewInformation, $structuralOverride = null) { |
558 | | - global |
559 | | - $objectIdAttribute, |
560 | | - $linkAttributeValuesAttribute, $textAttributeValuesAttribute, |
561 | | - $translatedTextAttributeValuesAttribute, $optionAttributeValuesAttribute, |
562 | | - $definedMeaningAttributesAttribute; |
563 | 557 | |
| 558 | + $o=OmegaWikiAttributes::getInstance(); |
| 559 | + |
564 | 560 | if ($structuralOverride) |
565 | | - $record = new ArrayRecord(new Structure($structuralOverride, $definedMeaningAttributesAttribute)); |
| 561 | + $record = new ArrayRecord(new Structure($structuralOverride, $o->definedMeaningAttributes)); |
566 | 562 | else |
567 | | - $record = new ArrayRecord(new Structure($definedMeaningAttributesAttribute)); |
| 563 | + $record = new ArrayRecord(new Structure($o->definedMeaningAttributes)); |
568 | 564 | |
569 | | - $record->setAttributeValue($objectIdAttribute, $objectId); |
570 | | - $record->setAttributeValue($textAttributeValuesAttribute, getTextAttributesValuesRecordSet(array($objectId), $viewInformation)); |
571 | | - $record->setAttributeValue($translatedTextAttributeValuesAttribute, getTranslatedTextAttributeValuesRecordSet(array($objectId), $viewInformation)); |
572 | | - $record->setAttributeValue($linkAttributeValuesAttribute, getLinkAttributeValuesRecordSet(array($objectId), $viewInformation)); |
573 | | - $record->setAttributeValue($optionAttributeValuesAttribute, getOptionAttributeValuesRecordSet(array($objectId), $viewInformation)); |
| 565 | + $record->objectId = $objectId; |
| 566 | + $record->textAttributeValues = getTextAttributesValuesRecordSet(array($objectId), $viewInformation); |
| 567 | + $record->translatedTextAttributeValues = getTranslatedTextAttributeValuesRecordSet(array($objectId), $viewInformation); |
| 568 | + $record->linkAttributeValues = getLinkAttributeValuesRecordSet(array($objectId), $viewInformation); |
| 569 | + $record->optionAttributeValues = getOptionAttributeValuesRecordSet(array($objectId), $viewInformation); |
574 | 570 | |
575 | 571 | return $record; |
576 | 572 | } |
577 | 573 | |
578 | 574 | function filterAttributeValues(RecordSet $sourceRecordSet, Attribute $attributeAttribute, array &$attributeIds) { |
579 | | - global |
580 | | - $definedMeaningIdAttribute; |
| 575 | + |
| 576 | + $o=OmegaWikiAttributes::getInstance(); |
581 | 577 | |
582 | 578 | $result = new ArrayRecordSet($sourceRecordSet->getStructure(), $sourceRecordSet->getKey()); |
583 | 579 | $i = 0; |
— | — | @@ -584,7 +580,7 @@ |
585 | 581 | while ($i < $sourceRecordSet->getRecordCount()) { |
586 | 582 | $record = $sourceRecordSet->getRecord($i); |
587 | 583 | |
588 | | - if (in_array($record->getAttributeValue($attributeAttribute)->getAttributeValue($definedMeaningIdAttribute), $attributeIds)) { |
| 584 | + if (in_array($record->getAttributeValue($attributeAttribute)->definedMeaningId, $attributeIds)) { |
589 | 585 | $result->add($record); |
590 | 586 | $sourceRecordSet->remove($i); |
591 | 587 | } |
— | — | @@ -596,37 +592,33 @@ |
597 | 593 | } |
598 | 594 | |
599 | 595 | function filterObjectAttributesRecord(Record $sourceRecord, array &$attributeIds) { |
600 | | - global |
601 | | - $objectIdAttribute, |
602 | | - $textAttributeValuesAttribute, $textAttributeAttribute, |
603 | | - $translatedTextAttributeAttribute, $translatedTextAttributeValuesAttribute, |
604 | | - $linkAttributeAttribute, $linkAttributeValuesAttribute, |
605 | | - $optionAttributeAttribute, $optionAttributeValuesAttribute; |
| 596 | + |
| 597 | + $o=OmegaWikiAttributes::getInstance(); |
606 | 598 | |
607 | 599 | $result = new ArrayRecord($sourceRecord->getStructure()); |
608 | | - $result->setAttributeValue($objectIdAttribute, $sourceRecord->getAttributeValue($objectIdAttribute)); |
| 600 | + $result->objectId = $sourceRecord->objectId; |
609 | 601 | |
610 | | - $result->setAttributeValue($textAttributeValuesAttribute, filterAttributeValues( |
611 | | - $sourceRecord->getAttributeValue($textAttributeValuesAttribute), |
612 | | - $textAttributeAttribute, |
| 602 | + $result->setAttributeValue($o->textAttributeValues, filterAttributeValues( |
| 603 | + $sourceRecord->textAttributeValues, |
| 604 | + $o->textAttribute, |
613 | 605 | $attributeIds |
614 | 606 | )); |
615 | 607 | |
616 | | - $result->setAttributeValue($translatedTextAttributeValuesAttribute, filterAttributeValues( |
617 | | - $sourceRecord->getAttributeValue($translatedTextAttributeValuesAttribute), |
618 | | - $translatedTextAttributeAttribute, |
| 608 | + $result->setAttributeValue($o->translatedTextAttributeValues, filterAttributeValues( |
| 609 | + $sourceRecord->translatedTextAttributeValues, |
| 610 | + $o->translatedTextAttribute, |
619 | 611 | $attributeIds |
620 | 612 | )); |
621 | 613 | |
622 | | - $result->setAttributeValue($linkAttributeValuesAttribute, filterAttributeValues( |
623 | | - $sourceRecord->getAttributeValue($linkAttributeValuesAttribute), |
624 | | - $linkAttributeAttribute, |
| 614 | + $result->setAttributeValue($o->linkAttributeValues, filterAttributeValues( |
| 615 | + $sourceRecord->linkAttributeValues, |
| 616 | + $o->linkAttribute, |
625 | 617 | $attributeIds |
626 | 618 | )); |
627 | 619 | |
628 | | - $result->setAttributeValue($optionAttributeValuesAttribute, filterAttributeValues( |
629 | | - $sourceRecord->getAttributeValue($optionAttributeValuesAttribute), |
630 | | - $optionAttributeAttribute, |
| 620 | + $result->setAttributeValue($o->optionAttributeValues, filterAttributeValues( |
| 621 | + $sourceRecord->optionAttributeValues, |
| 622 | + $o->optionAttribute, |
631 | 623 | $attributeIds |
632 | 624 | )); |
633 | 625 | |
— | — | @@ -634,8 +626,8 @@ |
635 | 627 | } |
636 | 628 | |
637 | 629 | function getTranslatedContentValue($translatedContentId, ViewInformation $viewInformation) { |
638 | | - global |
639 | | - $textAttribute; |
| 630 | + |
| 631 | + $o=OmegaWikiAttributes::getInstance(); |
640 | 632 | |
641 | 633 | if ($viewInformation->filterLanguageId == 0) |
642 | 634 | return getTranslatedContentRecordSet($translatedContentId, $viewInformation); |
— | — | @@ -646,7 +638,7 @@ |
647 | 639 | return $recordSet; |
648 | 640 | else { |
649 | 641 | if ($recordSet->getRecordCount() > 0) |
650 | | - return $recordSet->getRecord(0)->getAttributeValue($textAttribute); |
| 642 | + return $recordSet->getRecord(0)->text; |
651 | 643 | else |
652 | 644 | return ""; |
653 | 645 | } |
— | — | @@ -654,14 +646,15 @@ |
655 | 647 | } |
656 | 648 | |
657 | 649 | function getTranslatedContentRecordSet($translatedContentId, ViewInformation $viewInformation) { |
| 650 | + |
| 651 | + $o=OmegaWikiAttributes::getInstance(); |
658 | 652 | global |
659 | | - $translatedContentTable, |
660 | | - $translatedTextStructure; |
| 653 | + $translatedContentTable; |
661 | 654 | |
662 | 655 | $o=OmegaWikiAttributes::getInstance(); |
663 | 656 | |
664 | 657 | $recordSet = queryRecordSet( |
665 | | - $translatedTextStructure->getStructureType(), |
| 658 | + $o->translatedTextStructure->getStructureType(), |
666 | 659 | $viewInformation->queryTransactionInformation, |
667 | 660 | $o->language, |
668 | 661 | new TableColumnsToAttributesMapping( |
— | — | @@ -704,9 +697,10 @@ |
705 | 698 | } |
706 | 699 | |
707 | 700 | function getSynonymAndTranslationRecordSet($definedMeaningId, ViewInformation $viewInformation) { |
| 701 | + |
| 702 | + $o=OmegaWikiAttributes::getInstance(); |
708 | 703 | global |
709 | | - $syntransTable, $syntransIdAttribute, $expressionAttribute, $identicalMeaningAttribute, $objectAttributesAttribute, |
710 | | - $synonymsTranslationsStructure; |
| 704 | + $syntransTable; |
711 | 705 | |
712 | 706 | $dc=wdGetDataSetContext(); |
713 | 707 | $restrictions = array("defined_meaning_id=$definedMeaningId"); |
— | — | @@ -721,33 +715,30 @@ |
722 | 716 | ")"; |
723 | 717 | |
724 | 718 | $recordSet = queryRecordSet( |
725 | | - $synonymsTranslationsStructure->getStructureType(), |
| 719 | + $o->synonymsTranslationsStructure->getStructureType(), |
726 | 720 | $viewInformation->queryTransactionInformation, |
727 | | - $syntransIdAttribute, |
| 721 | + $o->syntransId, |
728 | 722 | new TableColumnsToAttributesMapping( |
729 | | - new TableColumnsToAttribute(array('syntrans_sid'), $syntransIdAttribute), |
730 | | - new TableColumnsToAttribute(array('expression_id'), $expressionAttribute), |
731 | | - new TableColumnsToAttribute(array('identical_meaning'),$identicalMeaningAttribute) |
| 723 | + new TableColumnsToAttribute(array('syntrans_sid'), $o->syntransId), |
| 724 | + new TableColumnsToAttribute(array('expression_id'), $o->expression), |
| 725 | + new TableColumnsToAttribute(array('identical_meaning'),$o->identicalMeaning) |
732 | 726 | ), |
733 | 727 | $syntransTable, |
734 | 728 | $restrictions |
735 | 729 | ); |
736 | 730 | |
737 | 731 | if ($viewInformation->filterLanguageId == 0) |
738 | | - expandExpressionReferencesInRecordSet($recordSet, array($expressionAttribute)); |
| 732 | + expandExpressionReferencesInRecordSet($recordSet, array($o->expression)); |
739 | 733 | else |
740 | | - expandExpressionSpellingsInRecordSet($recordSet, array($expressionAttribute)); |
| 734 | + expandExpressionSpellingsInRecordSet($recordSet, array($o->expression)); |
741 | 735 | |
742 | | - expandObjectAttributesAttribute($recordSet, $objectAttributesAttribute, $syntransIdAttribute, $viewInformation); |
| 736 | + expandObjectAttributesAttribute($recordSet, $o->objectAttributes, $o->syntransId, $viewInformation); |
743 | 737 | return $recordSet; |
744 | 738 | } |
745 | 739 | |
746 | 740 | function expandObjectAttributesAttribute(RecordSet $recordSet, Attribute $attributeToExpand, Attribute $objectIdAttribute, ViewInformation $viewInformation) { |
747 | | - global |
748 | | - $textAttributeObjectAttribute, $textAttributeValuesAttribute, |
749 | | - $attributeObjectAttribute, $translatedTextAttributeValuesAttribute, |
750 | | - $linkAttributeObjectAttribute, $linkAttributeValuesAttribute, |
751 | | - $optionAttributeObjectAttribute, $optionAttributeValuesAttribute; |
| 741 | + |
| 742 | + $o=OmegaWikiAttributes::getInstance(); |
752 | 743 | |
753 | 744 | $recordSetStructure = $recordSet->getStructure(); |
754 | 745 | $recordSetStructure->addAttribute($attributeToExpand); |
— | — | @@ -767,7 +758,7 @@ |
768 | 759 | $textAttributeValuesRecordSets = |
769 | 760 | splitRecordSet( |
770 | 761 | $allTextAttributeValuesRecordSet, |
771 | | - $textAttributeObjectAttribute |
| 762 | + $o->textAttributeObject |
772 | 763 | ); |
773 | 764 | |
774 | 765 | $emptyTextAttributesRecordSet = new ArrayRecordSet($allTextAttributeValuesRecordSet->getStructure(), $allTextAttributeValuesRecordSet->getKey()); |
— | — | @@ -777,7 +768,7 @@ |
778 | 769 | $translatedTextAttributeValuesRecordSets = |
779 | 770 | splitRecordSet( |
780 | 771 | $allTranslatedTextAttributeValuesRecordSet, |
781 | | - $attributeObjectAttribute |
| 772 | + $o->attributeObject |
782 | 773 | ); |
783 | 774 | |
784 | 775 | $emptyTranslatedTextAttributesRecordSet = new ArrayRecordSet($allTranslatedTextAttributeValuesRecordSet->getStructure(), $allTranslatedTextAttributeValuesRecordSet->getKey()); |
— | — | @@ -787,7 +778,7 @@ |
788 | 779 | $linkAttributeValuesRecordSets = |
789 | 780 | splitRecordSet( |
790 | 781 | $allLinkAttributeValuesRecordSet, |
791 | | - $linkAttributeObjectAttribute |
| 782 | + $o->linkAttributeObject |
792 | 783 | ); |
793 | 784 | |
794 | 785 | $emptyLinkAttributesRecordSet = new ArrayRecordSet($allLinkAttributeValuesRecordSet->getStructure(), $allLinkAttributeValuesRecordSet->getKey()); |
— | — | @@ -797,7 +788,7 @@ |
798 | 789 | $optionAttributeValuesRecordSets = |
799 | 790 | splitRecordSet( |
800 | 791 | $allOptionAttributeValuesRecordSet, |
801 | | - $optionAttributeObjectAttribute |
| 792 | + $o->optionAttributeObject |
802 | 793 | ); |
803 | 794 | |
804 | 795 | |
— | — | @@ -833,10 +824,10 @@ |
834 | 825 | |
835 | 826 | $objectAttributesRecord = new ArrayRecord($objectAttributesRecordStructure); |
836 | 827 | $objectAttributesRecord->setAttributeValue($objectIdAttribute, $objectId); |
837 | | - $objectAttributesRecord->setAttributeValue($textAttributeValuesAttribute, $textAttributeValuesRecordSet); |
838 | | - $objectAttributesRecord->setAttributeValue($translatedTextAttributeValuesAttribute, $translatedTextAttributeValuesRecordSet); |
839 | | - $objectAttributesRecord->setAttributeValue($linkAttributeValuesAttribute, $linkAttributeValuesRecordSet); |
840 | | - $objectAttributesRecord->setAttributeValue($optionAttributeValuesAttribute, $optionAttributeValuesRecordSet); |
| 828 | + $objectAttributesRecord->textAttributeValues = $textAttributeValuesRecordSet; |
| 829 | + $objectAttributesRecord->translatedTextAttributeValues = $translatedTextAttributeValuesRecordSet; |
| 830 | + $objectAttributesRecord->linkAttributeValues = $linkAttributeValuesRecordSet; |
| 831 | + $objectAttributesRecord->optionAttributeValues = $optionAttributeValuesRecordSet; |
841 | 832 | |
842 | 833 | $record->setAttributeValue($attributeToExpand, $objectAttributesRecord); |
843 | 834 | applyPropertyToColumnFiltersToRecord($record, $objectAttributesRecord, $viewInformation); |
— | — | @@ -845,23 +836,22 @@ |
846 | 837 | } |
847 | 838 | |
848 | 839 | function getDefinedMeaningReferenceRecord($definedMeaningId) { |
849 | | - global |
850 | | - $definedMeaningReferenceStructure, $definedMeaningIdAttribute, $definedMeaningLabelAttribute, |
851 | | - $definedMeaningDefiningExpressionAttribute; |
| 840 | + |
| 841 | + $o=OmegaWikiAttributes::getInstance(); |
852 | 842 | |
853 | | - $record = new ArrayRecord($definedMeaningReferenceStructure); |
854 | | - $record->setAttributeValue($definedMeaningIdAttribute, $definedMeaningId); |
855 | | - $record->setAttributeValue($definedMeaningLabelAttribute, definedMeaningExpression($definedMeaningId)); |
856 | | - $record->setAttributeValue($definedMeaningDefiningExpressionAttribute, definingExpression($definedMeaningId)); |
| 843 | + $record = new ArrayRecord($o->definedMeaningReferenceStructure); |
| 844 | + $record->definedMeaningId = $definedMeaningId; |
| 845 | + $record->definedMeaningLabel = definedMeaningExpression($definedMeaningId); |
| 846 | + $record->definedMeaningDefiningExpression = definingExpression($definedMeaningId); |
857 | 847 | |
858 | 848 | return $record; |
859 | 849 | } |
860 | 850 | |
861 | 851 | function getDefinedMeaningRelationsRecordSet($definedMeaningId, array $filterRelationTypes, ViewInformation $viewInformation) { |
| 852 | + |
| 853 | + $o=OmegaWikiAttributes::getInstance(); |
862 | 854 | global |
863 | | - $meaningRelationsTable, $relationIdAttribute, $relationTypeAttribute, |
864 | | - $objectAttributesAttribute, $otherDefinedMeaningAttribute, |
865 | | - $relationStructure; |
| 855 | + $meaningRelationsTable; |
866 | 856 | |
867 | 857 | $restrictions = array("meaning1_mid=$definedMeaningId"); |
868 | 858 | |
— | — | @@ -869,63 +859,64 @@ |
870 | 860 | $restrictions[] = "relationtype_mid NOT IN (". implode(", ", $filterRelationTypes) .")"; |
871 | 861 | |
872 | 862 | $recordSet = queryRecordSet( |
873 | | - $relationStructure->getStructureType(), |
| 863 | + $o->relationStructure->getStructureType(), |
874 | 864 | $viewInformation->queryTransactionInformation, |
875 | | - $relationIdAttribute, |
| 865 | + $o->relationId, |
876 | 866 | new TableColumnsToAttributesMapping( |
877 | | - new TableColumnsToAttribute(array('relation_id'), $relationIdAttribute), |
878 | | - new TableColumnsToAttribute(array('relationtype_mid'), $relationTypeAttribute), |
879 | | - new TableColumnsToAttribute(array('meaning2_mid'), $otherDefinedMeaningAttribute) |
| 867 | + new TableColumnsToAttribute(array('relation_id'), $o->relationId), |
| 868 | + new TableColumnsToAttribute(array('relationtype_mid'), $o->relationType), |
| 869 | + new TableColumnsToAttribute(array('meaning2_mid'), $o->otherDefinedMeaning) |
880 | 870 | ), |
881 | 871 | $meaningRelationsTable, |
882 | 872 | $restrictions, |
883 | 873 | array('add_transaction_id') |
884 | 874 | ); |
885 | 875 | |
886 | | - expandDefinedMeaningReferencesInRecordSet($recordSet, array($relationTypeAttribute, $otherDefinedMeaningAttribute)); |
887 | | - expandObjectAttributesAttribute($recordSet, $objectAttributesAttribute, $relationIdAttribute, $viewInformation); |
| 876 | + expandDefinedMeaningReferencesInRecordSet($recordSet, array($o->relationType, $o->otherDefinedMeaning)); |
| 877 | + expandObjectAttributesAttribute($recordSet, $o->objectAttributes, $o->relationId, $viewInformation); |
888 | 878 | |
889 | 879 | return $recordSet; |
890 | 880 | } |
891 | 881 | |
892 | 882 | function getDefinedMeaningReciprocalRelationsRecordSet($definedMeaningId, ViewInformation $viewInformation) { |
| 883 | + |
| 884 | + $o=OmegaWikiAttributes::getInstance(); |
893 | 885 | global |
894 | | - $meaningRelationsTable, $relationIdAttribute, $relationTypeAttribute, |
895 | | - $otherDefinedMeaningAttribute, $objectAttributesAttribute, |
896 | | - $reciprocalRelationsAttribute; |
| 886 | + $meaningRelationsTable; |
897 | 887 | |
898 | 888 | $recordSet = queryRecordSet( |
899 | | - $reciprocalRelationsAttribute->id, |
| 889 | + $o->reciprocalRelations->id, |
900 | 890 | $viewInformation->queryTransactionInformation, |
901 | | - $relationIdAttribute, |
| 891 | + $o->relationId, |
902 | 892 | new TableColumnsToAttributesMapping( |
903 | | - new TableColumnsToAttribute(array('relation_id'), $relationIdAttribute), |
904 | | - new TableColumnsToAttribute(array('relationtype_mid'), $relationTypeAttribute), |
905 | | - new TableColumnsToAttribute(array('meaning1_mid'), $otherDefinedMeaningAttribute) |
| 893 | + new TableColumnsToAttribute(array('relation_id'), $o->relationId), |
| 894 | + new TableColumnsToAttribute(array('relationtype_mid'), $o->relationType), |
| 895 | + new TableColumnsToAttribute(array('meaning1_mid'), $o->otherDefinedMeaning) |
906 | 896 | ), |
907 | 897 | $meaningRelationsTable, |
908 | 898 | array("meaning2_mid=$definedMeaningId"), |
909 | 899 | array('relationtype_mid') |
910 | 900 | ); |
911 | 901 | |
912 | | - expandDefinedMeaningReferencesInRecordSet($recordSet, array($relationTypeAttribute, $otherDefinedMeaningAttribute)); |
913 | | - expandObjectAttributesAttribute($recordSet, $objectAttributesAttribute, $relationIdAttribute, $viewInformation); |
| 902 | + expandDefinedMeaningReferencesInRecordSet($recordSet, array($o->relationType, $o->otherDefinedMeaning)); |
| 903 | + expandObjectAttributesAttribute($recordSet, $o->objectAttributes, $o->relationId, $viewInformation); |
914 | 904 | |
915 | 905 | return $recordSet; |
916 | 906 | } |
917 | 907 | |
918 | 908 | function getPossiblySynonymousRecordSet($definedMeaningId, ViewInformation $viewInformation) { |
| 909 | + |
| 910 | + $o=OmegaWikiAttributes::getInstance(); |
919 | 911 | global |
920 | | - $meaningRelationsTable, $possiblySynonymousIdAttribute, $possibleSynonymAttribute, |
921 | | - $objectAttributesAttribute, $otherDefinedMeaningAttribute; |
| 912 | + $meaningRelationsTable; |
922 | 913 | |
923 | 914 | $recordSet = queryRecordSet( |
924 | 915 | null, |
925 | 916 | $viewInformation->queryTransactionInformation, |
926 | | - $possiblySynonymousIdAttribute, |
| 917 | + $o->possiblySynonymousId, |
927 | 918 | new TableColumnsToAttributesMapping( |
928 | | - new TableColumnsToAttribute(array('relation_id'), $possiblySynonymousIdAttribute), |
929 | | - new TableColumnsToAttribute(array('meaning2_mid'), $possibleSynonymAttribute) |
| 919 | + new TableColumnsToAttribute(array('relation_id'), $o->possiblySynonymousId), |
| 920 | + new TableColumnsToAttribute(array('meaning2_mid'), $o->possibleSynonym) |
930 | 921 | ), |
931 | 922 | $meaningRelationsTable, |
932 | 923 | array( |
— | — | @@ -935,186 +926,192 @@ |
936 | 927 | array('add_transaction_id') |
937 | 928 | ); |
938 | 929 | |
939 | | - expandDefinedMeaningReferencesInRecordSet($recordSet, array($possibleSynonymAttribute)); |
940 | | - expandObjectAttributesAttribute($recordSet, $objectAttributesAttribute, $possiblySynonymousIdAttribute, $viewInformation); |
| 930 | + expandDefinedMeaningReferencesInRecordSet($recordSet, array($o->possibleSynonym)); |
| 931 | + expandObjectAttributesAttribute($recordSet, $o->objectAttributes, $o->possiblySynonymousId, $viewInformation); |
941 | 932 | |
942 | 933 | return $recordSet; |
943 | 934 | } |
944 | 935 | |
945 | 936 | function getGotoSourceRecord($record) { |
946 | | - global |
947 | | - $gotoSourceStructure, $collectionIdAttribute, $sourceIdentifierAttribute; |
| 937 | + |
| 938 | + $o=OmegaWikiAttributes::getInstance(); |
948 | 939 | |
949 | | - $result = new ArrayRecord($gotoSourceStructure); |
950 | | - $result->setAttributeValue($collectionIdAttribute, $record->getAttributeValue($collectionIdAttribute)); |
951 | | - $result->setAttributeValue($sourceIdentifierAttribute, $record->getAttributeValue($sourceIdentifierAttribute)); |
| 940 | + $result = new ArrayRecord($o->gotoSourceStructure); |
| 941 | + $result->collectionId = $record->collectionId; |
| 942 | + $result->sourceIdentifier = $record->sourceIdentifier; |
952 | 943 | |
953 | 944 | return $result; |
954 | 945 | } |
955 | 946 | |
956 | 947 | function getDefinedMeaningCollectionMembershipRecordSet($definedMeaningId, ViewInformation $viewInformation) { |
| 948 | + |
| 949 | + $o=OmegaWikiAttributes::getInstance(); |
957 | 950 | global |
958 | | - $collectionMembershipsTable, $collectionIdAttribute, $collectionMeaningAttribute, $sourceIdentifierAttribute, |
959 | | - $gotoSourceAttribute, $collectionMembershipStructure; |
| 951 | + $collectionMembershipsTable; |
960 | 952 | |
961 | 953 | $recordSet = queryRecordSet( |
962 | | - $collectionMembershipStructure->getStructureType(), |
| 954 | + $o->collectionMembershipStructure->getStructureType(), |
963 | 955 | $viewInformation->queryTransactionInformation, |
964 | | - $collectionIdAttribute, |
| 956 | + $o->collectionId, |
965 | 957 | new TableColumnsToAttributesMapping( |
966 | | - new TableColumnsToAttribute(array('collection_id'), $collectionIdAttribute), |
967 | | - new TableColumnsToAttribute(array('internal_member_id'), $sourceIdentifierAttribute) |
| 958 | + new TableColumnsToAttribute(array('collection_id'), $o->collectionId), |
| 959 | + new TableColumnsToAttribute(array('internal_member_id'), $o->sourceIdentifier) |
968 | 960 | ), |
969 | 961 | $collectionMembershipsTable, |
970 | 962 | array("member_mid=$definedMeaningId") |
971 | 963 | ); |
972 | 964 | |
973 | | - $recordSet->getStructure()->addAttribute($collectionMeaningAttribute); |
| 965 | + $recordSet->getStructure()->addAttribute($o->collectionMeaning); |
974 | 966 | |
975 | 967 | for ($i = 0; $i < $recordSet->getRecordCount(); $i++) { |
976 | 968 | $record = $recordSet->getRecord($i); |
977 | | - $record->setAttributeValue($collectionMeaningAttribute, getCollectionMeaningId($record->getAttributeValue($collectionIdAttribute))); |
978 | | - $record->setAttributeValue($gotoSourceAttribute, getGotoSourceRecord($record)); |
| 969 | + $record->collectionMeaning = getCollectionMeaningId($record->collectionId); |
| 970 | + $record->gotoSource = getGotoSourceRecord($record); |
979 | 971 | } |
980 | 972 | |
981 | | - expandDefinedMeaningReferencesInRecordSet($recordSet, array($collectionMeaningAttribute)); |
| 973 | + expandDefinedMeaningReferencesInRecordSet($recordSet, array($o->collectionMeaning)); |
982 | 974 | |
983 | 975 | return $recordSet; |
984 | 976 | } |
985 | 977 | |
986 | 978 | function getTextAttributesValuesRecordSet(array $objectIds, ViewInformation $viewInformation) { |
| 979 | + |
| 980 | + $o=OmegaWikiAttributes::getInstance(); |
987 | 981 | global |
988 | | - $textAttributeValuesTable, $textAttributeIdAttribute, $textAttributeObjectAttribute, |
989 | | - $textAttributeAttribute, $textAttribute, $objectAttributesAttribute, |
990 | | - $textAttributeValuesStructure; |
| 982 | + $textAttributeValuesTable; |
991 | 983 | |
992 | 984 | $recordSet = queryRecordSet( |
993 | | - $textAttributeValuesStructure->getStructureType(), |
| 985 | + $o->textAttributeValuesStructure->getStructureType(), |
994 | 986 | $viewInformation->queryTransactionInformation, |
995 | | - $textAttributeIdAttribute, |
| 987 | + $o->textAttributeId, |
996 | 988 | new TableColumnsToAttributesMapping( |
997 | | - new TableColumnsToAttribute(array('value_id'), $textAttributeIdAttribute), |
998 | | - new TableColumnsToAttribute(array('object_id'), $textAttributeObjectAttribute), |
999 | | - new TableColumnsToAttribute(array('attribute_mid'), $textAttributeAttribute), |
1000 | | - new TableColumnsToAttribute(array('text'), $textAttribute) |
| 989 | + new TableColumnsToAttribute(array('value_id'), $o->textAttributeId), |
| 990 | + new TableColumnsToAttribute(array('object_id'), $o->textAttributeObject), |
| 991 | + new TableColumnsToAttribute(array('attribute_mid'), $o->textAttribute), |
| 992 | + new TableColumnsToAttribute(array('text'), $o->text) |
1001 | 993 | ), |
1002 | 994 | $textAttributeValuesTable, |
1003 | 995 | array("object_id IN (" . implode(", ", $objectIds) . ")") |
1004 | 996 | ); |
1005 | 997 | |
1006 | | - expandDefinedMeaningReferencesInRecordSet($recordSet, array($textAttributeAttribute)); |
1007 | | - expandObjectAttributesAttribute($recordSet, $objectAttributesAttribute, $textAttributeIdAttribute, $viewInformation); |
| 998 | + expandDefinedMeaningReferencesInRecordSet($recordSet, array($o->textAttribute)); |
| 999 | + expandObjectAttributesAttribute($recordSet, $o->objectAttributes, $o->textAttributeId, $viewInformation); |
1008 | 1000 | |
1009 | 1001 | return $recordSet; |
1010 | 1002 | } |
1011 | 1003 | |
1012 | 1004 | function getLinkAttributeValuesRecordSet(array $objectIds, ViewInformation $viewInformation) { |
| 1005 | + |
| 1006 | + $o=OmegaWikiAttributes::getInstance(); |
1013 | 1007 | global |
1014 | | - $linkAttributeValuesTable, $linkAttributeIdAttribute, $linkAttributeObjectAttribute, |
1015 | | - $linkAttributeAttribute, $linkAttribute, $objectAttributesAttribute, |
1016 | | - $linkAttributeValuesStructure; |
| 1008 | + $linkAttributeValuesTable; |
1017 | 1009 | |
1018 | 1010 | $recordSet = queryRecordSet( |
1019 | | - $linkAttributeValuesStructure->getStructureType(), |
| 1011 | + $o->linkAttributeValuesStructure->getStructureType(), |
1020 | 1012 | $viewInformation->queryTransactionInformation, |
1021 | | - $linkAttributeIdAttribute, |
| 1013 | + $o->linkAttributeId, |
1022 | 1014 | new TableColumnsToAttributesMapping( |
1023 | | - new TableColumnsToAttribute(array('value_id'), $linkAttributeIdAttribute), |
1024 | | - new TableColumnsToAttribute(array('object_id'), $linkAttributeObjectAttribute), |
1025 | | - new TableColumnsToAttribute(array('attribute_mid'), $linkAttributeAttribute), |
1026 | | - new TableColumnsToAttribute(array('label', 'url'), $linkAttribute) |
| 1015 | + new TableColumnsToAttribute(array('value_id'), $o->linkAttributeId), |
| 1016 | + new TableColumnsToAttribute(array('object_id'), $o->linkAttributeObject), |
| 1017 | + new TableColumnsToAttribute(array('attribute_mid'), $o->linkAttribute), |
| 1018 | + new TableColumnsToAttribute(array('label', 'url'), $o->link) |
1027 | 1019 | ), |
1028 | 1020 | $linkAttributeValuesTable, |
1029 | 1021 | array("object_id IN (" . implode(", ", $objectIds) . ")") |
1030 | 1022 | ); |
1031 | 1023 | |
1032 | | - expandDefinedMeaningReferencesInRecordSet($recordSet, array($linkAttributeAttribute)); |
1033 | | - expandObjectAttributesAttribute($recordSet, $objectAttributesAttribute, $linkAttributeIdAttribute, $viewInformation); |
| 1024 | + expandDefinedMeaningReferencesInRecordSet($recordSet, array($o->linkAttribute)); |
| 1025 | + expandObjectAttributesAttribute($recordSet, $o->objectAttributes, $o->linkAttributeId, $viewInformation); |
1034 | 1026 | |
1035 | 1027 | return $recordSet; |
1036 | 1028 | } |
1037 | 1029 | |
1038 | 1030 | function getTranslatedTextAttributeValuesRecordSet(array $objectIds, ViewInformation $viewInformation) { |
| 1031 | + |
| 1032 | + $o=OmegaWikiAttributes::getInstance(); |
1039 | 1033 | global |
1040 | | - $translatedTextAttributeIdAttribute, $translatedContentAttributeValuesTable, $translatedTextAttributeAttribute, |
1041 | | - $objectAttributesAttribute, $attributeObjectAttribute, $translatedTextValueAttribute, $translatedTextValueIdAttribute, |
1042 | | - $translatedTextAttributeValuesStructure; |
| 1034 | + $translatedContentAttributeValuesTable; |
1043 | 1035 | |
1044 | 1036 | $recordSet = queryRecordSet( |
1045 | | - $translatedTextAttributeValuesStructure->getStructureType(), |
| 1037 | + $o->translatedTextAttributeValuesStructure->getStructureType(), |
1046 | 1038 | $viewInformation->queryTransactionInformation, |
1047 | | - $translatedTextAttributeIdAttribute, |
| 1039 | + $o->translatedTextAttributeId, |
1048 | 1040 | new TableColumnsToAttributesMapping( |
1049 | | - new TableColumnsToAttribute(array('value_id'), $translatedTextAttributeIdAttribute), |
1050 | | - new TableColumnsToAttribute(array('object_id'), $attributeObjectAttribute), |
1051 | | - new TableColumnsToAttribute(array('attribute_mid'), $translatedTextAttributeAttribute), |
1052 | | - new TableColumnsToAttribute(array('value_tcid'), $translatedTextValueIdAttribute) |
| 1041 | + new TableColumnsToAttribute(array('value_id'), $o->translatedTextAttributeId), |
| 1042 | + new TableColumnsToAttribute(array('object_id'), $o->attributeObject), |
| 1043 | + new TableColumnsToAttribute(array('attribute_mid'), $o->translatedTextAttribute), |
| 1044 | + new TableColumnsToAttribute(array('value_tcid'), $o->translatedTextValueId) |
1053 | 1045 | ), |
1054 | 1046 | $translatedContentAttributeValuesTable, |
1055 | 1047 | array("object_id IN (" . implode(", ", $objectIds) . ")") |
1056 | 1048 | ); |
1057 | 1049 | |
1058 | | - $recordSet->getStructure()->addAttribute($translatedTextValueAttribute); |
| 1050 | + $recordSet->getStructure()->addAttribute($o->translatedTextValue); |
1059 | 1051 | |
1060 | | - expandTranslatedContentsInRecordSet($recordSet, $translatedTextValueIdAttribute, $translatedTextValueAttribute, $viewInformation); |
1061 | | - expandDefinedMeaningReferencesInRecordSet($recordSet, array($translatedTextAttributeAttribute)); |
1062 | | - expandObjectAttributesAttribute($recordSet, $objectAttributesAttribute, $translatedTextAttributeIdAttribute, $viewInformation); |
| 1052 | + expandTranslatedContentsInRecordSet($recordSet, $o->translatedTextValueId, $o->translatedTextValue, $viewInformation); |
| 1053 | + expandDefinedMeaningReferencesInRecordSet($recordSet, array($o->translatedTextAttribute)); |
| 1054 | + expandObjectAttributesAttribute($recordSet, $o->objectAttributes, $o->translatedTextAttributeId, $viewInformation); |
1063 | 1055 | return $recordSet; |
1064 | 1056 | } |
1065 | 1057 | |
1066 | 1058 | function getOptionAttributeOptionsRecordSet($attributeId, ViewInformation $viewInformation) { |
| 1059 | + |
| 1060 | + $o=OmegaWikiAttributes::getInstance(); |
1067 | 1061 | global |
1068 | | - $optionAttributeOptionIdAttribute, $optionAttributeAttribute, $optionAttributeOptionAttribute, $optionAttributeOptionsTable; |
| 1062 | + $optionAttributeOptionsTable; |
1069 | 1063 | |
1070 | 1064 | $o=OmegaWikiAttributes::getInstance(); |
1071 | 1065 | $recordSet = queryRecordSet( |
1072 | 1066 | null, |
1073 | 1067 | $viewInformation->queryTransactionInformation, |
1074 | | - $optionAttributeOptionIdAttribute, |
| 1068 | + $o->optionAttributeOptionId, |
1075 | 1069 | new TableColumnsToAttributesMapping( |
1076 | | - new TableColumnsToAttribute(array('option_id'), $optionAttributeOptionIdAttribute), |
1077 | | - new TableColumnsToAttribute(array('attribute_id'), $optionAttributeAttribute), |
1078 | | - new TableColumnsToAttribute(array('option_mid'), $optionAttributeOptionAttribute), |
| 1070 | + new TableColumnsToAttribute(array('option_id'), $o->optionAttributeOptionId), |
| 1071 | + new TableColumnsToAttribute(array('attribute_id'), $o->optionAttribute), |
| 1072 | + new TableColumnsToAttribute(array('option_mid'), $o->optionAttributeOption), |
1079 | 1073 | new TableColumnsToAttribute(array('language_id'), $o->language) |
1080 | 1074 | ), |
1081 | 1075 | $optionAttributeOptionsTable, |
1082 | 1076 | array('attribute_id = ' . $attributeId) |
1083 | 1077 | ); |
1084 | 1078 | |
1085 | | - expandDefinedMeaningReferencesInRecordSet($recordSet, array($optionAttributeOptionAttribute)); |
| 1079 | + expandDefinedMeaningReferencesInRecordSet($recordSet, array($o->optionAttributeOption)); |
1086 | 1080 | |
1087 | 1081 | return $recordSet; |
1088 | 1082 | } |
1089 | 1083 | |
1090 | 1084 | function getOptionAttributeValuesRecordSet(array $objectIds, ViewInformation $viewInformation) { |
| 1085 | + |
| 1086 | + $o=OmegaWikiAttributes::getInstance(); |
1091 | 1087 | global |
1092 | | - $optionAttributeIdAttribute, $optionAttributeObjectAttribute, $optionAttributeOptionIdAttribute, $optionAttributeAttribute,$optionAttributeOptionAttribute, $optionAttributeValuesTable, $objectAttributesAttribute, |
1093 | | - $optionAttributeValuesStructure; |
| 1088 | + $optionAttributeValuesTable; |
1094 | 1089 | |
1095 | 1090 | $recordSet = queryRecordSet( |
1096 | | - $optionAttributeValuesStructure->getStructureType(), |
| 1091 | + $o->optionAttributeValuesStructure->getStructureType(), |
1097 | 1092 | $viewInformation->queryTransactionInformation, |
1098 | | - $optionAttributeIdAttribute, |
| 1093 | + $o->optionAttributeId, |
1099 | 1094 | new TableColumnsToAttributesMapping( |
1100 | | - new TableColumnsToAttribute(array('value_id'), $optionAttributeIdAttribute), |
1101 | | - new TableColumnsToAttribute(array('object_id'), $optionAttributeObjectAttribute), |
1102 | | - new TableColumnsToAttribute(array('option_id'), $optionAttributeOptionIdAttribute) |
| 1095 | + new TableColumnsToAttribute(array('value_id'), $o->optionAttributeId), |
| 1096 | + new TableColumnsToAttribute(array('object_id'), $o->optionAttributeObject), |
| 1097 | + new TableColumnsToAttribute(array('option_id'), $o->optionAttributeOptionId) |
1103 | 1098 | ), |
1104 | 1099 | $optionAttributeValuesTable, |
1105 | 1100 | array("object_id IN (" . implode(", ", $objectIds) . ")") |
1106 | 1101 | ); |
1107 | 1102 | |
1108 | 1103 | expandOptionsInRecordSet($recordSet, $viewInformation); |
1109 | | - expandDefinedMeaningReferencesInRecordSet($recordSet, array($optionAttributeAttribute, $optionAttributeOptionAttribute)); |
1110 | | - expandObjectAttributesAttribute($recordSet, $objectAttributesAttribute, $optionAttributeIdAttribute, $viewInformation); |
| 1104 | + expandDefinedMeaningReferencesInRecordSet($recordSet, array($o->optionAttribute, $o->optionAttributeOption)); |
| 1105 | + expandObjectAttributesAttribute($recordSet, $o->objectAttributes, $o->optionAttributeId, $viewInformation); |
1111 | 1106 | |
1112 | 1107 | return $recordSet; |
1113 | 1108 | } |
1114 | 1109 | |
1115 | 1110 | /* XXX: This can probably be combined with other functions. In fact, it probably should be. Do it. */ |
1116 | 1111 | function expandOptionsInRecordSet(RecordSet $recordSet, ViewInformation $viewInformation) { |
| 1112 | + |
| 1113 | + $o=OmegaWikiAttributes::getInstance(); |
1117 | 1114 | global |
1118 | | - $optionAttributeOptionIdAttribute, $optionAttributeIdAttribute, $optionAttributeAttribute, $optionAttributeOptionAttribute, $optionAttributeOptionsTable, $classAttributesTable; |
| 1115 | + $optionAttributeOptionsTable, $classAttributesTable; |
1119 | 1116 | |
1120 | 1117 | for ($i = 0; $i < $recordSet->getRecordCount(); $i++) { |
1121 | 1118 | $record = $recordSet->getRecord($i); |
— | — | @@ -1122,74 +1119,67 @@ |
1123 | 1120 | $optionRecordSet = queryRecordSet( |
1124 | 1121 | null, |
1125 | 1122 | $viewInformation->queryTransactionInformation, |
1126 | | - $optionAttributeOptionIdAttribute, |
| 1123 | + $o->optionAttributeOptionId, |
1127 | 1124 | new TableColumnsToAttributesMapping( |
1128 | | - new TableColumnsToAttribute(array('attribute_id'), $optionAttributeIdAttribute), |
1129 | | - new TableColumnsToAttribute(array('option_mid'), $optionAttributeOptionAttribute) |
| 1125 | + new TableColumnsToAttribute(array('attribute_id'), $o->optionAttributeId), |
| 1126 | + new TableColumnsToAttribute(array('option_mid'), $o->optionAttributeOption) |
1130 | 1127 | ), |
1131 | 1128 | $optionAttributeOptionsTable, |
1132 | | - array('option_id = ' . $record->getAttributeValue($optionAttributeOptionIdAttribute)) |
| 1129 | + array('option_id = ' . $record->optionAttributeOptionId) |
1133 | 1130 | ); |
1134 | 1131 | |
1135 | 1132 | $optionRecord = $optionRecordSet->getRecord(0); |
1136 | | - $record->setAttributeValue( |
1137 | | - $optionAttributeOptionAttribute, |
1138 | | - $optionRecord->getAttributeValue($optionAttributeOptionAttribute) |
1139 | | - ); |
| 1133 | + $record->optionAttributeOption = $optionRecord->optionAttributeOption; |
1140 | 1134 | |
1141 | 1135 | $optionRecordSet = queryRecordSet( |
1142 | 1136 | null, |
1143 | 1137 | $viewInformation->queryTransactionInformation, |
1144 | | - $optionAttributeIdAttribute, |
1145 | | - new TableColumnsToAttributesMapping(new TableColumnsToAttribute(array('attribute_mid'), $optionAttributeAttribute)), |
| 1138 | + $o->optionAttributeId, |
| 1139 | + new TableColumnsToAttributesMapping(new TableColumnsToAttribute(array('attribute_mid'), $o->optionAttribute)), |
1146 | 1140 | $classAttributesTable, |
1147 | | - array('object_id = ' . $optionRecord->getAttributeValue($optionAttributeIdAttribute)) |
| 1141 | + array('object_id = ' . $optionRecord->optionAttributeId) |
1148 | 1142 | ); |
1149 | 1143 | |
1150 | 1144 | $optionRecord = $optionRecordSet->getRecord(0); |
1151 | | - $record->setAttributeValue( |
1152 | | - $optionAttributeAttribute, |
1153 | | - $optionRecord->getAttributeValue($optionAttributeAttribute) |
1154 | | - ); |
| 1145 | + $record->optionAttribute = $optionRecord->optionAttribute; |
1155 | 1146 | } |
1156 | 1147 | } |
1157 | 1148 | |
1158 | 1149 | function getDefinedMeaningClassMembershipRecordSet($definedMeaningId, ViewInformation $viewInformation) { |
| 1150 | + |
| 1151 | + $o=OmegaWikiAttributes::getInstance(); |
1159 | 1152 | global |
1160 | | - $classMembershipsTable, $classMembershipIdAttribute, $classAttribute, |
1161 | | - $classMembershipStructure; |
| 1153 | + $classMembershipsTable; |
1162 | 1154 | |
1163 | 1155 | $recordSet = queryRecordSet( |
1164 | | - $classMembershipStructure->getStructureType(), |
| 1156 | + $o->classMembershipStructure->getStructureType(), |
1165 | 1157 | $viewInformation->queryTransactionInformation, |
1166 | | - $classMembershipIdAttribute, |
| 1158 | + $o->classMembershipId, |
1167 | 1159 | new TableColumnsToAttributesMapping( |
1168 | | - new TableColumnsToAttribute(array('class_membership_id'), $classMembershipIdAttribute), |
1169 | | - new TableColumnsToAttribute(array('class_mid'), $classAttribute) |
| 1160 | + new TableColumnsToAttribute(array('class_membership_id'), $o->classMembershipId), |
| 1161 | + new TableColumnsToAttribute(array('class_mid'), $o->class) |
1170 | 1162 | ), |
1171 | 1163 | $classMembershipsTable, |
1172 | 1164 | array("class_member_mid=$definedMeaningId") |
1173 | 1165 | ); |
1174 | 1166 | |
1175 | | - expandDefinedMeaningReferencesInRecordSet($recordSet, array($classAttribute)); |
| 1167 | + expandDefinedMeaningReferencesInRecordSet($recordSet, array($o->class)); |
1176 | 1168 | |
1177 | 1169 | return $recordSet; |
1178 | 1170 | } |
1179 | 1171 | |
1180 | 1172 | function getDefiningExpressionRecord($definedMeaningId) { |
1181 | 1173 | |
1182 | | - global |
1183 | | - $definedMeaningCompleteDefiningExpressionAttribute, |
1184 | | - $definedMeaningDefiningExpressionAttribute, |
1185 | | - $expressionIdAttribute; |
1186 | 1174 | |
| 1175 | + $o=OmegaWikiAttributes::getInstance(); |
| 1176 | + |
1187 | 1177 | $o=OmegaWikiAttributes::getInstance(); |
1188 | 1178 | |
1189 | 1179 | $definingExpression=definingExpressionRow($definedMeaningId); |
1190 | | - $definingExpressionRecord = new ArrayRecord($definedMeaningCompleteDefiningExpressionAttribute->type); |
1191 | | - $definingExpressionRecord->setAttributeValue($expressionIdAttribute, $definingExpression[0]); |
1192 | | - $definingExpressionRecord->setAttributeValue($definedMeaningDefiningExpressionAttribute, $definingExpression[1]); |
1193 | | - $definingExpressionRecord->setAttributeValue($o->language, $definingExpression[2]); |
| 1180 | + $definingExpressionRecord = new ArrayRecord($o->definedMeaningCompleteDefiningExpression->type); |
| 1181 | + $definingExpressionRecord->expressionId = $definingExpression[0]; |
| 1182 | + $definingExpressionRecord->definedMeaningDefiningExpression = $definingExpression[1]; |
| 1183 | + $definingExpressionRecord->language = $definingExpression[2]; |
1194 | 1184 | return $definingExpressionRecord; |
1195 | 1185 | |
1196 | 1186 | } |
Index: trunk/extensions/Wikidata/OmegaWiki/Transaction.php |
— | — | @@ -59,10 +59,10 @@ |
60 | 60 | |
61 | 61 | class QueryHistoryTransactionInformation extends DefaultQueryTransactionInformation { |
62 | 62 | public function versioningAttributes() { |
63 | | - global |
64 | | - $recordLifeSpanAttribute; |
| 63 | + |
| 64 | + $o=OmegaWikiAttributes::getInstance(); |
65 | 65 | |
66 | | - return array($recordLifeSpanAttribute); |
| 66 | + return array($o->recordLifeSpan); |
67 | 67 | } |
68 | 68 | |
69 | 69 | public function versioningFields($tableName) { |
— | — | @@ -74,10 +74,10 @@ |
75 | 75 | } |
76 | 76 | |
77 | 77 | public function setVersioningAttributes(Record $record, $row) { |
78 | | - global |
79 | | - $recordLifeSpanAttribute; |
| 78 | + |
| 79 | + $o=OmegaWikiAttributes::getInstance(); |
80 | 80 | |
81 | | - $record->setAttributeValue($recordLifeSpanAttribute, getRecordLifeSpanTuple($row['add_transaction_id'], $row['remove_transaction_id'])); |
| 81 | + $record->recordLifeSpan = getRecordLifeSpanTuple($row['add_transaction_id'], $row['remove_transaction_id']); |
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
— | — | @@ -95,11 +95,11 @@ |
96 | 96 | } |
97 | 97 | |
98 | 98 | public function versioningAttributes() { |
99 | | - global |
100 | | - $recordLifeSpanAttribute; |
| 99 | + |
| 100 | + $o=OmegaWikiAttributes::getInstance(); |
101 | 101 | |
102 | 102 | if ($this->addAttributes) |
103 | | - return array($recordLifeSpanAttribute); |
| 103 | + return array($o->recordLifeSpan); |
104 | 104 | else |
105 | 105 | return array(); |
106 | 106 | } |
— | — | @@ -109,11 +109,11 @@ |
110 | 110 | } |
111 | 111 | |
112 | 112 | public function setVersioningAttributes(Record $record, $row) { |
113 | | - global |
114 | | - $recordLifeSpanAttribute; |
| 113 | + |
| 114 | + $o=OmegaWikiAttributes::getInstance(); |
115 | 115 | |
116 | 116 | if ($this->addAttributes) |
117 | | - $record->setAttributeValue($recordLifeSpanAttribute, getRecordLifeSpanTuple($row['add_transaction_id'], $row['remove_transaction_id'])); |
| 117 | + $record->recordLifeSpan = getRecordLifeSpanTuple($row['add_transaction_id'], $row['remove_transaction_id']); |
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
— | — | @@ -218,25 +218,22 @@ |
219 | 219 | return " ($table.add_transaction_id=$transactionId OR $table.remove_transaction_id=$transactionId) "; |
220 | 220 | } |
221 | 221 | |
222 | | -global |
223 | | - $transactionIdAttribute, $userAttribute, $userIPAttribute, $timestampAttribute, |
224 | | - $transactionStructure, $transactionAttribute, $summaryAttribute, |
225 | | - $addTransactionAttribute, $removeTransactionAttribute, |
226 | | - $recordLifeSpanAttribute, $recordLifeSpanStructure; |
| 222 | + |
| 223 | +$o=OmegaWikiAttributes::getInstance(); |
227 | 224 | |
228 | | -$transactionIdAttribute = new Attribute('transaction-id', 'Transaction ID', 'integer'); |
229 | | -$userAttribute = new Attribute('user', 'User', 'user'); |
230 | | -$userIPAttribute = new Attribute('user-ip', 'User IP', 'IP'); |
231 | | -$timestampAttribute = new Attribute('timestamp', 'Time', 'timestamp'); |
232 | | -$summaryAttribute = new Attribute('summary', 'Summary', 'text'); |
233 | | -$transactionStructure = new Structure($transactionIdAttribute, $userAttribute, $userIPAttribute, $timestampAttribute, $summaryAttribute); |
234 | | -$transactionAttribute = new Attribute('transaction', 'Transaction', $transactionStructure); |
| 225 | +$o->transactionId = new Attribute('transaction-id', 'Transaction ID', 'integer'); |
| 226 | +$o->user = new Attribute('user', 'User', 'user'); |
| 227 | +$o->userIP = new Attribute('user-ip', 'User IP', 'IP'); |
| 228 | +$o->timestamp = new Attribute('timestamp', 'Time', 'timestamp'); |
| 229 | +$o->summary = new Attribute('summary', 'Summary', 'text'); |
| 230 | +$transactionStructure = new Structure($o->transactionId, $o->user, $o->userIP, $o->timestamp, $o->summary); |
| 231 | +$o->transaction = new Attribute('transaction', 'Transaction', $transactionStructure); |
235 | 232 | |
236 | | -$addTransactionAttribute = new Attribute('add-transaction', 'Added', $transactionStructure); |
237 | | -$removeTransactionAttribute = new Attribute('remove-transaction', 'Removed', $transactionStructure); |
| 233 | +$o->addTransaction = new Attribute('add-transaction', 'Added', $transactionStructure); |
| 234 | +$o->removeTransaction = new Attribute('remove-transaction', 'Removed', $transactionStructure); |
238 | 235 | |
239 | | -$recordLifeSpanStructure = new Structure($addTransactionAttribute, $removeTransactionAttribute); |
240 | | -$recordLifeSpanAttribute = new Attribute('record-life-span', 'Record life span', $recordLifeSpanStructure); |
| 236 | +$recordLifeSpanStructure = new Structure($o->addTransaction, $o->removeTransaction); |
| 237 | +$o->recordLifeSpan = new Attribute('record-life-span', 'Record life span', $recordLifeSpanStructure); |
241 | 238 | |
242 | 239 | function getUserName($userId) { |
243 | 240 | $dbr =& wfGetDB(DB_SLAVE); |
— | — | @@ -257,83 +254,80 @@ |
258 | 255 | return "Unknown"; |
259 | 256 | } |
260 | 257 | |
261 | | -function expandUserIDsInRecordSet(RecordSet $recordSet, Attribute $userIDAttribute, Attribute $userIPAttribute) { |
| 258 | +function expandUserIDsInRecordSet(RecordSet $recordSet, Attribute $userID, Attribute $userIP) { |
262 | 259 | for ($i = 0; $i < $recordSet->getRecordCount(); $i++) { |
263 | 260 | $record = $recordSet->getRecord($i); |
264 | 261 | $record->setAttributeValue( |
265 | 262 | $userIDAttribute, |
266 | 263 | getUserLabel( |
267 | | - $record->getAttributeValue($userIDAttribute), |
268 | | - $record->getAttributeValue($userIPAttribute) |
| 264 | + $record->$userIDAttribute, |
| 265 | + $record->$userIP |
269 | 266 | ) |
270 | 267 | ); |
271 | 268 | } |
272 | 269 | } |
273 | 270 | |
274 | | -function expandTransactionIdsInRecordSet(RecordSet $recordSet, Attribute $transactionIdAttribute, Attribute $transactionAttribute) { |
| 271 | +function expandTransactionIdsInRecordSet(RecordSet $recordSet, Attribute $transactionId, Attribute $transaction) { |
275 | 272 | for ($i = 0; $i < $recordSet->getRecordCount(); $i++) { |
276 | 273 | $record = $recordSet->getRecord($i); |
277 | | - $record->setAttributeValue( |
278 | | - $transactionAttribute, |
279 | | - getTransactionRecord($record->getAttributeValue($transactionIdAttribute)) |
280 | | - ); |
| 274 | + $record->$transaction = getTransactionRecord($record->$transactionId); |
281 | 275 | } |
282 | 276 | } |
283 | 277 | |
284 | 278 | function getTransactionRecord($transactionId) { |
285 | | - global |
286 | | - $transactionStructure, $transactionIdAttribute, $userAttribute, $timestampAttribute, $summaryAttribute; |
| 279 | + |
| 280 | + $o=OmegaWikiAttributes::getInstance(); |
287 | 281 | |
288 | 282 | $dc=wdGetDataSetContext(); |
289 | 283 | $result = new ArrayRecord($transactionStructure); |
290 | | - $result->setAttributeValue($transactionIdAttribute, $transactionId); |
| 284 | + $result->transactionId = $transactionId; |
291 | 285 | |
292 | 286 | if ($transactionId > 0) { |
293 | 287 | $dbr =& wfGetDB(DB_SLAVE); |
294 | 288 | $queryResult = $dbr->query("SELECT user_id, user_ip, timestamp, comment FROM {$dc}_transactions WHERE transaction_id=$transactionId"); |
295 | 289 | |
296 | 290 | if ($transaction = $dbr->fetchObject($queryResult)) { |
297 | | - $result->setAttributeValue($userAttribute, getUserLabel($transaction->user_id, $transaction->user_ip)); |
298 | | - $result->setAttributeValue($timestampAttribute, $transaction->timestamp); |
299 | | - $result->setAttributeValue($summaryAttribute, $transaction->comment); |
| 291 | + $result->user = getUserLabel($transaction->user_id, $transaction->user_ip); |
| 292 | + $result->timestamp = $transaction->timestamp; |
| 293 | + $result->summary = $transaction->comment; |
300 | 294 | } |
301 | 295 | } |
302 | 296 | else { |
303 | 297 | if ($transactionId != null) |
304 | | - $result->setAttributeValue($userAttribute, "Unknown"); |
| 298 | + $result->user = "Unknown"; |
305 | 299 | else |
306 | | - $result->setAttributeValue($userAttribute, ""); |
| 300 | + $result->user = ""; |
307 | 301 | |
308 | | - $result->setAttributeValue($timestampAttribute, ""); |
309 | | - $result->setAttributeValue($summaryAttribute, ""); |
| 302 | + $result->timestamp = ""; |
| 303 | + $result->summary = ""; |
310 | 304 | } |
311 | 305 | |
312 | 306 | return $result; |
313 | 307 | } |
314 | 308 | |
315 | 309 | function getRecordLifeSpanTuple($addTransactionId, $removeTransactionId) { |
316 | | - global |
317 | | - $recordLifeSpanStructure, $addTransactionAttribute, $removeTransactionAttribute; |
| 310 | + |
| 311 | + $o=OmegaWikiAttributes::getInstance(); |
318 | 312 | |
319 | 313 | $result = new ArrayRecord($recordLifeSpanStructure); |
320 | | - $result->setAttributeValue($addTransactionAttribute, getTransactionRecord($addTransactionId)); |
321 | | - $result->setAttributeValue($removeTransactionAttribute, getTransactionRecord($removeTransactionId)); |
| 314 | + $result->addTransaction = getTransactionRecord($addTransactionId); |
| 315 | + $result->removeTransaction = getTransactionRecord($removeTransactionId); |
322 | 316 | |
323 | 317 | return $result; |
324 | 318 | } |
325 | 319 | |
326 | 320 | function getTransactionLabel($transactionId) { |
327 | | - global |
328 | | - $timestampAttribute, $userAttribute, $summaryAttribute; |
| 321 | + |
| 322 | + $o=OmegaWikiAttributes::getInstance(); |
329 | 323 | |
330 | 324 | if ($transactionId > 0) { |
331 | 325 | $record = getTransactionRecord($transactionId); |
332 | 326 | |
333 | 327 | $label = |
334 | | - timestampAsText($record->getAttributeValue($timestampAttribute)) . ', ' . |
335 | | - $record->getAttributeValue($userAttribute); |
| 328 | + timestampAsText($record->timestamp) . ', ' . |
| 329 | + $record->user; |
336 | 330 | |
337 | | - $summary = $record->getAttributeValue($summaryAttribute); |
| 331 | + $summary = $record->summary; |
338 | 332 | |
339 | 333 | if ($summary != "") |
340 | 334 | $label .= ', ' . $summary; |