function getExpressionMeaningsEditor( Attribute $attribute, $allowAdd, ViewInformation $viewInformation ) { $o = OmegaWikiAttributes::getInstance(); $definedMeaningEditor = getDefinedMeaningEditor( $viewInformation ); $definedMeaningCaptionEditor = new DefinedMeaningHeaderEditor( $o->definedMeaningId, new SimplePermissionController( false ), false, 75 ); $definedMeaningCaptionEditor->setAddText( wfMsg( 'ow_NewExactMeaning' ) ); $expressionMeaningsEditor = new RecordSetListEditor( $attribute, new SimplePermissionController( true ), new ShowEditFieldChecker( true ), new AllowAddController( $allowAdd ), false, $allowAdd, new ExpressionMeaningController( $viewInformation->filterLanguageId ), 3, false ); $expressionMeaningsEditor->setCaptionEditor( $definedMeaningCaptionEditor ); $expressionMeaningsEditor->setValueEditor( $definedMeaningEditor ); return $expressionMeaningsEditor; }
protected function save( $referenceQueryTransactionInformation ) { global $wgTitle; parent::save( $referenceQueryTransactionInformation ); $definedMeaningId = $this->getDefinedMeaningIdFromTitle( $wgTitle->getText() ); $dmModel = new DefinedMeaningModel( $definedMeaningId, $this->viewInformation ); $definedMeaningId = $this->getDefinedMeaningIdFromTitle( $wgTitle->getText() ); getDefinedMeaningEditor( $this->viewInformation )->save( $this->getIdStack( $definedMeaningId ), $dmModel->getRecord() ); }
/** * FIXME - work in progress * */ public function save() { initializeOmegaWikiAttributes( $this->viewInformation ); initializeObjectAttributeEditors( $this->viewInformation ); # Nice try sherlock, but we really need to get our DMID from elsewhere # $definedMeaningId = $this->getId(); # Need 3 steps: copy defining expression, create new dm, then update $expression = $this->dupDefiningExpression(); var_dump( $expression ); # to make the expression really work, we may need to call # more here? $expression->createNewInDatabase(); # shouldn't this stuff be protected? $expressionId = $expression->id; $languageId = $expression->languageId; $this->hackDC(); // XXX $text = $this->getDefiningExpression(); $this->unhackDC(); // XXX # here we assume the DM is not there yet.. not entirely wise # in the long run. echo "id: $expressionId lang: $languageId"; $newDefinedMeaningId = createNewDefinedMeaning( $expressionId, $languageId, $text ); getDefinedMeaningEditor( $this->viewInformation )->save( $this->getIdStack( $newDefinedMeaningId ), $this->getRecord() ); return $newDefinedMeaningId; }