https://www.mediawiki.org/wiki/Special:Code/MediaWiki/115782
Revision: 115782 Author: kipcool Date: 2012-11-25 17:22:45 +0000 (Sun, 25 Nov 2012) Log Message: ----------- removed some unused functions Modified Paths: -------------- trunk/extensions/Wikidata/App.php trunk/extensions/Wikidata/Wikidata.hooks.php Modified: trunk/extensions/Wikidata/App.php =================================================================== --- trunk/extensions/Wikidata/App.php 2012-11-25 17:21:37 UTC (rev 115781) +++ trunk/extensions/Wikidata/App.php 2012-11-25 17:22:45 UTC (rev 115782) @@ -46,11 +46,6 @@ 'styles' => array( 'OmegaWiki/resources/suggest.css', 'OmegaWiki/resources/tables.css' ) ); -$wgResourceModules['ext.Wikidata.rtl'] = $resourcePathArray + array( - 'scripts' => 'OmegaWiki/resources/omegawiki-ajax.js', - 'styles' => array( 'OmegaWiki/resources/suggest-rtl.css', 'OmegaWiki/resources/tables-rtl.css' ) -); - $wgResourceModules['ext.Wikidata.edit'] = $resourcePathArray + array( 'scripts' => 'OmegaWiki/resources/omegawiki-edit.js' ); @@ -178,7 +173,6 @@ $wgSpecialPages['ow_statistics'] = 'SpecialOWStatistics'; $wgHooks['BeforePageDisplay'][] = 'WikidataHooks::onBeforePageDisplay'; -$wgHooks['SkinTemplateTabs'][] = 'WikidataHooks::onSkinTemplateTabs'; $wgHooks['GetPreferences'][] = 'WikidataHooks::onGetPreferences'; $wgHooks['ArticleFromTitle'][] = 'WikidataHooks::onArticleFromTitle'; $wgHooks['CustomEditor'][] = 'WikidataHooks::onCustomEditor'; Modified: trunk/extensions/Wikidata/Wikidata.hooks.php =================================================================== --- trunk/extensions/Wikidata/Wikidata.hooks.php 2012-11-25 17:21:37 UTC (rev 115781) +++ trunk/extensions/Wikidata/Wikidata.hooks.php 2012-11-25 17:22:45 UTC (rev 115782) @@ -5,12 +5,8 @@ public static function onBeforePageDisplay( $out, $skin ) { global $wgLang, $wgScriptPath, $wgRequest, $wgResourceModules; - if ( $wgLang->isRTL() ) { - $out->addModules( 'ext.Wikidata.rtl' ); - } else { - $out->addModules( 'ext.Wikidata' ); - } - + $out->addModules( 'ext.Wikidata' ); + if ( $wgRequest->getText( 'action' )=='edit' ) { $out->addModules( 'ext.Wikidata.edit' ); $out->addModules( 'ext.Wikidata.suggest' ); @@ -28,67 +24,6 @@ } /** - * Purpose: Add custom tabs - * - * When editing in read-only data-set, if you have the copy permission, you can - * make a copy into the designated community dataset and edit the data there. - * This is accessible through an 'edit copy' tab which is added below. - * - * @param $skin Skin as passed by MW - * @param $tabs as passed by MW - */ - public static function onSkinTemplateTabs( $skin, $content_actions ) { - global $wgUser, $wgCommunity_dc, $wdShowEditCopy, $wdHandlerClasses; - - $title = $skin->getTitle(); - - if ( !self::isWikidataNs( $title ) ) { - return true; - } - - $ns = $title->getNamespace(); - $editChanged = false; - $dc = wdGetDataSetContext(); - - if ( $wdHandlerClasses[ $ns ] == 'DefinedMeaning' ) { - - # Hackishly determine which DMID we're on by looking at the page title component - $tt = $title->getText(); - $rpos1 = strrpos( $tt, '(' ); - $rpos2 = strrpos( $tt, ')' ); - $dmid = ( $rpos1 && $rpos2 ) ? substr( $tt, $rpos1 + 1, $rpos2 - $rpos1 - 1 ) : 0; - if ( $dmid ) { - $copyTitle = SpecialPage::getTitleFor( 'Copy' ); - if ( $dc != $wgCommunity_dc && $wdShowEditCopy ) { - $editChanged = true; - $content_actions['edit'] = array( - 'class' => false, - 'text' => wfMsg( 'ow_nstab_edit_copy' ), - 'href' => $copyTitle->getLocalUrl( "action=copy&dmid=$dmid&dc1=$dc&dc2=$wgCommunity_dc" ) - ); - } - $content_actions['nstab-definedmeaning'] = array( - 'class' => 'selected', - 'text' => wfMsg( 'ow_nstab_definedmeaning' ), - 'href' => $title->getLocalUrl( "dataset=$dc" ) - ); - } - } - - // Prevent move tab being shown. - unset( $content_actions['move'] ); - - // Add context dataset (old hooks 'GetEditLinkTrail' and 'GetHistoryLinkTrail') - if ( !$editChanged && $content_actions['edit'] != null ) { - $content_actions['edit']['href'] = wfAppendQuery( $content_actions['edit']['href'], "dataset=$dc" ); - } - - $content_actions['history']['href'] = wfAppendQuery( $content_actions['history']['href'], "dataset=$dc" ); - - return true; - } - - /** * FIXME: This does not seem to do anything, need to check whether the * preferences are still being detected. */ _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits