r24744 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24743‎ | r24744 | r24745 >
Date:10:13, 13 August 2007
Author:proes
Status:old
Tags:
Comment:
Added $propertyCaption to constructor PropertyToColumnFilter. Users of PropertyToColumnFilters should update all present filters with this extra parameter. This parameter controls the name of the first column in the table with the property values.
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/OmegaWikiEditors.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/PropertyToColumnFilter.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/WikiDataGlobals.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataGlobals.php
@@ -43,6 +43,7 @@
4444 $wgPopupAnnotationName,
4545 $wgPossibleSynonymAttributeName,
4646 $wgPossiblySynonymousAttributeName,
 47+ $wgPropertyAttributeName,
4748 $wgRelationsAttributeName,
4849 $wgRelationTypeAttributeName,
4950 $wgSourceAttributeName,
@@ -90,6 +91,7 @@
9192 $wgPopupAnnotationName = "Annotation";
9293 $wgPossibleSynonymAttributeName = "Possible synonym";
9394 $wgPossiblySynonymousAttributeName = "Possibly synonymous";
 95+$wgPropertyAttributeName = "Property";
9496 $wgRelationsAttributeName = "Relations";
9597 $wgRelationTypeAttributeName = "Relation type";
9698 $wgSpellingAttributeName = "Spelling";
Index: trunk/extensions/Wikidata/OmegaWiki/PropertyToColumnFilter.php
@@ -3,17 +3,23 @@
44 require_once('Attribute.php');
55
66 class PropertyToColumnFilter {
7 - public $attributeIDs; // Array containing the defined meaning ids of the attributes that should be filtered
8 - protected $attribute; // Attribute
 7+ public $attributeIDs; // Array containing the defined meaning ids of the attributes that should be filtered
 8+ protected $attribute; // Attribute
 9+ protected $propertyCaption; // Caption of the first column
910
10 - public function __construct($identifier, $caption, array $attributeIDs) {
 11+ public function __construct($identifier, $caption, $propertyCaption, array $attributeIDs) {
1112 $this->attributeIDs = $attributeIDs;
12 - $this->attribute = new Attribute($identifier, $caption, "will-be-specified-later");
 13+ $this->attribute = new Attribute($identifier, $caption, "will-be-specified-later");
 14+ $this->propertyCaption = $propertyCaption;
1315 }
1416
1517 public function getAttribute() {
1618 return $this->attribute;
1719 }
 20+
 21+ public function getPropertyCaption() {
 22+ return $this->propertyCaption;
 23+ }
1824 }
1925
2026 ?>
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiEditors.php
@@ -23,7 +23,7 @@
2424 protected $propertyAttribute;
2525 protected $valueAttribute;
2626
27 - public function __construct(Attribute $attribute, ViewInformation $viewInformation) {
 27+ public function __construct(Attribute $attribute, $propertyCaption, ViewInformation $viewInformation) {
2828 parent::__construct(new RecordUnorderedListEditor($attribute, 5));
2929
3030 $this->recordSetTableEditor = new RecordSetTableEditor(
@@ -36,7 +36,7 @@
3737 null
3838 );
3939
40 - $this->propertyAttribute = new Attribute("property", "Property", "short-text");
 40+ $this->propertyAttribute = new Attribute("property", $propertyCaption, "short-text");
4141 $this->valueAttribute = new Attribute("value", "Value", "short-text");
4242
4343 foreach ($viewInformation->getPropertyToColumnFilters() as $propertyToColumnFilter)
@@ -184,24 +184,26 @@
185185 $textValueObjectAttributesEditors, $textAttributeIdAttribute,
186186 $linkValueObjectAttributesEditors, $linkAttributeIdAttribute,
187187 $translatedTextValueObjectAttributesEditors, $translatedTextAttributeIdAttribute,
188 - $optionValueObjectAttributesEditors, $optionAttributeIdAttribute, $annotationMeaningName;
 188+ $optionValueObjectAttributesEditors, $optionAttributeIdAttribute, $annotationMeaningName,
 189+ $wgPropertyAttributeName;
189190
190191 $linkValueObjectAttributesEditors = array();
191192 $textValueObjectAttributesEditors = array();
192193
193194 foreach ($viewInformation->getPropertyToColumnFilters() as $propertyToColumnFilter) {
194195 $attribute = $propertyToColumnFilter->getAttribute();
 196+ $propertyCaption = $propertyToColumnFilter->getPropertyCaption();
195197
196 - $textValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($attribute, $viewInformation);
197 - $linkValueObjectAttributeEditors[] = new ObjectAttributeValuesEditor($attribute, $viewInformation);
198 - $translatedTextValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($attribute, $viewInformation);
199 - $optionValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($attribute, $viewInformation);
 198+ $textValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $viewInformation);
 199+ $linkValueObjectAttributeEditors[] = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $viewInformation);
 200+ $translatedTextValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $viewInformation);
 201+ $optionValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $viewInformation);
