/[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.11 by dpavlin, Sat Oct 11 12:07:54 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 600  sub dropdown { Line 607  sub dropdown {
607          $$ncref = sub {          $$ncref = sub {
608                  my ($xp, $text) = @_;                  my ($xp, $text) = @_;
609    
610            my $default_value = x($attref->{default_value}) || 'null';
611            my $default_text = x($attref->{default_text}) || '-';
612                  if (defined $text) {                  if (defined $text) {
613                          chomp $text;                          chomp $text;
614                          $text=~s/^\s*//g;                          $text=~s/^\s*//g;
615                          $text=~s/^[\d\.\s]+//g;                          $text=~s/^[\d\.\s]+//g if ($remove_nrs_in_answers);
616                          $text=~s/\s*$//g;                          $text=~s/\s*$//g;
617                          push @dropdown_data,x($text) if ($text ne "");                          push @dropdown_data,x($text) if ($text ne "");
618                  } else {                  } else {
# Line 611  sub dropdown { Line 620  sub dropdown {
620                          my $id=1;                          my $id=1;
621                          my $p=new_pit();                          my $p=new_pit();
622                          $body.="<select name=$p >\n";                          $body.="<select name=$p >\n";
623                          $body.="<option value=null>-</option>\n";                          $body.="<option value=\"$default_value\">$default_text<option>\n";
624                          foreach $opt (@dropdown_data) {                          foreach $opt (@dropdown_data) {
625                                  if (defined($opt) && $opt ne "") {                                  if (defined($opt) && $opt ne "") {
626                                          $body.="<option value=$id>$opt</option>\n";                                          $body.="<option value=$id>$opt</option>\n";
# Line 671  sub radiobuttons { Line 680  sub radiobuttons {
680                  if (defined $text) {                  if (defined $text) {
681                          chomp $text;                          chomp $text;
682                          $text=~s/^\s*//g;                          $text=~s/^\s*//g;
683                          $text=~s/^[\d\.\s]+//g;                          $text=~s/^[\d\.\s]+//g if ($remove_nrs_in_answers);
684                          $text=~s/\s*$//g;                          $text=~s/\s*$//g;
685                          push @radiobuttons_data,x($text) if ($text ne "");                          push @radiobuttons_data,x($text) if ($text ne "");
686                  } else {                  } else {
# Line 716  sub checkboxes { Line 725  sub checkboxes {
725                  if (defined $text) {                  if (defined $text) {
726                          chomp $text;                          chomp $text;
727                          $text=~s/^\s*//g;                          $text=~s/^\s*//g;
728                          $text=~s/^[\d\.\s]+//g;                          $text=~s/^[\d\.\s]+//g if ($remove_nrs_in_answers);
729                          $text=~s/\s*$//g;                          $text=~s/\s*$//g;
730                          push @checkboxes_data,x($text) if ($text ne "");                          push @checkboxes_data,x($text) if ($text ne "");
731                  } else {                  } else {
# Line 769  sub config { Line 778  sub config {
778                  my ($xp, $text) = @_;                  my ($xp, $text) = @_;
779                  $db_user=x($attref->{db_user});                  $db_user=x($attref->{db_user});
780                  $prefix=x($attref->{prefix});                  $prefix=x($attref->{prefix});
781                  $without_invitation=x($attref->{without_invitation});                  $without_invitation=x($attref->{without_invitation}) &&
782                            print "Pool is without need for unique ID (and invitation URLs).\n";
783                    $remove_nrs_in_answers=x($attref->{$remove_nrs_in_answers}) &&
784                            print "Numbers before answers will be removed.\n";
785          }          }
786  }  }
787    

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

  ViewVC Help
Powered by ViewVC 1.1.26