version 1.32, 2010/06/06 02:40:35
|
version 1.37, 2014/12/15 00:50:20
|
Line 205 sub handler {
|
Line 205 sub handler {
|
my $weightprefix=$env{'request.course.id'}.'.'.$symb.'.'; |
my $weightprefix=$env{'request.course.id'}.'.'.$symb.'.'; |
|
|
# ---------------------------------------------------------- Anything to store? |
# ---------------------------------------------------------- Anything to store? |
|
my $storeresult; |
if (($symb) && (defined($env{'form.questiontype'}))) { |
if (($symb) && (defined($env{'form.questiontype'}))) { |
my %storecontent=(); |
my %storecontent=(); |
undef %storecontent; |
undef %storecontent; |
Line 218 sub handler {
|
Line 218 sub handler {
|
$env{'form.newopt'}=~s/\'/\\\'/g; |
$env{'form.newopt'}=~s/\'/\\\'/g; |
$curoptions{$env{'form.newopt'}}=$env{'form.newopt'}; |
$curoptions{$env{'form.newopt'}}=$env{'form.newopt'}; |
} |
} |
$env{'form.options'}="('".join("','",keys %curoptions)."')"; |
$env{'form.options'}="('".join("','",keys(%curoptions))."')"; |
} |
} |
$env{'form.hiddenparts'}='!'.$env{'form.questiontype'}; |
$env{'form.hiddenparts'}='!'.$env{'form.questiontype'}; |
foreach (keys %env) { |
foreach my $envkey (keys(%env)) { |
if ($_=~/^form\.(\w+)$/) { |
if ($envkey=~/^form\.(\w+)$/) { |
my $parm=$1; |
my $parm=$1; |
$storecontent{$prefix.$parm}=$env{'form.'.$parm}; |
$storecontent{$prefix.$parm}=$env{'form.'.$parm}; |
$storecontent{$prefix.$parm}=~s/^\s+//s; |
$storecontent{$prefix.$parm}=~s/^\s+//s; |
Line 247 sub handler {
|
Line 247 sub handler {
|
&Apache::lonnet::devalidatecourseresdata( |
&Apache::lonnet::devalidatecourseresdata( |
$env{'course.'.$env{'request.course.id'}.'.num'}, |
$env{'course.'.$env{'request.course.id'}.'.num'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}); |
$env{'course.'.$env{'request.course.id'}.'.domain'}); |
|
if ($reply eq 'ok') { |
|
if ($env{'form.forceview'}) { |
|
my $dest = &get_parent_uri($symb); |
|
if ($dest) { |
|
$r->internal_redirect($dest); |
|
return OK; |
|
} |
|
} |
|
} else { |
|
$storeresult = $reply; |
|
} |
} |
} |
# ------------------------------------------------------------------- Read Data |
# ------------------------------------------------------------------- Read Data |
|
|
Line 256 sub handler {
|
Line 266 sub handler {
|
$env{'course.'.$env{'request.course.id'}.'.num'}, |
$env{'course.'.$env{'request.course.id'}.'.num'}, |
$env{'request.course.id'}.'.'.$symb); |
$env{'request.course.id'}.'.'.$symb); |
|
|
|
my $js = <<"ENDJS"; |
|
|
|
<script type="text/javascript"> |
|
// <![CDATA[ |
|
|
|
function setForceView() { |
|
if (document.getElementById('spview')) { |
|
document.getElementById('spview').value = 1; |
|
} |
|
return true; |
|
} |
|
// END LON-CAPA Internal --> |
|
// ]]> |
|
</script> |
|
|
|
ENDJS |
|
|
# ------------------------------------------------------------ Print the screen |
# ------------------------------------------------------------ Print the screen |
my $spell_header=&Apache::lonhtmlcommon::spellheader(); |
my $spell_header=&Apache::lonhtmlcommon::spellheader(); |
$r->print(&Apache::loncommon::start_page('Simple Problem Editor', |
$r->print(&Apache::loncommon::start_page('Simple Problem Editor', |
$spell_header)); |
$spell_header.$js)); |
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() |
if ($storeresult) { |
.&Apache::lonhtmlcommon::add_item_funclist( |
$r->print('<p class="LC_error">'.&mt('An error: [_1] occurred saving your changes',$storeresult).'</p>'); |
'<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 292 sub handler {
|
Line 315 sub handler {
|
.&rawrendering($symb) |
.&rawrendering($symb) |
.'</div>' |
.'</div>' |
); |
); |
$r->print('<form name="simpleedit" method="post">'); |
$r->print('<form name="simpleedit" method="post" action="">'); |
# Question Type |
# Question Type |
my %questiontypes=( |
my %questiontypes=( |
'radio' => '1 out of N multiple choice (radio button)', |
'radio' => '1 out of N multiple choice (radio button)', |
Line 314 sub handler {
|
Line 337 sub handler {
|
); |
); |
$r->print( |
$r->print( |
'<p>' |
'<p>' |
|
.'<input type="hidden" name="forceview" value="" id="spview" />' |
.'<input type="submit" value="'.&mt('Save and Edit').'" />' |
.'<input type="submit" value="'.&mt('Save and Edit').'" />' |
|
.(' ' x3) |
|
.'<input type="submit" value="'.&mt('Save and View').'" onclick="javascript:setForceView();" />' |
.'</p>' |
.'</p>' |
); |
); |
# Script |
# Script |
Line 414 sub handler {
|
Line 440 sub handler {
|
} |
} |
# Store Button |
# Store Button |
$r->print( |
$r->print( |
'<input type="submit" value="'.&mt('Save and Edit').'" /></form>'); |
'<input type="submit" value="'.&mt('Save and Edit').'" />'. |
|
(' ' x3). |
|
'<input type="submit" value="'.&mt('Save and View').'" onclick="javascript:setForceView();" />'. |
|
'</form>'); |
} else { |
} else { |
$r->print(&mt('Could not identify problem.')); |
$r->print(&mt('Could not identify problem.')); |
} |
} |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
|
|
1; |
1; |
__END__ |
__END__ |