r23740 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23739‎ | r23740 | r23741 >
Date:14:26, 5 July 2007
Author:proes
Status:old
Tags:
Comment:
Refactored object attributes a bit
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/OmegaWikiEditors.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/WikiDataGlobals.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiEditors.php
@@ -10,36 +10,18 @@
1111
1212 function initializeObjectAttributeEditors(ViewInformation $viewInformation) {
1313 global
14 - $objectAttributesAttribute, $definedMeaningAttributesAttribute,
15 - $definedMeaningObjectAttributesEditor, $definedMeaningIdAttribute,
16 - $definitionObjectAttributesEditor, $definedMeaningIdAttribute,
17 - $synonymsAndTranslationsObjectAttributesEditor, $syntransIdAttribute,
18 - $relationsObjectAttributesEditor, $relationIdAttribute,
19 - $possiblySynonymousObjectAttributesEditor, $possiblySynonymousIdAttribute,
 14+ $objectAttributesAttribute, $definedMeaningIdAttribute,
2015 $textValueObjectAttributesEditor, $textAttributeIdAttribute,
2116 $urlValueObjectAttributesEditor, $urlAttributeIdAttribute,
2217 $translatedTextValueObjectAttributesEditor, $translatedTextAttributeIdAttribute,
23 - $optionValueObjectAttributesEditor, $optionAttributeIdAttribute,
24 - $definedMeaningMeaningName, $definitionMeaningName,
25 - $relationMeaningName, $synTransMeaningName,
26 - $annotationMeaningName;
 18+ $optionValueObjectAttributesEditor, $optionAttributeIdAttribute, $annotationMeaningName;
2719
28 - $definedMeaningObjectAttributesEditor = new RecordUnorderedListEditor($definedMeaningAttributesAttribute, 5);
29 - $definitionObjectAttributesEditor = new RecordUnorderedListEditor($objectAttributesAttribute, 5);
30 - $synonymsAndTranslationsObjectAttributesEditor = new RecordUnorderedListEditor($objectAttributesAttribute, 5);
31 - $possiblySynonymousObjectAttributesEditor = new RecordUnorderedListEditor($objectAttributesAttribute, 5);
32 - $relationsObjectAttributesEditor = new RecordUnorderedListEditor($objectAttributesAttribute, 5);
3320
3421 $textValueObjectAttributesEditor = new RecordUnorderedListEditor($objectAttributesAttribute, 5);
3522 $urlValueObjectAttributesEditor = new RecordUnorderedListEditor($objectAttributesAttribute, 5);
3623 $translatedTextValueObjectAttributesEditor = new RecordUnorderedListEditor($objectAttributesAttribute, 5);
3724 $optionValueObjectAttributesEditor = new RecordUnorderedListEditor($objectAttributesAttribute, 5);
3825
39 - setObjectAttributesEditor($definedMeaningObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $definedMeaningIdAttribute), $definedMeaningMeaningName, new ObjectIdFetcher(0, $definedMeaningIdAttribute));
40 - setObjectAttributesEditor($definitionObjectAttributesEditor, $viewInformation, new DefinitionObjectIdFetcher(0, $definedMeaningIdAttribute), $definitionMeaningName, new ObjectIdFetcher(0, $definedMeaningIdAttribute));
41 - setObjectAttributesEditor($synonymsAndTranslationsObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $syntransIdAttribute), $synTransMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute));
42 - setObjectAttributesEditor($possiblySynonymousObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $possiblySynonymousIdAttribute), $relationMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute));
43 - setObjectAttributesEditor($relationsObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $relationIdAttribute), $relationMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute));
4426 setObjectAttributesEditor($textValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $textAttributeIdAttribute), $annotationMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute));
4527 setObjectAttributesEditor($urlValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $urlAttributeIdAttribute), $annotationMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute));
4628 setObjectAttributesEditor($translatedTextValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $translatedTextAttributeIdAttribute), $annotationMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute));
@@ -82,7 +64,8 @@
8365
8466 function getDefinitionEditor(ViewInformation $viewInformation) {
8567 global
86 - $definitionAttribute, $translatedTextAttribute, $definitionObjectAttributesEditor, $wgPopupAnnotationName;
 68+ $definitionAttribute, $translatedTextAttribute, $wgPopupAnnotationName,
 69+ $objectAttributesAttribute, $definedMeaningIdAttribute, $definitionMeaningName, $objectAttributesAttribute;
8770
8871 $editor = new RecordDivListEditor($definitionAttribute);
8972 $editor->addEditor(getTranslatedTextEditor(
@@ -91,7 +74,10 @@
9275 new DefinedMeaningFilteredDefinitionController($viewInformation->filterLanguageId),
9376 $viewInformation
9477 ));
95 - $editor->addEditor(new PopUpEditor($definitionObjectAttributesEditor, $wgPopupAnnotationName));
 78+ $editor->addEditor(new PopUpEditor(
 79+ createObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $definedMeaningIdAttribute, 0, $definitionMeaningName),
 80+ $wgPopupAnnotationName
 81+ ));
