Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataGlobals.php |
— | — | @@ -128,9 +128,9 @@ |
129 | 129 | // Defined meaning editor |
130 | 130 | |
131 | 131 | global |
132 | | - $wgDefinedMeaningAttributesOrder; |
| 132 | + $wdDefinedMeaningAttributesOrder; |
133 | 133 | |
134 | | -$wgDefinedMeaningAttributesOrder = array( |
| 134 | +$wdDefinedMeaningAttributesOrder = array( |
135 | 135 | $wgDefinitionAttributeId, |
136 | 136 | $wgClassAttributesAttributeId, |
137 | 137 | $wgAlternativeDefinitionsAttributeId, |
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiAttributes.php |
— | — | @@ -330,25 +330,6 @@ |
331 | 331 | foreach ($annotatedAttributes as $annotatedAttribute) |
332 | 332 | $annotatedAttribute->type->addAttribute($attribute); |
333 | 333 | } |
334 | | - |
335 | | - global $wdDefinedMeaningAttributesOrder; |
336 | | - |
337 | | - /** |
338 | | - * This global determines the order of the different |
339 | | - * attributes in the user interface. |
340 | | - */ |
341 | | - $wdDefinedMeaningAttributesOrder=array( |
342 | | - $definitionAttribute->id, |
343 | | - $classAttributesAttribute->id, |
344 | | - $alternativeDefinitionsAttribute->id, |
345 | | - $synonymsAndTranslationsAttribute->id, |
346 | | - $possiblySynonymousAttribute->id, |
347 | | - $relationsAttribute->id, |
348 | | - $reciprocalRelationsAttribute->id, |
349 | | - $classMembershipAttribute->id, |
350 | | - $collectionMembershipAttribute->id, |
351 | | - $definedMeaningAttributesAttribute->id |
352 | | - ); |
353 | 334 | } |
354 | 335 | |
355 | 336 | |
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiEditors.php |
— | — | @@ -90,14 +90,22 @@ |
91 | 91 | return $editor; |
92 | 92 | } |
93 | 93 | |
94 | | -function addPropertyToColumnFilterEditors(Editor $editor, ViewInformation $viewInformation, Attribute $idAttribute, $levelsFromDefinedMeaning, $levelName) { |
| 94 | +function createPropertyToColumnFilterEditors(ViewInformation $viewInformation, Attribute $idAttribute, $levelsFromDefinedMeaning, $levelName) { |
| 95 | + $result = array(); |
| 96 | + |
95 | 97 | foreach ($viewInformation->getPropertyToColumnFilters() as $propertyToColumnFilter) { |
96 | 98 | $attribute = $propertyToColumnFilter->getAttribute(); |
97 | | - $editor->addEditor(new PopUpEditor( |
98 | | - createObjectAttributesEditor($viewInformation, $attribute, $idAttribute, $levelsFromDefinedMeaning, $levelName), |
99 | | - $attribute->name |
100 | | - )); |
| 99 | + $result[] = createObjectAttributesEditor($viewInformation, $attribute, $idAttribute, $levelsFromDefinedMeaning, $levelName); |
101 | 100 | } |
| 101 | + |
| 102 | + return $result; |
| 103 | +} |
| 104 | + |
| 105 | +function addPropertyToColumnFilterEditors(Editor $editor, ViewInformation $viewInformation, Attribute $idAttribute, $levelsFromDefinedMeaning, $levelName) { |
| 106 | + foreach (createPropertyToColumnFilterEditors($viewInformation, $idAttribute, $levelsFromDefinedMeaning, $levelName) as $propertyToColumnEditor) { |
| 107 | + $attribute = $propertyToColumnEditor->getAttribute(); |
| 108 | + $editor->addEditor(new PopUpEditor($propertyToColumnEditor, $attribute->name)); |
| 109 | + } |
102 | 110 | } |
103 | 111 | |
104 | 112 | function getTranslatedTextEditor(Attribute $attribute, UpdateController $updateController, UpdateAttributeController $updateAttributeController, ViewInformation $viewInformation) { |
— | — | @@ -541,6 +549,10 @@ |
542 | 550 | $availableEditors->addEditor($reciprocalRelationsEditor); |
543 | 551 | $availableEditors->addEditor($classMembershipEditor); |
544 | 552 | $availableEditors->addEditor($collectionMembershipEditor); |
| 553 | + |
| 554 | + foreach (createPropertyToColumnFilterEditors($viewInformation, $definedMeaningIdAttribute, 0, $definedMeaningMeaningName) as $propertyToColumnEditor) |
| 555 | + $availableEditors->addEditor($propertyToColumnEditor); |
| 556 | + |
545 | 557 | $availableEditors->addEditor(createObjectAttributesEditor($viewInformation, $definedMeaningAttributesAttribute, $definedMeaningIdAttribute, 0, $definedMeaningMeaningName)); |
546 | 558 | |
547 | 559 | if ($viewInformation->possiblySynonymousRelationTypeId != 0) |
— | — | @@ -550,7 +562,7 @@ |
551 | 563 | |
552 | 564 | foreach ($wdDefinedMeaningAttributesOrder as $attributeId) { |
553 | 565 | $editor = $availableEditors->getEditorForAttributeId($attributeId); |
554 | | - |
| 566 | + |
555 | 567 | if ($editor != null) |
556 | 568 | $definedMeaningEditor->addEditor($editor); |
557 | 569 | } |
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php |
— | — | @@ -598,13 +598,13 @@ |
599 | 599 | |
600 | 600 | function filterObjectAttributesRecord(Record $sourceRecord, array &$attributeIds) { |
601 | 601 | global |
602 | | - $definedMeaningAttributesAttribute, $objectIdAttribute, |
| 602 | + $objectIdAttribute, |
603 | 603 | $textAttributeValuesAttribute, $textAttributeAttribute, |
604 | 604 | $translatedTextAttributeAttribute, $translatedTextAttributeValuesAttribute, |
605 | 605 | $linkAttributeAttribute, $linkAttributeValuesAttribute, |
606 | 606 | $optionAttributeAttribute, $optionAttributeValuesAttribute; |
607 | 607 | |
608 | | - $result = new ArrayRecord(new Structure($definedMeaningAttributesAttribute)); |
| 608 | + $result = new ArrayRecord($sourceRecord->getStructure()); |
609 | 609 | $result->setAttributeValue($objectIdAttribute, $sourceRecord->getAttributeValue($objectIdAttribute)); |
610 | 610 | |
611 | 611 | $result->setAttributeValue($textAttributeValuesAttribute, filterAttributeValues( |
Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaningModel.php |
— | — | @@ -172,7 +172,11 @@ |
173 | 173 | $record->setAttributeValue($reciprocalRelationsAttribute, getDefinedMeaningReciprocalRelationsRecordSet($id, $view)); |
174 | 174 | $record->setAttributeValue($classMembershipAttribute, getDefinedMeaningClassMembershipRecordSet($id, $view)); |
175 | 175 | $record->setAttributeValue($collectionMembershipAttribute, getDefinedMeaningCollectionMembershipRecordSet($id, $view)); |
176 | | - $record->setAttributeValue($definedMeaningAttributesAttribute, getObjectAttributesRecord($id, $view)); |
| 176 | + |
| 177 | + $objectAttributesRecord = getObjectAttributesRecord($id, $view); |
| 178 | + $record->setAttributeValue($definedMeaningAttributesAttribute, $objectAttributesRecord); |
| 179 | + applyPropertyToColumnFiltersToRecord($record, $objectAttributesRecord, $view); |
| 180 | + |
177 | 181 | $this->record=$record; |
178 | 182 | $this->recordIsLoaded=true; |
179 | 183 | return true; |