--- loncom/homework/lonsimpleproblemedit.pm 2003/07/09 10:05:15 1.3
+++ loncom/homework/lonsimpleproblemedit.pm 2004/11/30 22:57:16 1.11
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Simple Problem Parameter Setting "Editor"
#
-# $Id: lonsimpleproblemedit.pm,v 1.3 2003/07/09 10:05:15 www Exp $
+# $Id: lonsimpleproblemedit.pm,v 1.11 2004/11/30 22:57:16 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -32,6 +32,7 @@ use strict;
use Apache::Constants qw(:common :http);
use Apache::loncommon;
use Apache::lonnet;
+use Apache::lonlocal;
my %qparms;
my $prefix;
@@ -49,29 +50,20 @@ sub evaloptionhash {
}
sub rawrendering {
- my ($request,$uri)=@_;
- my $problem=&Apache::lonnet::getfile
- (&Apache::lonnet::filelocation('',$uri));
- &Apache::lonnet::devalidatecourseresdata(
- $ENV{'course.'.$ENV{'request.course.id'}.'.num'},
- $ENV{'course.'.$ENV{'request.course.id'}.'.domain'});
- 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/^.*\
]*\>//si;
- $result=~s/\<\/body[^\>]*\>.*$//si;
- return $result;
+ my ($symb)=@_;
+ my %data=('show_errors'=>'on',
+ 'devalidatecourseresdata'=>'on');
+ return &Apache::loncommon::get_student_view($symb,time,time,
+ $ENV{'request.course.id'},
+ 'web',\%data);
}
sub questiontext {
my $text=$qparms{$prefix.'questiontext'};
+ my $qt=&mt('Question Text');
return (<
-Question Text
+ |
$qt
|
@@ -81,9 +73,10 @@ ENDQUESTION
sub hint {
my $text=$qparms{$prefix.'hinttext'};
+ my $ht=&mt('Hint Text');
return (<
-Hint Text
+ |
$ht
|
@@ -116,11 +109,16 @@ sub foil {
my $selectposition=&Apache::loncommon::select_form
($position,'position'.$number,%positions);
my $text=$qparms{$prefix.'text'.$number};
+ my %lt=&Apache::lonlocal::texthash('foil' => 'Foil',
+ 'value' => 'Value',
+ 'pos' => 'Position',
+ 'text' => 'Text');
+
return (<
-Foil |
-Value: $selectvalue | Position: $selectposition |
-Text:
+ |
$lt{'foil'} |
+$lt{'value'}: $selectvalue | $lt{'pos'}: $selectposition |
+$lt{'text'}:
|
@@ -132,17 +130,17 @@ sub handler {
my $r = shift;
if ($r->header_only) {
- $r->content_type('text/html');
+ &Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
return OK;
}
# -------------------------------------------------------------------- Allowed?
- unless (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) {
+ unless (&Apache::lonnet::allowed('mdc',$ENV{'request.course.id'})) {
return HTTP_NOT_ACCEPTABLE;
}
# ----------------------------------------------------------------- Send header
- $r->content_type('text/html');
+ &Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
# ----------------------------------------------------- Figure out where we are
my $uri=$r->uri;
@@ -167,6 +165,7 @@ sub handler {
}
$ENV{'form.options'}="('".join("','",keys %curoptions)."')";
}
+ $ENV{'form.hiddenparts'}='!'.$ENV{'form.questiontype'};
foreach (keys %ENV) {
if ($_=~/^form\.(\w+)$/) {
my $parm=$1;
@@ -198,7 +197,7 @@ ENDDOCUMENT
if ($symb) {
$r->print(''.&Apache::lonnet::gettitle($symb).'
');
$r->print(''.
- &rawrendering($r,$uri).
+ &rawrendering($symb).
' |
');
$r->print('