version 1.149, 2008/11/24 18:55:01
|
version 1.155, 2010/05/26 12:22:54
|
Line 44 BEGIN {
|
Line 44 BEGIN {
|
'window','display','storetc','physnet', |
'window','display','storetc','physnet', |
'standalone','comment','num','parse','algebra', |
'standalone','comment','num','parse','algebra', |
'LONCAPA_INTERNAL_TURN_STYLE_ON', |
'LONCAPA_INTERNAL_TURN_STYLE_ON', |
'LONCAPA_INTERNAL_TURN_STYLE_OFF', |
'LONCAPA_INTERNAL_TURN_STYLE_OFF')); |
'LONCAPA_INTERNAL_LONHTTPD_PORT')); |
|
} |
} |
|
|
sub start_LONCAPA_INTERNAL_TURN_STYLE_ON { |
sub start_LONCAPA_INTERNAL_TURN_STYLE_ON { |
Line 81 sub end_LONCAPA_INTERNAL_TURN_STYLE_OFF
|
Line 80 sub end_LONCAPA_INTERNAL_TURN_STYLE_OFF
|
return ('','no'); |
return ('','no'); |
} |
} |
|
|
sub start_LONCAPA_INTERNAL_LONHTTPD_PORT { |
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
|
if ($target eq 'web' || $target eq 'webgrade') { |
|
return '<script type="text/javascript">var lonhttpdport=\''. |
|
&Apache::loncommon::lonhttpd_port().'\';</script>'; |
|
} |
|
return ('','no'); |
|
} |
|
|
|
sub end_LONCAPA_INTERNAL_LONHTTPD_PORT { |
|
return ('','no'); |
|
} |
|
|
|
sub start_script { |
sub start_script { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
@Apache::scripttag::parser_env = @_; |
@Apache::scripttag::parser_env = @_; |
Line 386 sub start_import {
|
Line 372 sub start_import {
|
my $bodytext=$$parser[$#$parser]->get_text("/import"); |
my $bodytext=$$parser[$#$parser]->get_text("/import"); |
my $result =""; |
my $result =""; |
|
|
$bodytext=Apache::run::evaluate($bodytext,$safeeval,$$parstack[$#$parstack]); |
$bodytext=&Apache::run::evaluate($bodytext,$safeeval,$$parstack[$#$parstack]); |
|
|
if ($target eq 'web' || $target eq 'webgrade' || $target eq 'grade' |
if ($target eq 'web' || $target eq 'webgrade' || $target eq 'grade' |
|| $target eq 'answer' || $target eq 'tex' || $target eq 'analyze' ) { |
|| $target eq 'answer' || $target eq 'tex' || $target eq 'analyze' ) { |
Line 398 sub start_import {
|
Line 384 sub start_import {
|
&Apache::lonxml::error("<b> Unable to find <i>$bodytext as $location</i> for import</b>"); |
&Apache::lonxml::error("<b> Unable to find <i>$bodytext as $location</i> for import</b>"); |
return ""; |
return ""; |
} |
} |
|
my $importmode=&Apache::lonxml::get_param('importmode',$parstack,$safeeval); |
|
if (($importmode eq 'problem') || ($importmode eq 'part')) { |
|
# We are using import to import published problems |
|
if (($importmode eq 'problem') || ($file=~/<part[^<]*>/s)) { |
|
# We explicitly don't want this to be a separate part or the problem already has parts |
|
$file=~s/^\s*<problem>/<library>/s; |
|
$file=~s/<\/problem>\s*$/<\/library>/s; |
|
} else { |
|
# We want this to be a separate part, but it currently is not |
|
$file=~s/^\s*<problem>/<library><part>/s; |
|
$file=~s/<\/problem>\s*$/<\/part><\/library>/s; |
|
} |
|
} |
my $dir=$location; |
my $dir=$location; |
$dir=~s:/[^/]*$::; |
$dir=~s:/[^/]*$::; |
# &Apache::lonxml::debug("directory $dir $location file $file \n<b>END</b>\n"); |
# &Apache::lonxml::debug("directory $dir $location file $file \n<b>END</b>\n"); |
Line 411 sub start_import {
|
Line 409 sub start_import {
|
|
|
} elsif ($target eq "edit" ) { |
} elsif ($target eq "edit" ) { |
$result.=&Apache::edit::tag_start($target,$token); |
$result.=&Apache::edit::tag_start($target,$token); |
$result.=&Apache::edit::editline($token->[1],$bodytext,'',40); |
my $location=$token->[1]; |
|
$location=~s/^\s*//s; |
|
$location=~s/\s*$//s; |
|
$result.=&Apache::edit::editline($location,$bodytext,'',40); |
$result.=&Apache::edit::browse(undef,'textnode'); |
$result.=&Apache::edit::browse(undef,'textnode'); |
|
$result.= ' <label>'.&mt('Import as:'). |
|
'<select name="importmode_'.$Apache::lonxml::curdepth.'">'; |
|
my %options=&Apache::lonlocal::texthash('' => 'as standard library', |
|
'problem' => 'as problem', |
|
'part' => 'as problem part(s)'); |
|
foreach my $option (sort(keys(%options))) { |
|
$result.='<option value="'.$option.'"'; |
|
if ($option eq &Apache::lonxml::get_param('importmode',$parstack,$safeeval)) { |
|
$result.=' selected="selected"'; |
|
} |
|
$result.='>'.$options{$option}.'</option>'; |
|
} |
|
$result.='</select></label>'; |
#FIXME this need to convert $bodytext to be a contruction space reference |
#FIXME this need to convert $bodytext to be a contruction space reference |
#my $location=&Apache::lonnet::filelocation($Apache::lonxml::pwd['-1'],$bodytext); |
#my $location=&Apache::lonnet::filelocation($Apache::lonxml::pwd['-1'],$bodytext); |
#$result.="Click<a href=\"$location\">here</a> to edit<br />" |
#$result.="Click<a href=\"$location\">here</a> to edit<br />" |
} elsif ($target eq 'modified') { |
} elsif ($target eq 'modified') { |
$result=$token->[4].&Apache::edit::modifiedfield("/import",$parser); |
&Apache::edit::get_new_args($token,$parstack,$safeeval,'importmode'); |
|
$result='<import id="'.$token->[2]{'id'}.'" importmode="'.$token->[2]{'importmode'}.'">'; |
|
$result.=&Apache::edit::modifiedfield("/import",$parser); |
} elsif ($target eq 'meta') { |
} elsif ($target eq 'meta') { |
my $id= &Apache::lonxml::get_id($parstack,$safeeval); |
my $id= &Apache::lonxml::get_id($parstack,$safeeval); |
$result.='<import part="'.$Apache::inputtags::part; |
$result.='<import part="'.$Apache::inputtags::part; |
Line 611 sub start_algebra {
|
Line 627 sub start_algebra {
|
$inside = &Apache::run::evaluate($inside,$safeeval,$$parstack[-1]); |
$inside = &Apache::run::evaluate($inside,$safeeval,$$parstack[-1]); |
if ($target eq 'web' || $target eq 'tex' || $target eq 'analyze') { |
if ($target eq 'web' || $target eq 'tex' || $target eq 'analyze') { |
my $style=&Apache::lonxml::get_param('style',$parstack,$safeeval); |
my $style=&Apache::lonxml::get_param('style',$parstack,$safeeval); |
$result=&Apache::lontexconvert::algebra($inside,$target,$style,$parstack,$safeeval); |
$result=&Apache::lontexconvert::algebra($inside,undef,$target,$style,$parstack,$safeeval); |
} |
} |
$Apache::lonxml::post_evaluate=0; |
$Apache::lonxml::post_evaluate=0; |
} |
} |
Line 641 and <import>
|
Line 657 and <import>
|
This is part of the LearningOnline Network with CAPA project |
This is part of the LearningOnline Network with CAPA project |
described at http://www.lon-capa.org. |
described at http://www.lon-capa.org. |
|
|
|
|
=head1 NOTABLE SUBROUTINES |
|
|
|
=over |
|
|
|
=item start_LONCAPA_INTERNAL_LONHTTPD_PORT() |
|
|
|
emits a pice of javascript that says a global js variable to the |
|
current lonhttp port, currently used by the remote control to find out |
|
where to load images from |
|
|
|
=back |
|
|
|
=cut |
=cut |
|
|