Open main menu

Extension:VoteSystem

MediaWiki extensions manual
OOjs UI icon advanced.svg
VoteSystem
Release status: beta
Implementation Tag , Special page
Description Special page to create a voting module, which is included in the article by the tag
Author(s) RUNA (Runa_cgtalk)
Latest version 0.1 (March 2010)
MediaWiki tested on 1.10.2, 1.15.1
License GPL
Download See the section labeled code below
Translate the VoteSystem extension if it is available at translatewiki.net
Check usage and version matrix.

With this module, you can create a vote. To control the vote created a special page. Users who have the right to edit wiki-pages, also have access to this page.

Contents

DescriptionEdit

Creating a new voteEdit

Go to special page Vote_System. Click +New vote. It opens a form to create a new vote. Fields:

  • Title - Vote theme
  • Type
    • one answer - you can choose only one answer
    • multiple answers - you can choose multiple answers
  • Access
    • view results - wiki groups, comma separated, are allowed to view the overall results for this vote
    • record - wiki groups, comma separated, are allowed to respond to this vote

After pressing Save will be created a new vote. This will open a list of vote themes, and the newly created voting will be shown in it. After creating the new vote, to add answer choices and choose additional options, edit newly created vote.

Editing voteEdit

To edit a vote click on the name of the desired vote in the list. Initially, the right to edit the vote is a creator of this survey, as well as a group "Administrators" Editing permissions can be extended in the field Access to editing (wiki group, as well as users, separated by commas). By default, if user have the right to reply to a question, after the answer he loses the right (identification by user name or P-address). To remove this restriction, you need to tick to allow multiple voting.

Editing answersEdit

To add an answer click on the link +New answer. To edit a variant of the answer you should click on its name in the list of answers. This will open editing answer form.

Voting theme is presented in the form of reference, when you click on that you can return to form for editing the vote. Field Text - text of answer. If you tick +text input field, then the answer will be displayed with an additional field for manual input response. After you click "Save" answer option recorded, and the transition to the editing vote form.

A list of answers is shown in a table that has fields "Text", "Actions", "Results". Delete unnecessary answer by clicking on the x in the "Actions". If this vote had someone answered, then in the "Results" you will see the overall results of voting for each answer. And also at the bottom a link to download log-file detailed statistics on the results of the survey.

Inserting the vote moduleEdit

To insert a module of a vote on a page, go to the edit form of voting, copy the contents of the field Code insertion in the clipboard and open for editing a page and put in the right place to copy the code insertion. After you save the page module voting will be displayed in accordance with the rights described in the Access form editing voting.

InstallationEdit

To install this extension

  • Create folder "/extensions/VoteSystem"
  • Create files: (see Code section)
    • VoteSystem.php
    • VoteSystem.i18n.php
    • VoteSystem_body.php
    • VoteSystem_module.php
    • votesystem.css
  • Copy these files in the folder "/extensions/VoteSystem"
  • Create folder "/extensions/VoteSystem/img" with files:
  • Create tables in your database (see Tables definition section)
  • Add the following to LocalSettings.php :
require_once("$IP/extensions/VoteSystem/VoteSystem.php");

CodeEdit

Tables definitionEdit

CREATE TABLE `vote_answer` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(255) NOT NULL,
  `id_question` int(11) NOT NULL,
  `sort` tinyint(4) default NULL,
  `hasText` tinyint(1) default NULL,
  `created` timestamp NOT NULL default CURRENT_TIMESTAMP,
  `last_updated` timestamp NULL default NULL,
  `del` tinyint(1) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `vote_question` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(255) NOT NULL,
  `type` tinyint(1) NOT NULL default '0',
  `created` timestamp NOT NULL default CURRENT_TIMESTAMP,
  `last_updated` timestamp NULL default NULL,
  `user` varchar(255) NOT NULL,
  `finished` tinyint(1) default NULL,
  `del` tinyint(1) default NULL,
  `permissions_read` tinyblob,
  `permissions_write` tinyblob,
  `multi_count` tinyint(1) default NULL,
  `permissions_edit` tinyblob,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `vote_result` (
  `id` int(11) NOT NULL auto_increment,
  `id_question` int(11) NOT NULL,
  `id_answer` int(11) NOT NULL,
  `adate` timestamp NOT NULL default CURRENT_TIMESTAMP,
  `user` varchar(255) NOT NULL,
  `text` mediumblob,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;