version 1.216, 2003/10/13 21:09:47
|
version 1.226, 2003/11/21 20:21:20
|
Line 171 sub setup_rndseed {
|
Line 171 sub setup_rndseed {
|
if (defined($rndseed) && $rndseed ne int($rndseed)) { |
if (defined($rndseed) && $rndseed ne int($rndseed)) { |
$rndseed=join(',',&Math::Random::random_seed_from_phrase($rndseed)); |
$rndseed=join(',',&Math::Random::random_seed_from_phrase($rndseed)); |
} |
} |
&Apache::lonxml::debug("Setting rndseed to $rndseed"); |
if ($safeeval) { |
&Apache::run::run('$external::randomseed='.$rndseed.';',$safeeval); |
&Apache::lonxml::debug("Setting rndseed to $rndseed"); |
|
&Apache::run::run('$external::randomseed='.$rndseed.';',$safeeval); |
|
} |
} |
} |
return $rndseed; |
return $rndseed; |
} |
} |
Line 455 sub start_problem {
|
Line 457 sub start_problem {
|
} |
} |
my $id = $Apache::inputtags::part; |
my $id = $Apache::inputtags::part; |
my $weight = &Apache::lonnet::EXT("resource.$id.weight"); |
my $weight = &Apache::lonnet::EXT("resource.$id.weight"); |
my $allkeys=&Apache::lonnet::metadata($ENV{'request.uri'},'keys'); |
my $packages=&Apache::lonnet::metadata($ENV{'request.uri'},'packages'); |
my @allkeys = split /,/,$allkeys; |
my @packages = split /,/,$packages; |
my $allow_print_points = 0; |
my $allow_print_points = 0; |
foreach my $partial_key (@allkeys) { |
foreach my $partial_key (@packages) { |
if ($partial_key=~m/weight/) { |
if ($partial_key=~m/part_0/) { |
$allow_print_points++; |
$allow_print_points=1; |
} |
} |
} |
} |
my $duedate = &Apache::lonnet::EXT("resource.$id.duedate"); |
my $duedate = &Apache::lonnet::EXT("resource.$id.duedate"); |
Line 501 sub start_problem {
|
Line 503 sub start_problem {
|
} elsif ($target eq 'edit') { |
} elsif ($target eq 'edit') { |
$result.=$head_tag_start."</head>".$body_tag_start.$form_tag_start. |
$result.=$head_tag_start."</head>".$body_tag_start.$form_tag_start. |
&problem_edit_header(); |
&problem_edit_header(); |
|
$Apache::lonxml::warnings_error_header= |
|
&mt("Editor Errors - these errors might not effect the running of the problem, but they will likely cause problems with further use of the Edit mode. Please use the EditXML mode to fix these errors.")."<br />"; |
my $temp=&Apache::edit::insertlist($target,$token); |
my $temp=&Apache::edit::insertlist($target,$token); |
$result.=$temp; |
$result.=$temp; |
} elsif ($target eq 'modified') { |
} elsif ($target eq 'modified') { |
Line 946 sub start_part {
|
Line 950 sub start_part {
|
&Apache::run::run($expression,$safeeval); |
&Apache::run::run($expression,$safeeval); |
|
|
if ($target eq 'meta') { |
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' || |
} elsif ($target eq 'web' || $target eq 'grade' || |
$target eq 'answer' || $target eq 'tex') { |
$target eq 'answer' || $target eq 'tex') { |
if ($hidden) { |
if ($hidden) { |
Line 978 sub start_part {
|
Line 984 sub start_part {
|
$result.='\noindent \end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent'; |
$result.='\noindent \end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent'; |
} |
} |
my $weight = &Apache::lonnet::EXT("resource.$id.weight"); |
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}}';} |
} |
} |
} |
} |
} |
} |
Line 986 sub start_part {
|
Line 1000 sub start_part {
|
$result.=&Apache::edit::tag_start($target,$token); |
$result.=&Apache::edit::tag_start($target,$token); |
$result.=&Apache::edit::text_arg('Part ID:','id',$token). |
$result.=&Apache::edit::text_arg('Part ID:','id',$token). |
&Apache::loncommon::help_open_topic("Part_Tag_Edit_Help"). |
&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(); |
&Apache::edit::end_row().&Apache::edit::start_spanning_row(); |
} elsif ($target eq 'modified') { |
} elsif ($target eq 'modified') { |
my $constructtag=&Apache::edit::get_new_args($token,$parstack, |
my $constructtag=&Apache::edit::get_new_args($token,$parstack, |
$safeeval,'id'); |
$safeeval,'id','display'); |
if ($constructtag) { |
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::rebuild_tag($token); |
$result.=&Apache::edit::handle_insert(); |
$result.=&Apache::edit::handle_insert(); |
} |
} |
Line 1115 sub end_startouttext {
|
Line 1133 sub end_startouttext {
|
&Apache::edit::editfield($token->[1],$text,"",80,4); |
&Apache::edit::editfield($token->[1],$text,"",80,4); |
} |
} |
if ($target eq 'modified') { |
if ($target eq 'modified') { |
$text=&Apache::lonxml::get_all_text("endouttext",$parser); |
$result='<startouttext />'.&Apache::edit::modifiedfield("endouttext",$parser); |
$result='<startouttext />'.&Apache::edit::modifiedfield(); |
|
} |
} |
if ($target eq 'tex') { |
if ($target eq 'tex') { |
$result .= '\noindent '; |
$result .= '\noindent '; |
Line 1160 sub start_simpleeditbutton {
|
Line 1177 sub start_simpleeditbutton {
|
my $result=''; |
my $result=''; |
if (($target eq 'web') && |
if (($target eq 'web') && |
(&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) { |
(&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) { |
my $url=$ENV{'REQUEST_URI'}; |
my $url=$ENV{'request.noversionuri'}; |
$url=~s/\?.*$//; |
$url=~s/\?.*$//; |
$result='<table width="100%" bgcolor="#FFFFAA" border="2"><tr><td>'. |
$result='<table width="100%" bgcolor="#FFFFAA" border="2"><tr><td>'. |
'<a href="'.$url.'/smpedit">'.&mt('Simple Problem Editor').'</a> - '.&mt('Note: it can take up to 10 minutes for changes to take effect for all users.'). |
'<a href="'.$url.'/smpedit">'.&mt('Simple Problem Editor').'</a> - '.&mt('Note: it can take up to 10 minutes for changes to take effect for all users.'). |