mediawiki-extensions-AJAXPoll/AJAXPoll.php
Wikinaut 0a73018060 fixed a problem with fractional percentages
when rendering the result bar do not use localized percentage string
width must contain a dot like 33.33% but must not come with a comma like 33,33%

Change-Id: Id2dd68cb8df339358b274df08d713eee351adf42
2013-05-31 08:41:13 +02:00

93 lines
2.8 KiB
PHP

<?php
/**
* AJAX Poll extension for MediaWiki
* Created by Dariusz Siedlecki, based on the work by Eric David.
* Licensed under the GFDL.
*
* <poll>
* [Option]
* Question
* Answer 1
* Answer 2
* Answer ...
* Answer n
* </poll>
*
* @file
* @ingroup Extensions
* @author Dariusz Siedlecki <datrio@gmail.com>
* @author Jack Phoenix <jack@countervandalism.net>
* @author Thomas Gries
* @maintainer Thomas Gries
* @version 1.80
* @link http://www.mediawiki.org/wiki/Extension:AJAX_Poll Documentation
*/
if( !defined( 'MEDIAWIKI' ) ) {
die( "This is not a valid entry point.\n" );
}
// Extension credits that will show up on Special:Version
$wgExtensionCredits['parserhook'][] = array(
'path' => __FILE__,
'name' => 'AJAX Poll',
'version' => '1.82 20130531',
'author' => array( 'Dariusz Siedlecki', 'Jack Phoenix', 'Thomas Gries' ),
'descriptionmsg' => 'ajaxpoll-desc',
'url' => 'https://www.mediawiki.org/wiki/Extension:AJAX_Poll',
);
// Internationalization + AJAX function
$dir = dirname( __FILE__ );
$wgExtensionMessagesFiles['AJAXPoll'] = $dir . '/AJAXPoll.i18n.php';
$wgAutoloadClasses['AJAXPoll'] = $dir . '/AJAXPoll_body.php';
$wgAjaxExportList[] = 'AJAXPoll::submitVote';
$wgHooks['ParserFirstCallInit'][] = 'AJAXPoll::onParserInit';
$wgHooks['LoadExtensionSchemaUpdates'][] = 'AJAXPoll::onLoadExtensionSchemaUpdates';
$myResourceTemplate = array(
'localBasePath' => dirname( __FILE__ ) . "/resources",
'remoteExtPath' => 'AJAXPoll/resources',
'group' => 'ext.ajaxpoll',
);
$wgResourceModules['ext.ajaxpoll'] = $myResourceTemplate + array(
'scripts' => array(
'ajaxpoll.js',
),
'styles' => array(
'ajaxpoll.css',
),
'dependencies' => array(
)
);
# new user rights
$wgAvailableRights[] = 'ajaxpoll-vote';
$wgAvailableRights[] = 'ajaxpoll-viewresults';
$wgAvailableRights[] = 'ajaxpoll-viewresults-before-vote';
# The 'ajaxpoll-view-results-before-vote' group permission allows the specified
# group members to view poll results even without having voted
# but only if the high-level group permission 'ajaxpoll-vote' allows to view
# results in general.
#
# This 'ajaxpoll-view-results-before-vote' can be overwritten with the specific
# per-poll setting "show-results-before-voting" which takes precedence over the
# group permission.
#
# permission 'ajaxpoll-view-results' >>
# >> per-poll setting "show-results-before-voting" (if present)
# >> permission 'ajaxpoll-view-results-before-vote'
#
# anons
# default: anons cannot vote and will never see results
$wgGroupPermissions['*']['ajaxpoll-vote'] = false;
$wgGroupPermissions['*']['ajaxpoll-view-results'] = false;
$wgGroupPermissions['*']['ajaxpoll-view-results-before-vote'] = false;
# users
# default: users can vote and can see poll results - when they have voted
$wgGroupPermissions['user']['ajaxpoll-vote'] = true;
$wgGroupPermissions['user']['ajaxpoll-view-results'] = true;