version 1.152, 2010/04/27 20:29:20
|
version 1.158, 2011/12/09 22:04:55
|
Line 116 sub start_script {
|
Line 116 sub start_script {
|
my $function_name = |
my $function_name = |
join('_','LONCAPA_scriptvars',$uname,$udom, |
join('_','LONCAPA_scriptvars',$uname,$udom, |
$env{'form.counter'},$Apache::lonxml::curdepth); |
$env{'form.counter'},$Apache::lonxml::curdepth); |
my $script_var ="<script type=\"text/javascript\"> |
my $scriptblocklog=$start_page. |
// <![CDATA[ |
&Apache::loncommon::start_scrollbox('500px','480px','480px'). |
function $function_name() {newWindow=open('','new_W','width=500,height=500,scrollbars=1,resizable=yes');newWindow.$windowopen;newWindow.document.writeln('$start_page<pre>"; |
'<pre>'.&Apache::run::dump($target,$safeeval).'</pre>'. |
my $listing=&Apache::run::dump($target,$safeeval); |
&Apache::loncommon::end_scrollbox(). |
$listing=~s/\\/\\\\/g; |
$end_page; |
$listing=~s/\'/\\\'/g; |
$scriptblocklog=~s/\'/\\'/gs; |
$script_var.=$listing; |
&Apache::lonxml::add_script_result( |
$script_var.= "<\\/pre>$end_page');newWindow.document.close();newWindow.focus()} |
&Apache::loncommon::modal_adhoc_script($function_name,500,500,$scriptblocklog). |
// ]]> |
"<a href=\"javascript:$function_name();void(0);\">".&mt('Script Vars')."</a><br />" |
</script><a href=\"javascript:$function_name();void(0);\">".&mt('Script Vars')."</a><br />"; |
); |
&Apache::lonxml::add_script_result($script_var); |
|
} |
} |
} elsif ($target eq "edit" ) { |
} elsif ($target eq "edit" ) { |
#&Apache::run::run($bodytext,$safeeval); |
#&Apache::run::run($bodytext,$safeeval); |
Line 372 sub start_import {
|
Line 371 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 384 sub start_import {
|
Line 383 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 397 sub start_import {
|
Line 408 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; |
if ($id) { |
if ($id) { |
$result.='" id="'.$id; |
$result.='" id="'.$id; |
} |
} |
$result.='">'; |
$result.='" importmode="'.$token->[2]{'importmode'}.'">'; |
$result.=$bodytext; |
$result.=$bodytext; |
$result.='</import>'; |
$result.='</import>'; |
} |
} |
Line 597 sub start_algebra {
|
Line 626 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,undef,$target,$style,$parstack,$safeeval); |
$result=&Apache::lontexconvert::algebra($inside,$target,$style,$parstack,$safeeval); |
} |
} |
$Apache::lonxml::post_evaluate=0; |
$Apache::lonxml::post_evaluate=0; |
} |
} |