r77961 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77960‎ | r77961 | r77962 >
Date:07:52, 7 December 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Added AdminLinks hook, removed not needed code and added special page stub
Modified paths:
  • /trunk/extensions/Push/Push.hooks.php (modified) (history)
  • /trunk/extensions/Push/Push.i18n.php (modified) (history)
  • /trunk/extensions/Push/Push.php (modified) (history)
  • /trunk/extensions/Push/includes/Push_Tab.php (modified) (history)
  • /trunk/extensions/Push/specials/Push_Body.php (added) (history)

Diff [purge]

Index: trunk/extensions/Push/Push.i18n.php
@@ -16,6 +16,8 @@
1717 */
1818 $messages['en'] = array(
1919 'push-desc' => 'Lightweight extension to push content to other wikis',
 20+
 21+ // Tab
2022 'push-tab-text' => 'Push',
2123 'push-button-text' => 'Push',
2224 'push-button-desc' => 'This tab allows you to push the current revision of this page to one or more other wikis.',
@@ -27,4 +29,7 @@
2830 'push-add-target' => 'Add target',
2931 'push-import-revision-message' => 'Import from $1 by $2.$3', // $3 is 'push-import-revision-comment' or empty. 1360!
3032 'push-import-revision-comment' => ' Last comment: $1',
 33+
 34+ // Special page
 35+ 'special-push' => 'Push',
3136 );
\ No newline at end of file
Index: trunk/extensions/Push/specials/Push_Body.php
@@ -0,0 +1,49 @@
 2+<?php
 3+
 4+/**
 5+ * A special page that allows pushing one or more pages to one or more targets.
 6+ *
 7+ * @since 0.1
 8+ *
 9+ * @author Jeroen De Dauw
 10+ */
 11+class SpecialPush extends SpecialPage {
 12+
 13+ /**
 14+ * Constructor.
 15+ *
 16+ * @since 0.1
 17+ */
 18+ public function __construct() {
 19+ parent::__construct( 'Push', 'push' );
 20+ }
 21+
 22+ /**
 23+ * @see SpecialPage::getDescription
 24+ */
 25+ public function getDescription() {
 26+ return wfMsg( 'special-' . strtolower( $this->mName ) );
 27+ }
 28+
 29+ /**
 30+ * Main method.
 31+ *
 32+ * @since 0.1
 33+ *
 34+ * @param string $arg
 35+ */
 36+ public function execute( $arg ) {
 37+ global $wgOut, $wgUser;
 38+
 39+ $wgOut->setPageTitle( wfMsg( 'special-push' ) );
 40+
 41+ // If the user is authorized, display the page, if not, show an error.
 42+ if ( !$this->userCanExecute( $wgUser ) ) {
 43+ $this->displayRestrictionError();
 44+ return;
 45+ }
 46+
 47+ // TODO
 48+ }
 49+
 50+}
\ No newline at end of file
Property changes on: trunk/extensions/Push/specials/Push_Body.php
___________________________________________________________________
Added: svn:eol-style
151 + native
Index: trunk/extensions/Push/Push.php
@@ -42,12 +42,19 @@
4343
4444 $wgExtensionMessagesFiles['Push'] = dirname( __FILE__ ) . '/Push.i18n.php';
4545
 46+$wgAutoloadClasses['PushHooks'] = dirname( __FILE__ ) . '/Push.hooks.php';
4647 $wgAutoloadClasses['PushTab'] = dirname( __FILE__ ) . '/includes/Push_Tab.php';
 48+$wgAutoloadClasses['SpecialPush'] = dirname( __FILE__ ) . '/specials/Push_Body.php';
4749
 50+$wgSpecialPages['Push'] = 'SpecialPush';
 51+$wgSpecialPageGroups['Push'] = 'pagetools';
 52+
4853 $wgHooks['UnknownAction'][] = 'PushTab::onUnknownAction';
4954 $wgHooks['SkinTemplateTabs'][] = 'PushTab::displayTab';
5055 $wgHooks['SkinTemplateNavigation'][] = 'PushTab::displayTab2';
5156
 57+$wgHooks['AdminLinks'][] = 'PushHooks::addToAdminLinks';
 58+
5259 $wgAvailableRights[] = 'push';
5360 $wgAvailableRights[] = 'pushadmin';
5461
Index: trunk/extensions/Push/includes/Push_Tab.php
@@ -203,18 +203,9 @@
204204 }
205205
206206 /**
207 - * Displays several configuration options for the push operations.
 207+ * Displays a form via which a new push item can be added.
208208 *
209209 * @since 0.1
210 - */
211 - protected static function displayPushOptions() {
212 - global $wgOut;
213 - }
214 -
215 - /**
216 - * Displays a form via which a new psuh item can be added.
217 - *
218 - * @since 0.1
219210 */
220211 protected static function displayNewPushItem() {
221212 global $wgOut;
Index: trunk/extensions/Push/Push.hooks.php
@@ -12,6 +12,24 @@
1313 */
1414 final class PushHooks {
1515
 16+ /**
 17+ * Adds a link to Admin Links page.
 18+ *
 19+ * @since 0.1
 20+ *
 21+ * @return true
 22+ */
 23+ public static function addToAdminLinks( &$admin_links_tree ) {
 24+ $displaying_data_section = $admin_links_tree->getSection( wfMsg( 'smw_adminlinks_displayingdata' ) );
1625
 26+ // Escape if SMW hasn't added links.
 27+ if ( is_null( $displaying_data_section ) ) return true;
 28+ $smw_docu_row = $displaying_data_section->getRow( 'smw' );
1729
 30+ $maps_docu_label = wfMsg( 'adminlinks_documentation', wfMsg( 'maps_name' ) );
 31+ $smw_docu_row->addItem( AlItem::newFromExternalLink( 'http://mapping.referata.com/wiki/Maps', $maps_docu_label ) );
 32+
 33+ return true;
 34+ }
 35+
1836 }
\ No newline at end of file

Follow-up revisions

RevisionCommit summaryAuthorDate
r77962Follow up to r77961 - apperently modified code in the wrong extension >_>jeroendedauw08:04, 7 December 2010

Status & tagging log