200202 }
201203
202 - $textValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($objectAttributesAttribute, $viewInformation);
203 - $linkValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($objectAttributesAttribute, $viewInformation);
204 - $translatedTextValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($objectAttributesAttribute, $viewInformation);
205 - $optionValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($objectAttributesAttribute, $viewInformation);
 204+ $textValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($objectAttributesAttribute, $wgPropertyAttributeName, $viewInformation);
 205+ $linkValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($objectAttributesAttribute, $wgPropertyAttributeName, $viewInformation);
 206+ $translatedTextValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($objectAttributesAttribute, $wgPropertyAttributeName, $viewInformation);
 207+ $optionValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($objectAttributesAttribute, $wgPropertyAttributeName, $viewInformation);
206208
207209 foreach ($textValueObjectAttributesEditors as $textValueObjectAttributesEditor)
208210 addObjectAttributesEditors($textValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $textAttributeIdAttribute), $annotationMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute));
@@ -264,7 +266,8 @@
265267 function getDefinitionEditor(ViewInformation $viewInformation) {
266268 global
267269 $definitionAttribute, $translatedTextAttribute, $wgPopupAnnotationName,
268 - $objectAttributesAttribute, $definedMeaningIdAttribute, $definitionMeaningName, $objectAttributesAttribute;
 270+ $objectAttributesAttribute, $definedMeaningIdAttribute, $definitionMeaningName, $objectAttributesAttribute,
 271+ $wgPropertyAttributeName;
269272
270273 $editor = new RecordDivListEditor($definitionAttribute);
271274 $editor->addEditor(getTranslatedTextEditor(
@@ -276,14 +279,15 @@
277280
278281 foreach ($viewInformation->getPropertyToColumnFilters() as $propertyToColumnFilter) {
279282 $attribute = $propertyToColumnFilter->getAttribute();
 283+ $propertyCaption = $propertyToColumnFilter->getPropertyCaption();
280284 $editor->addEditor(new PopUpEditor(
281 - createDefinitionObjectAttributesEditor($viewInformation, $attribute, $definedMeaningIdAttribute, 0, $definitionMeaningName),
 285+ createDefinitionObjectAttributesEditor($viewInformation, $attribute, $propertyCaption, $definedMeaningIdAttribute, 0, $definitionMeaningName),
282286 $attribute->name
283287 ));
284288 }
285289
286290 $editor->addEditor(new PopUpEditor(
287 - createDefinitionObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $definedMeaningIdAttribute, 0, $definitionMeaningName),
 291+ createDefinitionObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $wgPropertyAttributeName, $definedMeaningIdAttribute, 0, $definitionMeaningName),
288292 $wgPopupAnnotationName
289293 ));
290294
@@ -295,7 +299,8 @@
296300
297301 foreach ($viewInformation->getPropertyToColumnFilters() as $propertyToColumnFilter) {
298302 $attribute = $propertyToColumnFilter->getAttribute();
299 - $result[] = createObjectAttributesEditor($viewInformation, $attribute, $idAttribute, $levelsFromDefinedMeaning, $levelName);
 303+ $propertyCaption = $propertyToColumnFilter->getPropertyCaption();
 304+ $result[] = createObjectAttributesEditor($viewInformation, $attribute, $propertyCaption, $idAttribute, $levelsFromDefinedMeaning, $levelName);
300305 }
301306
302307 return $result;
@@ -332,11 +337,11 @@
333338 $objectAttributesEditor->addEditor(getOptionAttributeValuesEditor($viewInformation, new OptionAttributeValuesController($objectIdFetcher), $levelDefinedMeaningName, $dmObjectIdFetcher));
334339 }
335340
336 -function createObjectAttributesEditor(ViewInformation $viewInformation, Attribute $attribute, Attribute $idAttribute, $levelsFromDefinedMeaning, $levelName) {
 341+function createObjectAttributesEditor(ViewInformation $viewInformation, Attribute $attribute, $propertyCaption, Attribute $idAttribute, $levelsFromDefinedMeaning, $levelName) {
337342 global
338343 $objectAttributesAttribute, $definedMeaningIdAttribute;
339344
340 - $result = new ObjectAttributeValuesEditor($attribute, $viewInformation);
 345+ $result = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $viewInformation);
341346
342347 addObjectAttributesEditors(
343348 $result,
@@ -349,11 +354,11 @@
350355 return $result;
351356 }
352357
353 -function createDefinitionObjectAttributesEditor(ViewInformation $viewInformation, Attribute $attribute, Attribute $idAttribute, $levelsFromDefinedMeaning, $levelName) {
 358+function createDefinitionObjectAttributesEditor(ViewInformation $viewInformation, Attribute $attribute, $propertyCaption, Attribute $idAttribute, $levelsFromDefinedMeaning, $levelName) {
354359 global
355360 $objectAttributesAttribute, $definedMeaningIdAttribute;
356361
357 - $result = new ObjectAttributeValuesEditor($attribute, $viewInformation);
 362+ $result = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $viewInformation);
358363
359364 addObjectAttributesEditors(
360365 $result,
@@ -427,7 +432,8 @@
428433 global
429434 $synonymsAndTranslationsAttribute, $identicalMeaningAttribute, $expressionIdAttribute,
430435 $expressionAttribute, $wgPopupAnnotationName,
431 - $syntransIdAttribute, $synTransMeaningName, $objectAttributesAttribute;
 436+ $syntransIdAttribute, $synTransMeaningName, $objectAttributesAttribute,
 437+ $wgPropertyAttributeName;
432438
433439 $tableEditor = new RecordSetTableEditor(
434440 $synonymsAndTranslationsAttribute,
@@ -445,7 +451,7 @@
446452 addPropertyToColumnFilterEditors($tableEditor, $viewInformation, $syntransIdAttribute, 1, $synTransMeaningName);
447453
448454 $tableEditor->addEditor(new PopUpEditor(
449 - createObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $syntransIdAttribute, 1, $synTransMeaningName),
 455+ createObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $wgPropertyAttributeName, $syntransIdAttribute, 1, $synTransMeaningName),
450456 $wgPopupAnnotationName
451457 ));
452458
@@ -457,7 +463,8 @@
458464 function getDefinedMeaningRelationsEditor(ViewInformation $viewInformation) {
459465 global
460466 $relationsAttribute, $relationTypeAttribute, $otherDefinedMeaningAttribute, $objectAttributesAttribute,
461 - $relationsObjectAttributesEditor, $relationIdAttribute, $relationMeaningName, $wgPopupAnnotationName;
 467+ $relationsObjectAttributesEditor, $relationIdAttribute, $relationMeaningName, $wgPopupAnnotationName,
 468+ $wgPropertyAttributeName;
462469
463470 $editor = new RecordSetTableEditor($relationsAttribute, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, new DefinedMeaningRelationController());
464471 $editor->addEditor(new RelationTypeReferenceEditor($relationTypeAttribute, new SimplePermissionController(false), true));
@@ -466,7 +473,7 @@
467474 addPropertyToColumnFilterEditors($editor, $viewInformation, $relationIdAttribute, 1, $relationMeaningName);
468475
469476 $editor->addEditor(new PopUpEditor(
470 - createObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $relationIdAttribute, 1, $relationMeaningName),
 477+ createObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $wgPropertyAttributeName, $relationIdAttribute, 1, $relationMeaningName),
471478 $wgPopupAnnotationName
472479 ));
473480
@@ -478,7 +485,8 @@
479486 function getDefinedMeaningReciprocalRelationsEditor(ViewInformation $viewInformation) {
480487 global
481488 $reciprocalRelationsAttribute, $relationTypeAttribute, $otherDefinedMeaningAttribute, $objectAttributesAttribute,
482 - $relationsObjectAttributesEditor, $relationIdAttribute, $relationMeaningName, $wgPopupAnnotationName;
 489+ $relationsObjectAttributesEditor, $relationIdAttribute, $relationMeaningName, $wgPopupAnnotationName,
 490+ $wgPropertyAttributeName;
483491
484492 $editor = new RecordSetTableEditor($reciprocalRelationsAttribute, new SimplePermissionController(false), new ShowEditFieldChecker(true), new AllowAddController(false), false, false, null);
485493 $editor->addEditor(new DefinedMeaningReferenceEditor($otherDefinedMeaningAttribute, new SimplePermissionController(false), true));
@@ -487,7 +495,7 @@
488496 addPropertyToColumnFilterEditors($editor, $viewInformation, $relationIdAttribute, 1, $relationMeaningName);
489497
490498 $editor->addEditor(new PopUpEditor(
491 - createObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $relationIdAttribute, 1, $relationMeaningName),
 499+ createObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $wgPropertyAttributeName, $relationIdAttribute, 1, $relationMeaningName),
492500 $wgPopupAnnotationName
493501 ));
494502
@@ -711,7 +719,8 @@
712720 global
713721 $wdDefinedMeaningAttributesOrder, $definedMeaningIdAttribute, $definedMeaningMeaningName,
714722 $definedMeaningAttribute, $possiblySynonymousIdAttribute, $possiblySynonymousAttribute,
715 - $possibleSynonymAttribute, $relationMeaningName, $objectAttributesAttribute, $definedMeaningAttributesAttribute;
 723+ $possibleSynonymAttribute, $relationMeaningName, $objectAttributesAttribute, $definedMeaningAttributesAttribute,
 724+ $wgPropertyAttributeName;
