[LON-CAPA-cvs] cvs: rat /client extpickcode.html loncom/interface londocs.pm

www lon-capa-cvs@mail.lon-capa.org
Wed, 04 Sep 2002 19:24:47 -0000


www		Wed Sep  4 15:24:47 2002 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
    /rat/client	extpickcode.html 
  Log:
  Starts to handle external resources reasonably.
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.17 loncom/interface/londocs.pm:1.18
--- loncom/interface/londocs.pm:1.17	Wed Sep  4 10:50:53 2002
+++ loncom/interface/londocs.pm	Wed Sep  4 15:24:46 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.17 2002/09/04 14:50:53 www Exp $
+# $Id: londocs.pm,v 1.18 2002/09/04 19:24:46 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -198,6 +198,7 @@
 	  $url=&Apache::lonnet::tokenwrapper($url);
        } 
     }
+    $url=~s/^http\&colon\;\/\//\/adm\/wrapper\/ext\//;
 # Title
     $title=&Apache::lonnet::unescape($title);
     my $foldertitle=$title;
@@ -247,7 +248,7 @@
        $allowed=0;
        $forcestandard=1;
        $forcesupplement=0;
-       $script=&Apache::&Apache::lonxml::registerurl(1,undef);
+       $script=&Apache::lonxml::registerurl(1,undef);
        $events='onLoad="'.&Apache::lonxml::loadevents.
            '" onUnload="'.&Apache::lonxml::unloadevents.'"';
     }
@@ -283,7 +284,18 @@
     }
 }
 
-function makenewext(targetform) {
+function makenewext(targetname) {
+    this.document.forms.extimport.useform.value=targetname;
+    window.open('/adm/rat/extpickframe.html');
+}
+
+function finishpick() {
+    var title=this.document.forms.extimport.title.value;
+    var url=this.document.forms.extimport.url.value;
+    var form=this.document.forms.extimport.useform.value;
+    eval
+     ('this.document.forms.'+form+'.importdetail.value="'+title+'='+url+
+    '";this.document.forms.'+form+'.submit();');
 }
 </script>
 </head>
@@ -338,7 +350,7 @@
 <input type="hidden" name="folder" value="$folder">
 <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
 <input type=hidden name="importdetail" value="">
-<input name="newext" type="button" onClick="javascript:makenewext(this.form);"
+<input name="newext" type="button" onClick="javascript:makenewext('newext');"
 value="External Resource" />
 </form>
 <form action="/adm/coursedocs" method="post" name="newsyl">
@@ -404,7 +416,7 @@
 "javascript:groupimport();" value="Import">
 </form>
 </td><td bgcolor="#DDDDDD">
-<form action="/adm/coursedocs" method="post" name="newfolder">
+<form action="/adm/coursedocs" method="post" name="supnewfolder">
 <input type="hidden" name="folder" value="$folder">
 <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
 <input type=hidden name="importdetail" value="">
@@ -412,21 +424,22 @@
 onClick="javascript:makenewfolder(this.form,'$folderseq');"
 value="New Folder" />
 </form>
-<form action="/adm/coursedocs" method="post" name="newext">
+<form action="/adm/coursedocs" method="post" name="supnewext">
 <input type="hidden" name="folder" value="$folder">
 <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
 <input type=hidden name="importdetail" value="">
-<input name="newext" type="button" onClick="javascript:makenewext(this.form);"
+<input name="newext" type="button" 
+onClick="javascript:makenewext('supnewext');"
 value="External Resource" />
 </form>
-<form action="/adm/coursedocs" method="post" name="newsyl">
+<form action="/adm/coursedocs" method="post" name="supnewsyl">
 <input type="hidden" name="folder" value="$folder">
 <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
 <input type=hidden name="importdetail" 
 value="Syllabus=/public/$coursedom/$coursenum/syllabus">
 <input name="newsyl" type="submit" value="Syllabus" />
 </form>
-<form action="/adm/coursedocs" method="post" name="newaboutme">
+<form action="/adm/coursedocs" method="post" name="subnewaboutme">
 <input type="hidden" name="folder" value="$folder">
 <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
 <input type=hidden name="importdetail" 
@@ -438,7 +451,9 @@
 ENDSUPFORM
        }
     }
-
+    if ($allowed) {
+	$r->print('<form name="extimport"><input type="hidden" name="title"><input type="hidden" name="url"><input type="hidden" name="useform"></form>');
+    }
     $r->print('</body></html>');
     return OK;
 } 
Index: rat/client/extpickcode.html
diff -u rat/client/extpickcode.html:1.1 rat/client/extpickcode.html:1.2
--- rat/client/extpickcode.html:1.1	Wed Sep  4 12:54:45 2002
+++ rat/client/extpickcode.html	Wed Sep  4 15:24:46 2002
@@ -4,7 +4,7 @@
 The LearningOnline Network
 Pick External Resources
 //
-// $Id: extpickcode.html,v 1.1 2002/09/04 16:54:45 www Exp $
+// $Id: extpickcode.html,v 1.2 2002/09/04 19:24:46 www Exp $
 //
 // Copyright Michigan State University Board of Trustees
 //
@@ -34,13 +34,15 @@
 <form>
 <table>
 <tr><td bgcolor="#FFFF99">
-<input type="button" name="cancel" value="Choose" /></td>
+<input type="button" name="cancel" value="Choose"
+onClick="javascript:parent.opener.document.forms.extimport.title.value=this.form.exttitle.value;parent.opener.document.forms.extimport.url.value=this.form.exturl.value;parent.opener.finishpick();parent.close();" /></td>
 <td>Title:</td>
 <td><input type="text" size="60" name="exttitle" value="External Resource" />
 </td></tr>
 <tr>
 <td bgcolor="#FFFF99">
-<input type="button" name="cancel" value="Cancel" /></td>
+<input type="button" name="cancel" value="Cancel"
+onClick="parent.close();"/></td>
 <td>URL: <input type="button" name="view" value="View"
 onClick="javascript:parent.extcontent.location.href=this.form.exturl.value;" />
 </td>