From MediaWiki.org
Jump to navigation Jump to search
· Main page · Terminology and Syntax · Developing scripts · Installation and administration · Examples

Declaration/voting mode[edit]

Now there's an example of three different polls:

<qpoll id=almaz1 showresults perrow=2>
{Please choose the side of conflict:
|layout="transpose" type="unique()" showresults="0"}
! Choose a score (I - least important, V - most important)
| I | II | III | IV | V
describes my values and ideals
describes my personal views
most suitable approach to current situation
explains their arguments in the most logical way
provides the most useful idea

{When I begin to work on some project as a member of working group, the most important thing to me is:
|layout="proposals transpose" type="unique()" showresults="1"}
| 1 | 2 | 3 | 4 | 5
understanding the goals and importance of the project
to figure out the goals and values of the working group members
to define, how the project will be performed
to understand, which benefits this project could bring to our group members
to organize the project in such way that it will be well done

{In reality, I am understanding new ideas better and easier, when I can:
|layout="proposals" type="()" showresults="1;color:blue;background:yellow"}
|| "Real" myself ||| "Ideal" myself
| Yes | No | Yes | Maybe | No
Have you thought which external factors encourage you to invent something new?
Have you experienced problems due to excessive curiosity?
Did you have a strong desire to improve handiwork?
Did you ever have problems due to excessive stubbornness?

{Which picture do you like better?
|type="unique()" showresults="2;color:blue;background:yellow;textcolor:#FF0000;textbackground:aquamarine"}
| 1 | 2 | 3 | 4 | 5

Let's assume the poll above is located at the wikipage Mainpage. It's unique identifier on the mainpage is #almaz1 (id=almaz1 poll attribute). Only a different title can re-use the same identifier. This poll will show it's statistics to everyone who can view and thus vote on the Mainpage, in case wiki admin permitted this by placing qp_Setup::$global_showresults=1; in LocalSettings.php (showresults attribute). Questions of this poll will be displayed two per row (perrow=2 poll attribute). Questions of poll will have their statistics displayed in different style, according to their showresults attributes.

<qpoll dependance="Mainpage#almaz1" id=poll0 showresults="2;color:green">
{Checking various types of questions, 1
|Large metacategory for the full list of categories just below
| Category 1 | Category 2 | Category 3
understanding the goals
guessing real goals of the project
digging deeply into the problem

{Checking various types of questions, 2
|| Two categories span "A"|| Two categories span "B"
| 1 | 2 | 3 | 4
understanding the real goals
Did you mean {{#qpuserchoice:Mainpage#almaz1|1|2|the default|the roman one||the roman third||the roman fifth}} choice?
guessing true goals of the project
digging even more deeply into the problem

{Checking various types of questions, 3
|| Metacategory for categories I & II | Metacategory for categories III & IV
| I | II | III | IV
understanding the goals
guessing real goals of the project
digging deeply into the problem

Let's assume the second poll is located at the wikipage Pagename. It will be available for the current user only after the first poll (Mainpage#almaz1) was successfully submitted (dependance="Mainpage#almaz1" poll attribute). It's own id=poll0. It might be addressed in the future with Pagename#poll0 poll address (or, just #poll0 if the another poll or parser function is located on the same page).

The question 2, proposal 1 of this poll calls a qpuserchoice parser function to display a custom proposal text depending on the user's category choice in the previously voted poll Mainpage#almaz1 question 1, proposal 2 (see "the most logically suitable to the current situation" proposal text line above). The displaying proposal text will be Did you mean ... choice?, where ... will be substituted according to the user choice of categories in Mainpage#almaz1 question 1, proposal 2

Mainpage#almaz1 question 1, proposal 2 selection Pagename#poll0 question 2, proposal 1 text
II,IV Did you mean the default choice?
I Did you mean the roman one choice?
III Did you mean the roman third choice?
V Did you mean the roman fifth choice?

Note also, that the metacategory (spans) line of the question number 3

|| Metacategory for categories I & II | Metacategory for categories III & IV

is equivalent to the line

|| Metacategory for categories I & II || Metacategory for categories III & IV

second metacategory was filled up with one additional empty cell automatically to include the rest of the categories (IV in this case).

<qpoll id=multi>
{Your favorite drink
|textwidth="20" type="mixed"}
| Plain water | Juice | Beer | Other drink
()[][]<> Winter
()[][]<> Spring
()[][]<> Summer
()[][]<> Autumn

The poll of "mixed" type. Choose only the water, or any combination of juice, beer and/or other custom drink, which you would prefer during the proposed seasons of the year.

<qpoll id=multi2>
{Your favorite drink
|textwidth="20" type="mixed"}
| Plain water | Juice | Beer | Other drink
()[][]<> Winter

Since the v0.4.3 it's possible to omit repeated declaration of exactly the same category types at the next proposal line. Starting from the second proposal line (Spring), there's only proposal text. Thus, the poll with id=multi2 has the same category types as the previously declared poll with id=multi.

Since the v0.7.0 it's possible to define just one category question when proposal have textfield type:

<qpoll id=multi3>
{Please describe your short opinion on newspapers below
|textwidth="20" type="mixed"}
| Your feedback
<> Calgary Herald
Edmonton Journal
Lethbridge Herald
Lethbridge Sun Times
Lethbridge Journal

Starting with v0.7.0 question's "common question" can be hidden when there is only one category defined and it's name equals to html entity 160 (non-breaking space). This might be useful when defining the fields for question comments and feedbacks. For example, you may replace common question title "Your feedback" to html entity 160 in the poll with id=multi3 to have the question to be hidden.

Statistical display mode[edit]

Please note that this mode is available only since v0.6.0. The following code can be placed at any wiki page where the extension was installed:

<qpoll address="Mainpage#almaz1" showresults="1">

If permitted by value of qp_Setup::$global_showresults property, will show the statistical results of poll with id almaz1 located at Mainpage.

  • first question will have green bars displayed
  • second will inherit showresults="1" from poll's value of showresults attribute, thus showing only numerical percents
  • third will not be displayed at all
  • fourth will have only numerical percents displayed