--- loncom/homework/structuretags.pm 2003/10/13 21:09:47 1.216
+++ loncom/homework/structuretags.pm 2003/11/06 06:54:51 1.225
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.216 2003/10/13 21:09:47 albertel Exp $
+# $Id: structuretags.pm,v 1.225 2003/11/06 06:54:51 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -171,8 +171,10 @@ sub setup_rndseed {
if (defined($rndseed) && $rndseed ne int($rndseed)) {
$rndseed=join(',',&Math::Random::random_seed_from_phrase($rndseed));
}
- &Apache::lonxml::debug("Setting rndseed to $rndseed");
- &Apache::run::run('$external::randomseed='.$rndseed.';',$safeeval);
+ if ($safeeval) {
+ &Apache::lonxml::debug("Setting rndseed to $rndseed");
+ &Apache::run::run('$external::randomseed='.$rndseed.';',$safeeval);
+ }
}
return $rndseed;
}
@@ -455,12 +457,12 @@ sub start_problem {
}
my $id = $Apache::inputtags::part;
my $weight = &Apache::lonnet::EXT("resource.$id.weight");
- my $allkeys=&Apache::lonnet::metadata($ENV{'request.uri'},'keys');
- my @allkeys = split /,/,$allkeys;
+ my $packages=&Apache::lonnet::metadata($ENV{'request.uri'},'packages');
+ my @packages = split /,/,$packages;
my $allow_print_points = 0;
- foreach my $partial_key (@allkeys) {
- if ($partial_key=~m/weight/) {
- $allow_print_points++;
+ foreach my $partial_key (@packages) {
+ if ($partial_key=~m/part_0/) {
+ $allow_print_points=1;
}
}
my $duedate = &Apache::lonnet::EXT("resource.$id.duedate");
@@ -946,7 +948,9 @@ sub start_part {
&Apache::run::run($expression,$safeeval);
if ($target eq 'meta') {
- return &Apache::response::mandatory_part_meta;
+ my $display=&Apache::lonxml::get_param('display',$parstack,$safeeval);
+ return &Apache::response::mandatory_part_meta.
+ &Apache::response::meta_parameter_write('display','string',$display,'Part Description');
} elsif ($target eq 'web' || $target eq 'grade' ||
$target eq 'answer' || $target eq 'tex') {
if ($hidden) {
@@ -978,7 +982,15 @@ sub start_part {
$result.='\noindent \end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent';
}
my $weight = &Apache::lonnet::EXT("resource.$id.weight");
- if ($Apache::lonhomework::type eq 'exam') { $result .= '\fbox{\textit{'.$weight.' pt}}';}
+ my $allkeys=&Apache::lonnet::metadata($ENV{'request.uri'},'keys');
+ my @allkeys = split /,/,$allkeys;
+ my $allow_print_points = 0;
+ foreach my $partial_key (@allkeys) {
+ if ($partial_key=~m/\_(\d*)\_weight/) {
+ if ($1 ne '0') {$allow_print_points=1;}
+ }
+ }
+ if (($Apache::lonhomework::type eq 'exam') && ($allow_print_points)) { $result .= '\fbox{\textit{'.$weight.' pt}}';}
}
}
}
@@ -986,11 +998,15 @@ sub start_part {
$result.=&Apache::edit::tag_start($target,$token);
$result.=&Apache::edit::text_arg('Part ID:','id',$token).
&Apache::loncommon::help_open_topic("Part_Tag_Edit_Help").
+ ' '.
+&Apache::edit::text_arg('Displayed Part Description:','display',$token).
&Apache::edit::end_row().&Apache::edit::start_spanning_row();
} elsif ($target eq 'modified') {
my $constructtag=&Apache::edit::get_new_args($token,$parstack,
- $safeeval,'id');
+ $safeeval,'id','display');
if ($constructtag) {
+ #limiting ids to only letters numbers, and space
+ $token->[2]->{'id'}=~s/[^A-Za-z0-9 ]//gs;
$result = &Apache::edit::rebuild_tag($token);
$result.=&Apache::edit::handle_insert();
}
@@ -1115,8 +1131,7 @@ sub end_startouttext {
&Apache::edit::editfield($token->[1],$text,"",80,4);
}
if ($target eq 'modified') {
- $text=&Apache::lonxml::get_all_text("endouttext",$parser);
- $result='
'. ''.&mt('Simple Problem Editor').' - '.&mt('Note: it can take up to 10 minutes for changes to take effect for all users.'). |