r23760 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23759‎ | r23760 | r23761 >
Date:20:09, 5 July 2007
Author:proes
Status:old
Tags:
Comment:
* Now other annotation levels can be filtered to separate columns too on the view page
* Edit and history page are still pending
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/OmegaWikiEditors.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/SpecialSuggest.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/WikiDataTables.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/SpecialSuggest.php
@@ -72,7 +72,7 @@
7373 $sql = getSQLToSelectPossibleAttributes($objectId, $attributesLevel, 'TEXT');
7474 break;
7575 case 'url-attribute':
76 - $sql = getSQLToSelectPossibleAttributes($objectId, $attributesLevel, 'TEXT');
 76+ $sql = getSQLToSelectPossibleAttributes($objectId, $attributesLevel, 'URL');
7777 break;
7878 case 'language':
7979 require_once('languages.php');
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiEditors.php
@@ -88,6 +88,19 @@
8989 ));
9090
9191 return $editor;
 92+}
 93+
 94+function addPropertyToColumnFilterEditors(Editor $editor, ViewInformation $viewInformation, $levelsFromDefinedMeaning, $levelName) {
 95+ global
 96+ $definedMeaningIdAttribute;
 97+
 98+ foreach ($viewInformation->getPropertyToColumnFilters() as $propertyToColumnFilter) {
 99+ $attribute = $propertyToColumnFilter->getAttribute();
 100+ $editor->addEditor(new PopUpEditor(
 101+ createObjectAttributesEditor($viewInformation, $attribute, $definedMeaningIdAttribute, $levelsFromDefinedMeaning, $levelName),
 102+ $attribute->name
 103+ ));
 104+ }
92105 }
93106
94107 function getTranslatedTextEditor(Attribute $attribute, UpdateController $updateController, UpdateAttributeController $updateAttributeController, ViewInformation $viewInformation) {
@@ -225,6 +238,9 @@
226239
227240 $tableEditor->addEditor(getExpressionTableCellEditor($expressionAttribute, $viewInformation));
228241 $tableEditor->addEditor(new BooleanEditor($identicalMeaningAttribute, new SimplePermissionController(true), true, true));
 242+
 243+ addPropertyToColumnFilterEditors($tableEditor, $viewInformation, 1, $synTransMeaningName);
 244+
229245 $tableEditor->addEditor(new PopUpEditor(
230246 createObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $syntransIdAttribute, 1, $synTransMeaningName),
231247 $wgPopupAnnotationName
@@ -243,6 +259,9 @@
244260 $editor = new RecordSetTableEditor($relationsAttribute, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, new DefinedMeaningRelationController());
245261 $editor->addEditor(new RelationTypeReferenceEditor($relationTypeAttribute, new SimplePermissionController(false), true));
246262 $editor->addEditor(new DefinedMeaningReferenceEditor($otherDefinedMeaningAttribute, new SimplePermissionController(false), true));
 263+
 264+ addPropertyToColumnFilterEditors($editor, $viewInformation, 1, $relationMeaningName);
 265+
247266 $editor->addEditor(new PopUpEditor(
248267 createObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $relationIdAttribute, 1, $relationMeaningName),
249268 $wgPopupAnnotationName
@@ -261,6 +280,9 @@
262281 $editor = new RecordSetTableEditor($reciprocalRelationsAttribute, new SimplePermissionController(false), new ShowEditFieldChecker(true), new AllowAddController(false), false, false, null);
263282 $editor->addEditor(new DefinedMeaningReferenceEditor($otherDefinedMeaningAttribute, new SimplePermissionController(false), true));
264283 $editor->addEditor(new RelationTypeReferenceEditor($relationTypeAttribute, new SimplePermissionController(false), true));
 284+
 285+ addPropertyToColumnFilterEditors($editor, $viewInformation, 1, $relationMeaningName);
 286+
265287 $editor->addEditor(new PopUpEditor(
266288 createObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $relationIdAttribute, 1, $relationMeaningName),
267289 $wgPopupAnnotationName
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php
@@ -526,14 +526,27 @@
527527 $objectAttributesRecord = getObjectAttributesRecord($definitionId, $viewInformation, $objectAttributesAttribute->id);
528528 $record->setAttributeValue($objectAttributesAttribute, $objectAttributesRecord);
529529
 530+ applyPropertyToColumnFiltersToRecord($record, $objectAttributesRecord, $viewInformation);
 531+
 532+ return $record;
 533+}
 534+
 535+function applyPropertyToColumnFiltersToRecord(Record $destinationRecord, Record $sourceRecord, ViewInformation $viewInformation) {
530536 foreach ($viewInformation->getPropertyToColumnFilters() as $propertyToColumnFilter) {
531 - $record->setAttributeValue(
 537+ $destinationRecord->setAttributeValue(
532538 $propertyToColumnFilter->getAttribute(),
533 - filterObjectAttributesRecord($objectAttributesRecord, $propertyToColumnFilter->attributeIDs)
 539+ filterObjectAttributesRecord($sourceRecord, $propertyToColumnFilter->attributeIDs)
534540 );
535541 }
 542+}
536543
537 - return $record;
 544+function applyPropertyToColumnFiltersToRecordSet(RecordSet $recordSet, Attribute $sourceAttribute, ViewInformation $viewInformation) {
 545+ for ($i = 0; $i < $recordSet->getRecordCount(); $i++) {
 546+ $record = $recordSet->getRecord($i);
 547+ $attributeValuesRecord = $recordSet->getAttributeValue($sourceAttribute);
 548+
 549+ applyPropertyToColumnFiltersToRecord($record, $attributeValuesRecord, $viewInformation);
 550+ }
538551 }
539552
540553 function getObjectAttributesRecord($objectId, ViewInformation $viewInformation, $structuralOverride = null) {
@@ -819,6 +832,7 @@
820833 $objectAttributesRecord->setAttributeValue($optionAttributeValuesAttribute, $optionAttributeValuesRecordSet);
821834
822835 $record->setAttributeValue($attributeToExpand, $objectAttributesRecord);
 836+ applyPropertyToColumnFiltersToRecord($record, $objectAttributesRecord, $viewInformation);
823837 }
824838 }
825839 }
@@ -1123,7 +1137,7 @@
11241138 $classAttributesTable,
11251139 array('object_id = ' . $optionRecord->getAttributeValue($optionAttributeIdAttribute))
11261140 );
1127 -
 1141+
11281142 $optionRecord = $optionRecordSet->getRecord(0);
11291143 $record->setAttributeValue(
11301144 $optionAttributeAttribute,
Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataTables.php
@@ -20,7 +20,7 @@
2121 }
2222
2323 public function qualifiedName() {
24 - return $this->table->identifier . '.' . $this->identifier;
 24+ return $this->table->getIdentifier() . '.' . $this->identifier;
2525 }
2626
2727 public function toExpression() {
@@ -44,8 +44,9 @@
4545
4646 public function getIdentifier() {
4747 $dc = wdGetDataSetContext();
48 - return "{$dc}_".$this->identifier;
 48+ return "{$dc}_" . $this->identifier;
4949 }
 50+
5051 protected function createColumn($identifier) {
5152 $result = new TableColumn($this, $identifier);
5253 $this->columns[] = $result;

Status & tagging log