version 1.6, 2003/09/21 21:40:06
|
version 1.11, 2004/11/30 22:57:16
|
Line 50 sub evaloptionhash {
|
Line 50 sub evaloptionhash {
|
} |
} |
|
|
sub rawrendering { |
sub rawrendering { |
my ($request,$uri)=@_; |
my ($symb)=@_; |
my $problem=&Apache::lonnet::getfile |
my %data=('show_errors'=>'on', |
(&Apache::lonnet::filelocation('',$uri)); |
'devalidatecourseresdata'=>'on'); |
&Apache::lonnet::devalidatecourseresdata( |
return &Apache::loncommon::get_student_view($symb,time,time, |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}, |
$ENV{'request.course.id'}, |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}); |
'web',\%data); |
my $uname=$ENV{'user.name'}; |
|
my $udom=$ENV{'user.domain'}; |
|
$ENV{'user.name'}=time; |
|
$ENV{'user.domain'}=time; |
|
my $result = &Apache::lonxml::xmlparse($request,'web', $problem); |
|
$ENV{'user.name'}=$uname; |
|
$ENV{'user.domain'}=$udom; |
|
$result=~s/^.*\<body[^\>]*\>//si; |
|
$result=~s/\<\/body[^\>]*\>.*$//si; |
|
return $result; |
|
} |
} |
|
|
sub questiontext { |
sub questiontext { |
my $text=$qparms{$prefix.'questiontext'}; |
my $text=$qparms{$prefix.'questiontext'}; |
|
my $qt=&mt('Question Text'); |
return (<<ENDQUESTION); |
return (<<ENDQUESTION); |
<table bgcolor="#dddd22" cellspacing="4" cellpadding="2"> |
<table bgcolor="#dddd22" cellspacing="4" cellpadding="2"> |
<tr><td><b>Question Text</b><br /> |
<tr><td><b>$qt</b><br /> |
<textarea name="questiontext" cols="80" rows="8">$text</textarea> |
<textarea name="questiontext" cols="80" rows="8">$text</textarea> |
</td></tr> |
</td></tr> |
</table> |
</table> |
Line 82 ENDQUESTION
|
Line 73 ENDQUESTION
|
|
|
sub hint { |
sub hint { |
my $text=$qparms{$prefix.'hinttext'}; |
my $text=$qparms{$prefix.'hinttext'}; |
|
my $ht=&mt('Hint Text'); |
return (<<ENDHINT); |
return (<<ENDHINT); |
<table bgcolor="#accacc" cellspacing="4" cellpadding="2"> |
<table bgcolor="#accacc" cellspacing="4" cellpadding="2"> |
<tr><td><b>Hint Text</b><br /> |
<tr><td><b>$ht</b><br /> |
<textarea name="hinttext" cols="80" rows="4">$text</textarea> |
<textarea name="hinttext" cols="80" rows="4">$text</textarea> |
</td></tr> |
</td></tr> |
</table> |
</table> |
Line 117 sub foil {
|
Line 109 sub foil {
|
my $selectposition=&Apache::loncommon::select_form |
my $selectposition=&Apache::loncommon::select_form |
($position,'position'.$number,%positions); |
($position,'position'.$number,%positions); |
my $text=$qparms{$prefix.'text'.$number}; |
my $text=$qparms{$prefix.'text'.$number}; |
|
my %lt=&Apache::lonlocal::texthash('foil' => 'Foil', |
|
'value' => 'Value', |
|
'pos' => 'Position', |
|
'text' => 'Text'); |
|
|
return (<<ENDFOIL); |
return (<<ENDFOIL); |
<table bgcolor="#dd55ff" cellspacing="4" cellpadding="2"> |
<table bgcolor="#dd55ff" cellspacing="4" cellpadding="2"> |
<tr><td colspan="2"><b>Foil</b></td></tr> |
<tr><td colspan="2"><b>$lt{'foil'}</b></td></tr> |
<tr><td>Value: $selectvalue</td><td>Position: $selectposition</td></tr> |
<tr><td>$lt{'value'}: $selectvalue</td><td>$lt{'pos'}: $selectposition</td></tr> |
<tr><td colspan="2">Text:<br /> |
<tr><td colspan="2">$lt{'text'}:<br /> |
<textarea name="text$number" cols="80" rows="4">$text</textarea> |
<textarea name="text$number" cols="80" rows="4">$text</textarea> |
</td></tr> |
</td></tr> |
</table> |
</table> |
Line 168 sub handler {
|
Line 165 sub handler {
|
} |
} |
$ENV{'form.options'}="('".join("','",keys %curoptions)."')"; |
$ENV{'form.options'}="('".join("','",keys %curoptions)."')"; |
} |
} |
|
$ENV{'form.hiddenparts'}='!'.$ENV{'form.questiontype'}; |
foreach (keys %ENV) { |
foreach (keys %ENV) { |
if ($_=~/^form\.(\w+)$/) { |
if ($_=~/^form\.(\w+)$/) { |
my $parm=$1; |
my $parm=$1; |
Line 199 ENDDOCUMENT
|
Line 197 ENDDOCUMENT
|
if ($symb) { |
if ($symb) { |
$r->print('<h1>'.&Apache::lonnet::gettitle($symb).'</h1>'); |
$r->print('<h1>'.&Apache::lonnet::gettitle($symb).'</h1>'); |
$r->print('<table border="2" bgcolor="#FFFFFF" width="100%"><tr><td>'. |
$r->print('<table border="2" bgcolor="#FFFFFF" width="100%"><tr><td>'. |
&rawrendering($r,$uri). |
&rawrendering($symb). |
'</td></tr></table><br />'); |
'</td></tr></table><br />'); |
$r->print('<form method="post">'); |
$r->print('<form method="post">'); |
# Question Type |
# Question Type |
Line 211 ENDDOCUMENT
|
Line 209 ENDDOCUMENT
|
$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('<b>Question Type: '.&Apache::loncommon::select_form |
$r->print('<b>'.&mt('Question Type'). |
|
': '.&Apache::loncommon::select_form |
($qtype,'questiontype',%questiontypes). |
($qtype,'questiontype',%questiontypes). |
'</b><br /><input type="submit" value="'.&mt('Store Changes'). |
'</b><br /><input type="submit" value="'.&mt('Store Changes'). |
'" /><p> </p>'); |
'" /><p> </p>'); |
Line 244 ENDDOCUMENT
|
Line 243 ENDDOCUMENT
|
$r->print( |
$r->print( |
'<table bgcolor="#ffcc22" cellspacing="4" cellpadding="2">'. |
'<table bgcolor="#ffcc22" cellspacing="4" cellpadding="2">'. |
'<tr><td><input type="hidden" name="options" value="'. |
'<tr><td><input type="hidden" name="options" value="'. |
$options.'" />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)). |