Index: trunk/extensions/Wikidata/OmegaWiki/PropertyToColumnFilter.php |
— | — | @@ -2,6 +2,46 @@ |
3 | 3 | |
4 | 4 | require_once('Attribute.php'); |
5 | 5 | |
| 6 | +interface AttributeIDFilter { |
| 7 | + public function filter(array $attributeIDs); |
| 8 | +} |
| 9 | + |
| 10 | +class IncludeAttributeIDsFilter implements AttributeIDFilter { |
| 11 | + protected $attributeIDsToInclude; |
| 12 | + |
| 13 | + public function __construct($attributeIDsToInclude) { |
| 14 | + $this->attributeIDsToInclude = $attributeIDsToInclude; |
| 15 | + } |
| 16 | + |
| 17 | + public function filter(array $attributeIDs) { |
| 18 | + $result = array(); |
| 19 | + |
| 20 | + foreach ($attributeIDs as $attributeID) |
| 21 | + if (in_array($attributeID, $this->attributeIDsToInclude)) |
| 22 | + $result[] = $attributeID; |
| 23 | + |
| 24 | + return $result; |
| 25 | + } |
| 26 | +} |
| 27 | + |
| 28 | +class ExcludeAttributeIDsFilter implements AttributeIDFilter { |
| 29 | + protected $attributeIDsToExclude; |
| 30 | + |
| 31 | + public function __construct($attributeIDsToExclude) { |
| 32 | + $this->attributeIDsToExclude = $attributeIDsToExclude; |
| 33 | + } |
| 34 | + |
| 35 | + public function filter(array $attributeIDs) { |
| 36 | + $result = array(); |
| 37 | + |
| 38 | + foreach ($attributeIDs as $attributeID) |
| 39 | + if (!in_array($attributeID, $this->attributeIDsToExclude)) |
| 40 | + $result[] = $attributeID; |
| 41 | + |
| 42 | + return $result; |
| 43 | + } |
| 44 | +} |
| 45 | + |
6 | 46 | class PropertyToColumnFilter { |
7 | 47 | public $attributeIDs; // Array containing the defined meaning ids of the attributes that should be filtered |
8 | 48 | protected $attribute; // Attribute |
— | — | @@ -20,6 +60,10 @@ |
21 | 61 | public function getPropertyCaption() { |
22 | 62 | return $this->propertyCaption; |
23 | 63 | } |
| 64 | + |
| 65 | + public function getAttributeIDFilter() { |
| 66 | + return new IncludeAttributeIDsFilter($this->attributeIDs); |
| 67 | + } |
24 | 68 | } |
25 | 69 | |
26 | 70 | ?> |
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiEditors.php |
— | — | @@ -22,10 +22,12 @@ |
23 | 23 | protected $recordSetTableEditor; |
24 | 24 | protected $propertyAttribute; |
25 | 25 | protected $valueAttribute; |
| 26 | + protected $attributeIDFilter; |
26 | 27 | |
27 | | - public function __construct(Attribute $attribute, $propertyCaption, ViewInformation $viewInformation) { |
| 28 | + public function __construct(Attribute $attribute, $propertyCaption, ViewInformation $viewInformation, AttributeIDFilter $attributeIDFilter) { |
28 | 29 | parent::__construct(new RecordUnorderedListEditor($attribute, 5)); |
29 | 30 | |
| 31 | + $this->attributeIDFilter = $attributeIDFilter; |
30 | 32 | $this->recordSetTableEditor = new RecordSetTableEditor( |
31 | 33 | $attribute, |
32 | 34 | new SimplePermissionController(false), |
— | — | @@ -48,6 +50,10 @@ |
49 | 51 | addTableMetadataEditors($this->recordSetTableEditor, $viewInformation); |
50 | 52 | } |
51 | 53 | |
| 54 | + public function getAttributeIDFilter() { |
| 55 | + return $this->attributeIDFilter; |
| 56 | + } |
| 57 | + |
52 | 58 | protected function attributeInStructure(Attribute $attribute, Structure $structure) { |
53 | 59 | $result = false; |
54 | 60 | $attributes = $structure->getAttributes(); |
— | — | @@ -209,14 +215,17 @@ |
210 | 216 | class ShowEditFieldForAttributeValuesChecker extends ShowEditFieldChecker { |
211 | 217 | protected $levelDefinedMeaningName; |
212 | 218 | protected $annotationType; |
| 219 | + protected $attributeIDFilter; |
213 | 220 | |
214 | | - public function __construct($levelDefinedMeaningName, $annotationType) { |
| 221 | + public function __construct($levelDefinedMeaningName, $annotationType, AttributeIDFilter $attributeIDFilter) { |
215 | 222 | $this->levelDefinedMeaningName = $levelDefinedMeaningName; |
216 | 223 | $this->annotationType = $annotationType; |
| 224 | + $this->attributeIDFilter = $attributeIDFilter; |
217 | 225 | } |
218 | 226 | |
219 | 227 | public function check(IdStack $idPath) { |
220 | 228 | $classAttributes = $idPath->getClassAttributes()->filterClassAttributes($this->levelDefinedMeaningName, $this->annotationType); |
| 229 | + $classAttributes = $this->attributeIDFilter->filter($classAttributes); |
221 | 230 | |
222 | 231 | return count($classAttributes) > 0; |
223 | 232 | } |
— | — | @@ -240,29 +249,32 @@ |
241 | 250 | foreach ($viewInformation->getPropertyToColumnFilters() as $propertyToColumnFilter) { |
242 | 251 | $attribute = $propertyToColumnFilter->getAttribute(); |
243 | 252 | $propertyCaption = $propertyToColumnFilter->getPropertyCaption(); |
| 253 | + $attributeIDfilter = $propertyToColumnFilter->getAttributeIDFilter(); |
244 | 254 | |
245 | | - $textValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $viewInformation); |
246 | | - $linkValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $viewInformation); |
247 | | - $translatedTextValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $viewInformation); |
248 | | - $optionValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $viewInformation); |
| 255 | + $textValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $viewInformation, $attributeIDfilter); |
| 256 | + $linkValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $viewInformation, $attributeIDfilter); |
| 257 | + $translatedTextValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $viewInformation, $attributeIDfilter); |
| 258 | + $optionValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $viewInformation, $attributeIDfilter); |
249 | 259 | } |
250 | 260 | |
251 | | - $textValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($o->objectAttributes, $wgPropertyAttributeName, $viewInformation); |
252 | | - $linkValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($o->objectAttributes, $wgPropertyAttributeName, $viewInformation); |
253 | | - $translatedTextValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($o->objectAttributes, $wgPropertyAttributeName, $viewInformation); |
254 | | - $optionValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($o->objectAttributes, $wgPropertyAttributeName, $viewInformation); |
| 261 | + $leftOverAttributeIdFilter = $viewInformation->getLeftOverAttributeFilter(); |
255 | 262 | |
| 263 | + $textValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($o->objectAttributes, $wgPropertyAttributeName, $viewInformation, $leftOverAttributeIdFilter); |
| 264 | + $linkValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($o->objectAttributes, $wgPropertyAttributeName, $viewInformation, $leftOverAttributeIdFilter); |
| 265 | + $translatedTextValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($o->objectAttributes, $wgPropertyAttributeName, $viewInformation, $leftOverAttributeIdFilter); |
| 266 | + $optionValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($o->objectAttributes, $wgPropertyAttributeName, $viewInformation, $leftOverAttributeIdFilter); |
| 267 | + |
256 | 268 | foreach ($textValueObjectAttributesEditors as $textValueObjectAttributesEditor) |
257 | | - addObjectAttributesEditors($textValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $o->textAttributeId), $annotationMeaningName, new ObjectIdFetcher(1, $o->definedMeaningId)); |
| 269 | + addObjectAttributesEditors($textValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $o->textAttributeId), $annotationMeaningName); |
258 | 270 | |
259 | 271 | foreach ($linkValueObjectAttributesEditors as $linkValueObjectAttributesEditor) |
260 | | - addObjectAttributesEditors($linkValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $o->linkAttributeId), $annotationMeaningName, new ObjectIdFetcher(1, $o->definedMeaningId)); |
| 272 | + addObjectAttributesEditors($linkValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $o->linkAttributeId), $annotationMeaningName); |
261 | 273 | |
262 | 274 | foreach ($translatedTextValueObjectAttributesEditors as $translatedTextValueObjectAttributesEditor) |
263 | | - addObjectAttributesEditors($translatedTextValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $o->translatedTextAttributeId), $annotationMeaningName, new ObjectIdFetcher(1, $o->definedMeaningId)); |
| 275 | + addObjectAttributesEditors($translatedTextValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $o->translatedTextAttributeId), $annotationMeaningName); |
264 | 276 | |
265 | 277 | foreach ($optionValueObjectAttributesEditors as $optionValueObjectAttributesEditor) |
266 | | - addObjectAttributesEditors($optionValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $o->optionAttributeId), $annotationMeaningName, new ObjectIdFetcher(1, $o->definedMeaningId)); |
| 278 | + addObjectAttributesEditors($optionValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $o->optionAttributeId), $annotationMeaningName); |
267 | 279 | } |
268 | 280 | |
269 | 281 | function getTransactionEditor(Attribute $attribute) { |
— | — | @@ -328,13 +340,13 @@ |
329 | 341 | $attribute = $propertyToColumnFilter->getAttribute(); |
330 | 342 | $propertyCaption = $propertyToColumnFilter->getPropertyCaption(); |
331 | 343 | $editor->addEditor(new PopUpEditor( |
332 | | - createDefinitionObjectAttributesEditor($viewInformation, $attribute, $propertyCaption, $o->definedMeaningId, $definitionMeaningName), |
| 344 | + createDefinitionObjectAttributesEditor($viewInformation, $attribute, $propertyCaption, $o->definedMeaningId, $definitionMeaningName, $propertyToColumnFilter->getAttributeIDFilter()), |
333 | 345 | $attribute->name |
334 | 346 | )); |
335 | 347 | } |
336 | 348 | |
337 | 349 | $editor->addEditor(new PopUpEditor( |
338 | | - createDefinitionObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->definedMeaningId, $definitionMeaningName), |
| 350 | + createDefinitionObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->definedMeaningId, $definitionMeaningName, $viewInformation->getLeftOverAttributeFilter()), |
339 | 351 | $wgPopupAnnotationName |
340 | 352 | )); |
341 | 353 | |
— | — | @@ -347,7 +359,9 @@ |
348 | 360 | foreach ($viewInformation->getPropertyToColumnFilters() as $propertyToColumnFilter) { |
349 | 361 | $attribute = $propertyToColumnFilter->getAttribute(); |
350 | 362 | $propertyCaption = $propertyToColumnFilter->getPropertyCaption(); |
351 | | - $result[] = createObjectAttributesEditor($viewInformation, $attribute, $propertyCaption, $idAttribute, $levelName); |
| 363 | + $attributeIDFilter = $propertyToColumnFilter->getAttributeIDFilter(); |
| 364 | + |
| 365 | + $result[] = createObjectAttributesEditor($viewInformation, $attribute, $propertyCaption, $idAttribute, $levelName, $attributeIDFilter); |
352 | 366 | } |
353 | 367 | |
354 | 368 | return $result; |
— | — | @@ -378,17 +392,19 @@ |
379 | 393 | return $editor; |
380 | 394 | } |
381 | 395 | |
382 | | -function addObjectAttributesEditors(Editor $objectAttributesEditor, ViewInformation $viewInformation, ContextFetcher $annotatedObjectIdFetcher, $annotationLevelName) { |
383 | | - $objectAttributesEditor->addEditor(getTextAttributeValuesEditor($viewInformation, new TextAttributeValuesController($annotatedObjectIdFetcher), $annotationLevelName)); |
384 | | - $objectAttributesEditor->addEditor(getTranslatedTextAttributeValuesEditor($viewInformation, new TranslatedTextAttributeValuesController($annotatedObjectIdFetcher, $viewInformation->filterLanguageId), $annotationLevelName)); |
385 | | - $objectAttributesEditor->addEditor(getLinkAttributeValuesEditor($viewInformation, new LinkAttributeValuesController($annotatedObjectIdFetcher), $annotationLevelName)); |
386 | | - $objectAttributesEditor->addEditor(getOptionAttributeValuesEditor($viewInformation, new OptionAttributeValuesController($annotatedObjectIdFetcher), $annotationLevelName)); |
| 396 | +function addObjectAttributesEditors(ObjectAttributeValuesEditor $objectAttributesEditor, ViewInformation $viewInformation, ContextFetcher $annotatedObjectIdFetcher, $annotationLevelName) { |
| 397 | + $attributeIDFilter = $objectAttributesEditor->getAttributeIDfilter(); |
| 398 | + |
| 399 | + $objectAttributesEditor->addEditor(getTextAttributeValuesEditor($viewInformation, new TextAttributeValuesController($annotatedObjectIdFetcher), $annotationLevelName, $attributeIDFilter)); |
| 400 | + $objectAttributesEditor->addEditor(getTranslatedTextAttributeValuesEditor($viewInformation, new TranslatedTextAttributeValuesController($annotatedObjectIdFetcher, $viewInformation->filterLanguageId), $annotationLevelName, $attributeIDFilter)); |
| 401 | + $objectAttributesEditor->addEditor(getLinkAttributeValuesEditor($viewInformation, new LinkAttributeValuesController($annotatedObjectIdFetcher), $annotationLevelName, $attributeIDFilter)); |
| 402 | + $objectAttributesEditor->addEditor(getOptionAttributeValuesEditor($viewInformation, new OptionAttributeValuesController($annotatedObjectIdFetcher), $annotationLevelName, $attributeIDFilter)); |
387 | 403 | } |
388 | 404 | |
389 | | -function createObjectAttributesEditor(ViewInformation $viewInformation, Attribute $attribute, $propertyCaption, Attribute $idAttribute, $levelName) { |
| 405 | +function createObjectAttributesEditor(ViewInformation $viewInformation, Attribute $attribute, $propertyCaption, Attribute $idAttribute, $levelName, AttributeIDFilter $attributeIDFilter) { |
390 | 406 | $o=OmegaWikiAttributes::getInstance(); |
391 | 407 | |
392 | | - $result = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $viewInformation); |
| 408 | + $result = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $viewInformation, $attributeIDFilter); |
393 | 409 | |
394 | 410 | addObjectAttributesEditors( |
395 | 411 | $result, |
— | — | @@ -400,10 +416,10 @@ |
401 | 417 | return $result; |
402 | 418 | } |
403 | 419 | |
404 | | -function createDefinitionObjectAttributesEditor(ViewInformation $viewInformation, Attribute $attribute, $propertyCaption, Attribute $idAttribute, $levelName) { |
| 420 | +function createDefinitionObjectAttributesEditor(ViewInformation $viewInformation, Attribute $attribute, $propertyCaption, Attribute $idAttribute, $levelName, AttributeIDFilter $attributeIDFilter) { |
405 | 421 | $o=OmegaWikiAttributes::getInstance(); |
406 | 422 | |
407 | | - $result = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $viewInformation); |
| 423 | + $result = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $viewInformation, $attributeIDFilter); |
408 | 424 | |
409 | 425 | addObjectAttributesEditors( |
410 | 426 | $result, |
— | — | @@ -491,7 +507,7 @@ |
492 | 508 | addPropertyToColumnFilterEditors($tableEditor, $viewInformation, $o->syntransId, $synTransMeaningName); |
493 | 509 | |
494 | 510 | $tableEditor->addEditor(new PopUpEditor( |
495 | | - createObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->syntransId, $synTransMeaningName), |
| 511 | + createObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->syntransId, $synTransMeaningName, $viewInformation->getLeftOverAttributeFilter()), |
496 | 512 | $wgPopupAnnotationName |
497 | 513 | )); |
498 | 514 | |
— | — | @@ -514,7 +530,7 @@ |
515 | 531 | addPropertyToColumnFilterEditors($editor, $viewInformation, $o->relationId, $relationMeaningName); |
516 | 532 | |
517 | 533 | $editor->addEditor(new PopUpEditor( |
518 | | - createObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->relationId, $relationMeaningName), |
| 534 | + createObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->relationId, $relationMeaningName, $viewInformation->getLeftOverAttributeFilter()), |
519 | 535 | $wgPopupAnnotationName |
520 | 536 | )); |
521 | 537 | |
— | — | @@ -537,7 +553,7 @@ |
538 | 554 | addPropertyToColumnFilterEditors($editor, $viewInformation, $o->relationId, $relationMeaningName); |
539 | 555 | |
540 | 556 | $editor->addEditor(new PopUpEditor( |
541 | | - createObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->relationId, $relationMeaningName), |
| 557 | + createObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->relationId, $relationMeaningName, $viewInformation->getLeftOverAttributeFilter()), |
542 | 558 | $wgPopupAnnotationName |
543 | 559 | )); |
544 | 560 | |
— | — | @@ -604,13 +620,13 @@ |
605 | 621 | $editor->addEditor(new PopUpEditor($columnEditor, $columnEditor->getAttribute()->name)); |
606 | 622 | } |
607 | 623 | |
608 | | -function getTextAttributeValuesEditor(ViewInformation $viewInformation, $controller, $levelDefinedMeaningName) { |
| 624 | +function getTextAttributeValuesEditor(ViewInformation $viewInformation, UpdateController $controller, $levelDefinedMeaningName, AttributeIDFilter $attributeIDFilter) { |
609 | 625 | global |
610 | 626 | $textValueObjectAttributesEditors; |
611 | 627 | |
612 | 628 | $o=OmegaWikiAttributes::getInstance(); |
613 | 629 | |
614 | | - $showEditFieldChecker = new ShowEditFieldForAttributeValuesChecker($levelDefinedMeaningName, "TEXT"); |
| 630 | + $showEditFieldChecker = new ShowEditFieldForAttributeValuesChecker($levelDefinedMeaningName, "TEXT", $attributeIDFilter); |
615 | 631 | |
616 | 632 | $editor = new RecordSetTableEditor($o->textAttributeValues, new SimplePermissionController(true), $showEditFieldChecker, new AllowAddController(true), true, false, $controller); |
617 | 633 | $editor->addEditor(new TextAttributeEditor($o->textAttribute, new SimplePermissionController(false), true, $levelDefinedMeaningName)); |
— | — | @@ -622,13 +638,13 @@ |
623 | 639 | return $editor; |
624 | 640 | } |
625 | 641 | |
626 | | -function getLinkAttributeValuesEditor(ViewInformation $viewInformation, UpdateController $controller, $levelDefinedMeaningName) { |
| 642 | +function getLinkAttributeValuesEditor(ViewInformation $viewInformation, UpdateController $controller, $levelDefinedMeaningName, AttributeIDFilter $attributeIDFilter) { |
627 | 643 | global |
628 | 644 | $linkValueObjectAttributesEditors; |
629 | 645 | |
630 | 646 | $o=OmegaWikiAttributes::getInstance(); |
631 | 647 | |
632 | | - $showEditFieldChecker = new ShowEditFieldForAttributeValuesChecker($levelDefinedMeaningName, "URL"); |
| 648 | + $showEditFieldChecker = new ShowEditFieldForAttributeValuesChecker($levelDefinedMeaningName, "URL", $attributeIDFilter); |
633 | 649 | |
634 | 650 | $editor = new RecordSetTableEditor($o->linkAttributeValues, new SimplePermissionController(true), $showEditFieldChecker, new AllowAddController(true), true, false, $controller); |
635 | 651 | $editor->addEditor(new LinkAttributeEditor($o->linkAttribute, new SimplePermissionController(false), true, $levelDefinedMeaningName)); |
— | — | @@ -649,13 +665,13 @@ |
650 | 666 | return $editor; |
651 | 667 | } |
652 | 668 | |
653 | | -function getTranslatedTextAttributeValuesEditor(ViewInformation $viewInformation, UpdateController $controller, $levelDefinedMeaningName) { |
| 669 | +function getTranslatedTextAttributeValuesEditor(ViewInformation $viewInformation, UpdateController $controller, $levelDefinedMeaningName, AttributeIDFilter $attributeIDFilter) { |
654 | 670 | global |
655 | 671 | $translatedTextValueObjectAttributesEditors; |
656 | 672 | |
657 | 673 | $o=OmegaWikiAttributes::getInstance(); |
658 | 674 | |
659 | | - $showEditFieldChecker = new ShowEditFieldForAttributeValuesChecker($levelDefinedMeaningName, "TRNS"); |
| 675 | + $showEditFieldChecker = new ShowEditFieldForAttributeValuesChecker($levelDefinedMeaningName, "TRNS", $attributeIDFilter); |
660 | 676 | |
661 | 677 | $editor = new RecordSetTableEditor($o->translatedTextAttributeValues, new SimplePermissionController(true), $showEditFieldChecker, new AllowAddController(true), true, false, $controller); |
662 | 678 | $editor->addEditor(new TranslatedTextAttributeEditor($o->translatedTextAttribute, new SimplePermissionController(false), true, $levelDefinedMeaningName)); |
— | — | @@ -672,16 +688,15 @@ |
673 | 689 | return $editor; |
674 | 690 | } |
675 | 691 | |
676 | | -function getOptionAttributeValuesEditor(ViewInformation $viewInformation, UpdateController $controller, $levelDefinedMeaningName) { |
| 692 | +function getOptionAttributeValuesEditor(ViewInformation $viewInformation, UpdateController $controller, $levelDefinedMeaningName, AttributeIDFilter $attributeIDFilter) { |
677 | 693 | global |
678 | 694 | $optionValueObjectAttributesEditors; |
679 | 695 | |
680 | 696 | $o=OmegaWikiAttributes::getInstance(); |
681 | 697 | |
682 | | - $showEditFieldChecker = new ShowEditFieldForAttributeValuesChecker($levelDefinedMeaningName, "OPTN"); |
| 698 | + $showEditFieldChecker = new ShowEditFieldForAttributeValuesChecker($levelDefinedMeaningName, "OPTN", $attributeIDFilter); |
683 | 699 | |
684 | 700 | $editor = new RecordSetTableEditor($o->optionAttributeValues, new SimplePermissionController(true), $showEditFieldChecker, new AllowAddController(true), true, false, $controller); |
685 | | - |
686 | 701 | $editor->addEditor(new OptionAttributeEditor($o->optionAttribute, new SimplePermissionController(false), true, $levelDefinedMeaningName)); |
687 | 702 | $editor->addEditor(new OptionSelectEditor($o->optionAttributeOption, new SimplePermissionController(false), true)); |
688 | 703 | |
— | — | @@ -787,7 +802,7 @@ |
788 | 803 | $o->possibleSynonym, |
789 | 804 | $viewInformation->possiblySynonymousRelationTypeId, |
790 | 805 | $viewInformation, |
791 | | - createObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->possiblySynonymousId, $relationMeaningName) |
| 806 | + createObjectAttributesEditor($viewInformation, $o->objectAttributes, $wgPropertyAttributeName, $o->possiblySynonymousId, $relationMeaningName, $viewInformation->getLeftOverAttributeFilter()) |
792 | 807 | ); |
793 | 808 | |
794 | 809 | $availableEditors = new AttributeEditorMap(); |
— | — | @@ -803,7 +818,7 @@ |
804 | 819 | foreach (createPropertyToColumnFilterEditors($viewInformation, $o->definedMeaningId, $definedMeaningMeaningName) as $propertyToColumnEditor) |
805 | 820 | $availableEditors->addEditor($propertyToColumnEditor); |
806 | 821 | |
807 | | - $availableEditors->addEditor(createObjectAttributesEditor($viewInformation, $o->definedMeaningAttributes, $wgPropertyAttributeName, $o->definedMeaningId, $definedMeaningMeaningName)); |
| 822 | + $availableEditors->addEditor(createObjectAttributesEditor($viewInformation, $o->definedMeaningAttributes, $wgPropertyAttributeName, $o->definedMeaningId, $definedMeaningMeaningName, $viewInformation->getLeftOverAttributeFilter())); |
808 | 823 | |
809 | 824 | if ($viewInformation->possiblySynonymousRelationTypeId != 0) |
810 | 825 | $availableEditors->addEditor($possiblySynonymousEditor); |
Index: trunk/extensions/Wikidata/OmegaWiki/ViewInformation.php |
— | — | @@ -44,6 +44,15 @@ |
45 | 45 | public function getPropertyToColumnFilters() { |
46 | 46 | return $this->propertyToColumnFilters; |
47 | 47 | } |
| 48 | + |
| 49 | + public function getLeftOverAttributeFilter() { |
| 50 | + $allFilteredAttributeIds = array(); |
| 51 | + |
| 52 | + foreach ($this->getPropertyToColumnFilters() as $propertyToColumnFilter) |
| 53 | + $allFilteredAttributeIds = array_merge($allFilteredAttributeIds, $propertyToColumnFilter->attributeIDs); |
| 54 | + |
| 55 | + return new ExcludeAttributeIDsFilter($allFilteredAttributeIds); |
| 56 | + } |
48 | 57 | |
49 | 58 | /* make an attempt at a hashCode function. |
50 | 59 | * note that this function is imperfect..., I've left out |
Index: trunk/extensions/Wikidata/OmegaWiki/Editor.php |
— | — | @@ -1347,6 +1347,7 @@ |
1348 | 1348 | $parameters = array( |
1349 | 1349 | "level" => $this->attributesLevelName, |
1350 | 1350 | "definedMeaningId" => $idPath->getDefinedMeaningId(), |
| 1351 | + "annotationAttributeId" => $idPath->getAnnotationAttribute()->getId(), |
1351 | 1352 | "onUpdate" => 'updateSelectOptions(\'' . $this->addId($idPath->getId()) . '-option\',' . $syntransId |
1352 | 1353 | ); |
1353 | 1354 | return getSuggest($this->addId($idPath->getId()), $this->suggestType(), $parameters); |