@voter = OpenVoter.find(:all,
:conditions => ["session_id = ? and election_id = ?",
session.session_id, @election.id])[0]
-
- @voter = OpenVoter.new unless @voter
+
+ unless @voter and not @voter.election.kiosk
+ @voter = OpenVoter.new
+ end
@voter.election = @election
@voter.session_id = session.session_id
if @voter.election.embeddable? and params[:embed] == "true" \
and @voter.election.early_results?
redirect_to :action => :results, :id => @password, :embed => 'true'
+ elsif @voter.election.kiosk and params[:kiosk] = "true"
+ redirect_to :action => "kiosk_ready", :id => @password, :kiosk => true
else
render :action => 'thanks'
end
redirect_to :action => 'index'
end
end
-
+
+ def kiosk_ready
+ if not authenticate
+ redirect_to :action => 'index', :kiosk => true
+ end
+ end
+
private
def authenticate
password = params[:id]
def authenticated?
authenticated
end
+
+ def kiosk?
+ kiosk
+ end
def shortdesc
shortdesc = description.split(/\n/)[0]
<% type_hash = {}; ELECTION_TYPES.each {|k,v| type_hash[v] = k} %>
<%= select_tag 'election[election_method]', options_for_select(type_hash, @election.election_method) %></p>
-<p><label for="election_election_method">Enable Embeddable Elections?</label>
-<%= check_box :election, :embeddable %></p>
+<p><label for="election_verifiable">Enable voter verifiable
+elections?</label>
+<%= check_box :election, :verifiable%></p>
-<p><label for="election_election_method">Should results be visible before end of election?</label>
+<p><label for="election_early_results">Should results be visible before end of election?</label>
<%= check_box :election, :early_results%></p>
+<p><label for="election_embeddable">Enable embeddable elections?</label>
+<%= check_box :election, :embeddable %></p>
+
+<p><label for="election_kiosk">Enable kiosk mode?</label>
+<em><strong>Warning:</strong> This will let users vote multiple times
+from the same computer!</em>
+<%= check_box :election, :kiosk%></p>
+
<!--[eoform:election]-->
<li>Elections <strong>will be</strong> embeddable.</li>
<% end %>
+<% if @election.kiosk %>
+<li>Selectricity's kiosk mode <strong>will be</strong> available.</li>
+<% end %>
+
+<% if @election.verifiable%>
+<li>Voters <strong>will be</strong> given tokens to verify their votes.</li>
+<% else %>
+<li>Elections <strong>will not be</strong> voter verifiable.</li>
+<% end %>
+
</ul>
<% if @election.active? and not @election.authenticated? %>
-<p><strong>Link</strong></p>
-<%= (link_to ("Go Vote!",
- :controller => 'voter', :action => 'index', :election_id => @election.id)).to_s %>
+<p><strong>Link to election:</strong></p>
+<ul>
+<li><%= (link_to ("Vote in election",
+ :controller => 'voter', :action => 'index', :election_id => @election.id)).to_s %>
+ (<%= votepassword_url(:urlpassword => "open." + @election.id.to_s) %>)</li>
+
+<% if @election.kiosk %>
+<li><%= (link_to ("Kiosk mode",
+ :controller => 'voter', :action => 'index', :election_id => @election.id, :kiosk => true)).to_s %>
+ (<%= votepassword_url(:urlpassword => "open." + @election.id.to_s, :kiosk => true) %>)</li>
+ <% end %>
+</ul>
<% end -%>
<div class="normal-header">
<div id="footer">
- <a href="http://blog.selectricity.org/">Copyleft 2006, 2007</a>
- <a href="http://www.media.mit.edu">MIT Media Lab</a>, <%= link_to("Selectricity Team", :controller => 'about', :action => 'team') %> ::
+ <a href="http://blog.selectricity.org/">Copyleft 2006-2009</a>
+ <a href="http://civic.mit.edu">MIT Center for Future Civic Media</a>,
+ <a href="http://www.media.mit.edu">MIT Media Lab</a>,
+ <%= link_to("Selectricity Team", :controller => 'about', :action => 'team') %> ::
<a href="http://blog.selectricity.org/">Selectricity News Blog</a>
</div>
<%= render :partial => 'common/sortable_vote' %>
<div style="margin-left: 30pt;">
-<%= button_to "Submit Vote", :action => 'review', :id => @password %>
+<% if @voter.election.kiosk and params[:kiosk] == "true" %>
+ <%= button_to "Submit Vote", :action => 'review', :id => @password, :kiosk => true %>
+<% else %>
+ <%= button_to "Submit Vote", :action => 'review', :id => @password %>
+<% end %>
</div>
<p><strong>Description:</strong></p>
<p><%= @voter.election.description %></p>
+<% if @voter.election.authenticated? %>
<div class="normal-header">
<span class="header">Current Voter</span>
<span class="subheader"></span>
</div>
+<% end %>
<p><strong><%= @voter.email %></strong></p>
--- /dev/null
+<div id="title-header">
+ <span class="header"><%= @voter.election.name %></span>
+ <span class="subheader"></span>
+</div>
+
+<p>Selectricity is running in kiosk mode and is ready for the next
+voter. Press the button below to generate a new ballot.</p>
+
+<p align="center"><%= button_to "Vote!", :action => "index", :urlpassword => @password, :kiosk => true %></p>
--- /dev/null
+class KioskMode < ActiveRecord::Migration
+ def self.up
+ add_column :elections, :kiosk, :boolean,
+ :null => false, :default => false
+ add_column :elections, :verifiable, :boolean,
+ :null => false, :default => true
+
+ Election.find(:all).select {|e| e.class == QuickVote }.each do |e|
+ e.verifiable = false
+ e.save
+ end
+ end
+
+ def self.down
+ remove_column :elections, :kiosk
+ remove_column :elections, :verifiable
+ end
+end
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 3)
+ActiveRecord::Schema.define(:version => 3) do
create_table "candidates", :force => true do |t|
t.integer "election_id", :null => false
end
create_table "elections", :force => true do |t|
- t.string "name", :limit => 100, :null => false
- t.text "description", :null => false
- t.integer "anonymous", :limit => 1, :default => 1, :null => false
+ t.string "name", :limit => 100, :null => false
+ t.text "description", :null => false
+ t.integer "anonymous", :limit => 1, :default => 1, :null => false
t.datetime "startdate"
- t.datetime "enddate", :null => false
- t.integer "active", :limit => 1, :default => 0, :null => false
- t.integer "viewable", :limit => 1, :default => 1, :null => false
- t.integer "notices", :limit => 1, :default => 0, :null => false
+ t.datetime "enddate", :null => false
+ t.integer "active", :limit => 1, :default => 0, :null => false
+ t.integer "viewable", :limit => 1, :default => 1, :null => false
+ t.integer "notices", :limit => 1, :default => 0, :null => false
t.integer "user_id"
t.string "quickuser"
- t.string "election_method", :limit => 100, :default => "ssd"
- t.string "type", :limit => 100, :null => false
- t.boolean "embeddable", :default => false, :null => false
- t.boolean "authenticated", :default => true, :null => false
- t.boolean "early_results", :default => false, :null => false
+ t.string "election_method", :limit => 100, :default => "ssd"
+ t.string "type", :limit => 100, :null => false
+ t.boolean "embeddable", :default => false, :null => false
+ t.boolean "authenticated", :default => true, :null => false
+ t.boolean "early_results", :default => false, :null => false
+ t.string "embed_custom_string"
end
add_index "elections", ["user_id"], :name => "fk_user_election"
create_table "pictures", :force => true do |t|
- t.string "filename", :limit => 200
- t.binary "data"
- t.string "filetype", :limit => 100
- t.integer "candidate_id"
+ t.string "filename"
+ t.string "content_type"
+ t.integer "size"
+ t.integer "width"
+ t.integer "height"
+ t.integer "parent_id"
+ t.string "thumbnail"
+ t.datetime "created_at"
+ t.integer "candidate_id"
end
- add_index "pictures", ["candidate_id"], :name => "fk_candidate_picture"
-
create_table "rankings", :force => true do |t|
t.integer "vote_id"
t.integer "candidate_id"