716725
717726 $definitionEditor = getDefinitionEditor($viewInformation);
718727 $alternativeDefinitionsEditor = getAlternativeDefinitionsEditor($viewInformation);
@@ -728,7 +737,7 @@
729738 $possibleSynonymAttribute,
730739 $viewInformation->possiblySynonymousRelationTypeId,
731740 $viewInformation,
732 - createObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $possiblySynonymousIdAttribute, 1, $relationMeaningName)
 741+ createObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $wgPropertyAttributeName, $possiblySynonymousIdAttribute, 1, $relationMeaningName)
733742 );
734743
735744 $availableEditors = new AttributeEditorMap();
@@ -744,7 +753,7 @@
745754 foreach (createPropertyToColumnFilterEditors($viewInformation, $definedMeaningIdAttribute, 0, $definedMeaningMeaningName) as $propertyToColumnEditor)
746755 $availableEditors->addEditor($propertyToColumnEditor);
747756
748 - $availableEditors->addEditor(createObjectAttributesEditor($viewInformation, $definedMeaningAttributesAttribute, $definedMeaningIdAttribute, 0, $definedMeaningMeaningName));
 757+ $availableEditors->addEditor(createObjectAttributesEditor($viewInformation, $definedMeaningAttributesAttribute, $wgPropertyAttributeName, $definedMeaningIdAttribute, 0, $definedMeaningMeaningName));
749758
750759 if ($viewInformation->possiblySynonymousRelationTypeId != 0)
751760 $availableEditors->addEditor($possiblySynonymousEditor);

Status & tagging log