9682
9783 return $editor;
9884 }
@@ -122,6 +108,23 @@
123109 $objectAttributesEditor->addEditor(getOptionAttributeValuesEditor($viewInformation, new OptionAttributeValuesController($objectIdFetcher), $levelDefinedMeaningName, $dmObjectIdFetcher));
124110 }
125111
 112+function createObjectAttributesEditor(ViewInformation $viewInformation, Attribute $attribute, Attribute $idAttribute, $levelsFromDefinedMeaning, $levelName) {
 113+ global
 114+ $objectAttributesAttribute, $definedMeaningIdAttribute;
 115+
 116+ $result = new RecordUnorderedListEditor($attribute, 5);
 117+
 118+ setObjectAttributesEditor(
 119+ $result,
 120+ $viewInformation,
 121+ new ObjectIdFetcher(0, $idAttribute),
 122+ $levelName,
 123+ new ObjectIdFetcher($levelsFromDefinedMeaning, $definedMeaningIdAttribute)
 124+ );
 125+
 126+ return $result;
 127+}
 128+
126129 function getAlternativeDefinitionsEditor(ViewInformation $viewInformation) {
127130 global
128131 $alternativeDefinitionsAttribute, $alternativeDefinitionAttribute, $sourceAttribute;
@@ -182,7 +185,8 @@
183186 function getSynonymsAndTranslationsEditor(ViewInformation $viewInformation) {
184187 global
185188 $synonymsAndTranslationsAttribute, $identicalMeaningAttribute, $expressionIdAttribute,
186 - $expressionAttribute, $synonymsAndTranslationsObjectAttributesEditor, $wgPopupAnnotationName;
 189+ $expressionAttribute, $wgPopupAnnotationName,
 190+ $syntransIdAttribute, $synTransMeaningName, $objectAttributesAttribute;
187191
188192 $tableEditor = new RecordSetTableEditor(
189193 $synonymsAndTranslationsAttribute,
@@ -196,7 +200,10 @@
197201
198202 $tableEditor->addEditor(getExpressionTableCellEditor($expressionAttribute, $viewInformation));
199203 $tableEditor->addEditor(new BooleanEditor($identicalMeaningAttribute, new SimplePermissionController(true), true, true));
200 - $tableEditor->addEditor(new PopUpEditor($synonymsAndTranslationsObjectAttributesEditor, $wgPopupAnnotationName));
 204+ $tableEditor->addEditor(new PopUpEditor(
 205+ createObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $syntransIdAttribute, 1, $synTransMeaningName),
 206+ $wgPopupAnnotationName
 207+ ));
201208
202209 addTableMetadataEditors($tableEditor, $viewInformation);
203210
@@ -205,13 +212,16 @@
206213
207214 function getDefinedMeaningRelationsEditor(ViewInformation $viewInformation) {
208215 global
209 - $relationsAttribute, $relationTypeAttribute, $otherDefinedMeaningAttribute,
210 - $relationsObjectAttributesEditor, $wgPopupAnnotationName;
 216+ $relationsAttribute, $relationTypeAttribute, $otherDefinedMeaningAttribute, $objectAttributesAttribute,
 217+ $relationsObjectAttributesEditor, $relationIdAttribute, $relationMeaningName, $wgPopupAnnotationName;
211218
212219 $editor = new RecordSetTableEditor($relationsAttribute, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, new DefinedMeaningRelationController());
213220 $editor->addEditor(new RelationTypeReferenceEditor($relationTypeAttribute, new SimplePermissionController(false), true));
214221 $editor->addEditor(new DefinedMeaningReferenceEditor($otherDefinedMeaningAttribute, new SimplePermissionController(false), true));
215 - $editor->addEditor(new PopUpEditor($relationsObjectAttributesEditor, $wgPopupAnnotationName));
 222+ $editor->addEditor(new PopUpEditor(
 223+ createObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $relationIdAttribute, 1, $relationMeaningName),
 224+ $wgPopupAnnotationName
 225+ ));
216226
217227 addTableMetadataEditors($editor, $viewInformation);
218228
@@ -220,13 +230,16 @@
221231
222232 function getDefinedMeaningReciprocalRelationsEditor(ViewInformation $viewInformation) {
223233 global
224 - $reciprocalRelationsAttribute, $relationTypeAttribute, $otherDefinedMeaningAttribute,
225 - $relationsObjectAttributesEditor, $wgPopupAnnotationName;
 234+ $reciprocalRelationsAttribute, $relationTypeAttribute, $otherDefinedMeaningAttribute, $objectAttributesAttribute,
 235+ $relationsObjectAttributesEditor, $relationIdAttribute, $relationMeaningName, $wgPopupAnnotationName;
226236
227237 $editor = new RecordSetTableEditor($reciprocalRelationsAttribute, new SimplePermissionController(false), new ShowEditFieldChecker(true), new AllowAddController(false), false, false, null);
228238 $editor->addEditor(new DefinedMeaningReferenceEditor($otherDefinedMeaningAttribute, new SimplePermissionController(false), true));
229239 $editor->addEditor(new RelationTypeReferenceEditor($relationTypeAttribute, new SimplePermissionController(false), true));
230 - $editor->addEditor(new PopUpEditor($relationsObjectAttributesEditor, $wgPopupAnnotationName));
 240+ $editor->addEditor(new PopUpEditor(
 241+ createObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $relationIdAttribute, 1, $relationMeaningName),
 242+ $wgPopupAnnotationName
 243+ ));
231244
232245 addTableMetadataEditors($editor, $viewInformation);
233246
@@ -444,9 +457,9 @@
445458
446459 function getDefinedMeaningEditor(ViewInformation $viewInformation) {
447460 global
448 - $wdDefinedMeaningAttributesOrder,
 461+ $wdDefinedMeaningAttributesOrder, $definedMeaningIdAttribute, $definedMeaningMeaningName,
449462 $definedMeaningAttribute, $possiblySynonymousIdAttribute, $possiblySynonymousAttribute,
450 - $possibleSynonymAttribute, $definedMeaningObjectAttributesEditor, $possiblySynonymousObjectAttributesEditor;
 463+ $possibleSynonymAttribute, $relationMeaningName, $objectAttributesAttribute, $definedMeaningAttributesAttribute;
451464
452465 $definitionEditor = getDefinitionEditor($viewInformation);
453466 $alternativeDefinitionsEditor = getAlternativeDefinitionsEditor($viewInformation);
@@ -463,7 +476,7 @@
464477 $possibleSynonymAttribute,
465478 $viewInformation->possiblySynonymousRelationTypeId,
466479 $viewInformation,
467 - $possiblySynonymousObjectAttributesEditor
 480+ createObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $possiblySynonymousIdAttribute, 1, $relationMeaningName)
468481 );
469482
470483 $availableEditors = new AttributeEditorMap();
@@ -475,7 +488,7 @@
476489 $availableEditors->addEditor($reciprocalRelationsEditor);
477490 $availableEditors->addEditor($classMembershipEditor);
478491 $availableEditors->addEditor($collectionMembershipEditor);
479 - $availableEditors->addEditor($definedMeaningObjectAttributesEditor);
 492+ $availableEditors->addEditor(createObjectAttributesEditor($viewInformation, $definedMeaningAttributesAttribute, $definedMeaningIdAttribute, 0, $definedMeaningMeaningName));
480493
481494 if ($viewInformation->possiblySynonymousRelationTypeId != 0)
482495 $availableEditors->addEditor($possiblySynonymousEditor);
@@ -484,7 +497,7 @@
485498
486499 foreach ($wdDefinedMeaningAttributesOrder as $attributeId) {
487500 $editor = $availableEditors->getEditorForAttributeId($attributeId);
488 -
 501+
489502 if ($editor != null)
490503 $definedMeaningEditor->addEditor($editor);
491504 }
Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataGlobals.php
@@ -92,11 +92,11 @@
9393 $wgSourceIdentifierAttributeName = "Source identifier";
9494 $wgTextAttributeAttributeName = "Property";
9595 $wgTextAttributeName = "Text";
96 -$wgTextAttributeValuesAttributeName = "String properties";
 96+$wgTextAttributeValuesAttributeName = "Plain text properties";
9797 $wgTranslatedTextAttributeAttributeName = "Property";
9898 $wgTranslatedTextAttributeName = "Translated text";
9999 $wgTranslatedTextAttributeValueAttributeName = "Text";
100 -$wgTranslatedTextAttributeValuesAttributeName = "Text properties";
 100+$wgTranslatedTextAttributeValuesAttributeName = "Translatable text properties";
101101 $wgUrlAttributeAttributeName = "Property";
102102 $wgUrlAttributeValuesAttributeName = "URL properties";
103103

Status & tagging log