Index: trunk/extensions/Wikidata/OmegaWiki/SpecialSuggest.php |
— | — | @@ -72,7 +72,7 @@ |
73 | 73 | $sql = getSQLToSelectPossibleAttributes($objectId, $attributesLevel, 'TEXT'); |
74 | 74 | break; |
75 | 75 | case 'url-attribute': |
76 | | - $sql = getSQLToSelectPossibleAttributes($objectId, $attributesLevel, 'TEXT'); |
| 76 | + $sql = getSQLToSelectPossibleAttributes($objectId, $attributesLevel, 'URL'); |
77 | 77 | break; |
78 | 78 | case 'language': |
79 | 79 | require_once('languages.php'); |
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiEditors.php |
— | — | @@ -88,6 +88,19 @@ |
89 | 89 | )); |
90 | 90 | |
91 | 91 | 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 | + } |
92 | 105 | } |
93 | 106 | |
94 | 107 | function getTranslatedTextEditor(Attribute $attribute, UpdateController $updateController, UpdateAttributeController $updateAttributeController, ViewInformation $viewInformation) { |
— | — | @@ -225,6 +238,9 @@ |
226 | 239 | |
227 | 240 | $tableEditor->addEditor(getExpressionTableCellEditor($expressionAttribute, $viewInformation)); |
228 | 241 | $tableEditor->addEditor(new BooleanEditor($identicalMeaningAttribute, new SimplePermissionController(true), true, true)); |
| 242 | + |
| 243 | + addPropertyToColumnFilterEditors($tableEditor, $viewInformation, 1, $synTransMeaningName); |
| 244 | + |
229 | 245 | $tableEditor->addEditor(new PopUpEditor( |
230 | 246 | createObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $syntransIdAttribute, 1, $synTransMeaningName), |
231 | 247 | $wgPopupAnnotationName |
— | — | @@ -243,6 +259,9 @@ |
244 | 260 | $editor = new RecordSetTableEditor($relationsAttribute, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, new DefinedMeaningRelationController()); |
245 | 261 | $editor->addEditor(new RelationTypeReferenceEditor($relationTypeAttribute, new SimplePermissionController(false), true)); |
246 | 262 | $editor->addEditor(new DefinedMeaningReferenceEditor($otherDefinedMeaningAttribute, new SimplePermissionController(false), true)); |
| 263 | + |
| 264 | + addPropertyToColumnFilterEditors($editor, $viewInformation, 1, $relationMeaningName); |
| 265 | + |
247 | 266 | $editor->addEditor(new PopUpEditor( |
248 | 267 | createObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $relationIdAttribute, 1, $relationMeaningName), |
249 | 268 | $wgPopupAnnotationName |
— | — | @@ -261,6 +280,9 @@ |
262 | 281 | $editor = new RecordSetTableEditor($reciprocalRelationsAttribute, new SimplePermissionController(false), new ShowEditFieldChecker(true), new AllowAddController(false), false, false, null); |
263 | 282 | $editor->addEditor(new DefinedMeaningReferenceEditor($otherDefinedMeaningAttribute, new SimplePermissionController(false), true)); |
264 | 283 | $editor->addEditor(new RelationTypeReferenceEditor($relationTypeAttribute, new SimplePermissionController(false), true)); |
| 284 | + |
| 285 | + addPropertyToColumnFilterEditors($editor, $viewInformation, 1, $relationMeaningName); |
| 286 | + |
265 | 287 | $editor->addEditor(new PopUpEditor( |
266 | 288 | createObjectAttributesEditor($viewInformation, $objectAttributesAttribute, $relationIdAttribute, 1, $relationMeaningName), |
267 | 289 | $wgPopupAnnotationName |
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php |
— | — | @@ -526,14 +526,27 @@ |
527 | 527 | $objectAttributesRecord = getObjectAttributesRecord($definitionId, $viewInformation, $objectAttributesAttribute->id); |
528 | 528 | $record->setAttributeValue($objectAttributesAttribute, $objectAttributesRecord); |
529 | 529 | |
| 530 | + applyPropertyToColumnFiltersToRecord($record, $objectAttributesRecord, $viewInformation); |
| 531 | + |
| 532 | + return $record; |
| 533 | +} |
| 534 | + |
| 535 | +function applyPropertyToColumnFiltersToRecord(Record $destinationRecord, Record $sourceRecord, ViewInformation $viewInformation) { |
530 | 536 | foreach ($viewInformation->getPropertyToColumnFilters() as $propertyToColumnFilter) { |
531 | | - $record->setAttributeValue( |
| 537 | + $destinationRecord->setAttributeValue( |
532 | 538 | $propertyToColumnFilter->getAttribute(), |
533 | | - filterObjectAttributesRecord($objectAttributesRecord, $propertyToColumnFilter->attributeIDs) |
| 539 | + filterObjectAttributesRecord($sourceRecord, $propertyToColumnFilter->attributeIDs) |
534 | 540 | ); |
535 | 541 | } |
| 542 | +} |
536 | 543 | |
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 | + } |
538 | 551 | } |
539 | 552 | |
540 | 553 | function getObjectAttributesRecord($objectId, ViewInformation $viewInformation, $structuralOverride = null) { |
— | — | @@ -819,6 +832,7 @@ |
820 | 833 | $objectAttributesRecord->setAttributeValue($optionAttributeValuesAttribute, $optionAttributeValuesRecordSet); |
821 | 834 | |
822 | 835 | $record->setAttributeValue($attributeToExpand, $objectAttributesRecord); |
| 836 | + applyPropertyToColumnFiltersToRecord($record, $objectAttributesRecord, $viewInformation); |
823 | 837 | } |
824 | 838 | } |
825 | 839 | } |
— | — | @@ -1123,7 +1137,7 @@ |
1124 | 1138 | $classAttributesTable, |
1125 | 1139 | array('object_id = ' . $optionRecord->getAttributeValue($optionAttributeIdAttribute)) |
1126 | 1140 | ); |
1127 | | - |
| 1141 | + |
1128 | 1142 | $optionRecord = $optionRecordSet->getRecord(0); |
1129 | 1143 | $record->setAttributeValue( |
1130 | 1144 | $optionAttributeAttribute, |
Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataTables.php |
— | — | @@ -20,7 +20,7 @@ |
21 | 21 | } |
22 | 22 | |
23 | 23 | public function qualifiedName() { |
24 | | - return $this->table->identifier . '.' . $this->identifier; |
| 24 | + return $this->table->getIdentifier() . '.' . $this->identifier; |
25 | 25 | } |
26 | 26 | |
27 | 27 | public function toExpression() { |
— | — | @@ -44,8 +44,9 @@ |
45 | 45 | |
46 | 46 | public function getIdentifier() { |
47 | 47 | $dc = wdGetDataSetContext(); |
48 | | - return "{$dc}_".$this->identifier; |
| 48 | + return "{$dc}_" . $this->identifier; |
49 | 49 | } |
| 50 | + |
50 | 51 | protected function createColumn($identifier) { |
51 | 52 | $result = new TableColumn($this, $identifier); |
52 | 53 | $this->columns[] = $result; |