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

matthew lon-capa-cvs@mail.lon-capa.org
Wed, 28 May 2003 15:19:34 -0000


matthew		Wed May 28 11:19:34 2003 EDT

  Modified files:              
    /loncom/interface/spreadsheet	lonspreadsheet.pm 
  Log:
  Fix to load file selector not having a value selected.
  
  
Index: loncom/interface/spreadsheet/lonspreadsheet.pm
diff -u loncom/interface/spreadsheet/lonspreadsheet.pm:1.6 loncom/interface/spreadsheet/lonspreadsheet.pm:1.7
--- loncom/interface/spreadsheet/lonspreadsheet.pm:1.6	Tue May 27 16:05:46 2003
+++ loncom/interface/spreadsheet/lonspreadsheet.pm	Wed May 28 11:19:34 2003
@@ -1,5 +1,5 @@
 #
-# $Id: lonspreadsheet.pm,v 1.6 2003/05/27 20:05:46 matthew Exp $
+# $Id: lonspreadsheet.pm,v 1.7 2003/05/28 15:19:34 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -126,7 +126,7 @@
     ##
     ## Create the save and load dialogs
     my $filename = $spreadsheet->filename();
-    $filename = '' if ($filename =~ /^default\.$sheettype/i);
+    $filename = 'Default' if ($filename =~ /^default\.$sheettype/i);
     $filename =~ s/_$sheettype$//;
     my $save_dialog = '<nobr>'.
         '<input type="submit" name="save" value="Save as" /> '.
@@ -147,16 +147,23 @@
     </td></tr>
 <tr><td>&nbsp;</td><td>
     <select name="fileselect" onchange="document.sheet.loadfilename.value=document.sheet.fileselect.value" >
-    <option name="Default">Default</option>
 END
+    my $default_filename_set = 0;
     foreach my $sheetfilename ($spreadsheet->othersheets()) {
         $sheetfilename =~ s/_$sheettype$//;
         $load_dialog .= '    <option name="'.$sheetfilename.'"';
         if ($filename eq $sheetfilename) {
             $load_dialog .= ' selected';
+            $default_filename_set = 1;
         }
         $load_dialog .= '>'.$sheetfilename."</option>\n";
     }
+    if ($default_filename_set) {
+        $load_dialog .= '<option name="Default">Default</option>'."\n";
+    } else {
+        $load_dialog .= '<option name="Default" selected >Default</option>'.
+            "\n";
+    }
     $load_dialog .= "</td><td>&nbsp;</td></tr>\n</table>\n";
         #
     $result .=<<END;
@@ -322,6 +329,7 @@
         #
         if (exists($ENV{'form.load'}) && exists($ENV{'form.loadfilename'})) {
             $filename = $ENV{'form.loadfilename'};
+            $ENV{'form.workcopy'} = 'no';
         }
     }
     ##