version 1.172.2.2.2.1, 2024/02/28 15:52:39
|
version 1.173, 2015/01/19 15:36:16
|
Line 30 package Apache::scripttag;
|
Line 30 package Apache::scripttag;
|
|
|
use strict; |
use strict; |
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::loncommon; |
|
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonxml(); |
use Apache::lonxml(); |
use Apache::londefdef(); |
use Apache::londefdef(); |
Line 119 sub start_script {
|
Line 118 sub start_script {
|
} elsif ($target eq "edit" ) { |
} elsif ($target eq "edit" ) { |
#&Apache::run::run($bodytext,$safeeval); |
#&Apache::run::run($bodytext,$safeeval); |
#$result="<br /> <$token->[1]> output: <br />$bodytext<br />Source:<br />"; |
#$result="<br /> <$token->[1]> output: <br />$bodytext<br />Source:<br />"; |
my $bodytext=&Apache::lonxml::get_all_text_unbalanced("/script",$parser); |
my $bodytext=&Apache::lonxml::get_all_text_unbalanced("/script",$parser); |
$result=&Apache::edit::tag_start($target,$token,'Script'); |
$result=&Apache::edit::tag_start($target,$token,'Script'); |
|
|
my $depth = $Apache::lonxml::curdepth; |
my $depth = $Apache::lonxml::curdepth; |
$result.='<span id="LC_edit_problem_codemirror">'; |
$result.='<span id="LC_edit_problem_codemirror">'; |
my $nocodemirror = &Apache::loncommon::nocodemirror(); |
unless ($env{'environment.nocodemirror'}) { |
unless ($nocodemirror) { |
|
# only show button if codemirror activated |
# only show button if codemirror activated |
$result.='<input type="button" id="fitsize'.$depth.'" value="'.&mt("Dynamic size"). |
$result.='<input type="button" id="fitsize'.$depth.'" value="'.&mt("Dynamic size"). |
'" onclick="autosize(\''.$depth.'\')" />'; |
'" onclick="autosize(\''.$depth.'\')" />'; |
} |
} |
$result.=&Apache::edit::editfield($token->[1],$bodytext,'',80,4).'</span>'; |
$result.=&Apache::edit::editfield($token->[1],$bodytext,'',80,4).'</span>'; |
|
|
unless ($nocodemirror) { |
unless ($env{'environment.nocodemirror'}) { |
$result.='<script type="text/javascript"> |
$result.='<script type="text/javascript"> |
var cm'.$depth.' = CodeMirror.fromTextArea(document.getElementById("homework_edit_'.$depth.'"), |
var cm'.$depth.' = CodeMirror.fromTextArea(document.getElementById("homework_edit_'.$depth.'"), |
{ |
{ |
Line 143 sub start_script {
|
Line 141 sub start_script {
|
indentUnit: 4, |
indentUnit: 4, |
autoCloseBrackets: true, |
autoCloseBrackets: true, |
styleActiveLine: true, |
styleActiveLine: true, |
|
|
extraKeys: { |
extraKeys: { |
"Tab": "indentMore", |
"Tab": "indentMore", |
"Shift-Tab": "indentLess" |
"Shift-Tab": "indentLess" |
Line 155 sub start_script {
|
Line 153 sub start_script {
|
} |
} |
</script>'; |
</script>'; |
} |
} |
|
|
|
|
} elsif ($target eq 'meta') { |
} elsif ($target eq 'meta') { |
my $bodytext=&Apache::lonxml::get_all_text_unbalanced("/script",$parser); |
my $bodytext=&Apache::lonxml::get_all_text_unbalanced("/script",$parser); |
Line 680 sub end_storetc {
|
Line 679 sub end_storetc {
|
|
|
sub start_physnet { |
sub start_physnet { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my $bodytext = '/res/adm/includes/physnet.sty'; |
my $bodytext = '/adm/includes/physnet.sty'; |
my $location=&Apache::lonnet::filelocation($Apache::lonxml::pwd['-1'],$bodytext); |
my $location=&Apache::lonnet::filelocation($Apache::lonxml::pwd['-1'],$bodytext); |
my $cbistyletext=&Apache::lonnet::getfile($location); |
my $cbistyletext=&Apache::lonnet::getfile($location); |
|
|
%$style = (%$style,&Apache::style::styleparser($target,$cbistyletext)); |
%$style = (%$style,&Apache::style::styleparser($target,$cbistyletext)); |
if (keys(%$style) && (($target eq 'web') || ($target eq 'tex'))) { |
$$parser['-1']->unget_token($token); |
$$parser['-1']->unget_token($token); |
|
} |
|
# if ( defined($$style{'physnet'}) ) { |
# if ( defined($$style{'physnet'}) ) { |
# &Apache::lonxml::newparser($parser,\$$style{'physnet'}); |
# &Apache::lonxml::newparser($parser,\$$style{'physnet'}); |
# } |
# } |