[LON-CAPA-cvs] cvs: loncom /publisher lonconstruct.pm lonpubdir.pm publisher.html

www lon-capa-cvs@mail.lon-capa.org
Sun, 15 Jun 2003 18:02:57 -0000


www		Sun Jun 15 14:02:57 2003 EDT

  Modified files:              
    /loncom/publisher	lonconstruct.pm lonpubdir.pm publisher.html 
  Log:
  Bug #1265: upper construction space menu bar would not work if lower frame
  shows /adm/ or /res/ resources.
  
  
Index: loncom/publisher/lonconstruct.pm
diff -u loncom/publisher/lonconstruct.pm:1.11 loncom/publisher/lonconstruct.pm:1.12
--- loncom/publisher/lonconstruct.pm:1.11	Thu Jun  5 22:24:49 2003
+++ loncom/publisher/lonconstruct.pm	Sun Jun 15 14:02:57 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Construction Space Page Wrapper for Construction
 #
-# $Id: lonconstruct.pm,v 1.11 2003/06/06 02:24:49 www Exp $
+# $Id: lonconstruct.pm,v 1.12 2003/06/15 18:02:57 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -108,7 +108,11 @@
 
    $r->print(<<ENDPAGE);
 <html>
-<head><title>LON-CAPA Construction Space</title></head>
+<head><title>LON-CAPA Construction Space</title>
+<script language="JavaScript">
+var lastknownpriv="$lowerframe";
+</script>
+</head>
 <frameset rows="110,*" border="0">
 <frame src='/adm/publisher.html'>
 <frame src="$lowerframe" name="LONCAPAToBePublished">
Index: loncom/publisher/lonpubdir.pm
diff -u loncom/publisher/lonpubdir.pm:1.31 loncom/publisher/lonpubdir.pm:1.32
--- loncom/publisher/lonpubdir.pm:1.31	Fri May 16 16:47:08 2003
+++ loncom/publisher/lonpubdir.pm	Sun Jun 15 14:02:57 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
-# (Publication Handler
+# Construction Space Directory Lister
 #
-# $Id: lonpubdir.pm,v 1.31 2003/05/16 20:47:08 albertel Exp $
+# $Id: lonpubdir.pm,v 1.32 2003/06/15 18:02:57 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -69,13 +69,13 @@
              $fn,$r->dir_config('lonDefDomain')); 
   unless (($uname) && ($udom)) {
      $r->log_reason($uname.' at '.$udom.
-         ' trying to publish file '.$ENV{'form.filename'}.
+         ' trying to list directory '.$ENV{'form.filename'}.
          ' ('.$fn.') - not authorized', 
          $r->filename); 
      return HTTP_NOT_ACCEPTABLE;
   }
 
-  # Remove trailing / from direcgtory name.
+  # Remove trailing / from directory name.
 
   $fn=~s/\/$//;
 
@@ -147,7 +147,9 @@
 	#   Replace the ~username of the URL with /home/username/public_html
 	#   so that we don't have to worry about ~ expansion internally.
 	#
-	$fn=~s/^http\:\/\/[^\/]+\/\~(\w+)/\/home\/$1\/public_html/;
+	$fn=~s/^http\:\/\/[^\/]+\///;
+        $fn=~s/^\///;
+        $fn=~s/\~(\w+)/\/home\/$1\/public_html/;
 	
 	#  Remove trailing / strings (?) 
 	
@@ -353,7 +355,7 @@
 
 =head1 NAME
 
-Apache::lonpubdir - Publication Handler for Directories
+Apache::lonpubdir - Construction space directory lister
 
 =head1 SYNOPSIS
 
Index: loncom/publisher/publisher.html
diff -u loncom/publisher/publisher.html:1.28 loncom/publisher/publisher.html:1.29
--- loncom/publisher/publisher.html:1.28	Thu May 29 17:44:53 2003
+++ loncom/publisher/publisher.html	Sun Jun 15 14:02:57 2003
@@ -1,10 +1,17 @@
 <html>
 <head>
 <title>LON-CAPA Publishing Frame</title>
-<script>
+<script language="JavaScript">
+
+function frameloc() {
+    if (parent.LONCAPAToBePublished.location.href.indexOf("/~")!=-1) {
+       parent.lastknownpriv=parent.LONCAPAToBePublished.location.href;
+    }
+    return unescape(parent.lastknownpriv);
+}
 
 function getfilename() {
-   document.publisher.filename.value=parent.LONCAPAToBePublished.location.href;
+   document.publisher.filename.value=frameloc();
    if ((document.publisher.filename.value.charAt(
         document.publisher.filename.value.length-1)!='/') &&
        (document.publisher.filename.value.indexOf('/adm/pubdir')==-1)) {
@@ -15,14 +22,14 @@
 }
 
 function getdfilename() {
-  document.dpublisher.filename.value=unescape(parent.LONCAPAToBePublished.location.href);
+  document.dpublisher.filename.value=frameloc();
   if (document.dpublisher.filename.value.indexOf('/adm/pubdir')==-1) {
       document.dpublisher.submit();
   }
 }
 
 function getufilename() {
-  document.upublisher.filename.value=parent.LONCAPAToBePublished.location.href;
+  document.upublisher.filename.value=frameloc();
   if (document.upublisher.filename.value.indexOf('/adm/pubdir')!=-1) {
       document.upublisher.filename.value=document.dpublisher.filename.value;
   }
@@ -30,7 +37,7 @@
 }
 
 function getrfilename() {
-  document.rpublisher.filename.value=parent.LONCAPAToBePublished.location.href;
+  document.rpublisher.filename.value=frameloc();
    if ((document.rpublisher.filename.value.charAt(
         document.rpublisher.filename.value.length-1)!='/') &&
        (document.rpublisher.filename.value.indexOf('/adm/pubdir')==-1)) {
@@ -41,7 +48,7 @@
 }
 
 function getactionfilename() {
-  document.fileaction.filename.value=parent.LONCAPAToBePublished.location.href;
+  document.fileaction.filename.value=frameloc();
   var test=document.fileaction.action.selectedIndex;
   if (test == 4) { // trying to create a directory
       if (document.fileaction.filename.value.indexOf('/adm/pubdir')!=-1) {
@@ -58,12 +65,12 @@
 }
 
 function getdelfilename() {
-  document.del.filename.value=parent.LONCAPAToBePublished.location.href;
+  document.del.filename.value=frameloc();
   document.del.submit();
 }
 
 function getpostdata() {
-  document.printout.postdata.value=parent.LONCAPAToBePublished.location.href;
+  document.printout.postdata.value=frameloc();
   document.printout.submit();
 }
 </script>