--- loncom/homework/lonhomework.pm 2003/10/13 21:09:47 1.152 +++ loncom/homework/lonhomework.pm 2003/12/08 20:33:30 1.158 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Homework handler # -# $Id: lonhomework.pm,v 1.152 2003/10/13 21:09:47 albertel Exp $ +# $Id: lonhomework.pm,v 1.158 2003/12/08 20:33:30 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -149,7 +149,7 @@ $Apache::lonxml::browse=''; sub check_ip_acc { my ($acc)=@_; - if (!defined($acc)) { return 1; } + if (!defined($acc) || $acc =~ /^\s*$/) { return 1; } my $allowed=0; my $ip=$ENV{'REMOTE_ADDR'}; my $name; @@ -174,7 +174,7 @@ sub check_ip_acc { use Socket; my $netaddr=inet_aton($ip); ($name)=gethostbyaddr($netaddr,AF_INET); - } + } if ($name =~ /\Q$pattern\E$/i) { $allowed=1; } } elsif ($pattern =~ /\d+\.\d+\.\d+\.\d+/) { #127.0.0.1 @@ -216,9 +216,8 @@ sub check_access { my $allowed=&check_ip_acc(&Apache::lonnet::EXT("resource.$id.acc")); if (!$allowed) { - &Apache::lonnet::logthis("Early exit"); $status='INVALID_ACCESS'; - $date=&mt("may be open from a different computer."); + $date=&mt("can not be accessed from your location."); return($status,$date); } @@ -380,6 +379,8 @@ sub handle_save_or_undo { my $filetmp =$file.".tmp"; my $error=0; + &Apache::lonnet::correct_line_ends($result); + if ($ENV{'form.Undo'} eq &mt('undo')) { my $error=0; if (!copy($file,$filetmp)) { $error=1; } @@ -643,6 +644,8 @@ sub newproblem { &renderpage($request,$dest); } else { my $url=$request->uri; + my $shownurl=$url; + $shownurl=~s-^/~-/priv/-; my $dest = &Apache::lonnet::filelocation("",$request->uri); my $errormsg; if ($ENV{'form.newfile'}) { @@ -662,7 +665,7 @@ sub newproblem {
$lt{'createnew'} $extension$instructions $lt{'click'} "$lt{'Create'} $extension" $lt{'button'}.