r111064 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111063‎ | r111064 | r111065 >
Date:19:00, 9 February 2012
Author:kipcool
Status:deferred
Tags:
Comment:
Allow removing incoming relations directly.
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/Controller.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/OmegaWikiEditors.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/Controller.php
@@ -584,6 +584,13 @@
585585 }
586586 }
587587
 588+class IncomingRelationsController extends DefaultUpdateController {
 589+ public function remove( $keyPath ) {
 590+ $valueId = $keyPath->peek( 0 )->relationId;
 591+ removeRelationWithId( $valueId );
 592+ }
 593+}
 594+
588595 class AlternativeDefinitionsPermissionController implements PermissionController {
589596 public function allowUpdateOfAttribute( $attribute ) {
590597 return true;
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiEditors.php
@@ -582,12 +582,19 @@
583583 }
584584
585585 function getDefinedMeaningReciprocalRelationsEditor( ViewInformation $viewInformation ) {
586 - global
587 - $relationsObjectAttributesEditor, $relationMeaningName;
 586+ global $relationsObjectAttributesEditor, $relationMeaningName;
588587
589588 $o = OmegaWikiAttributes::getInstance();
590589
591 - $editor = new RecordSetTableEditor( $o->reciprocalRelations, new SimplePermissionController( false ), new ShowEditFieldChecker( true ), new AllowAddController( false ), false, false, null );
 590+ $permissionController = new SimplePermissionController( true );
 591+ $showEditFieldChecker = new ShowEditFieldChecker( true );
 592+ $allowAddController = new AllowAddController( false );
 593+ $allowRemove = true;
 594+ $isAddField = false;
 595+ $updateController = new IncomingRelationsController() ;
 596+
 597+ $editor = new RecordSetTableEditor( $o->reciprocalRelations, $permissionController, $showEditFieldChecker, $allowAddController, $allowRemove, $isAddField, $updateController );
 598+
592599 $editor->addEditor( new DefinedMeaningReferenceEditor( $o->otherDefinedMeaning, new SimplePermissionController( false ), true ) );
593600 $editor->addEditor( new RelationTypeReferenceEditor( $o->relationType, new SimplePermissionController( false ), true ) );
594601
@@ -606,7 +613,8 @@
607614 function getDefinedMeaningClassMembershipEditor( ViewInformation $viewInformation ) {
608615 $o = OmegaWikiAttributes::getInstance();
609616
610 - $editor = new RecordSetTableEditor( $o->classMembership, new SimplePermissionController( true ), new ShowEditFieldChecker( true ), new AllowAddController( true ), true, false, new DefinedMeaningClassMembershipController() );
 617+ $allowRemove = true;
 618+ $editor = new RecordSetTableEditor( $o->classMembership, new SimplePermissionController( true ), new ShowEditFieldChecker( true ), new AllowAddController( true ), $allowRemove, false, new DefinedMeaningClassMembershipController() );
611619 $editor->addEditor( new ClassReferenceEditor( $o->class, new SimplePermissionController( false ), true ) );
612620
613621 addTableMetadataEditors( $editor, $viewInformation );

Status & tagging log