Merge from devel
authorselectricity <selectricity@epicenter>
Fri, 31 Aug 2007 21:39:00 +0000 (17:39 -0400)
committerselectricity <selectricity@epicenter>
Fri, 31 Aug 2007 21:39:00 +0000 (17:39 -0400)
21 files changed:
app/controllers/election_controller.rb
app/controllers/quickvote_controller.rb
app/controllers/voter_controller.rb
app/models/voter_notify.rb
app/views/account/summary.rhtml
app/views/election/remind_voter.rhtml [new file with mode: 0644]
app/views/layouts/frontpage.rhtml
app/views/layouts/main.rhtml
app/views/quickvote/_pref_tables.rhtml
app/views/quickvote/_result_box.rhtml
app/views/quickvote/_results_sidebar.rhtml
app/views/quickvote/index.rhtml
app/views/quickvote/list_voters.rhtml
app/views/quickvote/results.rhtml
app/views/voter/forgot_password.rhtml [new file with mode: 0644]
app/views/voter_notify/reminder.rhtml [new file with mode: 0644]
app/views/voter_notify/votestart.rhtml
config/environment.rb
db/schema.rb
lib/whois/whois.rb
public/stylesheets/main.css

index eff920ff0419cdcb826e5b3d22817d13ffe07a5a..1affe0fbd254bc2622eaa4756242963ac7ede00b 100644 (file)
@@ -152,6 +152,14 @@ class ElectionController < ApplicationController
     voter.destroy
   end
   
+  def remind_voter
+    voter_array= FullVoter.find(:all, :conditions => ["email = ?", params[:email]])
+    voter_array.delete_if {|voter| voter.election.active == 0}
+    unless voter_array.empty?
+      VoterNotify.deliver_reminder(voter_array)
+    end
+  end
+  
   ## methods for computing and printing results
   ####################################################################
   def results
index b9c790f40f872fa99048f10aec38cc76abc348a1..cc57bb51d80ff8f825a3d88119ccbf90b4e22ef3 100644 (file)
@@ -185,8 +185,7 @@ class QuickvoteController < ApplicationController
 
       marker = GMarker.new([location.lat,location.lng],
                            :title => "Voter",
-                           :info_window => (voter.ipaddress or "unknown") \
-                                           + "   " + voter.vote.votestring)
+                           :info_window => (voter.ipaddress or "unknown"))
       @map.overlay_init(marker)
     end
   end
index 6693b0fa6baa9090cfa6c72b146a240f3d95024e..fb1bec7a0f69f84b1063b6e936722763d022b8f3 100644 (file)
@@ -32,7 +32,7 @@ class VoterController < ApplicationController
       redirect_to :action => 'index'
     end
   end
-
+  
   private
   def authenticate
     password = params[:id]
index d9fded5888faf10a84e5015215fcc501ecb9cf91..825786a7a33ba01754ce908aaa7ab66d669144a5 100644 (file)
@@ -8,7 +8,12 @@ class VoterNotify < ActionMailer::Base
     @body = { :voter => voter }
   end
 
-  def reminder(voter)
+  def reminder(voter_array)
+    @subject = "Selectricity Election Reminder!"
+    @recipients = voter_array[0].email
+    @from = MAIL_CONFIG[:from]
+    @sent_on = Time.now
+    @body = { :voter_array => voter_array }
   end
 
 end
index 2f24e2801f165c51de6d7b37d9f2c7dd28839e3a..d15e4425b36e6abb3d0e48043900b577cbb705db 100644 (file)
@@ -1,4 +1,4 @@
-<h2>This is your user summary profile, <%=h @user.login.capitalize %></h2>
+<h3>This is your user summary profile, <%=h @user.login.capitalize %></h3>
 
 <p>
 E-mail: <%=h @user.email %><br />
@@ -6,11 +6,11 @@ Member since: <%=h @user.created_at.strftime("%x") %>
 </p>
 
 <p>Your Elections:
-  <table class="voterbox">
+  <table class="voterbox" id="election">
     <tr>
          <% Election.content_columns.each do |column| -%>
          <% next if column.name.eql?("viewable") || column.name.eql?("quickuser")\
-         || column.name.eql?("active") %>
+         || column.name.eql?("active") || column.name.eql?("anonymous") %>
            <th><%= column.human_name %></th>
          <% end -%>
     </tr>
