Voting_System is one simple yet very powerful use of
Trackers in Tiki. This profile will enable the tracker feature and create a basic wiki page to act as a custom reduced interface to vote in the system, while hiding some fields to the end user, that are needed to ensure that the user is recognized as a member of the only group that can vote ("Group1"), and that only one vote per user is allowed.
Two users are created for demo purposes: user1, which belongs to group1, and user2, which belongs to group2. Therefore, only user1 can vote, beyond the admin, that can also vote since no permissions are checked against user admin, who has the ability to create and fine tune the system.
This page will be created:
Profile_Voting_System_voting_page
YAML
preferences:
feature_trackers: y
feature_wiki_argvariable: y
trackerfield_autoincrement: y
trackerfield_dropdownother: y
wikiplugin_jq: y
wikiplugin_tabs: y
wikiplugin_tracker: y
wikiplugin_trackerstat: y
instructions: Profile_Voting_System_voting_page
objects:
-
type: tracker
ref: Voting_System
data:
name: Voting
description: >
Voting for the New Board according to the proposal shown in the minutes from last general meeting.
sort_default_order: desc
sort_default_field: creation
restrict_end: 0
restrict_start: 0
allow:
- one_item_per_user
show:
- list_creation_date
- creation_date
- status_admin_only
-
type: tracker_field
ref: voting_notaSobreLaVotaciN
data:
name: Note from the Voting System
permname: notaSobreLaVotaciN
tracker: $profileobject:Voting_System$
options:
wikiparse: 1
max: 100
type: static
order: 0
visible: admin_only
description: |
^Choose the pre-selected, as proposed in the last General Meeting, or type in the full name of your personal proposal, at the "__Other__" box for the appropriate role. ~~red:Keep i mind that by writing something in the "__Other__" field, the different choice placed in the drop-down will be overridden. Moreover, if you choose "__Other__" in the drop-down, but you leave the box blank, that vote will be counted as "__Null Vote__", just as if you wrote the name and surname of someone who does not appear in the Members List~~. %%% %%%Please note that you can choose the option "__Blank vote__" or "__Null vote__", if you prefer, directly through from the drop-down itself. %%% %%%If you made a mistake and you want to correct your vote, all you have to do is to vote again, your old vote and will be replaced by your new choice.^
descparsed: y
flags:
- public
-
type: tracker_field
ref: voting_presidente
data:
name: Presidency
permname: presidente
tracker: $profileobject:Voting_System$
options:
options:
- Mrs Mary Jones
- Mrs Mary Jones
- Blank vote
- Null vote
- Other
type: dropdown_other
order: 10
flags:
- list
- searchable
- public
- mandatory
-
type: tracker_field
ref: voting_vicepresidente
data:
name: Vicepresidency
permname: vicepresidente
tracker: $profileobject:Voting_System$
options:
options:
- Armando Bronca PhD.
- Armando Bronca PhD.
- Blank vote
- Null vote
- Other
type: dropdown_other
order: 20
flags:
- list
- searchable
- public
- mandatory
-
type: tracker_field
ref: voting_secretariado
data:
name: Secretarial
permname: secretariado
tracker: $profileobject:Voting_System$
options:
options:
- Mr John Smith
- Mr John Smith
- Blank vote
- Null vote
- Other
type: dropdown_other
order: 30
flags:
- list
- searchable
- public
- mandatory
-
type: tracker_field
ref: voting_tesorerA
data:
name: Treasury
permname: tesorerA
tracker: $profileobject:Voting_System$
options:
options:
- Robin Hood Jr.
- Robin Hood Jr.
- Blank vote
- Null vote
- Other
type: dropdown_other
order: 40
flags:
- list
- searchable
- public
- mandatory
-
type: tracker_field
ref: voting_vocalA_1
data:
name: Extra Membership 1
permname: vocalA_1
tracker: $profileobject:Voting_System$
options:
options:
- John Doe Sr.
- John Doe Sr.
- Blank vote
- Null vote
- Other
type: dropdown_other
order: 50
flags:
- list
- searchable
- public
- mandatory
-
type: tracker_field
ref: voting_vocalA_2
data:
name: Extra Membership 2
permname: vocalA_2
tracker: $profileobject:Voting_System$
options:
options:
- Lara Croft
- Lara Croft
- Blank vote
- Null vote
- Other
type: dropdown_other
order: 60
flags:
- list
- searchable
- public
- mandatory
-
type: tracker_field
ref: voting_vocalA_3
data:
name: Extra Membership 3
permname: vocalA_3
tracker: $profileobject:Voting_System$
options:
options:
- Perico Los Palotes
- Perico Los Palotes
- Blank vote
- Null vote
- Other
type: dropdown_other
order: 70
flags:
- list
- searchable
- public
- mandatory
-
type: tracker_field
ref: voting_vocalA_4
data:
name: Extra Membership 4
permname: vocalA_4
tracker: $profileobject:Voting_System$
options:
options:
- Aytor Tilladepa Tatas
- Aytor Tilladepa Tatas
- Blank vote
- Null vote
- Other
type: dropdown_other
order: 80
flags:
- list
- searchable
- public
- mandatory
-
type: tracker_field
ref: voting_usuario
data:
name: Username
permname: usuario
tracker: $profileobject:Voting_System$
options:
autoassign: 1
notify: 1
type: user
order: 90
visible: admin_only
description: >
~~grey:''This field is necessary to check that the user is a member, and restrict the system to one vote per person in the members group. This field is only visible by the person voting at the time of the vote, and the system administrator to ensure that the system worked properly and there is a single vote per person, at any time if doubts arise about the voting system. No other member of the organization will have access to view voters. Also, once the voting period is over, and no computer issues were detected, then this user field will be deleted by the system administrator, so that the vote record will be completely anonymous regarding who voted what.''~~
descparsed: y
flags:
- list
- mandatory
-
type: tracker_field
ref: voting_voto
data:
name: 'Vote #'
permname: voto
tracker: $profileobject:Voting_System$
options:
start: 1
prepend: '#'
type: auto_increment
order: 100
flags:
- list
- searchable
- link
- public
Sample vote from user1
YAML
objects:
-
type: tracker_item
ref: vote_001
data:
tracker: $Voting_System
status: open
values:
- [ $voting_presidente, Mr Bean ]
- [ $voting_vicepresidente, Armando Bronca PhD. ]
- [ $voting_secretariado, Blank vote ]
- [ $voting_tesorerA, Robin Hood Jr. ]
- [ $voting_vocalA_1, Null vote ]
- [ $voting_vocalA_2, foo ]
- [ $voting_vocalA_3, Perico Los Palotes]
- [ $voting_vocalA_4, Aytor Tilladepa Tatas ]
- [ $voting_usuario, user1]
- [ $voting_voto, 1]
This will include:
Profile_Voting_System_voting_page
YAML
instructions: Voting
preferences:
enable: [ feature_wiki ]
objects:
-
type: wiki_page
ref: voting_page
data:
name: Voting
description: The Voting System
lang: en
content: wikicontent:Profile_Voting_System_voting_page
Groups
Create a group "group1" which has permission to cast a vote in the Voting system. The other group "group2" can't add items to that tracker (therefore, its members can't vote).
YAML
permissions:
Anonymous:
allow: []
Registered:
description: Users that are logged in
allow: [ edit, minor ]
deny: [ export_wiki ]
Group1:
description: Members of the organization allowed to cast a vote in the Voting System
allow:
- create_tracker_items
- list_trackers
- view_trackers
include: [ Registered ]
objects:
-
type: tracker
id: $Voting_System
allow:
- create_tracker_items
- list_trackers
- view_trackers
Group2:
description: Other registered users to the site, that are not allowed to cast a vote in the Voting System
allow:
- create_tracker_items
- list_trackers
- view_trackers
include: [ Registered ]
objects:
-
type: tracker
id: $Voting_System
deny:
- create_tracker_items
- list_trackers
- view_trackers
Users
Add a user to the group Members
YAML
objects:
-
type: user
data:
name: user1
pass: user1
email: user1@example.com
change: n
groups: [ Group1 ]
-
type: user
data:
name: user2
pass: user2
email: user2@example.com
change: n
groups: [ Group2 ]