Index: trunk/extensions/Push/Push.i18n.php |
— | — | @@ -18,6 +18,7 @@ |
19 | 19 | 'push-desc' => 'Lightweight extension to push content to other wiki\'s', |
20 | 20 | 'push-tab-text' => 'Push', |
21 | 21 | 'push-button-text' => 'Push', |
| 22 | + 'push-button-desc' => 'This tab allows you to push the current revision of this page to one or more other wiki\'s.', |
22 | 23 | 'push-button-pushing' => 'Pushing', |
23 | 24 | 'push-button-completed' => 'Push completed', |
24 | 25 | 'push-button-failed' => 'Push failed', |
Index: trunk/extensions/Push/Push.php |
— | — | @@ -49,10 +49,7 @@ |
50 | 50 | $wgHooks['SkinTemplateNavigation'][] = 'PushTab::displayTab2'; |
51 | 51 | |
52 | 52 | $wgAvailableRights[] = 'push'; |
53 | | -$wgGroupPermissions['*']['push'] = true; |
54 | | - |
55 | 53 | $wgAvailableRights[] = 'pushadmin'; |
56 | | -$wgGroupPermissions['sysop']['pushadmin'] = true; |
57 | 54 | |
58 | 55 | $egPushJSMessages = array( |
59 | 56 | 'push-button-pushing', |
— | — | @@ -77,8 +74,8 @@ |
78 | 75 | ); |
79 | 76 | } |
80 | 77 | |
81 | | -function efPushAddJSLocalisation( $parser = false ) { |
82 | | - global $egPushJSMessages; |
| 78 | +function efPushAddJSLocalisation() { |
| 79 | + global $egPushJSMessages, $wgOut; |
83 | 80 | |
84 | 81 | $data = array(); |
85 | 82 | |
— | — | @@ -86,14 +83,7 @@ |
87 | 84 | $data[$msg] = wfMsgNoTrans( $msg ); |
88 | 85 | } |
89 | 86 | |
90 | | - $js = 'var wgPushMessages = ' . json_encode( $data ) . ';'; |
91 | | - |
92 | | - if ( $parser ) { |
93 | | - $parser->getOutput()->addHeadItem( Html::inlineScript( $js ) ); |
94 | | - } else { |
95 | | - global $wgOut; |
96 | | - $wgOut->addInlineScript( $js ); |
97 | | - } |
| 87 | + $wgOut->addInlineScript( 'var wgPushMessages = ' . json_encode( $data ) . ';' ); |
98 | 88 | } |
99 | 89 | |
100 | 90 | require_once 'Push_Settings.php'; |
Index: trunk/extensions/Push/Push_Settings.php |
— | — | @@ -19,3 +19,6 @@ |
20 | 20 | } |
21 | 21 | |
22 | 22 | $egPushTargets = array(); |
| 23 | + |
| 24 | +$wgGroupPermissions['*']['push'] = true; |
| 25 | +$wgGroupPermissions['sysop']['pushadmin'] = true; |
Index: trunk/extensions/Push/includes/Push_Tab.php |
— | — | @@ -17,8 +17,14 @@ |
18 | 18 | * Adds an "action" (i.e., a tab) to allow pushing the current article. |
19 | 19 | */ |
20 | 20 | public static function displayTab( $obj, &$content_actions ) { |
21 | | - // Make sure that this is not a special page and that the page exists. |
22 | | - if ( isset( $obj->mTitle ) && $obj->mTitle->getNamespace() != NS_SPECIAL && $obj->mTitle->exists() ) { |
| 21 | + global $wgUser; |
| 22 | + |
| 23 | + // Make sure that this is not a special page, the page has contents, and the user can push. |
| 24 | + if (isset( $obj->mTitle ) |
| 25 | + && $obj->mTitle->getNamespace() != NS_SPECIAL |
| 26 | + && $obj->mTitle->exists() |
| 27 | + && $wgUser->isAllowed( 'push' ) ) { |
| 28 | + |
23 | 29 | global $wgRequest; |
24 | 30 | |
25 | 31 | $content_actions['push'] = array( |
— | — | @@ -97,18 +103,23 @@ |
98 | 104 | public static function displayPushPage( Article $article ) { |
99 | 105 | global $wgOut, $wgUser, $wgTitle, $wgSitename; |
100 | 106 | |
| 107 | + if ( !$wgUser->isAllowed( 'push' ) ) { |
| 108 | + $wgOut->permissionRequired( 'push' ); |
| 109 | + return false; |
| 110 | + } |
| 111 | + |
| 112 | + self::loadJs(); |
| 113 | + |
101 | 114 | $wgOut->setPageTitle( wfMsgExt( 'push-tab-title', 'parsemag', $article->getTitle()->getText() ) ); |
102 | 115 | |
103 | | - self::loadJs(); |
| 116 | + $wgOut->addHTML( '<p>' . htmlspecialchars( wfMsg( 'push-button-desc' ) ) . '</p>' ); |
104 | 117 | |
105 | 118 | $wgOut->addHTML( |
106 | 119 | Html::hidden( 'pageName', $wgTitle->getFullText(), array( 'id' => 'pageName' ) ) . |
107 | 120 | Html::hidden( 'siteName', $wgSitename, array( 'id' => 'siteName' ) ) |
108 | 121 | ); |
109 | 122 | |
110 | | - if ( $wgUser->isAllowed( 'push' ) ) { |
111 | | - self::displayPushList(); |
112 | | - } |
| 123 | + self::displayPushList(); |
113 | 124 | |
114 | 125 | if ( $wgUser->isAllowed( 'pushadmin' ) ) { |
115 | 126 | // TODO |
— | — | @@ -192,6 +203,15 @@ |
193 | 204 | } |
194 | 205 | |
195 | 206 | /** |
| 207 | + * Displays several configuration options for the push operations. |
| 208 | + * |
| 209 | + * @since 0.1 |
| 210 | + */ |
| 211 | + protected static function displayPushOptions() { |
| 212 | + global $wgOut; |
| 213 | + } |
| 214 | + |
| 215 | + /** |
196 | 216 | * Displays a form via which a new psuh item can be added. |
197 | 217 | * |
198 | 218 | * @since 0.1 |