Index: trunk/extensions/Poll/Poll_body.php |
— | — | @@ -15,5 +15,48 @@ |
16 | 16 | $action = htmlentities( $wgRequest->getText( 'action' ) ); |
17 | 17 | $id = htmlentities( $wgRequest->getText( 'id' ) ); |
18 | 18 | |
| 19 | + if($action == "create") { |
| 20 | + $this->create(); |
| 21 | + } |
| 22 | + |
| 23 | + if($action == "vote") { |
| 24 | + $this->vote(); |
| 25 | + } |
19 | 26 | } |
| 27 | + |
| 28 | + public function create() { |
| 29 | + global $wgRequest, $wgOut, $wgUser; |
| 30 | + |
| 31 | + $wgOut->setPagetitle( wfMsg( 'poll-title-create' ) ); |
| 32 | + |
| 33 | + $controll_create_right = $wgUser->isAllowed('poll-create'); |
| 34 | + $controll_create_blocked = $wgUser->isBlocked(); |
| 35 | + if( $controll_create_right != true ) { |
| 36 | + $wgOut->addWikiMsg( 'poll-create-right-error' ); |
| 37 | + } |
| 38 | + elseif( $controll_create_blocked == true ) { |
| 39 | + $wgOut->addWikiMsg( 'poll-create-block-error' ); |
| 40 | + } |
| 41 | + else { |
| 42 | + |
| 43 | + } |
| 44 | + } |
| 45 | + |
| 46 | + public function vote() { |
| 47 | + global $wgRequest, $wgOut, $wgUser; |
| 48 | + |
| 49 | + $wgOut->setPagetitle( wfMsg( 'poll-title-vote' ) ); |
| 50 | + |
| 51 | + $controll_create_right = $wgUser->isAllowed('poll-vote'); |
| 52 | + $controll_create_blocked = $wgUser->isBlocked(); |
| 53 | + if( $controll_create_right != true ) { |
| 54 | + $wgOut->addWikiMsg( 'poll-vote-right-error' ); |
| 55 | + } |
| 56 | + elseif( $controll_create_blocked == true ) { |
| 57 | + $wgOut->addWikiMsg( 'poll-vote-block-error' ); |
| 58 | + } |
| 59 | + else { |
| 60 | + |
| 61 | + } |
| 62 | + } |
20 | 63 | } |
Index: trunk/extensions/Poll/Poll.i18n.php |
— | — | @@ -8,12 +8,27 @@ |
9 | 9 | |
10 | 10 | $messages = array(); |
11 | 11 | |
| 12 | + |
12 | 13 | $messages['en'] = array( |
13 | 14 | 'poll' => 'Polls', |
14 | 15 | 'poll-desc' => 'Add a [[Special:Poll|special page]] for using polls', |
| 16 | + 'poll-title-create' => 'Create a new poll', |
| 17 | + 'poll-title-vote' => 'Voting page', |
| 18 | + 'poll-title-score' => 'Score', |
| 19 | + 'poll-create-right-error' => 'You are not allowed to create a new poll(needed right: poll-create)', |
| 20 | + 'poll-create-block-error' => 'You are not allowed to create a new poll because you use a blocked user', |
| 21 | + 'poll-vote-right-error' => 'You are not allowed to vote(needed right: poll-vote)', |
| 22 | + 'poll-vote-block-error' => 'You are not allowed to vote because you use a blocked user', |
15 | 23 | ); |
16 | 24 | |
17 | 25 | $messages['de'] = array( |
18 | 26 | 'poll' => 'Umfragen', |
19 | 27 | 'poll-desc' => 'Erstellt eine [[Special:Poll|Spezialsite]], um Umfragen zu nutzen', |
| 28 | + 'poll-title-create' => 'Eine neue Umfrage erstellen', |
| 29 | + 'poll-title-vote' => 'Abstimmen', |
| 30 | + 'poll-title-score' => 'Auswertung', |
| 31 | + 'poll-create-right-error' => 'Leider darfst du keine neue Umfrage erstellen(ben�tige Gruppenberechttigung: poll-create)', |
| 32 | + 'poll-create-block-error' => 'Leider darfst du keine neue Umfrage erstellen, weil du einen gesperten Benutzer benutzt', |
| 33 | + 'poll-vote-right-error' => 'Leider darfst du nicht abstimmen(ben�tige Gruppenberechttigung: poll-vote)', |
| 34 | + 'poll-vote-block-error' => 'Leider darfst du nicht abstimmen, weil du einen gesperten Benutzer benutzt', |
20 | 35 | ); |
Index: trunk/extensions/Poll/Poll.php |
— | — | @@ -33,6 +33,21 @@ |
34 | 34 | 'descriptionmsg' => 'poll-desc' |
35 | 35 | ); |
36 | 36 | |
| 37 | +// New right: poll-admin |
| 38 | +$wgGroupPermissions['sysop']['poll-admin'] = true; |
| 39 | +$wgGroupPermissions['*']['poll-admin'] = false; |
| 40 | +$wgAvailableRights[] = 'poll-admin'; |
| 41 | + |
| 42 | +// New right: poll-create |
| 43 | +$wgGroupPermissions['autoconfirmed']['poll-create'] = true; |
| 44 | +$wgGroupPermissions['*']['poll-create'] = false; |
| 45 | +$wgAvailableRights[] = 'poll-create'; |
| 46 | + |
| 47 | +// New right: poll-create |
| 48 | +$wgGroupPermissions['autoconfirmed']['poll-vote'] = true; |
| 49 | +$wgGroupPermissions['*']['poll-vote'] = false; |
| 50 | +$wgAvailableRights[] = 'poll-vote'; |
| 51 | + |
37 | 52 | $dir = dirname( __FILE__ ) . '/'; |
38 | 53 | |
39 | 54 | $wgAutoloadClasses['Poll'] = $dir . 'Poll_body.php'; # Tell MediaWiki to load the extension body. |