r23968 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23967‎ | r23968 | r23969 >
Date:15:12, 10 July 2007
Author:proes
Status:old
Tags:
Comment:
* Property to column filters now also apply to the Annotation section of a defined meaning
* Moved $wdDefinedMeaningAttributesOrder back to WikiDataGlobals.php because then it can be configured without having to call initializeOmegaWikiAttributes() first. After all it is a view independent application wide setting.
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/DefinedMeaningModel.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/OmegaWikiAttributes.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/OmegaWikiEditors.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/WikiDataGlobals.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataGlobals.php
@@ -128,9 +128,9 @@
129129 // Defined meaning editor
130130
131131 global
132 - $wgDefinedMeaningAttributesOrder;
 132+ $wdDefinedMeaningAttributesOrder;
133133
134 -$wgDefinedMeaningAttributesOrder = array(
 134+$wdDefinedMeaningAttributesOrder = array(
135135 $wgDefinitionAttributeId,
136136 $wgClassAttributesAttributeId,
137137 $wgAlternativeDefinitionsAttributeId,
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiAttributes.php
@@ -330,25 +330,6 @@
331331 foreach ($annotatedAttributes as $annotatedAttribute)
332332 $annotatedAttribute->type->addAttribute($attribute);
333333 }
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 - );
353334 }
354335
355336
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiEditors.php
@@ -90,14 +90,22 @@
9191 return $editor;
9292 }
9393
94 -function addPropertyToColumnFilterEditors(Editor $editor, ViewInformation $viewInformation, Attribute $idAttribute, $levelsFromDefinedMeaning, $levelName) {
 94+function createPropertyToColumnFilterEditors(ViewInformation $viewInformation, Attribute $idAttribute, $levelsFromDefinedMeaning, $levelName) {
 95+ $result = array();
 96+
9597 foreach ($viewInformation->getPropertyToColumnFilters() as $propertyToColumnFilter) {
9698 $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);
101100 }
 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+ }
102110 }
103111
104112 function getTranslatedTextEditor(Attribute $attribute, UpdateController $updateController, UpdateAttributeController $updateAttributeController, ViewInformation $viewInformation) {
@@ -541,6 +549,10 @@
542550 $availableEditors->addEditor($reciprocalRelationsEditor);
543551 $availableEditors->addEditor($classMembershipEditor);
544552 $availableEditors->addEditor($collectionMembershipEditor);
 553+
 554+ foreach (createPropertyToColumnFilterEditors($viewInformation, $definedMeaningIdAttribute, 0, $definedMeaningMeaningName) as $propertyToColumnEditor)
 555+ $availableEditors->addEditor($propertyToColumnEditor);
 556+
545557 $availableEditors->addEditor(createObjectAttributesEditor($viewInformation, $definedMeaningAttributesAttribute, $definedMeaningIdAttribute, 0, $definedMeaningMeaningName));
546558
547559 if ($viewInformation->possiblySynonymousRelationTypeId != 0)
@@ -550,7 +562,7 @@
551563
552564 foreach ($wdDefinedMeaningAttributesOrder as $attributeId) {
553565 $editor = $availableEditors->getEditorForAttributeId($attributeId);
554 -
 566+
555567 if ($editor != null)
556568 $definedMeaningEditor->addEditor($editor);
557569 }
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php
@@ -598,13 +598,13 @@
599599
600600 function filterObjectAttributesRecord(Record $sourceRecord, array &$attributeIds) {
601601 global
602 - $definedMeaningAttributesAttribute, $objectIdAttribute,
 602+ $objectIdAttribute,
603603 $textAttributeValuesAttribute, $textAttributeAttribute,
604604 $translatedTextAttributeAttribute, $translatedTextAttributeValuesAttribute,
605605 $linkAttributeAttribute, $linkAttributeValuesAttribute,
606606 $optionAttributeAttribute, $optionAttributeValuesAttribute;
607607
608 - $result = new ArrayRecord(new Structure($definedMeaningAttributesAttribute));
 608+ $result = new ArrayRecord($sourceRecord->getStructure());
609609 $result->setAttributeValue($objectIdAttribute, $sourceRecord->getAttributeValue($objectIdAttribute));
610610
611611 $result->setAttributeValue($textAttributeValuesAttribute, filterAttributeValues(
Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaningModel.php
@@ -172,7 +172,11 @@
173173 $record->setAttributeValue($reciprocalRelationsAttribute, getDefinedMeaningReciprocalRelationsRecordSet($id, $view));
174174 $record->setAttributeValue($classMembershipAttribute, getDefinedMeaningClassMembershipRecordSet($id, $view));
175175 $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+
177181 $this->record=$record;
178182 $this->recordIsLoaded=true;
179183 return true;

Status & tagging log