/[wopi]/make_poll.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /make_poll.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by dpavlin, Wed Sep 24 20:35:48 2003 UTC revision 1.12 by dpavlin, Sat Oct 11 15:47:33 2003 UTC
# Line 59  my $db_user="dpavlin"; Line 59  my $db_user="dpavlin";
59  # polls to be conducted by just publishing URL to them.  # polls to be conducted by just publishing URL to them.
60  my $without_invitation=0;  my $without_invitation=0;
61    
62    # This will remove numbers before answers. That enables you to have
63    # answers written like:
64    # 1.1 red
65    # 1.2 black
66    # and users will see just "red" and "black"
67    my $remove_nrs_in_answers=0;
68    
69  #------------------------------------------------------------------  #------------------------------------------------------------------
70    
71  sub suck_file {  sub suck_file {
# Line 597  sub dropdown { Line 604  sub dropdown {
604    
605          my @dropdown_data;          my @dropdown_data;
606    
607            my $default_value = x($attref->{default_value}) || 'null';
608            my $default_text = x($attref->{default_text}) || '-';
609    
610          $$ncref = sub {          $$ncref = sub {
611                  my ($xp, $text) = @_;                  my ($xp, $text) = @_;
612    
613                  if (defined $text) {                  if (defined $text) {
614                          chomp $text;                          chomp $text;
615                          $text=~s/^\s*//g;                          $text=~s/^\s*//g;
616                          $text=~s/^[\d\.\s]+//g;                          $text=~s/^[\d\.\s]+//g if ($remove_nrs_in_answers);
617                          $text=~s/\s*$//g;                          $text=~s/\s*$//g;
618                          push @dropdown_data,x($text) if ($text ne "");                          push @dropdown_data,x($text) if ($text ne "");
619                  } else {                  } else {
# Line 611  sub dropdown { Line 621  sub dropdown {
621                          my $id=1;                          my $id=1;
622                          my $p=new_pit();                          my $p=new_pit();
623                          $body.="<select name=$p >\n";                          $body.="<select name=$p >\n";
624                          $body.="<option value=null>-</option>\n";                          $body.="<option value=\"$default_value\">$default_text</option>\n";
625                          foreach $opt (@dropdown_data) {                          foreach $opt (@dropdown_data) {
626                                  if (defined($opt) && $opt ne "") {                                  if (defined($opt) && $opt ne "") {
627                                          $body.="<option value=$id>$opt</option>\n";                                          $body.="<option value=$id>$opt</option>\n";
# Line 671  sub radiobuttons { Line 681  sub radiobuttons {
681                  if (defined $text) {                  if (defined $text) {
682                          chomp $text;                          chomp $text;
683                          $text=~s/^\s*//g;                          $text=~s/^\s*//g;
684                          $text=~s/^[\d\.\s]+//g;                          $text=~s/^[\d\.\s]+//g if ($remove_nrs_in_answers);
685                          $text=~s/\s*$//g;                          $text=~s/\s*$//g;
686                          push @radiobuttons_data,x($text) if ($text ne "");                          push @radiobuttons_data,x($text) if ($text ne "");
687                  } else {                  } else {
# Line 716  sub checkboxes { Line 726  sub checkboxes {
726                  if (defined $text) {                  if (defined $text) {
727                          chomp $text;                          chomp $text;
728                          $text=~s/^\s*//g;                          $text=~s/^\s*//g;
729                          $text=~s/^[\d\.\s]+//g;                          $text=~s/^[\d\.\s]+//g if ($remove_nrs_in_answers);
730                          $text=~s/\s*$//g;                          $text=~s/\s*$//g;
731                          push @checkboxes_data,x($text) if ($text ne "");                          push @checkboxes_data,x($text) if ($text ne "");
732                  } else {                  } else {
# Line 769  sub config { Line 779  sub config {
779                  my ($xp, $text) = @_;                  my ($xp, $text) = @_;
780                  $db_user=x($attref->{db_user});                  $db_user=x($attref->{db_user});
781                  $prefix=x($attref->{prefix});                  $prefix=x($attref->{prefix});
782                  $without_invitation=x($attref->{without_invitation});                  $without_invitation=x($attref->{without_invitation}) &&
783                            print "Pool is without need for unique ID (and invitation URLs).\n";
784                    $remove_nrs_in_answers=x($attref->{$remove_nrs_in_answers}) &&
785                            print "Numbers before answers will be removed.\n";
786          }          }
787  }  }
788    

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.26