version 1.531.2.3, 2012/05/25 15:01:31
|
version 1.531.2.6, 2013/03/18 00:04:27
|
Line 743 sub setup_globals {
|
Line 743 sub setup_globals {
|
|
|
sub init_safespace { |
sub init_safespace { |
my ($target,$safeeval,$safehole,$safeinit) = @_; |
my ($target,$safeeval,$safehole,$safeinit) = @_; |
$safeeval->reval('use Math::Complex;'); |
|
$safeeval->reval('use LaTeX::Table;'); |
$safeeval->reval('use LaTeX::Table;'); |
$safeeval->deny_only(':dangerous'); |
$safeeval->deny_only(':dangerous'); |
|
$safeeval->reval('use Math::Complex;'); |
$safeeval->permit_only(":default"); |
$safeeval->permit_only(":default"); |
$safeeval->permit("entereval"); |
$safeeval->permit("entereval"); |
$safeeval->permit(":base_math"); |
$safeeval->permit(":base_math"); |
Line 1604 sub renderingoptions {
|
Line 1604 sub renderingoptions {
|
} |
} |
|
|
sub inserteditinfo { |
sub inserteditinfo { |
my ($filecontents,$filetype,$filename,$symb,$itemtitle) = @_; |
my ($filecontents,$filetype,$filename,$symb,$itemtitle,$folderpath,$uri) = @_; |
$filecontents = &HTML::Entities::encode($filecontents,'<>&"'); |
$filecontents = &HTML::Entities::encode($filecontents,'<>&"'); |
my $xml_help = ''; |
my $xml_help = ''; |
my $initialize=''; |
my $initialize=''; |
Line 1630 sub inserteditinfo {
|
Line 1630 sub inserteditinfo {
|
</script> |
</script> |
FULLPAGE |
FULLPAGE |
if ($filetype eq 'html') { |
if ($filetype eq 'html') { |
if ($symb) { |
if ($symb || $folderpath) { |
$deps_button = &Apache::lonhtmlcommon::dependencies_button()."\n"; |
$deps_button = &Apache::lonhtmlcommon::dependencies_button()."\n"; |
$initialize .= |
$initialize .= |
&Apache::lonhtmlcommon::dependencycheck_js($symb,$itemtitle)."\n"; |
&Apache::lonhtmlcommon::dependencycheck_js($symb,$itemtitle, |
|
undef,$folderpath,$uri)."\n"; |
} |
} |
$dragmath_button = '<span id="math_filecont">'.&Apache::lonhtmlcommon::dragmath_button('filecont',1).'</span>'; |
$dragmath_button = '<span id="math_filecont">'.&Apache::lonhtmlcommon::dragmath_button('filecont',1).'</span>'; |
$initialize .= "\n".&Apache::lonhtmlcommon::dragmath_js('EditMathPopup'); |
$initialize .= "\n".&Apache::lonhtmlcommon::dragmath_js('EditMathPopup'); |
Line 1763 sub handler {
|
Line 1764 sub handler {
|
} else { |
} else { |
$filetype='html'; |
$filetype='html'; |
} |
} |
|
unless ($env{'request.uri'}) { |
|
$env{'request.uri'}=$request->uri; |
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
|
['todocs']); |
|
} |
if ($filetype eq 'sty') { |
if ($filetype eq 'sty') { |
$breadcrumbtext = 'Style File Editor'; |
$breadcrumbtext = 'Style File Editor'; |
} elsif ($filetype eq 'js') { |
} elsif ($filetype eq 'js') { |
Line 1891 ENDNOTFOUND
|
Line 1897 ENDNOTFOUND
|
my ($displayfile,$url,$symb,$itemtitle); |
my ($displayfile,$url,$symb,$itemtitle); |
$displayfile=$request->uri; |
$displayfile=$request->uri; |
if ($request->uri =~ m{^/uploaded/}) { |
if ($request->uri =~ m{^/uploaded/}) { |
|
if ($env{'request.course.id'}) { |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
if ($request->uri =~ m{^\Q/uploaded/$cdom/$cnum/\Esupplemental/}) { |
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
|
['folderpath','title']); |
|
} |
|
} |
|
|
($symb,$itemtitle,$displayfile) = |
($symb,$itemtitle,$displayfile) = |
&get_courseupload_hierarchy($request->uri); |
&get_courseupload_hierarchy($request->uri, |
|
$env{'form.folderpath'},$env{'form.title'}); |
} else { |
} else { |
$displayfile=~s/^\/[^\/]*//; |
$displayfile=~s/^\/[^\/]*//; |
} |
} |
|
|
my ($edit_info, $add_to_onload, $add_to_onresize)= |
my ($edit_info, $add_to_onload, $add_to_onresize)= |
&inserteditinfo($filecontents,$filetype,$displayfile,$symb,$itemtitle); |
&inserteditinfo($filecontents,$filetype,$displayfile,$symb, |
|
$itemtitle,$env{'form.folderpath'},$request->uri); |
|
|
my %options = |
my %options = |
('add_entries' => |
('add_entries' => |
Line 1949 sub display_title {
|
Line 1966 sub display_title {
|
} |
} |
|
|
sub get_courseupload_hierarchy { |
sub get_courseupload_hierarchy { |
my ($url) = @_; |
my ($url,$folderpath,$title) = @_; |
my ($symb,$itemtitle,$displaypath); |
my ($symb,$itemtitle,$displaypath); |
if ($env{'request.course.id'}) { |
if ($env{'request.course.id'}) { |
$symb = &Apache::lonnet::symbread(); |
if ($folderpath =~ /^supplemental/) { |
my ($map,$id,$res)=&Apache::lonnet::decode_symb($symb); |
my @folders = split(/\&/,$folderpath); |
my $navmap=Apache::lonnavmaps::navmap->new; |
my @pathitems; |
if (ref($navmap)) { |
while (@folders) { |
my $res = $navmap->getBySymb($symb); |
my $folder=shift(@folders); |
if (ref($res)) { |
my $foldername=shift(@folders); |
my @pathitems = |
$foldername =~ s/\:(\d*)\:(\w*)\:(\w*):(\d*)\:?(\d*)$//; |
&Apache::loncommon::get_folder_hierarchy($navmap,$map,1); |
push(@pathitems,&unescape($foldername)); |
$itemtitle = $res->compTitle(); |
} |
push(@pathitems,$itemtitle); |
if ($title) { |
$displaypath = join(' » ',@pathitems); |
push(@pathitems,&unescape($title)); |
|
} |
|
$displaypath = join(' » ',@pathitems); |
|
} else { |
|
$symb = &Apache::lonnet::symbread($url); |
|
my ($map,$id,$res)=&Apache::lonnet::decode_symb($symb); |
|
my $navmap=Apache::lonnavmaps::navmap->new; |
|
if (ref($navmap)) { |
|
my $res = $navmap->getBySymb($symb); |
|
if (ref($res)) { |
|
my @pathitems = |
|
&Apache::loncommon::get_folder_hierarchy($navmap,$map,1); |
|
$itemtitle = $res->compTitle(); |
|
push(@pathitems,$itemtitle); |
|
$displaypath = join(' » ',@pathitems); |
|
} |
} |
} |
} |
} |
} |
} |
Line 2119 sub add_messages {
|
Line 2151 sub add_messages {
|
} |
} |
|
|
sub get_param { |
sub get_param { |
my ($param,$parstack,$safeeval,$context,$case_insensitive) = @_; |
my ($param,$parstack,$safeeval,$context,$case_insensitive, $noelide) = @_; |
if ( ! $context ) { $context = -1; } |
if ( ! $context ) { $context = -1; } |
my $args =''; |
my $args =''; |
if ( $#$parstack > (-2-$context) ) { $args=$$parstack[$context]; } |
if ( $#$parstack > (-2-$context) ) { $args=$$parstack[$context]; } |
if ( ! $Apache::lonxml::usestyle ) { |
if ( ! $Apache::lonxml::usestyle ) { |
$args=$Apache::lonxml::style_values.$args; |
$args=$Apache::lonxml::style_values.$args; |
} |
} |
|
|
|
if ($noelide) { |
|
$args =~ s/'\$/'\\\$/g; |
|
} |
|
|
if ( ! $args ) { return undef; } |
if ( ! $args ) { return undef; } |
if ( $case_insensitive ) { |
if ( $case_insensitive ) { |
if ($args =~ s/(my (?:.*))(\$\Q$param\E[,\)])/$1.lc($2)/ei) { |
if ($args =~ s/(my (?:.*))(\$\Q$param\E[,\)])/$1.lc($2)/ei) { |