[LON-CAPA-cvs] cvs: loncom /interface lonspreadsheet.pm

matthew lon-capa-cvs@mail.lon-capa.org
Mon, 08 Apr 2002 18:28:04 -0000


matthew		Mon Apr  8 14:28:04 2002 EDT

  Modified files:              
    /loncom/interface	lonspreadsheet.pm 
  Log:
  reply to dump
  
  
Index: loncom/interface/lonspreadsheet.pm
diff -u loncom/interface/lonspreadsheet.pm:1.80 loncom/interface/lonspreadsheet.pm:1.81
--- loncom/interface/lonspreadsheet.pm:1.80	Mon Feb  4 05:30:58 2002
+++ loncom/interface/lonspreadsheet.pm	Mon Apr  8 14:28:03 2002
@@ -1,5 +1,5 @@
 #
-# $Id: lonspreadsheet.pm,v 1.80 2002/02/04 10:30:58 matthew Exp $
+# $Id: lonspreadsheet.pm,v 1.81 2002/04/08 18:28:03 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1133,23 +1133,19 @@
 #
 # ----------------------------------------------- Read list of available sheets
 # 
-
 sub othersheets {
     my ($safeeval,$stype)=@_;
-
+    #
     my $cnum=&getcnum($safeeval);
     my $cdom=&getcdom($safeeval);
     my $chome=&getchome($safeeval);
-
+    #
     my @alternatives=();
-    my $result=&Apache::lonnet::reply('dump:'.$cdom.':'.$cnum.':'.
-                                      $stype.'_spreadsheets',$chome);
-    if ($result!~/^error\:/) {
-	foreach (split(/\&/,$result)) {
-            $alternatives[$#alternatives+1]=
-            &Apache::lonnet::unescape((split(/\=/,$_))[0]);
-        }
-    } 
+    my %results=&Apache::lonnet::dump($stype.'_spreadsheets',$cdom,$cnum);
+    my ($tmp) = keys(%results);
+    unless ($tmp =~ /^(con_lost|error|no_such_host)/i) {
+        @alternatives = sort (keys(%results));
+    }
     return @alternatives; 
 }
 
@@ -1220,17 +1216,14 @@
         }
       } else {
           my $sheet='';
-          my $reply=&Apache::lonnet::reply('dump:'.$cdom.':'.$cnum.':'.$fn,
-                                         $chome);
-          unless ($reply=~/^error\:/) {
-             $sheet=$reply;
-	  }
-          foreach (split(/\&/,$sheet)) {
-             my ($name,$value)=split(/\=/,$_);
-             $f{&Apache::lonnet::unescape($name)}=
-	        &Apache::lonnet::unescape($value);
+          my %tmphash = &Apache::lonnet::dump($fn,$cdom,$cnum);
+          my ($tmp) = keys(%tmphash);
+          unless ($tmp =~ /^(con_lost|error|no_such_host)/i) {
+              foreach (keys(%tmphash)) {
+                  $f{$_}=$tmphash{$_};
+              }
           }
-       }
+      }
 # --------------------------------------------------------------- Cache and set
        $spreadsheets{$cnum.'_'.$cdom.'_'.$stype.'_'.$fn}=join('___;___',%f);  
        &setformulas($safeeval,%f);