r50365 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50364‎ | r50365 | r50366 >
Date:12:09, 9 May 2009
Author:jan
Status:deferred
Tags:
Comment:
* Add new messages
* Add new rights
* Add 2 new function( create() and vote() )
Modified paths:
  • /trunk/extensions/Poll/Poll.i18n.php (modified) (history)
  • /trunk/extensions/Poll/Poll.php (modified) (history)
  • /trunk/extensions/Poll/Poll_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Poll/Poll_body.php
@@ -15,5 +15,48 @@
1616 $action = htmlentities( $wgRequest->getText( 'action' ) );
1717 $id = htmlentities( $wgRequest->getText( 'id' ) );
1818
 19+ if($action == "create") {
 20+ $this->create();
 21+ }
 22+
 23+ if($action == "vote") {
 24+ $this->vote();
 25+ }
1926 }
 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+ }
2063 }
Index: trunk/extensions/Poll/Poll.i18n.php
@@ -8,12 +8,27 @@
99
1010 $messages = array();
1111
 12+
1213 $messages['en'] = array(
1314 'poll' => 'Polls',
1415 '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',
1523 );
1624
1725 $messages['de'] = array(
1826 'poll' => 'Umfragen',
1927 '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',
2035 );
Index: trunk/extensions/Poll/Poll.php
@@ -33,6 +33,21 @@
3434 'descriptionmsg' => 'poll-desc'
3535 );
3636
 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+
3752 $dir = dirname( __FILE__ ) . '/';
3853
3954 $wgAutoloadClasses['Poll'] = $dir . 'Poll_body.php'; # Tell MediaWiki to load the extension body.

Follow-up revisions

RevisionCommit summaryAuthorDate
r50370Fix for r50365: use tabs for identation; not spacesialex14:25, 9 May 2009

Status & tagging log