function view() { global $wgOut, $wgTitle; parent::view(); $spelling = $wgTitle->getText(); $wgOut->addHTML( '<h1>Words matching <i>' . $spelling . '</i> and associated meanings</h1>' ); $wgOut->addHTML( '<p>Showing only a maximum of 100 matches.</p>' ); $wgOut->addHTML( $this->searchText( $spelling ) ); }
public function view() { global $wgOut, $wgTitle; parent::view(); $this->outputViewHeader(); $spelling = $wgTitle->getText(); $recordset = getExpressionsRecordSet( $spelling, $this->viewInformation ); $wgOut->addHTML( getExpressionsEditor( $spelling, $this->viewInformation )->view( $this->getIdStack(), $recordset ) ); $this->outputViewFooter(); }
public function view() { global $wgOut, $wgTitle, $wgRequest, $wdCurrentContext; // Split title into defining expression and ID $titleText = $wgTitle->getText(); $dmInfo = DefinedMeaningModel::splitTitleText( $titleText ); // Title doesn't have an ID in it (or ID 0) if ( is_null( $dmInfo ) || !$dmInfo["id"] ) { $wgOut->showErrorPage( 'errorpagetitle', 'ow_dm_badtitle' ); return false; } parent::view(); $definedMeaningModel = new DefinedMeaningModel( $dmInfo["id"], $this->viewInformation ); $this->definedMeaningModel = $definedMeaningModel; # TODO if I wasn't so sleepy I'd make this consistent $copyTo = $wgRequest->getText( 'CopyTo' ); if ( $copyTo ) { $definedMeaningModel->copyTo( $copyTo ); } if ( !empty( $dmInfo["expression"] ) ) { $definedMeaningModel->setDefiningExpression( $dmInfo["expression"] ); } // Search for this DM in all data-sets, beginning with the current one. // Switch dataset context if found elsewhere. $match = $definedMeaningModel->checkExistence( true, true ); // The defining expression is likely incorrect for some reason. Let's just // try looking up the number. if ( is_null( $match ) && !empty( $dmInfo["expression"] ) ) { $definedMeaningModel->setDefiningExpression( null ); $dmInfo["expression"] = null; $match = $definedMeaningModel->checkExistence( true, true ); } // The defining expression is either bad or missing. Let's redirect // to the correct URL. if ( empty( $dmInfo["expression"] ) && !is_null( $match ) ) { $definedMeaningModel->loadRecord(); $title = Title::newFromText( $definedMeaningModel->getWikiTitle() ); $url = $title->getFullURL(); $wgOut->disable(); header( "Location: $url" ); return false; } // Bad defining expression AND bad ID! :-( if ( is_null( $match ) ) { $wgOut->showErrorPage( 'errorpagetitle', 'ow_dm_missing' ); return false; } $definedMeaningModel->loadRecord(); $this->showDataSetPanel = false; # Raw mode $view_as = $wgRequest->getText( 'view_as' ); if ( $view_as == "raw" ) { $wgOut->addHTML( "<pre>" . $definedMeaningModel->getRecord() . "</pre>" ); # $wgOut->disable(); return; } $this->outputViewHeader(); // concept panel is annoying and useless // $wgOut->addHTML( $this->getConceptPanel() ); $editor = getDefinedMeaningEditor( $this->viewInformation ); $idStack = $this->getIdStack( $definedMeaningModel->getId() ); $html = $editor->view( $idStack, $definedMeaningModel->getRecord() ); $wgOut->addHTML( $html ); $this->outputViewFooter(); }