@@ -26,13 +26,6 @@ Member since: <%=h @user.created_at.strftime("%x") %>
                <% end -%>
          </td>
          <td><%=h election.description %></td>
-         <td>
-         <% if election.anonymous == 0 -%>
-              No
-            <% else -%>
-              Yes
-            <% end -%>
-         </td>
          <td><%=h election.startdate.strftime("%x") %></td>
       <td><%=h election.enddate.strftime("%x") %></td>
       <td>
@@ -48,6 +41,8 @@ Member since: <%=h @user.created_at.strftime("%x") %>
   </table>
 </p>
 
+<br />
+
 <p>
 Your Quickvotes:
 <table class="voterbox">
diff --git a/app/views/election/remind_voter.rhtml b/app/views/election/remind_voter.rhtml
new file mode 100644 (file)
index 0000000..40d7a20
--- /dev/null
@@ -0,0 +1 @@
+The message has been sent, please check your inbox soon.
\ No newline at end of file
index de173c280e7560b8229113d4500ac9a89ff87a2d..d5a5f01e7cef0a36364f5e83efbfd1a3fa621dc2 100644 (file)
@@ -24,7 +24,7 @@
       &nbsp;&nbsp;<%= link_to("sign up", :controller => "account", 
                                 :action => "signup")%>
     <% end -%>
