version 1.154, 2010/05/26 02:04: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 387 sub start_import {
|
Line 386 sub start_import {
|
my $importmode=&Apache::lonxml::get_param('importmode',$parstack,$safeeval); |
my $importmode=&Apache::lonxml::get_param('importmode',$parstack,$safeeval); |
if (($importmode eq 'problem') || ($importmode eq 'part')) { |
if (($importmode eq 'problem') || ($importmode eq 'part')) { |
# We are using import to import published problems |
# We are using import to import published problems |
# This will require some on-the-fly rewriting |
|
my $importid=&Apache::lonxml::get_param('id',$parstack,$safeeval); |
|
if ($importid) { |
|
# Rewrite all internal IDs of the problem to avoid duplicates |
|
$file=~s/id\s*=\s*([\"\'])(\w+)([\"\'])/id=$1$2DynPart$importid$3/gs; |
|
} |
|
if (($importmode eq 'problem') || ($file=~/<part[^<]*>/s)) { |
if (($importmode eq 'problem') || ($file=~/<part[^<]*>/s)) { |
# We explicitly don't want this to be a separate part or the problem already has parts |
# 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/^\s*<problem>/<library>/s; |
$file=~s/<\/problem>\s*$/<\/library>/s; |
$file=~s/<\/problem>\s*$/<\/library>/s; |
} else { |
} else { |
# We want this to be a separate part, but it currently is not |
# We want this to be a separate part, but it currently is not |
if ($importid) { |
$file=~s/^\s*<problem>/<library><part>/s; |
$file=~s/^\s*<problem>/<library><part id="DynPart$importid">/s; |
|
} else { |
|
$file=~s/^\s*<problem>/<library><part>/s; |
|
} |
|
$file=~s/<\/problem>\s*$/<\/part><\/library>/s; |
$file=~s/<\/problem>\s*$/<\/part><\/library>/s; |
} |
} |
} |
} |
Line 450 sub start_import {
|
Line 439 sub start_import {
|
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 637 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; |
} |
} |