Index: openacs-4/packages/oct-election/oct-election.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/oct-election/oct-election.info,v diff -u -r1.3.2.1 -r1.3.2.2 --- openacs-4/packages/oct-election/oct-election.info 7 Nov 2005 19:51:49 -0000 1.3.2.1 +++ openacs-4/packages/oct-election/oct-election.info 17 Nov 2006 15:10:27 -0000 1.3.2.2 @@ -8,12 +8,15 @@ f oct-election - + Joel Aufrecht Web app for voting in OCT elections. + + + Index: openacs-4/packages/oct-election/sql/postgresql/oct-election-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/oct-election/sql/postgresql/oct-election-create.sql,v diff -u -r1.1.1.1 -r1.1.1.1.4.1 --- openacs-4/packages/oct-election/sql/postgresql/oct-election-create.sql 14 May 2005 19:49:49 -0000 1.1.1.1 +++ openacs-4/packages/oct-election/sql/postgresql/oct-election-create.sql 17 Nov 2006 15:10:27 -0000 1.1.1.1.4.1 @@ -5,7 +5,8 @@ end_time timestamptz, vote_forum_cutoff timestamptz, number_of_candidates integer, - label varchar(100) + label varchar(100), + cvs_history_days integer ); create table oct_candidate ( Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/oct-election/sql/postgresql/upgrade/upgrade-1.0.1-1.0.2.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/oct-election/tcl/oct-election-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/oct-election/tcl/oct-election-procs.tcl,v diff -u -r1.1.1.1.4.1 -r1.1.1.1.4.2 --- openacs-4/packages/oct-election/tcl/oct-election-procs.tcl 7 Nov 2005 19:51:49 -0000 1.1.1.1.4.1 +++ openacs-4/packages/oct-election/tcl/oct-election-procs.tcl 17 Nov 2006 15:10:28 -0000 1.1.1.1.4.2 @@ -54,13 +54,40 @@ set text "You are not a valid voter for this election because you have not posted at least twice in the OpenACS forums since $pretty_vote_forum_cutoff. See OpenACS Governance" return [list $status $text] } - + + #Checking CVS commit history + set cvs_user [acs_user::get_element -user_id $user_id -element username] + set cvs_history_days [db_string get_cvs_days { + select cvs_history_days + from oct_election + where election_id = :election_id + } ] + if {$cvs_history_days eq 0} { + set cvs_history_days "all" + } + set service_url "http://xarg.net/tools/cvs/rss/?user=$cvs_user&days=$days" + if {![catch { + set commit_info [ns_httpget $service_url] + } errmsg] } { + set doc [dom parse $commit_info] + set root_node [$doc documentElement] + set commits [llength [$root_node selectNodes /rss/channel/item]] + if {!$commits} { + set status 0 + set text "You are not a valid voter for this election because you have not committed in the CVS Repository in the last $cvs_history_days. See OpenACS Governance" + return [list $status $text] + } + } else { + set status 0 + set text "We can not confirm your commit history in our CVS Repository, so you can not vote at this moment." + return [list $status $text] + } + if {!$past_start_p} { set status 0 set text "The election will not begin until [lc_time_fmt $start_time %c]" return [list $status $text] } - if {$past_end_p} { set status 0 set text "The election ended at [lc_time_fmt $end_time %c]" Index: openacs-4/packages/oct-election/www/election-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/oct-election/www/election-edit.tcl,v diff -u -r1.2.2.1 -r1.2.2.2 --- openacs-4/packages/oct-election/www/election-edit.tcl 7 Nov 2005 19:51:49 -0000 1.2.2.1 +++ openacs-4/packages/oct-election/www/election-edit.tcl 17 Nov 2006 15:10:29 -0000 1.2.2.2 @@ -15,6 +15,7 @@ {start_time:text {label "Start Time (2005-04-01 10:00PST)"}} {end_time:text {label "End Time"}} {vote_forum_cutoff:text {label "Forum Posting cutoff date (2005-04-01 10:00PST)"}} + {cvs_history_days:text {label "Number of days for checking Commit History"}} {number_of_candidates:integer {label "Number of Candidates"}} } -new_request { auth::require_login @@ -31,6 +32,7 @@ end_time, label, vote_forum_cutoff, + cvs_history_days, number_of_candidates from oct_election where election_id = :election_id; @@ -40,17 +42,18 @@ } -new_data { db_dml create_election { insert into oct_election - (start_time, end_time, number_of_candidates, vote_forum_cutoff, label) - values (:start_time, :end_time, :number_of_candidates, :vote_forum_cutoff, :label); + (start_time, end_time, number_of_candidates, vote_forum_cutoff, label, cvs_history_days) + values (:start_time, :end_time, :number_of_candidates, :vote_forum_cutoff, :label, :cvs_history_days); } } -edit_data { db_dml update_election { update oct_election set start_time = :start_time, end_time = :end_time, vote_forum_cutoff = :vote_forum_cutoff, + cvs_history_days = :cvs_history_days, number_of_candidates = :number_of_candidates, - label = :label + label = :label where election_id = :election_id} ad_returnredirect [export_vars -base election {election_id}] } Index: openacs-4/packages/oct-election/www/election.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/oct-election/www/election.adp,v diff -u -r1.2.2.1 -r1.2.2.2 --- openacs-4/packages/oct-election/www/election.adp 7 Nov 2005 19:51:49 -0000 1.2.2.1 +++ openacs-4/packages/oct-election/www/election.adp 17 Nov 2006 15:10:29 -0000 1.2.2.2 @@ -7,6 +7,7 @@

Start time: @pretty_start_time@

End time: @pretty_end_time@

Forum cutoff date: @pretty_vote_forum_cutoff@ +

Check CVS Commit History for the las @cvs_history_days@ days

Ballots: @ballot_count@

Edit

Index: openacs-4/packages/oct-election/www/election.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/oct-election/www/election.tcl,v diff -u -r1.3.2.2 -r1.3.2.3 --- openacs-4/packages/oct-election/www/election.tcl 16 May 2006 04:14:55 -0000 1.3.2.2 +++ openacs-4/packages/oct-election/www/election.tcl 17 Nov 2006 15:10:29 -0000 1.3.2.3 @@ -16,6 +16,7 @@ vote_forum_cutoff, number_of_candidates, label, + cvs_history_days, (case when now() > start_time then 1 else 0 end) as past_start_p, (case when now() > end_time then 1 else 0 end) as past_end_p from oct_election Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/oct-election/www/find-match-cvs-users-2.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/oct-election/www/find-match-cvs-users-2.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/oct-election/www/find-match-cvs-users.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/oct-election/www/find-match-cvs-users.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/oct-election/www/match-cvs-users-2.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/oct-election/www/match-cvs-users.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/oct-election/www/match-cvs-users.tcl'. Fisheye: No comparison available. Pass `N' to diff?