[LON-CAPA-cvs] cvs: rat / lonratedt.pm

www lon-capa-cvs@mail.lon-capa.org
Mon, 13 May 2002 21:26:05 -0000


www		Mon May 13 17:26:05 2002 EDT

  Modified files:              
    /rat	lonratedt.pm 
  Log:
  Steps towards loading map
  
  
Index: rat/lonratedt.pm
diff -u rat/lonratedt.pm:1.14 rat/lonratedt.pm:1.15
--- rat/lonratedt.pm:1.14	Mon May 13 15:38:32 2002
+++ rat/lonratedt.pm	Mon May 13 17:26:05 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Edit Handler for RAT Maps
 #
-# $Id: lonratedt.pm,v 1.14 2002/05/13 19:38:32 www Exp $
+# $Id: lonratedt.pm,v 1.15 2002/05/13 21:26:05 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -252,8 +252,9 @@
    my $importwindow=join("\n",map {
        $idx++;
        if ($_) { 
-          my ($name)=split(/\=/,$_);
-          unless ($name) { $name='UNKNOWN'; }
+          my ($name,$url)=split(/\=/,$_);
+          unless ($name) { $name=(split(/\//,$url))[-1]; }
+          unless ($name) { $name='EMPTY'; }
           '<option value="'.$idx.'">'.&Apache::lonnet::unescape($name).
                                     '</option>';
       }
@@ -262,7 +263,8 @@
    $idx=0;
    my $targetwindow=join("\n",map { 
        my ($name,$url)=split(/\:/,$resources[$_]);
-       unless ($name) { $name='UNKNOWN'; }
+       unless ($name) {  $name=(split(/\//,$url))[-1]; }
+       unless ($name) { $name='EMPTY'; }
        $targetdetail.='&'.&Apache::lonnet::escape($name).'='.
 	                  &Apache::lonnet::escape($url);
        $idx++;
@@ -352,6 +354,30 @@
    }
    idx.focus();
 }
+
+
+    var editbrowser;
+    function openbrowser(formname,elementname,only,omit) {
+        var url = '/res/?';
+        if (editbrowser == null) {
+            url += 'launch=1&';
+        }
+        url += 'catalogmode=interactive&';
+        url += 'mode=edit&';
+        url += 'form=' + formname + '&';
+        if (only != null) {
+            url += 'only=' + only + '&';
+        } 
+        if (omit != null) {
+            url += 'omit=' + omit + '&';
+        }
+        url += 'element=' + elementname + '';
+        var title = 'Browser';
+        var options = 'scrollbars=1,resizable=1,menubar=0';
+        options += ',width=700,height=600';
+        editbrowser = open(url,title,options,'1');
+        editbrowser.focus();
+    }
 </script>
 </head>                 
 <body bgcolor='#FFFFFF'>
@@ -366,8 +392,12 @@
 <tr><td bgcolor="#FFFFCC">
 <input type=button onClick="javascript:groupsearch()" value="Group Search">
 <input type=button onClick="javascript:groupimport();" value="Group Import">
-<br>after selected
+after selected
 <hr>
+<input type=text size=20 name=importmap>
+<input type=button 
+onClick="javascript:openbrowser('simpleedit','importmap','sequence,page','')"
+value="Browse"><input type=submit name=loadmap value="Load Map"><hr>
 <input type=submit name="discard" value="Discard Selected">
 <input type=submit name="clear" value="Clear All">
 <input type=button onClick="javascript:viewimport()" value="View">
@@ -423,7 +453,8 @@
 	    my ($title,$url)=split(/\:/,$_);
             $title=~s/\&colon\;/\:/g;
             $url=~s/\&colon\;/\:/g;
-            unless ($title) { $title='<i>Unknown</i>'; }
+            unless ($title) { $title=(split(/\//,$url))[-1] };
+            unless ($title) { $title='<i>Empty</i>'; }
             if ($url) {
 		$r->print('<a href="'.&Apache::lonratsrv::qtescape($url).'">');
             }