[LON-CAPA-cvs] cvs: loncom / loncapa_apache.conf /homework daxesave.pm

damieng damieng at source.lon-capa.org
Tue Feb 16 19:05:14 EST 2016


damieng		Wed Feb 17 00:05:14 2016 EDT

  Modified files:              
    /loncom	loncapa_apache.conf 
    /loncom/homework	daxesave.pm 
  Log:
  added support for editing supplemental web pages with Daxe
  
Index: loncom/loncapa_apache.conf
diff -u loncom/loncapa_apache.conf:1.238 loncom/loncapa_apache.conf:1.239
--- loncom/loncapa_apache.conf:1.238	Wed Jan  6 16:44:27 2016
+++ loncom/loncapa_apache.conf	Wed Feb 17 00:05:09 2016
@@ -2,7 +2,7 @@
 ## loncapa_apache.conf -- Apache HTTP LON-CAPA configuration file
 ##
 
-# $Id: loncapa_apache.conf,v 1.238 2016/01/06 16:44:27 damieng Exp $
+# $Id: loncapa_apache.conf,v 1.239 2016/02/17 00:05:09 damieng Exp $
 
 #
 # LON-CAPA Section (extensions to httpd.conf daemon configuration)
@@ -461,6 +461,11 @@
 PerlHandler Apache::daxepage
 </LocationMatch>
 
+<LocationMatch "^/daxepage/uploaded/[^/]+/[^/]+/supplemental/.*html?$">
+SetHandler perl-script
+PerlHandler Apache::daxepage
+</LocationMatch>
+
 <LocationMatch "^/daxeopen/priv/.*\.(task|problem|exam|quiz|assess|survey|library|xml|html|htm|xhtml|xhtm)$">
 SetHandler perl-script
 PerlHandler Apache::daxeopen
@@ -471,6 +476,11 @@
 PerlHandler Apache::daxeopen
 </LocationMatch>
 
+<LocationMatch "^/daxeopen/uploaded/[^/]+/[^/]+/supplemental/.*html?$">
+SetHandler perl-script
+PerlHandler Apache::daxeopen
+</LocationMatch>
+
 <IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule ^/daxeopen/(.*) /$1
Index: loncom/homework/daxesave.pm
diff -u loncom/homework/daxesave.pm:1.2 loncom/homework/daxesave.pm:1.3
--- loncom/homework/daxesave.pm:1.2	Thu Dec 10 16:26:43 2015
+++ loncom/homework/daxesave.pm	Wed Feb 17 00:05:14 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Convert and save a problem from Daxe.
 #
-# $Id: daxesave.pm,v 1.2 2015/12/10 16:26:43 damieng Exp $
+# $Id: daxesave.pm,v 1.3 2016/02/17 00:05:14 damieng Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -43,17 +43,31 @@
     
     $request->content_type('text/plain');
     
-    my $path = $env{'form.path'}; # should be in the form "/daxeopen/priv/..."
+    # path should be in the form "/daxeopen/priv/..."
+    # or ^/daxeopen/uploaded/[^/]+/[^/]+/supplemental/.*html?$
+    my $path = $env{'form.path'};
     $path =~ s/^\/daxeopen//;
     
-    my $allowed;
-    my ($ownername,$ownerdom,$ownerhome) = 
-        &Apache::lonnet::constructaccess($path, 'setpriv');
-    if (($ownername ne '') && ($ownerdom ne '') && ($ownerhome ne '')) {
-        unless ($ownerhome eq 'no_host') {
-            my @hosts = &Apache::lonnet::current_machine_ids();
-            if (grep(/^\Q$ownerhome\E$/, at hosts)) {
-                $allowed = 1;
+    my $allowed = 0;
+    if ($path =~ /^\/priv/) {
+        my ($ownername,$ownerdom,$ownerhome) = 
+            &Apache::lonnet::constructaccess($path, 'setpriv');
+        if (($ownername ne '') && ($ownerdom ne '') && ($ownerhome ne '')) {
+            unless ($ownerhome eq 'no_host') {
+                my @hosts = &Apache::lonnet::current_machine_ids();
+                if (grep(/^\Q$ownerhome\E$/, at hosts)) {
+                    $allowed = 1;
+                }
+            }
+        }
+    } elsif ($path =~ m|^/uploaded/[^/]+/[^/]+/supplemental/|) {
+        if ($env{'user.name'} ne '' && $env{'user.domain'} ne '' && $env{'request.course.id'}) {
+            $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+            $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+            if ($path =~ m|^/uploaded/\Q$cdom\E/\Q$cnum\E/supplemental/| && $path !~ /\.\./) {
+                if (&Apache::lonnet::allowed('mdc', $env{'request.course.id'})) {
+                    $allowed = 1;
+                }
             }
         }
     }




More information about the LON-CAPA-cvs mailing list