Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiAttributes.php |
— | — | @@ -247,6 +247,7 @@ |
248 | 248 | $t->definedMeaning = new Attribute(null, wfMsgSc("DefinedMeaning"), |
249 | 249 | new Structure( |
250 | 250 | "defined-meaning", |
| 251 | + $t->definedMeaningId, |
251 | 252 | $t->definedMeaningCompleteDefiningExpression, |
252 | 253 | $t->definition, |
253 | 254 | $t->classAttributes, |
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiEditors.php |
— | — | @@ -41,7 +41,6 @@ |
42 | 42 | |
43 | 43 | foreach ($viewInformation->getPropertyToColumnFilters() as $propertyToColumnFilter) |
44 | 44 | $this->recordSetTableEditor->addEditor(new DummyViewer($propertyToColumnFilter->getAttribute())); |
45 | | - |
46 | 45 | |
47 | 46 | $o=OmegaWikiAttributes::getInstance(); |
48 | 47 | |
— | — | @@ -284,33 +283,33 @@ |
285 | 284 | $attribute = $propertyToColumnFilter->getAttribute(); |
286 | 285 | $propertyCaption = $propertyToColumnFilter->getPropertyCaption(); |
287 | 286 | $editor->addEditor(new PopUpEditor( |
288 | | - createDefinitionObjectAttributesEditor($viewInformation, $attribute, $propertyCaption, $o->definedMeaningId, 0, $definitionMeaningName), |
| 287 | + createDefinitionObjectAttributesEditor($viewInformation, $attribute, $propertyCaption, $o->definedMeaningId, $definitionMeaningName), |
289 | 288 | $attribute->name |
290 | 289 | )); |
291 | 290 | } |
292 | 291 | |
293 | 292 | $editor->addEditor(new PopUpEditor( |
294 | | - createDefinitionObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->definedMeaningId, 0, $definitionMeaningName), |
| 293 | + createDefinitionObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->definedMeaningId, $definitionMeaningName), |
295 | 294 | $wgPopupAnnotationName |
296 | 295 | )); |
297 | 296 | |
298 | 297 | return $editor; |
299 | 298 | } |
300 | 299 | |
301 | | -function createPropertyToColumnFilterEditors(ViewInformation $viewInformation, Attribute $idAttribute, $levelsToLookUpwards, $levelName) { |
| 300 | +function createPropertyToColumnFilterEditors(ViewInformation $viewInformation, Attribute $idAttribute, $levelName) { |
302 | 301 | $result = array(); |
303 | 302 | |
304 | 303 | foreach ($viewInformation->getPropertyToColumnFilters() as $propertyToColumnFilter) { |
305 | 304 | $attribute = $propertyToColumnFilter->getAttribute(); |
306 | 305 | $propertyCaption = $propertyToColumnFilter->getPropertyCaption(); |
307 | | - $result[] = createObjectAttributesEditor($viewInformation, $attribute, $propertyCaption, $idAttribute, $levelsToLookUpwards, $levelName); |
| 306 | + $result[] = createObjectAttributesEditor($viewInformation, $attribute, $propertyCaption, $idAttribute, $levelName); |
308 | 307 | } |
309 | 308 | |
310 | 309 | return $result; |
311 | 310 | } |
312 | 311 | |
313 | | -function addPropertyToColumnFilterEditors(Editor $editor, ViewInformation $viewInformation, Attribute $idAttribute, $levelsToLookUpwards, $levelName) { |
314 | | - foreach (createPropertyToColumnFilterEditors($viewInformation, $idAttribute, $levelsToLookUpwards, $levelName) as $propertyToColumnEditor) { |
| 312 | +function addPropertyToColumnFilterEditors(Editor $editor, ViewInformation $viewInformation, Attribute $idAttribute, $levelName) { |
| 313 | + foreach (createPropertyToColumnFilterEditors($viewInformation, $idAttribute, $levelName) as $propertyToColumnEditor) { |
315 | 314 | $attribute = $propertyToColumnEditor->getAttribute(); |
316 | 315 | $editor->addEditor(new PopUpEditor($propertyToColumnEditor, $attribute->name)); |
317 | 316 | } |
— | — | @@ -334,14 +333,14 @@ |
335 | 334 | return $editor; |
336 | 335 | } |
337 | 336 | |
338 | | -function addObjectAttributesEditors(Editor $objectAttributesEditor, ViewInformation $viewInformation, ContextFetcher $annotatedObjectIdFetcher, $annotationLevelName, ContextFetcher $definedMeaningIdFetcher) { |
339 | | - $objectAttributesEditor->addEditor(getTextAttributeValuesEditor($viewInformation, new TextAttributeValuesController($annotatedObjectIdFetcher), $annotationLevelName, $definedMeaningIdFetcher)); |
340 | | - $objectAttributesEditor->addEditor(getTranslatedTextAttributeValuesEditor($viewInformation, new TranslatedTextAttributeValuesController($annotatedObjectIdFetcher, $viewInformation->filterLanguageId), $annotationLevelName, $definedMeaningIdFetcher)); |
341 | | - $objectAttributesEditor->addEditor(getLinkAttributeValuesEditor($viewInformation, new LinkAttributeValuesController($annotatedObjectIdFetcher), $annotationLevelName, $definedMeaningIdFetcher)); |
342 | | - $objectAttributesEditor->addEditor(getOptionAttributeValuesEditor($viewInformation, new OptionAttributeValuesController($annotatedObjectIdFetcher), $annotationLevelName, $definedMeaningIdFetcher)); |
| 337 | +function addObjectAttributesEditors(Editor $objectAttributesEditor, ViewInformation $viewInformation, ContextFetcher $annotatedObjectIdFetcher, $annotationLevelName) { |
| 338 | + $objectAttributesEditor->addEditor(getTextAttributeValuesEditor($viewInformation, new TextAttributeValuesController($annotatedObjectIdFetcher), $annotationLevelName)); |
| 339 | + $objectAttributesEditor->addEditor(getTranslatedTextAttributeValuesEditor($viewInformation, new TranslatedTextAttributeValuesController($annotatedObjectIdFetcher, $viewInformation->filterLanguageId), $annotationLevelName)); |
| 340 | + $objectAttributesEditor->addEditor(getLinkAttributeValuesEditor($viewInformation, new LinkAttributeValuesController($annotatedObjectIdFetcher), $annotationLevelName)); |
| 341 | + $objectAttributesEditor->addEditor(getOptionAttributeValuesEditor($viewInformation, new OptionAttributeValuesController($annotatedObjectIdFetcher), $annotationLevelName)); |
343 | 342 | } |
344 | 343 | |
345 | | -function createObjectAttributesEditor(ViewInformation $viewInformation, Attribute $attribute, $propertyCaption, Attribute $idAttribute, $levelsToLookUpwards, $levelName) { |
| 344 | +function createObjectAttributesEditor(ViewInformation $viewInformation, Attribute $attribute, $propertyCaption, Attribute $idAttribute, $levelName) { |
346 | 345 | $o=OmegaWikiAttributes::getInstance(); |
347 | 346 | |
348 | 347 | $result = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $viewInformation); |
— | — | @@ -350,14 +349,13 @@ |
351 | 350 | $result, |
352 | 351 | $viewInformation, |
353 | 352 | new ObjectIdFetcher(0, $idAttribute), |
354 | | - $levelName, |
355 | | - new ObjectIdFetcher($levelsToLookUpwards, $o->definedMeaningId) |
| 353 | + $levelName |
356 | 354 | ); |
357 | 355 | |
358 | 356 | return $result; |
359 | 357 | } |
360 | 358 | |
361 | | -function createDefinitionObjectAttributesEditor(ViewInformation $viewInformation, Attribute $attribute, $propertyCaption, Attribute $idAttribute, $levelsToLookUpwards, $levelName) { |
| 359 | +function createDefinitionObjectAttributesEditor(ViewInformation $viewInformation, Attribute $attribute, $propertyCaption, Attribute $idAttribute, $levelName) { |
362 | 360 | $o=OmegaWikiAttributes::getInstance(); |
363 | 361 | |
364 | 362 | $result = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $viewInformation); |
— | — | @@ -366,8 +364,7 @@ |
367 | 365 | $result, |
368 | 366 | $viewInformation, |
369 | 367 | new DefinitionObjectIdFetcher(0, $idAttribute), |
370 | | - $levelName, |
371 | | - new ObjectIdFetcher($levelsToLookUpwards, $o->definedMeaningId) |
| 368 | + $levelName |
372 | 369 | ); |
373 | 370 | |
374 | 371 | return $result; |
— | — | @@ -446,10 +443,10 @@ |
447 | 444 | $tableEditor->addEditor(getExpressionTableCellEditor($o->expression, $viewInformation)); |
448 | 445 | $tableEditor->addEditor(new BooleanEditor($o->identicalMeaning, new SimplePermissionController(true), true, true)); |
449 | 446 | |
450 | | - addPropertyToColumnFilterEditors($tableEditor, $viewInformation, $o->syntransId, 1, $synTransMeaningName); |
| 447 | + addPropertyToColumnFilterEditors($tableEditor, $viewInformation, $o->syntransId, $synTransMeaningName); |
451 | 448 | |
452 | 449 | $tableEditor->addEditor(new PopUpEditor( |
453 | | - createObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->syntransId, 1, $synTransMeaningName), |
| 450 | + createObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->syntransId, $synTransMeaningName), |
454 | 451 | $wgPopupAnnotationName |
455 | 452 | )); |
456 | 453 | |
— | — | @@ -469,10 +466,10 @@ |
470 | 467 | $editor->addEditor(new RelationTypeReferenceEditor($o->relationType, new SimplePermissionController(false), true)); |
471 | 468 | $editor->addEditor(new DefinedMeaningReferenceEditor($o->otherDefinedMeaning, new SimplePermissionController(false), true)); |
472 | 469 | |
473 | | - addPropertyToColumnFilterEditors($editor, $viewInformation, $o->relationId, 1, $relationMeaningName); |
| 470 | + addPropertyToColumnFilterEditors($editor, $viewInformation, $o->relationId, $relationMeaningName); |
474 | 471 | |
475 | 472 | $editor->addEditor(new PopUpEditor( |
476 | | - createObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->relationId, 1, $relationMeaningName), |
| 473 | + createObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->relationId, $relationMeaningName), |
477 | 474 | $wgPopupAnnotationName |
478 | 475 | )); |
479 | 476 | |
— | — | @@ -492,10 +489,10 @@ |
493 | 490 | $editor->addEditor(new DefinedMeaningReferenceEditor($o->otherDefinedMeaning, new SimplePermissionController(false), true)); |
494 | 491 | $editor->addEditor(new RelationTypeReferenceEditor($o->relationType, new SimplePermissionController(false), true)); |
495 | 492 | |
496 | | - addPropertyToColumnFilterEditors($editor, $viewInformation, $o->relationId, 1, $relationMeaningName); |
| 493 | + addPropertyToColumnFilterEditors($editor, $viewInformation, $o->relationId, $relationMeaningName); |
497 | 494 | |
498 | 495 | $editor->addEditor(new PopUpEditor( |
499 | | - createObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->relationId, 1, $relationMeaningName), |
| 496 | + createObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->relationId, $relationMeaningName), |
500 | 497 | $wgPopupAnnotationName |
501 | 498 | )); |
502 | 499 | |
— | — | @@ -562,14 +559,14 @@ |
563 | 560 | $editor->addEditor(new PopUpEditor($columnEditor, $columnEditor->getAttribute()->name)); |
564 | 561 | } |
565 | 562 | |
566 | | -function getTextAttributeValuesEditor(ViewInformation $viewInformation, $controller, $levelDefinedMeaningName, ContextFetcher $objectIdFetcher) { |
| 563 | +function getTextAttributeValuesEditor(ViewInformation $viewInformation, $controller, $levelDefinedMeaningName) { |
567 | 564 | global |
568 | 565 | $textValueObjectAttributesEditors; |
569 | 566 | |
570 | 567 | $o=OmegaWikiAttributes::getInstance(); |
571 | 568 | |
572 | 569 | $editor = new RecordSetTableEditor($o->textAttributeValues, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, $controller); |
573 | | - $editor->addEditor(new TextAttributeEditor($o->textAttribute, new SimplePermissionController(false), true, $levelDefinedMeaningName, $objectIdFetcher)); |
| 570 | + $editor->addEditor(new TextAttributeEditor($o->textAttribute, new SimplePermissionController(false), true, $levelDefinedMeaningName)); |
574 | 571 | $editor->addEditor(new TextEditor($o->text, new SimplePermissionController(true), true)); |
575 | 572 | |
576 | 573 | addPopupEditors($editor, $textValueObjectAttributesEditors); |
— | — | @@ -578,14 +575,14 @@ |
579 | 576 | return $editor; |
580 | 577 | } |
581 | 578 | |
582 | | -function getLinkAttributeValuesEditor(ViewInformation $viewInformation, UpdateController $controller, $levelDefinedMeaningName, ContextFetcher $objectIdFetcher) { |
| 579 | +function getLinkAttributeValuesEditor(ViewInformation $viewInformation, UpdateController $controller, $levelDefinedMeaningName) { |
583 | 580 | global |
584 | 581 | $linkValueObjectAttributesEditors; |
585 | 582 | |
586 | 583 | $o=OmegaWikiAttributes::getInstance(); |
587 | 584 | |
588 | 585 | $editor = new RecordSetTableEditor($o->linkAttributeValues, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, $controller); |
589 | | - $editor->addEditor(new LinkAttributeEditor($o->linkAttribute, new SimplePermissionController(false), true, $levelDefinedMeaningName, $objectIdFetcher)); |
| 586 | + $editor->addEditor(new LinkAttributeEditor($o->linkAttribute, new SimplePermissionController(false), true, $levelDefinedMeaningName)); |
590 | 587 | |
591 | 588 | if ($viewInformation->viewOrEdit == "view") |
592 | 589 | $linkEditor = new LinkEditor($o->link, new SimplePermissionController(true), true); |
— | — | @@ -603,14 +600,14 @@ |
604 | 601 | return $editor; |
605 | 602 | } |
606 | 603 | |
607 | | -function getTranslatedTextAttributeValuesEditor(ViewInformation $viewInformation, UpdateController $controller, $levelDefinedMeaningName, ContextFetcher $objectIdFetcher) { |
| 604 | +function getTranslatedTextAttributeValuesEditor(ViewInformation $viewInformation, UpdateController $controller, $levelDefinedMeaningName) { |
608 | 605 | global |
609 | 606 | $translatedTextValueObjectAttributesEditors; |
610 | 607 | |
611 | 608 | $o=OmegaWikiAttributes::getInstance(); |
612 | 609 | |
613 | 610 | $editor = new RecordSetTableEditor($o->translatedTextAttributeValues, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, $controller); |
614 | | - $editor->addEditor(new TranslatedTextAttributeEditor($o->translatedTextAttribute, new SimplePermissionController(false), true, $levelDefinedMeaningName, $objectIdFetcher)); |
| 611 | + $editor->addEditor(new TranslatedTextAttributeEditor($o->translatedTextAttribute, new SimplePermissionController(false), true, $levelDefinedMeaningName)); |
615 | 612 | $editor->addEditor(getTranslatedTextEditor( |
616 | 613 | $o->translatedTextValue, |
617 | 614 | new TranslatedTextAttributeValueController(), |
— | — | @@ -624,7 +621,7 @@ |
625 | 622 | return $editor; |
626 | 623 | } |
627 | 624 | |
628 | | -function getOptionAttributeValuesEditor(ViewInformation $viewInformation, UpdateController $controller, $levelDefinedMeaningName, ContextFetcher $objectIdFetcher) { |
| 625 | +function getOptionAttributeValuesEditor(ViewInformation $viewInformation, UpdateController $controller, $levelDefinedMeaningName) { |
629 | 626 | global |
630 | 627 | $optionValueObjectAttributesEditors; |
631 | 628 | |
— | — | @@ -632,7 +629,7 @@ |
633 | 630 | |
634 | 631 | $editor = new RecordSetTableEditor($o->optionAttributeValues, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, $controller); |
635 | 632 | |
636 | | - $editor->addEditor(new OptionAttributeEditor($o->optionAttribute, new SimplePermissionController(false), true, $levelDefinedMeaningName, $objectIdFetcher)); |
| 633 | + $editor->addEditor(new OptionAttributeEditor($o->optionAttribute, new SimplePermissionController(false), true, $levelDefinedMeaningName)); |
637 | 634 | $editor->addEditor(new OptionSelectEditor($o->optionAttributeOption, new SimplePermissionController(false), true)); |
638 | 635 | |
639 | 636 | addPopupEditors($editor, $optionValueObjectAttributesEditors); |
— | — | @@ -737,7 +734,7 @@ |
738 | 735 | $o->possibleSynonym, |
739 | 736 | $viewInformation->possiblySynonymousRelationTypeId, |
740 | 737 | $viewInformation, |
741 | | - createObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->possiblySynonymousId, 1, $relationMeaningName) |
| 738 | + createObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->possiblySynonymousId, $relationMeaningName) |
742 | 739 | ); |
743 | 740 | |
744 | 741 | $availableEditors = new AttributeEditorMap(); |
— | — | @@ -753,7 +750,7 @@ |
754 | 751 | foreach (createPropertyToColumnFilterEditors($viewInformation, $o->definedMeaningId, 0, $definedMeaningMeaningName) as $propertyToColumnEditor) |
755 | 752 | $availableEditors->addEditor($propertyToColumnEditor); |
756 | 753 | |
757 | | - $availableEditors->addEditor(createObjectAttributesEditor($viewInformation, $o->definedMeaningAttributes, $wgPropertyAttributeName, $o->definedMeaningId, 0, $definedMeaningMeaningName)); |
| 754 | + $availableEditors->addEditor(createObjectAttributesEditor($viewInformation, $o->definedMeaningAttributes, $wgPropertyAttributeName, $o->definedMeaningId, $definedMeaningMeaningName)); |
758 | 755 | |
759 | 756 | if ($viewInformation->possiblySynonymousRelationTypeId != 0) |
760 | 757 | $availableEditors->addEditor($possiblySynonymousEditor); |
— | — | @@ -769,7 +766,8 @@ |
770 | 767 | |
771 | 768 | $definedMeaningEditor->expandEditor($definitionEditor); |
772 | 769 | $definedMeaningEditor->expandEditor($synonymsAndTranslationsEditor); |
773 | | - return $definedMeaningEditor; |
| 770 | + |
| 771 | + return new DefinedMeaningContextEditor($definedMeaningEditor); |
774 | 772 | } |
775 | 773 | |
776 | 774 | function createTableViewer($attribute) { |
Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaningModel.php |
— | — | @@ -144,6 +144,7 @@ |
145 | 145 | $o=OmegaWikiAttributes::getInstance(); |
146 | 146 | |
147 | 147 | $record = new ArrayRecord($o->definedMeaning->type); |
| 148 | + $record->definedMeaningId = $id; |
148 | 149 | $record->definedMeaningCompleteDefiningExpression = getDefiningExpressionRecord($id); |
149 | 150 | $record->definition = getDefinedMeaningDefinitionRecord($id, $view); |
150 | 151 | $record->classAttributes = getClassAttributesRecordSet($id, $view); |
Index: trunk/extensions/Wikidata/OmegaWiki/ContextFetcher.php |
— | — | @@ -27,6 +27,7 @@ |
28 | 28 | $this->levelsToLookUp = $levelsToLookUp; |
29 | 29 | $this->attribute = $attribute; |
30 | 30 | } |
| 31 | + |
31 | 32 | public function fetch($keyPath) { |
32 | 33 | if ($keyPath->peek($this->levelsToLookUp)->getStructure()->supportsAttribute($this->attribute)) |
33 | 34 | return $keyPath->peek($this->levelsToLookUp)->getAttributeValue($this->attribute); |
— | — | @@ -55,6 +56,6 @@ |
56 | 57 | $attribute = $this->attribute; |
57 | 58 | return "DefinitionObjectIdFetcher($levelsToLookUp, $attribute)"; |
58 | 59 | } |
59 | | -} |
| 60 | +} |
60 | 61 | |
61 | 62 | |
Index: trunk/extensions/Wikidata/OmegaWiki/Editor.php |
— | — | @@ -16,12 +16,19 @@ |
17 | 17 | define('EOL',"\n"); # Makes human (and vim :-p) readable output (somewhat...) |
18 | 18 | #define('EOL',""); # Output only readable by browsers |
19 | 19 | |
| 20 | +/** |
| 21 | + * Class IdStack is used to keep track of context during the rendering of |
| 22 | + * a hierarchical structure of Records and RecordSets. The name IdStack might |
| 23 | + * not be accurate anymore and might be renamed to something else like RenderContext. |
| 24 | + */ |
| 25 | + |
20 | 26 | class IdStack { |
21 | 27 | protected $keyStack; |
22 | 28 | protected $idStack = array(); |
23 | 29 | protected $currentId; |
24 | 30 | protected $classStack = array(); |
25 | 31 | protected $currentClass; |
| 32 | + protected $definedMeaningIdStack = array(); // Used to keep track of which defined meaning is being rendered |
26 | 33 | |
27 | 34 | public function __construct($prefix) { |
28 | 35 | $this->keyStack = new RecordStack(); |
— | — | @@ -89,6 +96,23 @@ |
90 | 97 | public function getKeyStack() { |
91 | 98 | return $this->keyStack; |
92 | 99 | } |
| 100 | + |
| 101 | + public function pushDefinedMeaningId($definedMeaningId) { |
| 102 | + return $this->definedMeaningIdStack[] = $definedMeaningId; |
| 103 | + } |
| 104 | + |
| 105 | + public function popDefinedMeaningId() { |
| 106 | + return array_pop($this->definedMeaningIdStack); |
| 107 | + } |
| 108 | + |
| 109 | + public function getDefinedMeaningId() { |
| 110 | + $stackSize = count($this->definedMeaningIdStack); |
| 111 | + |
| 112 | + if ($stackSize > 0) |
| 113 | + return $this->definedMeaningIdStack[$stackSize - 1]; |
| 114 | + else |
| 115 | + throw new Exception("There is no defined meaning defined in the current context"); |
| 116 | + } |
93 | 117 | |
94 | 118 | public function __tostring() { |
95 | 119 | return "<object of class IdStack>"; |
— | — | @@ -1229,20 +1253,18 @@ |
1230 | 1254 | |
1231 | 1255 | class AttributeEditor extends DefinedMeaningReferenceEditor { |
1232 | 1256 | protected $attributesLevelName; |
1233 | | - protected $objectIdFetcher; |
1234 | 1257 | |
1235 | | - public function __construct(Attribute $attribute = null, PermissionController $permissionController, $isAddField, $attributesLevelName, ContextFetcher $objectIdFetcher) { |
| 1258 | + public function __construct(Attribute $attribute = null, PermissionController $permissionController, $isAddField, $attributesLevelName) { |
1236 | 1259 | parent::__construct($attribute, $permissionController, $isAddField); |
1237 | 1260 | |
1238 | 1261 | $this->attributesLevelName = $attributesLevelName; |
1239 | | - $this->objectIdFetcher = $objectIdFetcher; |
1240 | 1262 | } |
1241 | 1263 | |
1242 | 1264 | public function add(IdStack $idPath) { |
1243 | 1265 | if ($this->isAddField) { |
1244 | 1266 | $parameters = array( |
1245 | 1267 | "attributesLevel" => $this->attributesLevelName, |
1246 | | - "attributesObjectId" => $this->objectIdFetcher->fetch($idPath->getKeyStack()) |
| 1268 | + "attributesObjectId" => $idPath->getDefinedMeaningId() |
1247 | 1269 | ); |
1248 | 1270 | |
1249 | 1271 | return getSuggest($this->addId($idPath->getId()), $this->suggestType(), $parameters); |
— | — | @@ -1283,13 +1305,10 @@ |
1284 | 1306 | public function add(IdStack $idPath) { |
1285 | 1307 | if ($this->isAddField) { |
1286 | 1308 | $syntransId = $idPath->getKeyStack()->peek(0)->syntransId; |
1287 | | - $objectId = $this->objectIdFetcher->fetch($idPath->getKeyStack()); |
1288 | 1309 | |
1289 | | -// echo "SyntransId: $syntransId ObjectId: $objectId\n"; |
1290 | | - |
1291 | 1310 | $parameters = array( |
1292 | 1311 | 'attributesLevel' => $this->attributesLevelName, |
1293 | | - 'attributesObjectId' => $objectId, |
| 1312 | + 'attributesObjectId' => $idPath->getDefinedMeaningId(), |
1294 | 1313 | 'onUpdate' => 'updateSelectOptions(\'' . $this->addId($idPath->getId()) . '-option\',' . $syntransId |
1295 | 1314 | ); |
1296 | 1315 | return getSuggest($this->addId($idPath->getId()), $this->suggestType(), $parameters); |
— | — | @@ -2201,3 +2220,27 @@ |
2202 | 2221 | return true; |
2203 | 2222 | } |
2204 | 2223 | } |
| 2224 | + |
| 2225 | +class DefinedMeaningContextEditor extends WrappingEditor { |
| 2226 | + public function view(IdStack $idPath, $value) { |
| 2227 | + $idPath->pushDefinedMeaningId($value->definedMeaningId); |
| 2228 | + $result = $this->wrappedEditor->view($idPath, $value); |
| 2229 | + $idPath->popDefinedMeaningId(); |
| 2230 | + |
| 2231 | + return $result; |
| 2232 | + } |
| 2233 | + |
| 2234 | + public function edit(IdStack $idPath, $value) { |
| 2235 | + $idPath->pushDefinedMeaningId($value->definedMeaningId); |
| 2236 | + $result = $this->wrappedEditor->edit($idPath, $value); |
| 2237 | + $idPath->popDefinedMeaningId(); |
| 2238 | + |
| 2239 | + return $result; |
| 2240 | + } |
| 2241 | + |
| 2242 | + public function save(IdStack $idPath, $value) { |
| 2243 | + $idPath->pushDefinedMeaningId($value->definedMeaningId); |
| 2244 | + $this->wrappedEditor->save($idPath, $value); |
| 2245 | + $idPath->popDefinedMeaningId(); |
| 2246 | + } |
| 2247 | +} |