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

www lon-capa-cvs@mail.lon-capa.org
Fri, 01 Aug 2003 20:32:05 -0000


www		Fri Aug  1 16:32:05 2003 EDT

  Modified files:              
    /loncom/publisher	loncfile.pm publisher.html 
  Log:
  Looking better for bug #2018, needs testing.
  
  
Index: loncom/publisher/loncfile.pm
diff -u loncom/publisher/loncfile.pm:1.34 loncom/publisher/loncfile.pm:1.35
--- loncom/publisher/loncfile.pm:1.34	Fri Aug  1 14:06:33 2003
+++ loncom/publisher/loncfile.pm	Fri Aug  1 16:32:05 2003
@@ -9,7 +9,7 @@
 #  and displays a page showing the results of the action.
 #
 #
-# $Id: loncfile.pm,v 1.34 2003/08/01 18:06:33 www Exp $
+# $Id: loncfile.pm,v 1.35 2003/08/01 20:32:05 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -173,8 +173,9 @@
 sub URLToPath {
   my $Url = shift;
   &Debug($r, "UrlToPath got: $Url");
-  $Url=~ s/^http\:\/\/[^\/]+\/\~(\w+)/\/home\/$1\/public_html/;
   $Url=~ s/^http\:\/\/[^\/]+//;
+  $Url=~ s/^\///;
+  $Url=~ s/(\~|priv\/)(\w+)\//\/home\/$2\/public_html\//;
   &Debug($r, "Returning $Url \n");
   return $Url;
 }
@@ -1241,12 +1242,7 @@
 
   if ($ENV{'form.filename'}) {
       $fn=&Apache::lonnet::unescape($ENV{'form.filename'});
-      &Debug($r, "loncfile::handler - raw url: $fn");
-#      $fn=~s/^http\:\/\/[^\/]+\/\~(\w+)/\/home\/$1\/public_html/;
-#      $fn=~s/^http\:\/\/[^\/]+//;
-      $fn=URLToPath($fn);
-      &Debug($r, "loncfile::handler - doctored url: $fn");
-
+      $fn=&URLToPath($fn);
   } else {
       &Debug($r, "loncfile::handler - no form.filename");
      $r->log_reason($ENV{'user.name'}.' at '.$ENV{'user.domain'}.
Index: loncom/publisher/publisher.html
diff -u loncom/publisher/publisher.html:1.30 loncom/publisher/publisher.html:1.31
--- loncom/publisher/publisher.html:1.30	Fri Aug  1 14:06:33 2003
+++ loncom/publisher/publisher.html	Fri Aug  1 16:32:05 2003
@@ -4,9 +4,10 @@
 <script language="JavaScript">
 
 function frameloc() {
-    if (parent.LONCAPAToBePublished.location.href.indexOf("/~")!=-1) {
-       parent.lastknownpriv=parent.LONCAPAToBePublished.location.href;
+    if (parent.LONCAPAToBePublished.location.pathname.indexOf("/~")!=-1) {
+       parent.lastknownpriv=parent.LONCAPAToBePublished.location.pathname;
     }
+// alert ('We are at '+parent.lastknownpriv);
     return unescape(parent.lastknownpriv);
 }
 
@@ -78,7 +79,7 @@
     <body bgcolor="#ccffdd" text='#002200' link='#003333' vlink='#006666'>
       <font size="-2">
 	<table border="0" align="center"><tr><th bgcolor="#004400" height="20">
-	      <table border="0" cellspacing="4"><tr valign="middle">
+	      <table border="0" cellspacing="2" cellpadding="2"><tr valign="middle">
 		  <form name="publisher" action="/adm/publish" target="_parent" method="post">
 		    <td bgcolor="#ccddaa" align="center">
 		      <input type="hidden" name="filename" value="" />