version 1.469, 2023/03/15 16:57:06
|
version 1.475, 2024/04/14 17:12:28
|
Line 50 use Apache::lonlocal;
|
Line 50 use Apache::lonlocal;
|
use Apache::loncommon(); |
use Apache::loncommon(); |
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use File::Basename; |
use File::Basename; |
use LONCAPA(); |
use LONCAPA; |
# use Data::Dumper; |
# use Data::Dumper; |
|
|
BEGIN { |
BEGIN { |
Line 591 sub start_body {
|
Line 591 sub start_body {
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
if ($env{'request.state'} eq 'construct') { |
if ($env{'request.state'} eq 'construct') { |
my $url=&Apache::lonnet::hreflocation('',$env{'request.filename'}); |
my $url=&Apache::lonnet::hreflocation('',$env{'request.filename'}); |
|
my $text = 'Authoring Space'; |
|
my $href = &Apache::loncommon::authorspace($url); |
|
if ($env{'request.course.id'}) { |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
if ($href eq "/priv/$cdom/$cnum/") { |
|
$text = 'Course Authoring Space'; |
|
} |
|
} |
&Apache::lonhtmlcommon::add_breadcrumb({ |
&Apache::lonhtmlcommon::add_breadcrumb({ |
'text' => 'Authoring Space', |
'text' => $text, |
'href' => &Apache::loncommon::authorspace($url), |
'href' => $href, |
}); |
}); |
&Apache::lonhtmlcommon::add_breadcrumb({ |
&Apache::lonhtmlcommon::add_breadcrumb({ |
'text' => 'HTML Editor', |
'text' => 'HTML Editor', |
Line 612 sub start_body {
|
Line 621 sub start_body {
|
if ($env{'request.use_absolute'}) { |
if ($env{'request.use_absolute'}) { |
$args->{'use_absolute'} = $env{'request.use_absolute'}; |
$args->{'use_absolute'} = $env{'request.use_absolute'}; |
} |
} |
|
if ($env{'form.only_body'}) { |
|
$args->{'only_body'} = 1; |
|
} |
} |
} |
$currentstring = |
$currentstring = |
&Apache::loncommon::start_page($Apache::londefdef::title, |
&Apache::loncommon::start_page($Apache::londefdef::title, |
Line 646 sub start_body {
|
Line 658 sub start_body {
|
|
|
sub edit_controls { |
sub edit_controls { |
my ($nochgview) = @_; |
my ($nochgview) = @_; |
my $result .= ' |
my ($is_course_doc,$is_supp,$supp_path,$supp_title); |
|
my $result = ' |
<form method="post" action=""> |
<form method="post" action=""> |
<div class="LC_edit_problem_header">'; |
<div class="LC_edit_problem_header">'."\n"; |
unless ($nochgview) { |
unless ($nochgview) { |
$result .= ' |
$result .= ' |
<div class="LC_edit_problem_header_row1">'. |
<div class="LC_edit_problem_header_row1">'. |
Line 657 sub edit_controls {
|
Line 670 sub edit_controls {
|
</div>'; |
</div>'; |
} |
} |
$result .= ' |
$result .= ' |
<div><input type="submit" name="editmode" accesskey="e" value="'.&mt('Edit').'" />'; |
<div> |
|
<input type="hidden" name="editmode" value="" /> |
|
<input type="button" name="editordefault" accesskey="e" value="'.&mt('Edit'). |
|
'" onclick="seteditmode(this.form,'."'edit'".');" />'."\n"; |
if ($env{'browser.type'} ne 'explorer' || $env{'browser.version'} > 9) { |
if ($env{'browser.type'} ne 'explorer' || $env{'browser.version'} > 9) { |
my $uri = $env{'request.uri'}; |
my $uri = $env{'request.uri'}; |
my $daxeurl = '/daxepage'.$uri; |
if ($uri =~ /\.(xml|html|htm|xhtml|xhtm)$/) { |
$result .= '<input type="button" value="'.&mt('Edit with Daxe').'" '. |
my %editors = &Apache::loncommon::permitted_editors($uri); |
'onclick="window.open(\''.$daxeurl.'\',\'_blank\');" />'; |
if ($editors{'daxe'}) { |
|
my $daxeurl = '/daxepage'.$uri; |
|
$result .= '<input type="button" name="editordaxe" value="'.&mt('Edit with Daxe'). |
|
'" onclick="seteditmode(this.form,'."'daxe'".');" />'."\n"; |
|
} |
|
} |
} |
} |
if (($env{'request.course.id'}) && ($env{'form.forceedit'})) { |
if (($env{'request.course.id'}) && ($env{'form.forceedit'})) { |
my $url=&Apache::lonnet::hreflocation('',$env{'request.filename'}); |
my $url=&Apache::lonnet::hreflocation('',$env{'request.filename'}); |
Line 671 sub edit_controls {
|
Line 692 sub edit_controls {
|
if ($env{'request.course.id'}) { |
if ($env{'request.course.id'}) { |
$cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
$cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
$cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
$cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
if ($url =~ m{^\Q/uploaded/$cdom/$cnum/\E(supplemental|docs)/}) { |
|
if ($1 eq 'supplemental') { |
|
$is_supp = 1; |
|
} |
|
$is_course_doc = 1; |
|
} |
if ($env{'request.filename'} =~ m{/userfiles/supplemental/default|\d+/}) { |
if ($env{'request.filename'} =~ m{/userfiles/supplemental/default|\d+/}) { |
if (&Apache::lonnet::is_course_upload($env{'request.filename'}, |
my $fn=&Apache::lonnet::declutter($env{'request.filename'}); |
$cnum,$cdom)) { |
if (&Apache::lonnet::is_course_upload($fn,$cnum,$cdom)) { |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['folderpath','title']); |
['folderpath','title']); |
|
$supp_path = &escape(&HTML::Entities::decode($Apache::lonnet::env{'form.folderpath'})); |
|
$supp_title = &escape(&HTML::Entities::decode($Apache::lonnet::env{'form.title'})); |
} |
} |
} |
} |
} |
} |
Line 703 sub edit_controls {
|
Line 732 sub edit_controls {
|
</div> |
</div> |
</form> |
</form> |
'; |
'; |
return $result; |
my $setedit_js = &Apache::lonxml::seteditor_javascript($is_course_doc,$is_supp, |
|
$supp_path,$supp_title); |
|
return $setedit_js."\n".$result; |
} |
} |
|
|
sub end_body { |
sub end_body { |
Line 3279 sub end_externallink {
|
Line 3310 sub end_externallink {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <blankspace heigth=""> |
#-- <blankspace height=""> |
sub start_blankspace { |
sub start_blankspace { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $currentstring = &end_p(); # closes off any unclosed <p> |
my $currentstring = &end_p(); # closes off any unclosed <p> |
if ($target eq 'tex') { |
if ($target eq 'tex') { |
my $howmuch = &Apache::lonxml::get_param('heigth',$parstack,$safeeval,undef,1); |
my $howmuch = &Apache::lonxml::get_param('height',$parstack,$safeeval,undef,1); |
$currentstring .= '\vskip '.$howmuch.' '; |
$currentstring .= '\vskip '.$howmuch.' '; |
} |
} |
return $currentstring; |
return $currentstring; |
Line 4313 sub resize_image {
|
Line 4344 sub resize_image {
|
$height_param=$TeXwidth/$old_width_param*$height_param; |
$height_param=$TeXwidth/$old_width_param*$height_param; |
} |
} |
} elsif ($TeXheight) { |
} elsif ($TeXheight) { |
$height_param = $TeXheight; |
|
if ($height_param) { |
if ($height_param) { |
$width_param = $TeXheight/$height_param*$width_param; |
$width_param = $TeXheight/$height_param*$width_param; |
} |
} |
|
$height_param = $TeXheight; |
} elsif ($width) { |
} elsif ($width) { |
my $old_width_param=$width_param; |
my $old_width_param=$width_param; |
$width_param = $width*$scaling; |
$width_param = $width*$scaling; |