version 1.29, 2009/10/19 15:15:03
|
version 1.33, 2012/11/08 21:55:11
|
Line 110 ENDSCRIPT
|
Line 110 ENDSCRIPT
|
|
|
sub foil { |
sub foil { |
my $number=shift; |
my $number=shift; |
my %values=''; |
my (%values,%defaultvalues,%customvalues); |
|
%defaultvalues = &Apache::lonlocal::texthash( |
|
'unused' => 'Not shown, not used' |
|
); |
if ($qtype eq 'radio') { |
if ($qtype eq 'radio') { |
%values=('true' => 'True', 'false' => 'False'); |
%customvalues = &Apache::lonlocal::texthash( |
|
'true' => 'True', |
|
'false' => 'False' |
|
); |
} elsif ($qtype eq 'option') { |
} elsif ($qtype eq 'option') { |
%values=&evaloptionhash($qparms{$prefix.'options'}); |
%customvalues=&evaloptionhash($qparms{$prefix.'options'}); |
} |
} |
$values{'unused'}='Not shown, not used'; |
%values = (%defaultvalues,%customvalues); |
my $value=$qparms{$prefix.'value'.$number}; |
my $value=$qparms{$prefix.'value'.$number}; |
unless (defined($value)) { $value='unused'; } |
unless (defined($value)) { $value='unused'; } |
unless ($values{$value}) { $value='unused'; } |
unless ($values{$value}) { $value='unused'; } |
Line 128 sub foil {
|
Line 134 sub foil {
|
unless ($positions{$position}) { |
unless ($positions{$position}) { |
$position='random'; |
$position='random'; |
} |
} |
my $selectvalue=&Apache::loncommon::select_form |
my $selectvalue=&Apache::loncommon::select_form( |
($value,'value'.$number,%values); |
$value, |
my $selectposition=&Apache::loncommon::select_form |
'value'.$number, |
($position,'position'.$number,%positions); |
\%values); |
|
my $selectposition=&Apache::loncommon::select_form( |
|
$position, |
|
'position'.$number, |
|
{&Apache::lonlocal::texthash(%positions)}); |
my $text=$qparms{$prefix.'text'.$number}; |
my $text=$qparms{$prefix.'text'.$number}; |
my %lt=&Apache::lonlocal::texthash('foil' => 'Foil', |
my %lt=&Apache::lonlocal::texthash('foil' => 'Foil', |
'value' => 'Value', |
'value' => 'Value', |
Line 252 sub handler {
|
Line 262 sub handler {
|
$spell_header)); |
$spell_header)); |
if ($symb) { |
if ($symb) { |
my $title='<h1>'.&Apache::lonnet::gettitle($symb).'</h1>'; |
my $title='<h1>'.&Apache::lonnet::gettitle($symb).'</h1>'; |
my $displaylink = &get_parent_uri($symb); |
if (&get_parent_uri($symb)) { |
if ($displaylink ne '') { |
$r->print($title); |
my $functions=&Apache::lonhtmlcommon::start_funclist() |
|
.&Apache::lonhtmlcommon::add_item_funclist( |
|
'<a href="'.$displaylink.'">' |
|
.&mt('Student View').'</a>') |
|
.&Apache::lonhtmlcommon::end_funclist(); |
|
$r->print(&Apache::loncommon::head_subbox($functions) |
|
.$title); |
|
} else { |
} else { |
$r->print($title |
$r->print($title |
.'<p class="LC_error">' |
.'<p class="LC_error">' |
Line 284 sub handler {
|
Line 287 sub handler {
|
); |
); |
$r->print('<form name="simpleedit" method="post">'); |
$r->print('<form name="simpleedit" method="post">'); |
# Question Type |
# Question Type |
my %questiontypes=('radio' => |
my %questiontypes=( |
'1 out of N multiple choice (radio button)', |
'radio' => '1 out of N multiple choice (radio button)', |
'option' => 'Option response', |
'option' => 'Option Response', |
'string' => 'Short string response', |
'string' => 'Short string response', |
'essay' => 'Essay, open end', |
'essay' => 'Essay, open end', |
'numerical' => 'Numerical response'); |
'numerical' => 'Numerical Response'); |
$qtype=$qparms{$prefix.'questiontype'}; |
$qtype=$qparms{$prefix.'questiontype'}; |
unless (defined($qtype)) { $qtype='radio'; } |
unless (defined($qtype)) { $qtype='radio'; } |
unless ($questiontypes{$qtype}) { $qtype='radio'; } |
unless ($questiontypes{$qtype}) { $qtype='radio'; } |
$r->print( |
$r->print( |
'<fieldset style="width:400px;">' |
'<fieldset style="width:400px;">' |
.'<legend>'.&mt('Question Type').'</legend>' |
.'<legend>'.&mt('Question Type').'</legend>' |
.&Apache::loncommon::select_form |
.&Apache::loncommon::select_form( |
($qtype,'questiontype',%questiontypes) |
$qtype, |
|
'questiontype', |
|
{&Apache::lonlocal::texthash(%questiontypes)}) |
.'</fieldset>' |
.'</fieldset>' |
); |
); |
$r->print( |
$r->print( |
Line 318 sub handler {
|
Line 323 sub handler {
|
unless (defined($maxfoils)) { $maxfoils=10; } |
unless (defined($maxfoils)) { $maxfoils=10; } |
unless ($maxfoils=~/^\d+$/) { $maxfoils=10; } |
unless ($maxfoils=~/^\d+$/) { $maxfoils=10; } |
if ($maxfoils<=0) { $maxfoils=10; } |
if ($maxfoils<=0) { $maxfoils=10; } |
my %randomizes=('yes' => 'Display foils in random order', |
my %randomizes=( |
'no' => 'Display foils in order given'); |
'yes' => 'Display foils in random order', |
|
'no' => 'Display foils in order given'); |
my $randomize=$qparms{$prefix.'randomize'}; |
my $randomize=$qparms{$prefix.'randomize'}; |
unless (defined($randomize)) { $randomize='yes'; } |
unless (defined($randomize)) { $randomize='yes'; } |
unless ($randomizes{$randomize}) { $randomize='yes'; } |
unless ($randomizes{$randomize}) { $randomize='yes'; } |
Line 327 sub handler {
|
Line 333 sub handler {
|
'<table bgcolor="#00ee44" cellspacing="4" cellpadding="2" style="width:100%">'. |
'<table bgcolor="#00ee44" cellspacing="4" cellpadding="2" style="width:100%">'. |
'<tr><td>'.&mt('Max number of foils displayed'). |
'<tr><td>'.&mt('Max number of foils displayed'). |
': <input type="text" size="3" name="maxfoils" value="'.$maxfoils.'" /> '. |
': <input type="text" size="3" name="maxfoils" value="'.$maxfoils.'" /> '. |
&Apache::loncommon::select_form |
&Apache::loncommon::select_form( |
($randomize,'randomize',%randomizes). |
$randomize, |
|
'randomize', |
|
{&Apache::lonlocal::texthash(%randomizes)}). |
'</td></tr><tr><td bgcolor="#F0F0F0">'); |
'</td></tr><tr><td bgcolor="#F0F0F0">'); |
# Option Response: Options |
# Option Response: Options |
if ($qtype eq 'option') { |
if ($qtype eq 'option') { |
Line 341 sub handler {
|
Line 349 sub handler {
|
$options.'" />'.&mt('Add new option').': '. |
$options.'" />'.&mt('Add new option').': '. |
'<input type="text" name="newopt" size="15" />'. |
'<input type="text" name="newopt" size="15" />'. |
&mt('Delete an option').': '. |
&mt('Delete an option').': '. |
&Apache::loncommon::select_form('','delopt',('' => '',%optionshash)). |
&Apache::loncommon::select_form('','delopt',{'' => '',%optionshash}). |
'</td></tr><tr><td>'); |
'</td></tr><tr><td>'); |
} |
} |
# Foils |
# Foils |
Line 371 sub handler {
|
Line 379 sub handler {
|
$r->print( |
$r->print( |
'<table bgcolor="#00ee44" cellspacing="4" cellpadding="2" style="width:100%">'. |
'<table bgcolor="#00ee44" cellspacing="4" cellpadding="2" style="width:100%">'. |
'<tr><td><label>'.&mt('Correct answer').': <input type="text" size="20" name="stringanswer" value="'.$stringanswer.'" /></label> '. |
'<tr><td><label>'.&mt('Correct answer').': <input type="text" size="20" name="stringanswer" value="'.$stringanswer.'" /></label> '. |
&Apache::loncommon::select_form |
&Apache::loncommon::select_form( |
($stringtype,'stringtype',%stringtypes). |
$stringtype, |
|
'stringtype', |
|
{&Apache::lonlocal::texthash(%stringtypes)}). |
'</td></tr></table><br />'); |
'</td></tr></table><br />'); |
# Hint |
# Hint |
$r->print(&hint()); |
$r->print(&hint()); |
Line 403 sub handler {
|
Line 413 sub handler {
|
} |
} |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
|
|
1; |
1; |
__END__ |
__END__ |