[LON-CAPA-cvs] cvs: loncom /xml lonxml.pm

raeburn raeburn at source.lon-capa.org
Sun Jul 27 07:20:13 EDT 2014


raeburn		Sun Jul 27 11:20:13 2014 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  - Serve .css or .js file content as-is in Authoring Space, if file is a
    dependency of an .html or .swf file currently being displayed.
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.548 loncom/xml/lonxml.pm:1.549
--- loncom/xml/lonxml.pm:1.548	Sat Jun 21 23:36:05 2014
+++ loncom/xml/lonxml.pm	Sun Jul 27 11:20:13 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.548 2014/06/21 23:36:05 raeburn Exp $
+# $Id: lonxml.pm,v 1.549 2014/07/27 11:20:13 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1751,6 +1751,7 @@
             }
 	}
     }
+    my $inhibit_menu;
     my %mystyle;
     my $result = '';
     my $filecontents=&Apache::lonnet::getfile($file);
@@ -1808,8 +1809,15 @@
 	    &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') {
@@ -1847,7 +1855,7 @@
 #
 # 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);




More information about the LON-CAPA-cvs mailing list