23 |
my $poll; |
my $poll; |
24 |
my $dowarn = 1; |
my $dowarn = 1; |
25 |
|
|
26 |
my $question_nr = 0; # curr. question |
my $q_type = "q"; # q=question, u=unnumbered question |
27 |
|
my %question_nr; # curr. question numbers |
28 |
my $question_tag = ""; # originalni oblik broja questions |
my $question_tag = ""; # originalni oblik broja questions |
29 |
my $page_nr = 1; # prvo question na strani |
my $page_nr = 1; # prvo question na strani |
30 |
|
|
102 |
|
|
103 |
); |
); |
104 |
|
|
105 |
|
# name of database colums |
106 |
|
# for questions |
107 |
|
my $q_db_col = "q"; |
108 |
|
# for unnumbered questions |
109 |
|
my $u_db_col = "u"; |
110 |
|
|
111 |
|
|
112 |
#------------------------------------------------------------------ |
#------------------------------------------------------------------ |
113 |
|
|
114 |
sub suck_file { |
sub suck_file { |
289 |
|
|
290 |
# return unique name of question |
# return unique name of question |
291 |
sub new_que { |
sub new_que { |
292 |
my $out="p".$question_nr; |
my $out=$q_type.( $question_nr{$q_type} || 0 ); |
293 |
$out .= "_".$p_suffix if ($p_suffix); |
$out .= "_".$p_suffix if ($p_suffix); |
294 |
$curr_suffix=$p_suffix; |
$curr_suffix=$p_suffix; |
295 |
$p_suffix++; |
$p_suffix++; |
298 |
|
|
299 |
# current question |
# current question |
300 |
sub curr_que { |
sub curr_que { |
301 |
return "p".$question_nr.$curr_suffix; |
return $q_type.( $question_nr{$q_type} || 0 ).$curr_suffix; |
302 |
} |
} |
303 |
|
|
304 |
#---------------------------------------------------------- |
#---------------------------------------------------------- |
532 |
chomp $text; |
chomp $text; |
533 |
$question_tag .= x($text); |
$question_tag .= x($text); |
534 |
} else { |
} else { |
535 |
$question_nr = $question_tag; |
$question_nr{$q_type} = $question_tag; |
536 |
$question_nr =~ s/[^0-9a-zA-Z]//g; |
$question_nr{$q_type} =~ s/[^0-9a-zA-Z]//g; |
537 |
print "$question_nr "; |
print "$question_nr{$q_type} "; |
538 |
} |
} |
539 |
$p_suffix=""; |
$p_suffix=""; |
540 |
}; |
}; |
550 |
|
|
551 |
my ($xp, $el, $attref, $ncref) = @_; |
my ($xp, $el, $attref, $ncref) = @_; |
552 |
|
|
553 |
|
my $nonum = x($attref->{unnumbered}); |
554 |
|
if ($nonum) { |
555 |
|
$q_type = $u_db_col; # unnumbered questions |
556 |
|
} else { |
557 |
|
$q_type = $q_db_col; |
558 |
|
} |
559 |
|
|
560 |
|
$question_nr{$q_type}++; |
561 |
|
|
562 |
$body.=$html{'que_before'} if ($html{'que_before'}); |
$body.=$html{'que_before'} if ($html{'que_before'}); |
563 |
|
|
564 |
$$ncref = sub { |
$$ncref = sub { |
691 |
$$ncref = sub { |
$$ncref = sub { |
692 |
my ($xp, $text) = @_; |
my ($xp, $text) = @_; |
693 |
if (! defined $text) { |
if (! defined $text) { |
694 |
my $nr=$attref->{nr}; |
my $nr=$attref->{nr} || die "need <radiobuttons_tab nr=\"999\"> for number of buttons"; |
695 |
|
# shownumbers="before|after" |
696 |
|
my $shownumbers=lc(x($attref->{shownumbers})) || 'no'; |
697 |
my $p=new_que(); |
my $p=new_que(); |
698 |
for (my $i=1; $i<=$nr; $i++) { |
for (my $i=1; $i<=$nr; $i++) { |
699 |
$body.="<td><input type=radio name=$p value=$i></td> "; |
$body.="<td>"; |
700 |
|
$body.=$i if ($shownumbers eq "before"); |
701 |
|
$body.="<input type=radio name=$p value=$i>"; |
702 |
|
$body.=$i if ($shownumbers eq "after"); |
703 |
|
$body.="</td> "; |
704 |
} |
} |
705 |
push @sql_create,"$p int4"; |
push @sql_create,"$p int4"; |
706 |
push @sql_update,"$p=\$$p"; |
push @sql_update,"$p=\$$p"; |
886 |
$html{$file} = suck_file($include_files{$file}); |
$html{$file} = suck_file($include_files{$file}); |
887 |
} |
} |
888 |
} |
} |
889 |
|
$q_db_col=x($attref->{q_db_col}) || 'q'; |
890 |
|
$u_db_col=x($attref->{u_db_col}) || 'u'; |
891 |
|
|
892 |
} |
} |
893 |
} |
} |