function execute( $par ) { global $wgOut, $wgUser, $wgRequest; $wgOut->setPageTitle( 'Add Collection' ); if ( !$wgUser->isAllowed( 'addcollection' ) ) { $wgOut->addHTML( 'You do not have permission to add a collection.' ); return false; } $dbr = wfGetDB( DB_MASTER ); if ( $wgRequest->getText( 'collection' ) ) { require_once( 'WikiDataAPI.php' ); require_once( 'Transaction.php' ); $dc = $wgRequest->getText( 'dataset' ); $collectionName = $wgRequest->getText( 'collection' ); startNewTransaction( $wgUser->getID(), wfGetIP(), 'Add collection ' . $collectionName ); bootstrapCollection( $collectionName, $wgRequest->getText( 'language' ), $wgRequest->getText( 'type' ), $dc ); $wgOut->addHTML( wfMsg( 'ow_collection_added', $collectionName ) . "<br />" ); } $datasets = wdGetDatasets(); $datasetarray[''] = wfMsgSc( "none_selected" ); foreach ( $datasets as $datasetid => $dataset ) { $datasetarray[$datasetid] = $dataset->fetchName(); } $wgOut->addHTML( getOptionPanel( array( 'Collection name:' => getTextBox( 'collection' ), 'Language of name:' => getSuggest( 'language', 'language' ), 'Collection type:' => getSelect( 'type', array( '' => 'None', 'RELT' => 'RELT', 'LEVL' => 'LEVL', 'CLAS' => 'CLAS', 'MAPP' => 'MAPP' ) ), 'Dataset:' => getSelect( 'dataset', $datasetarray ) ), '', array( 'create' => wfMsg( 'ow_create' ) ) ) ); }
/** * FIXME: This does not seem to do anything, need to check whether the * preferences are still being detected. */ public static function onGetPreferences( $user, &$preferences ) { $datasets = wdGetDatasets(); foreach ( $datasets as $datasetid => $dataset ) { $datasetarray[$dataset->fetchName()] = $datasetid; } $preferences['ow_uipref_datasets'] = array( 'type' => 'multiselect', 'options' => $datasetarray, 'section' => 'omegawiki', 'label' => wfMsg( 'ow_shown_datasets' ), 'prefix' => 'ow_datasets-', ); return true; }
/** links to futt bugly alternate copy mechanism, the * latter being something that actually is somewhat * understandable (though not yet refactored into * something purdy and maintainable) */ protected function getCopyPanel2() { global $wgScriptPath, $wgCommunity_dc; $html = "Copy to:<br />\n"; $datasets = wdGetDatasets(); $dataset = $datasets[$wgCommunity_dc]; $dmid = $this->definedMeaningModel->getId(); $dc1 = $this->definedMeaningModel->getDataSet(); $name = $dataset->fetchName(); $dc2 = $wgCommunity_dc; $html .= "<a href='index.php?title=Special:Copy&action=copy&dmid=$dmid&dc1=$dc1&dc2=$dc2'>$name</a><br />\n"; return $html; }