//
FULLPAGE
my $textareaclass;
if ($filetype eq 'html') {
- my $context;
- if ($env{'request.course.id'}) {
- my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
- my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
- if ($uri =~ m{^\Q/uploaded/$cdom/$cnum/portfolio/syllabus/\E}) {
- $context = 'syllabus';
- $deps_button = &Apache::lonhtmlcommon::dependencies_button()."\n";
- $initialize .=
- &Apache::lonhtmlcommon::dependencycheck_js(undef,&mt('Syllabus'),
- $uri,undef,
- "/public/$cdom/$cnum/syllabus").
- "\n";
- if (&Apache::lonhtmlcommon::htmlareabrowser()) {
- $textareaclass = 'class="LC_richDefaultOn"';
- }
- }
- }
- unless ($context eq 'syllabus') {
- if ($symb || $folderpath) {
- $deps_button = &Apache::lonhtmlcommon::dependencies_button()."\n";
- $initialize .=
- &Apache::lonhtmlcommon::dependencycheck_js($symb,$itemtitle,
- undef,$folderpath,$uri)."\n";
+ if ($context eq 'syllabus') {
+ $deps_button = &Apache::lonhtmlcommon::dependencies_button()."\n";
+ $initialize .=
+ &Apache::lonhtmlcommon::dependencycheck_js(undef,&mt('Syllabus'),
+ $uri,undef,
+ "/public/$cdom/$cnum/syllabus").
+ "\n";
+ if (&Apache::lonhtmlcommon::htmlareabrowser()) {
+ $textareaclass = 'class="LC_richDefaultOn"';
}
+ } elsif ($symb || $folderpath) {
+ $deps_button = &Apache::lonhtmlcommon::dependencies_button()."\n";
+ $initialize .=
+ &Apache::lonhtmlcommon::dependencycheck_js($symb,$itemtitle,
+ undef,$folderpath,$uri)."\n";
}
$dragmath_button = ''.&Apache::lonhtmlcommon::dragmath_button('filecont',1).'';
$initialize .= "\n".&Apache::lonhtmlcommon::dragmath_js('EditMathPopup');
@@ -1575,7 +1602,11 @@ FULLPAGE
$add_to_onresize = "resize_textarea('$textarea_id','LC_aftertextarea');";
if ($filetype eq 'html') {
- $xml_help=&Apache::loncommon::helpLatexCheatsheet();
+ my $not_author;
+ if ($uri =~ m{^/uploaded/}) {
+ $not_author = 1;
+ }
+ $xml_help=&Apache::loncommon::helpLatexCheatsheet(undef,undef,$not_author);
}
my $titledisplay=&display_title();
@@ -1599,6 +1630,10 @@ FULLPAGE
}
}
}
+ my $undo;
+ unless ($uri =~ m{^/uploaded/}) {
+ $undo = ''."\n";
+ }
my $editfooter=(<
@@ -1610,15 +1645,14 @@ $initialize
$xml_help
-
-
-
- $htmlerror $deps_button $dragmath_button
-
-
$spelllink
@@ -1630,6 +1664,44 @@ ENDFOOTER
return ($editfooter,$add_to_onload,$add_to_onresize);;
}
+sub setmode_javascript {
+ return <<"ENDSCRIPT";
+
+ENDSCRIPT
+}
+
+sub seteditor_javascript {
+ return <<"ENDSCRIPT";
+
+ENDSCRIPT
+}
+
sub get_target {
my $viewgrades=&Apache::lonnet::allowed('vgr',$env{'request.course.id'});
if ( $env{'request.state'} eq 'published') {
@@ -1740,6 +1812,7 @@ sub handler {
}
}
}
+ my $inhibit_menu;
my %mystyle;
my $result = '';
my $filecontents=&Apache::lonnet::getfile($file);
@@ -1797,8 +1870,15 @@ ENDNOTFOUND
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['rawmode']);
if ($env{'form.rawmode'}) { $result = $filecontents; }
+ if (($env{'request.state'} eq 'construct') &&
+ (($filetype eq 'css') || ($filetype eq 'js')) && ($ENV{'HTTP_REFERER'})) {
+ if ($ENV{'HTTP_REFERER'} =~ m{^https?\://[^\/]+/priv/$LONCAPA::match_domain/$LONCAPA::match_username/[^\?]+\.(x?html?|swf)(|\?)[^\?]*$}) {
+ $inhibit_menu = 1;
+ }
+ }
if (($filetype ne 'html') &&
- (!$env{'form.return_only_error_and_warning_counts'})) {
+ (!$env{'form.return_only_error_and_warning_counts'}) &&
+ (!$inhibit_menu)) {
my $nochgview = 1;
my $controls = '';
if ($env{'request.state'} eq 'construct') {
@@ -1815,8 +1895,17 @@ ENDNOTFOUND
}
my $brcrum;
if ($env{'request.state'} eq 'construct') {
- $brcrum = [{'href' => &Apache::loncommon::authorspace($request->uri),
- 'text' => 'Authoring Space'},
+ my $text = 'Authoring Space';
+ my $href = &Apache::loncommon::authorspace($request->uri);
+ 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';
+ }
+ }
+ $brcrum = [{'href' => $href,
+ 'text' => $text,},
{'href' => '',
'text' => $breadcrumbtext}];
} else {
@@ -1836,7 +1925,7 @@ ENDNOTFOUND
#
# Edit action? Insert editing commands
#
- unless ($env{'request.state'} eq 'published') {
+ unless (($env{'request.state'} eq 'published') || ($inhibit_menu)) {
if ($env{'form.editmode'} && (!($env{'form.viewmode'})) && (!($env{'form.discardview'})))
{
my ($displayfile,$url,$symb,$itemtitle,$action);
@@ -1877,9 +1966,18 @@ ENDNOTFOUND
'onload' => $add_to_onload, });
my $header;
if ($env{'request.state'} eq 'construct') {
+ my $text = 'Authoring Space';
+ my $href = &Apache::loncommon::authorspace($request->uri);
+ 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';
+ }
+ }
$options{'bread_crumbs'} = [{
- 'href' => &Apache::loncommon::authorspace($request->uri),
- 'text' => 'Authoring Space'},
+ 'href' => $href,
+ 'text' => $text},
{'href' => '',
'text' => $breadcrumbtext}];
$header = &Apache::loncommon::head_subbox(
@@ -2035,7 +2133,7 @@ sub error {
my $declutter=&Apache::lonnet::declutter($env{'request.filename'});
my $baseurl = &Apache::lonnet::clutter($declutter);
my @userlist;
- foreach (keys %users) {
+ foreach (keys(%users)) {
my ($user,$domain) = split(/:/, $_);
push(@userlist,"$user:$domain");
my $key=$declutter.'_'.$user.'_'.$domain;
@@ -2235,7 +2333,7 @@ sub register_insert {
sub dump_insertlist {
my ($ext) = @_;
- open(XML,">/tmp/insertlist.xml.$ext");
+ open(XML,">","/tmp/insertlist.xml.$ext");
print XML ("");
my $i=0;