-      &nbsp;&nbsp;<%= link_to ("help/about", :controller => "site", 
+      &nbsp;&nbsp;<%= link_to("help/about", :controller => "site", 
                                :action => 'about')%>
       </div>
          <a href="index.html"><h1>selectricity: voting machinery for the masses</h1></a>
index 74ad018564dbdd57ec8e894ac45d2eb54d99c84e..bdb206a9fc8af29049a0d7e35190fb7602411df1 100644 (file)
@@ -5,8 +5,11 @@
     <%= stylesheet_link_tag "common", :media => "all" %>
     <%= stylesheet_link_tag "main", :media => "all" %>
     <%= stylesheet_link_tag *(@stylesheets) %>
-    <%= stylesheet_link_tag "ie6hacks", :media => "all" if \
-          request.user_agent =~ /msie\s(5\.[5-9]|[6]\.[0-9]*).*(win)/i %>
+    <%begin%>
+      <%= stylesheet_link_tag "ie6hacks", :media => "all" if 
+      request.user_agent =~ /msie\s(5\.[5-9]|[6]\.[0-9]*).*(win)/i %>
+    <%rescue NoMethodError%>
+    <%end%>
     <%= javascript_include_tag "prototype", "effects", "dragdrop", "controls" %>
   </head>
 
index 628ce55ca5d873474e149fdc4097109cf8512799..3479167d226296cc14a0864c47b1299d2efb452a 100644 (file)
@@ -1,8 +1,9 @@
-<% candidates = @election.condorcet_result.ranked_candidates.flatten -%>
+<% candidates = @election.ssd_result.ranked_candidates.flatten -%>
 <% voters = @election.voters.size %>
-<% matrix = @election.condorcet_result.matrix %>
-<% victories = @election.condorcet_result.victories_and_ties %>
+<% matrix = @election.ssd_result.matrix %>
+<% victories = @election.ssd_result.victories_and_ties %>
 
+<% if candidates.size <= 7 -%>
 <!-- This table shows how many times each choice was ranked above the other, 
        with percentages-->
 <table class="preftable">
@@ -30,7 +31,7 @@
  </tr>
 <% end -%>
 </table>
-
+<br />
 <!-- This table generates a margin of victory -->
 <table class="preftable">
   <% candidates.each do |victor| %>
@@ -49,3 +50,5 @@
   </tr>
   <% end -%>
 </table>
+<% end -%>
+
index 41d9d173532773edf1ecb086820687be4597ed34..917dbd4eea590d0ecbdec4da97361428e8783069 100644 (file)
@@ -9,8 +9,11 @@
   <% end %></span>
 </div>
 
+<% unless @election.election_method == method -%>
+<%= render :partial => 'result', :object => @results[method]%>
+<% end -%>
 <%= render :partial => 'methodinfo_' + method,
-           :object => @results[@election.election_method] %>
+           :object => @results[method] %>
 
 </div>
 
index c60ed3ddfc1cf90a31e10cddf936a2e2d4283fc7..773db655df2f999daf7f4f2c388c8a656233f002 100644 (file)
@@ -4,7 +4,7 @@
 <p>This election was run using:
 <strong><%= ELECTION_TYPES[@election.election_method] %></strong></p>
 
-<p>View results with other methods:<br />
+<p>View results using other methods:<br />
 <% type_hash = {}; ELECTION_TYPES.each {|k,v| type_hash[v] = k} %>
 <%= select_tag 'election_type_select', options_for_select(type_hash, @election.election_method) %></p>
 
@@ -34,4 +34,11 @@ Event.observe(method_select, 'change', show_results_for);
 
 <h2>Statistics</h2>
 <%= image_tag( graph_url( :action => 'votes_per_interval', :id => @election ))%>
+<br />
+<br />
+
+<h2>Voter Report</h2>
+
+<p><%= link_to "[Map/List of Voters]", :controller => "quickvote",
+       :action => "list_voters", :id => @election.id %></p>
 
index 856d74e154e3d2b0cd1bdca6159738e40dc8fdaf..d1018cf0a1da36563edf27d2f5fedf53b13bc06b 100644 (file)
@@ -3,6 +3,8 @@
        <span class="subheader"><%=h @voter.election.description.capitalize %></span>
 </div>
 
+<div class="clear-div"></div>
+
 <div class="main-content">
 
 <% if @voter.voted? %>
index ea276d7b6a7d50570ae059e5348ba82ca6b8b2ab..cdfc049ae28808cbd5331e63d3f0383b2ba3fdcd 100644 (file)
             end
             
             %>
-        <%=h((w.host == nil or w.host.empty?) ? voter.ipaddress : w.host)%>
+        <%=h((w.host == nil or w.host.empty?) ? voter.ipaddress : w.host.reverse.slice(0,30).reverse)%>
       </td>
       <td>
         <%org=(w.all.grep(/^(OrgName|org-name)/)[0] or "").sub(/^(OrgName|org-name)\:/,'').strip+" - "+ (w.all.grep(/^(NetName|netname)/)[0] or "").sub(/^(NetName|netname)\:/,'').strip %>
-        <% if org =~ /IANA/ %>
+        <% if org =~ /asdfasdf/ %>
           <%= "No additional information" %>
         <% else %>
           <%= h(org) %>
index 52810fe543d228a1b43391b82ddce41feffeab2f..4c91538992c3aa50850e009e28ccd8ac2d4c2d32 100644 (file)
@@ -25,7 +25,7 @@
 
 <p><strong>Number of voters:</strong></p>
    <blockquote>
-     <%= @election.voters.reject {|v| not v.voted? }.length %> (see below for details) 
+     <%= @election.voters.reject {|v| not v.voted? }.length %>
    </blockquote>
 
 <%= render :partial => 'result_box',
 
 <div class="clear-div"></div>
 
-<div class="normal-header">
-  <span class="header">Voter Report</span>
-  <span class="subheader"></span>
-</div>
-
-<p><%= link_to "[View All Voters]", :controller => "quickvote", :action => "list_voters", :id => @election.id %></p>
-<br />
-
 <!--
 <%= image_tag( graph_url( :action => 'choices_positions', :id => @election ) ) %><br />
 -->
diff --git a/app/views/voter/forgot_password.rhtml b/app/views/voter/forgot_password.rhtml
new file mode 100644 (file)
index 0000000..43d1d03
--- /dev/null
@@ -0,0 +1,12 @@
+<h4>Deleted your email? Lost your password?</h4>
+<p>Not to worry, enter the email at which you were supposed to receive your
+password, and we'll hook you up with a set of magic numbers that shall grant
+access to the chambers within. Hoo-rah!</p>
+
+<% form_tag :controller => 'election', :action => 'remind_voter' do %>
+
+  <p><span label for="email">Email</label></span>
+  <%= text_field_tag :email %></p>
+
+  <%= submit_tag "Submit" %>
+<% end -%>
diff --git a/app/views/voter_notify/reminder.rhtml b/app/views/voter_notify/reminder.rhtml
new file mode 100644 (file)
index 0000000..1373bc2
--- /dev/null
@@ -0,0 +1,17 @@
+Voter!
+
+Either you or an election administrator has requested you receive a reminder for an election you've been registered in.
+
+Here are the election(s) for which you are currently registered and your tokens to enter each election:
+<% @voter_array.each do |voter| -%>
+<%= voter.election.name %>: <%= voter.password %>
+<% end -%>
+
+
+If you feel there is a technical error, please contact:
+
+  help@selectricity.org
+  (Selectricity Tech Support)
+
+Thanks and happy voting!
+Selectricity Staff
index 216ddebf15b1df71b0b6a9b3ab838afa6d428a67..f9dbfc6c90c4cc56282be87e545ed97cb4a8da7a 100644 (file)
@@ -1,17 +1,17 @@
 Voter!
 
-This is an automated message sent by selectricity.media.mit.edu.
+This is an automated message sent by Selectricity.
 
 You have been listed as a voter in an upcoming election.
 
 The election title: <%= @voter.election.name %>
 
 To read more about the election, the candidates, and to vote, you will
-need to use the following token to log in to selectricity.media.mit.edu:
+need to use the following token to log in to Selectricity:
   <%= @voter.password %>
 
 Alternatively, you can just click this URL:
-  http://selectricity.media.mit.edu<%= url_for :controller => 'election', :action => 'show', :id => @voter.election %>
+  http://selectricity.org<%= url_for :controller => 'voter' %>
 
 If you have any questions or if you feel you have received this message
 in error, you should contact:
@@ -21,10 +21,9 @@ in error, you should contact:
 
 Alternatively, if you feel there is a technical error, please contact:
 
-  help@selectricity.media.mit.edu
+  help@selectricity.org
   (Selectricity Tech Support)
 
 Thanks and happy voting!
 Selectricity Staff
-  
-  
+
index ccd9ad0990874b6b4bb92d6260caa52a891b9982..3e5f1c6b4408031dbba3bdb81fd3401acbb3de00 100644 (file)
@@ -59,7 +59,7 @@ end
 
 # Include your application configuration below
 
-MAIL_CONFIG = { :from => 'Selectricity <info@selectricity.media.mit.edu>'} 
+MAIL_CONFIG = { :from => 'Selectricity <info@selectricity.org>'} 
 
 require 'uniq_token'
 require 'randarray'
index 6c038deadbd2983e1fb2073265ec989248421809..e7d7d85723b458caf478df16696688be794a469e 100644 (file)
@@ -42,6 +42,14 @@ ActiveRecord::Schema.define() do
     t.column "rank",         :integer
   end
 
+  create_table "sessions", :force => true do |t|
+    t.column "sessid",     :string
+    t.column "data",       :text
+    t.column "updated_at", :datetime
+  end
+
+  add_index "sessions", ["sessid"], :name => "session_index"
+
   create_table "sitealizer", :force => true do |t|
     t.column "path",       :string
     t.column "ip",         :string
index 7cc6e9d1eea43efef502e6ac0d4ea406f156b440..962a399c9283b4a12d054f0dcc6d2506d91caf23 100755 (executable)
@@ -130,7 +130,7 @@ module Whois
             if ip_range.include? self.ip and l[1].length > 0
               return Object.instance_eval("Server::#{l[1]}.new")
             end
-            return Server::Ripe.new
+            return Server::Arin.new
           end
         end
 
@@ -139,7 +139,7 @@ module Whois
           ipv6_list = YAML::load_file(File.dirname(__FILE__) + '/data/ipv6.yaml')
           server = server_with_hash(ipv6_list)
           unless server.kind_of? Server::Server
-            return Server::Ripe.new
+            return Server::Arin.new
           else
             return server
           end
index 13626a13bd67f4a807535390e38f603e9ef76c8c..16b10bfef028ed463ab08fae6dd91802b60b66cf 100644 (file)
@@ -274,14 +274,15 @@ li.moveable {
 }
 
 .preftable th {
+       font-family: verdana,arial,helvetica,sans-serif;
        border-width: 2px;
        border-color: #999999;
        border-style: solid;
        text-align: center;
        font-weight: bold;
-       padding: 5px 5px 5px 15px;
+       padding: 5px 5px 5px 5px;
        background-color: #999999;
-       color: #fff;
+       color: #FFFFFF;
 }
 
 .preftable td {
@@ -324,6 +325,17 @@ li.moveable {
   padding-left: 5px;
 }
 
+/* voterbox#election is used on user summary page */
+.voterbox#election { border-color: #990d13; }
+
+.voterbox#election th {
+        background-color: #dc0d13;
+        border-color: #dc0d13; 
+}
+       
+.voterbox#election td { border-color: #990d13;}
+
+
 .rbmoreinfo hr {
   width: 100%;
   height: 10px;

Benjamin Mako Hill || Want to submit a patch?