--- loncom/homework/default_homework.lcpm 2006/07/18 14:06:17 1.111 +++ loncom/homework/default_homework.lcpm 2006/07/27 22:56:37 1.114 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # used by lonxml::xmlparse() as input variable $safeinit to Apache::run::run() # -# $Id: default_homework.lcpm,v 1.111 2006/07/18 14:06:17 www Exp $ +# $Id: default_homework.lcpm,v 1.114 2006/07/27 22:56:37 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -206,13 +206,13 @@ sub implicit_multiplication { # 3x10^8 -> 3&8; 3*10^-8 -> 3&-8 $expression=~s/(\d+)(?:x|\*)10(?:\^|\*\*)([\+\-]*\d+)/$1\&\($2\)/gsi; # Fill in multiplication signs -# a b -> a*b - $expression=~s/\s+/\*/gs; +# a b -> a*b;3 b -> 3*b;3 4 -> 3*4 + $expression=~s/(\w)\s+(\w)/$1\*$2/gs; # 3a -> 3*a; 3( -> 3*(; 3A -> 3*a $expression=~s/(\d)([a-zA-Z\(])/$1\*$2/gs; -# a3 -> a*3; )3 -> )*3 +# a3 -> a*3; $expression=~s/([a-zA-Z])(\d)/$1\*$2/gs; -# )a -> )*a +# )a -> )*a; )3 -> )*3 $expression=~s/\)(\w)/\)\*$1/gs; # 3&8 -> 3e8; 3&-4 -> 3e-4 $expression=~s/(\d+)\&\(([\+\-]*\d+)\)/$1e$2/gs; @@ -850,6 +850,18 @@ sub class { return $course; } +sub firstname { + my $firstname = &EXT('environment.firstname'); + $firstname = '' if $firstname eq ""; + return $firstname; +} + +sub lastname { + my $lastname = &EXT('environment.lastname'); + $lastname = '' if $lastname eq ""; + return $lastname; +} + sub sec { my $sec = &EXT('request.course.sec'); $sec = '' if $sec eq "";