[LON-CAPA-cvs] cvs: loncom /interface/spreadsheet Spreadsheet.pm
matthew
lon-capa-cvs@mail.lon-capa.org
Tue, 27 May 2003 21:17:22 -0000
matthew Tue May 27 17:17:22 2003 EDT
Modified files:
/loncom/interface/spreadsheet Spreadsheet.pm
Log:
Fixes to allow loading of files from published resource space.
Removed superflous logthis calls.
Index: loncom/interface/spreadsheet/Spreadsheet.pm
diff -u loncom/interface/spreadsheet/Spreadsheet.pm:1.7 loncom/interface/spreadsheet/Spreadsheet.pm:1.8
--- loncom/interface/spreadsheet/Spreadsheet.pm:1.7 Tue May 27 16:36:02 2003
+++ loncom/interface/spreadsheet/Spreadsheet.pm Tue May 27 17:17:22 2003
@@ -1,5 +1,5 @@
#
-# $Id: Spreadsheet.pm,v 1.7 2003/05/27 20:36:02 matthew Exp $
+# $Id: Spreadsheet.pm,v 1.8 2003/05/27 21:17:22 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -142,7 +142,7 @@
if (@_) {
my ($newfilename) = @_;
if (! defined($newfilename) || $newfilename eq 'Default' ||
- $newfilename !~ /\w/ || $newfilename =~ /\W/) {
+ $newfilename !~ /\w/) {
my %tmphash = &Apache::lonnet::get('environment',
['spreadsheet_default_'.
$self->{'type'}],
@@ -152,12 +152,12 @@
if ($tmp !~ /^(con_lost|error|no_such_host)/i) {
$newfilename=$tmphash{'spreadsheet_default_'.$self->{'type'}};
}
- }
- if (! defined($newfilename) ||
- $newfilename !~ /\w/ ||
- $newfilename =~ /^\W*$/) {
- $newfilename = 'default.'.$self->{'type'};
- } else {
+ if (! defined($newfilename) ||
+ $newfilename !~ /\w/ ||
+ $newfilename =~ /^\W*$/) {
+ $newfilename = 'default.'.$self->{'type'};
+ }
+ } elsif ($newfilename !~ /^\/res\/.*\.spreadsheet/) {
my $regexp = '_'.$self->{'type'}.'$';
if ($newfilename !~ /$regexp/) {
$newfilename .= '_'.$self->{'type'};
@@ -1497,7 +1497,7 @@
$sheetxml='<field row="0" col="A"></field>';
}
($formulas,undef) = &parse_sheet(\$sheetxml);
- } elsif($self->filename() =~ /^\/*\.spreadsheet$/) {
+ } elsif($self->filename() =~ /^\/res\/.*\.spreadsheet$/) {
# Load a spreadsheet definition file
my $sheetxml=&Apache::lonnet::getfile
(&Apache::lonnet::filelocation('',$filename));
@@ -1653,7 +1653,6 @@
if (@_) {
($self->{'temporary'})= @_;
}
- $self->logthis('temporary = '.$self->{'temporary'});
return $self->{'temporary'};
}