You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(58) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(53) |
Feb
(56) |
Mar
|
Apr
|
May
(30) |
Jun
(78) |
Jul
(121) |
Aug
(155) |
Sep
(77) |
Oct
(61) |
Nov
(45) |
Dec
(94) |
2006 |
Jan
(116) |
Feb
(33) |
Mar
(11) |
Apr
(23) |
May
(60) |
Jun
(89) |
Jul
(130) |
Aug
(109) |
Sep
(124) |
Oct
(63) |
Nov
(82) |
Dec
(45) |
2007 |
Jan
(31) |
Feb
(35) |
Mar
(123) |
Apr
(36) |
May
(18) |
Jun
(134) |
Jul
(133) |
Aug
(241) |
Sep
(126) |
Oct
(31) |
Nov
(15) |
Dec
(5) |
2008 |
Jan
(11) |
Feb
(6) |
Mar
(16) |
Apr
(29) |
May
(43) |
Jun
(149) |
Jul
(27) |
Aug
(29) |
Sep
(37) |
Oct
(20) |
Nov
(4) |
Dec
(6) |
2009 |
Jan
(34) |
Feb
(30) |
Mar
(16) |
Apr
(6) |
May
(1) |
Jun
(32) |
Jul
(22) |
Aug
(7) |
Sep
(18) |
Oct
(50) |
Nov
(22) |
Dec
(8) |
2010 |
Jan
(17) |
Feb
(15) |
Mar
(10) |
Apr
(9) |
May
(67) |
Jun
(30) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
(1) |
Dec
|
From: Gavin L. v. a. <we...@ma...> - 2008-06-18 19:38:00
|
Log Message: ----------- Implement Danny Glin's fix for set_location entries being left when a set was deleted. Modified Files: -------------- webwork2/lib/WeBWorK: DB.pm Revision Data ------------- Index: DB.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/DB.pm,v retrieving revision 1.108 retrieving revision 1.109 diff -Llib/WeBWorK/DB.pm -Llib/WeBWorK/DB.pm -u -r1.108 -r1.109 --- lib/WeBWorK/DB.pm +++ lib/WeBWorK/DB.pm @@ -1099,6 +1099,7 @@ my ($self, $setID) = shift->checkArgs(\@_, "set_id$U"); $self->deleteUserSet(undef, $setID); $self->deleteGlobalProblem($setID, undef); + $self->deleteGlobalSetLocation($setID, undef); return $self->{set}->delete($setID); } |
From: dpvc v. a. <we...@ma...> - 2008-06-15 12:42:35
|
Log Message: ----------- Remove cached perlFunction when a substitution or reduction is made. Modified Files: -------------- pg/lib: Parser.pm Revision Data ------------- Index: Parser.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Parser.pm,v retrieving revision 1.49 retrieving revision 1.50 diff -Llib/Parser.pm -Llib/Parser.pm -u -r1.49 -r1.50 --- lib/Parser.pm +++ lib/Parser.pm @@ -638,6 +638,7 @@ $self->{tree} = $self->{tree}->reduce; $self->{variables} = $self->{tree}->getVariables; $self->{context}{reduction} = $reduce if $reduce; + delete $self->{f}; return $self; } @@ -652,6 +653,7 @@ foreach my $x (keys %{$self->{values}}) {delete $self->{variables}{$x}} $self->{tree} = $self->{tree}->substitute; $self->unsetValues; + delete $self->{f}; return $self; } |
From: dpvc v. a. <we...@ma...> - 2008-06-15 12:41:04
|
Log Message: ----------- Added ability to assign to function names, like f(x)=x+1. Modified Files: -------------- pg/macros: parserAssignment.pl Revision Data ------------- Index: parserAssignment.pl =================================================================== RCS file: /webwork/cvs/system/pg/macros/parserAssignment.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -Lmacros/parserAssignment.pl -Lmacros/parserAssignment.pl -u -r1.1 -r1.2 --- macros/parserAssignment.pl +++ macros/parserAssignment.pl @@ -82,22 +82,64 @@ examples above as well, since it returns a Formula when the value is one). +The left-hand side of an assignment can also be a function +declaration, as in + + f(x) = 3x + 1 + +To allow this, use + + parser::Assignment->Function("f"); + +You can supply more than one function name if you want. E.g., + + parser::Assignment->Function("f","g"); + +The number of variables for these functions is determined by the +assignment itself, so after declaring f to be a function, you can use +either + + f(x) = x+1 +or + f(x,y) = x^2 + y^2 + +provided the variables are defined in the current context. + Type-checking between the student and correct answers is performed using the right-hand values of the assignment, and a warning message will be issued if the types are not compatible. The type of the -variable, however, is not checked. +variable on the left-hand side, however, is not checked. + +For function declarations, the name of the function and the order +of the variables must match the professor's answer; however, the +names of the variables don't have to match, as long as the function +returns the same results for the same inputs. So + + f(x) = x + 1 +and + f(y) = y + 1 + +will be marked as equal. =cut -sub _parserAssignment_init { - PG_restricted_eval('sub Assignment {parser::Assignment::List->new(@_)}'); -} +# +# FIXME: allow any variables in declaration +# FIXME: Add more hints when variable name isn't right +# or function name or number of arguments isn't right. +# + +sub _parserAssignment_init {parser::Assignment::Init()} ###################################################################### package parser::Assignment; our @ISA = qw(Parser::BOP); +sub Init { + main::PG_restricted_eval('sub Assignment {parser::Assignment::List->new(@_)}'); +} + # # Check that the left operand is a variable and not used on the right # @@ -105,11 +147,19 @@ my $self = shift; my $name = $self->{def}{string} || $self->{bop}; $self->Error("Only one assignment is allowed in an equation") if $self->{lop}->type eq 'Assignment' || $self->{rop}->type eq 'Assignment'; - $self->Error("The left side of an assignment must be a variable",$name) - unless $self->{lop}->class eq 'Variable' || $self->context->flag("allowBadOperands"); - $self->Error("The right side of an assignment must not include the variable being defined") - if $self->{rop}->getVariables->{$self->{lop}{name}}; - delete $self->{equation}{variables}{$self->{lop}{name}}; + $self->Error("The left side of an assignment must be a variable or function",$name) + unless $self->{lop}->class eq 'Variable' || $self->{lop}{isDummy} || $self->context->flag("allowBadOperands"); + if ($self->{lop}{isDummy}) { + my $fvars = $self->{lop}->getVariables; + foreach my $x (keys(%{$self->{rop}->getVariables})) { + $self->Error("The formula for %s can't use the variable '%s'",$self->{lop}->string,$x) + unless $fvars->{$x}; + } + } else { + $self->Error("The right side of an assignment must not include the variable being defined") + if $self->{rop}->getVariables->{$self->{lop}{name}}; + delete $self->{equation}{variables}{$self->{lop}{name}}; + } $self->{type} = Value::Type('Assignment',2,$self->{rop}->typeRef,list => 1); } @@ -118,7 +168,7 @@ # sub eval { my $self = shift; my $context = $self->context; - my ($a,$b) = ($self->Package("String")->make($context,$self->{lop}{name}),$self->{rop}); + my ($a,$b) = ($self->Package("String")->make($context,$self->{lop}->string),$self->{rop}); $b = Value::makeValue($b->eval,context => $context); return parser::Assignment::List->make($context,$a,$b); } @@ -128,6 +178,7 @@ # sub getVariables { my $self = shift; + return $self->{lop}->getVariables if $self->{lop}{isDummy}; $self->{rop}->getVariables; } @@ -136,7 +187,7 @@ # sub perl { my $self = shift; - return "parser::Assignment::List->new('".$self->{lop}{name}."',".$self->{rop}->perl.")"; + return "parser::Assignment::List->new('".$self->{lop}->string."',".$self->{rop}->perl.")"; } # @@ -163,6 +214,19 @@ return; } +sub Function { + my $self = shift || "Value"; + my $context = (Value::isContext($_[0]) ? shift : $self->context); + Value->Error("You must provide a function name") unless scalar(@_) > 0; + foreach my $f (@_) { + Value->Error("Function name '%s' is illegal",$f) unless $f =~ m/^[a-z][a-z0-9]*$/i; + my $name = $f; $name = $1.'_{'.$2.'}' if ($name =~ m/^(\D+)(\d+)$/); + $context->functions->add( + $f => {class => 'parser::Assignment::Function', TeX => $name, type => $Value::Type{number}} + ); + } +} + ###################################################################### # @@ -176,7 +240,7 @@ sub new { my $self = shift; my $class = ref($self) || $self; my $context = (Value::isContext($_[0]) ? shift : $self->context); - Value::Error("Too many arguments") if scalar(@_) > 2; + Value->Error("Too many arguments") if scalar(@_) > 2; my ($x,$v) = @_; if (defined($v)) { my $context = $self->context; @@ -184,12 +248,13 @@ if ($v->isFormula) { $x = $self->Package("Formula")->new($context,$x); $v->{tree} = parser::Assignment->new($v,"=",$x->{tree},$v->{tree}); + bless $v, $self->Package("Formula"); return $v; } return $self->make($self->Package("String")->make($context,$x),$v); } else { $v = $self->Package("Formula")->new($x); - Value::Error("Your formula doesn't seem to be an assignment") + Value->Error("Your formula doesn't seem to be an assignment") unless $v->{tree}->type eq "Assignment"; return $v; } @@ -219,7 +284,8 @@ # sub cmp_class { my $self = shift; - "a Variable equal to ".$self->{data}[1]->showClass; + my $type = ($self->{data}[0] =~ m/\(/ ? 'Function' : 'Variable'); + "a $type equal to ".$self->{data}[1]->showClass; } sub showClass {cmp_class(@_)} @@ -267,8 +333,64 @@ } else { $value = $self->Package("Formula")->new($self->context,$self->{tree}{rop}); } - return "a Variable equal to ".$value->showClass; + my $type = ($self->{tree}{lop}{isDummy} ? "Function" : "Variable"); + return "a $type equal to ".$value->showClass; } sub showClass {cmp_class(@_)} +# +# Convert varaible names to those used in the correct answer, if the +# student answer uses different ones +# +sub compare { + my ($l,$r) = @_; my $self = $l; + my $context = $self->context; + $r = $context->Package("Formula")->new($context,$r) unless Value::isFormula($r); + if ($l->{tree}{lop}{isDummy} && $r->type eq 'Assignment' && $r->{tree}{lop}{isDummy}) { + my ($F,$f) = ($l->{tree}{lop}{params},$r->{tree}{lop}{params}); + if (scalar(@{$F}) == scalar(@{$f})) { + my @subs = (); + for (my $i = 0; $i < scalar(@{$F}); $i++) { + push(@subs,$f->[$i]{name} => $F->[$i]{name}) + unless $F->[$i]{name} eq $f->[$i]{name}; + } + $r = $r->substitute(@subs) if scalar(@subs); + delete $r->{f}; + } + } + $l->SUPER::compare($r,@_); +} + +###################################################################### + +# +# A dummy function that is used for assignments like f(x) = x^2 +# + +package parser::Assignment::Function; +our @ISA = ("Parser::Function"); + +sub _check { + my $self = shift; my %var; + foreach my $x (@{$self->{params}}) { + $self->Error("The arguments of '%s' must be variables",$self->{name}) + unless $x->class eq 'Variable'; + $self->Error("The arguments of '%s' must all be different",$self->{name}) + if $var{$x->{name}}; + $var{$x->{name}} = 1; + } + $self->{type} = $self->{def}{type}; + $self->{isDummy} = 1; +} + +sub eval { + my $self = shift; + $self->Error("Dummy function '%s' can not be evaluated",$self->{name}); +} + +sub call { + my $self = shift; + $self->Error("Dummy function '%s' can not be called",$self->{name}); +} + 1; |
From: dpvc v. a. <we...@ma...> - 2008-06-15 04:10:56
|
Log Message: ----------- Implements an assignment operator that can be used to force the student to include the "y=" part of "y = 3x + 1" rather than having to include the "y=" as part of the text of the problem. You can also request lists of assignments, e.g., x = 1, x = -1, and the type of object assigned can be any MathObject (e.g., vector, complex, infinity, interval, whatever). Added Files: ----------- pg/macros: parserAssignment.pl Revision Data ------------- --- /dev/null +++ macros/parserAssignment.pl @@ -0,0 +1,274 @@ +################################################################################ +# WeBWorK Online Homework Delivery System +# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# $CVSHeader: pg/macros/parserAssignment.pl,v 1.1 2008/06/15 03:54:01 dpvc Exp $ +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of either: (a) the GNU General Public License as published by the +# Free Software Foundation; either version 2, or (at your option) any later +# version, or (b) the "Artistic License" which comes with this package. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the +# Artistic License for more details. +################################################################################ + +=head1 NAME + +parserAssignment.pl - Implements assignments to variables + +=head1 DESCRIPTION + +This file implements an assignment operator that allows only a single +variable reference on the left and any value on the right. You can use +this to require students to enter things like + + y = 3x + 1 + +rather than making the "y = " part of the text of the question. This +also allows you to ask for lists of assignments more easily. + +To use it, load the macro file, select the Context you want to use, +add any variables you may need, and enable the assignment operator as +in the following example: + + loadMacros( + "PGstandard.pl", + "MathObjects.pl", + "parserAssignment.pl", + ); + + Context("Numeric")->variables->add(y=>'Real'); + parser::Assignment->Allow; + +Now you can use the equal sign in Formula() objects to create assignments. + + $f = Formula("y = 3x + 1"); + ... + ANS($f->cmp); + +The student will have to make an assignment to the same variable in +order to get credit. For example, he or she could enter y = 1+3x to get +credit for the answer above. + +The left-hand side of an assignment must be a single variable, so + + $f = Formula("3y = 2x"); + +will produce an error. The right-hand side can not include the +variable being assigned on the left, so + + $f = Formula("x = 2x+1"); + +also is not allowed. + +You can produce lists of assignments just as easily: + + $f = Formula("y = 3x, y = 2x-1"); + +and the assignment can be of any type of MathObject. For example: + + Context("Vector")->variables->add(p=>'Vector3D'); + parser::Assignment->Allow; + + $f = Formula("p = <1,2x,1-x>"); + +To produce a constant assignment, use Compute(), as in: + + $p = Compute("p = <1,2,3>"); + +(in fact, Compute() could be used for in place of Formula() in the +examples above as well, since it returns a Formula when the value is +one). + +Type-checking between the student and correct answers is performed +using the right-hand values of the assignment, and a warning message +will be issued if the types are not compatible. The type of the +variable, however, is not checked. + +=cut + +sub _parserAssignment_init { + PG_restricted_eval('sub Assignment {parser::Assignment::List->new(@_)}'); +} + +###################################################################### + +package parser::Assignment; +our @ISA = qw(Parser::BOP); + +# +# Check that the left operand is a variable and not used on the right +# +sub _check { + my $self = shift; my $name = $self->{def}{string} || $self->{bop}; + $self->Error("Only one assignment is allowed in an equation") + if $self->{lop}->type eq 'Assignment' || $self->{rop}->type eq 'Assignment'; + $self->Error("The left side of an assignment must be a variable",$name) + unless $self->{lop}->class eq 'Variable' || $self->context->flag("allowBadOperands"); + $self->Error("The right side of an assignment must not include the variable being defined") + if $self->{rop}->getVariables->{$self->{lop}{name}}; + delete $self->{equation}{variables}{$self->{lop}{name}}; + $self->{type} = Value::Type('Assignment',2,$self->{rop}->typeRef,list => 1); +} + +# +# Convert to an Assignment object +# +sub eval { + my $self = shift; my $context = $self->context; + my ($a,$b) = ($self->Package("String")->make($context,$self->{lop}{name}),$self->{rop}); + $b = Value::makeValue($b->eval,context => $context); + return parser::Assignment::List->make($context,$a,$b); +} + +# +# Don't count the left-hand variable +# +sub getVariables { + my $self = shift; + $self->{rop}->getVariables; +} + +# +# Create an Assignment object +# +sub perl { + my $self = shift; + return "parser::Assignment::List->new('".$self->{lop}{name}."',".$self->{rop}->perl.")"; +} + +# +# Add/Remove the Assignment operator to/from a context +# +sub Allow { + my $self = shift || "Value"; my $context = shift || $self->context; + my $allow = shift; $allow = 1 unless defined($allow); + if ($allow) { + my $prec = $context->{operators}{','}{precedence}; + $prec = 1 unless defined($prec); + $context->operators->add( + '=' => { + class => 'parser::Assignment', + precedence => $prec+.25, # just above comma + associativity => 'left', # computed left to right + type => 'bin', # binary operator + string => ' = ', # output string for it + } + ); + $context->{value}{Formula} = 'parser::Assignment::Formula'; + $context->{value}{Assignment} = 'parser::Assignment::List'; + } else {$context->operators->remove('=')} + return; +} + +###################################################################### + +# +# A special List object that holds a variable and a value, and +# that prints with an equal sign. +# + +package parser::Assignment::List; +our @ISA = ("Value::List"); + +sub new { + my $self = shift; my $class = ref($self) || $self; + my $context = (Value::isContext($_[0]) ? shift : $self->context); + Value::Error("Too many arguments") if scalar(@_) > 2; + my ($x,$v) = @_; + if (defined($v)) { + my $context = $self->context; + $v = Value::makeValue($v,context=>$context); + if ($v->isFormula) { + $x = $self->Package("Formula")->new($context,$x); + $v->{tree} = parser::Assignment->new($v,"=",$x->{tree},$v->{tree}); + return $v; + } + return $self->make($self->Package("String")->make($context,$x),$v); + } else { + $v = $self->Package("Formula")->new($x); + Value::Error("Your formula doesn't seem to be an assignment") + unless $v->{tree}->type eq "Assignment"; + return $v; + } +} + +sub string { + my $self = shift; my ($x,$v) = $self->value; + $x->string . ' = ' . $v->string; +} + +sub TeX { + my $self = shift; my ($x,$v) = $self->value; + $x = $self->Package("Formula")->new($x->{data}[0]); + $x->TeX . ' = ' . $v->string; +} + +# +# Needed since these are called explicitly without an object +# +sub cmp_defaults { + my $self = shift; + $self->SUPER::cmp_defaults(@_); +} + +# +# Class is an a variable assigned to whatever +# +sub cmp_class { + my $self = shift; + "a Variable equal to ".$self->{data}[1]->showClass; +} +sub showClass {cmp_class(@_)} + +# +# Return the proper type +# +sub typeRef { + my $self = shift; + Value::Type('Assignment',2,$self->{data}[1]->typeRef,list=>1); +} + +###################################################################### + +# +# A subclass of Formula that does typematching properly for Assignments +# (the match is against the right-hand sides) +# + +package parser::Assignment::Formula; +our @ISA = ("Value::Formula"); + +sub new { + my $self = shift; $class = ref($self) || $self; + my $f = $self->SUPER::new(@_); + bless $f, $class if $f->type eq 'Assignment'; + return $f; +} + +sub typeMatch { + my $self = shift; my $other = shift; my $ans = shift; + return 0 unless $self->type eq $other->type; + $other = $other->Package("Formula")->new($self->context,$other) unless $other->isFormula; + my $typeMatch = ($self->createRandomPoints(1))[1]->[0]{data}[1]; + $main::__other__ = sub {($other->createRandomPoints(1))[1]->[0]{data}[1]}; + $other = main::PG_restricted_eval('&$__other__()'); + delete $main::{__other__}; + return 1 unless defined($other); # can't really tell, so don't report type mismatch + $typeMatch->typeMatch($other,$ans); +} + +sub cmp_class { + my $self = shift; my $value; + if ($self->{tree}{rop}{isConstant}) { + $value = ($self->createRandomPoints(1))[1]->[0]{data}[1]; + } else { + $value = $self->Package("Formula")->new($self->context,$self->{tree}{rop}); + } + return "a Variable equal to ".$value->showClass; +} +sub showClass {cmp_class(@_)} + +1; |
From: jj v. a. <we...@ma...> - 2008-06-14 23:31:34
|
Log Message: ----------- New script for creating a special Nat. Problem Library file pointer (i.e., a pg file which just tells webwork to use the contents of another file). Added Files: ----------- admintools: npl-problem-pointer Revision Data ------------- --- /dev/null +++ npl-problem-pointer @@ -0,0 +1,124 @@ +#!/usr/bin/perl + +# Make a Problem Library type pointer to the given problem + +# This new pg file will tell webwork to process the contents of +# the existing pg file when used as a problem. It includes the +# tags which tell NPL-update to ignore it. + +# See the usage statements below. The first argument is the +# existing path. The second argument is the place to put the +# special file. There should not be a file in that position +# already. This is a safety feature in case the script is +# called with the arguments reversed. So, if file1 is a duplicate +# of file2 and you want to keep file1 and make file2 the linking +# file, then delete file2 before calling this script. + +# This needs to be called from the top directory of the Problem +# Library (so the directory containing 270, Indiana, Michigan, etc. + +# This script does not execute any cvs commands. If a file really is +# new, then you would need "cvs add". If you just deleted a file and +# are now putting in the linking file, then you would just need "cvs up" +# If you have several files, you may want to deal with them all and +# then call "cvs up" just once. + +# This could be made nicer in several ways: +# - pod style documentation +# - command line flag to delete the second argument if it already +# exists +# - command line flag to call cvs update +# - declare more variables with "my" + +use File::Basename; + +if(scalar(@ARGV) != 2) { + print "Usage: npl-problem-pointer existing/path new/path\n"; + print "Paths should not start with Library\n"; + print "Run me from the top of the problem library.\n"; + exit(); +} + +$existpath = $ARGV[0]; +$newpath = $ARGV[1]; + + +if( -f $newpath ) { + print "I don't want to overwrite $newpath ... quitting\n"; + exit(); +} + +sub surePathToFile($) { + # constructs intermediate directories enroute to the file + # the input path must be the path relative to this starting directory + my $start_directory = ""; + my $path = shift; + my $delim = "/"; + unless ($path ) { + warn "missing directory<br> surePathToFile start_directory pa +th "; + return ''; + } + my ($perms, $groupID) = (stat ".")[2,5]; + + #$path =~ s|^$start_directory|| if $path =~ m|^$start_directory|; + + + # find the nodes on the given path + my @nodes = split("$delim",$path); + + # create new path + $path = $start_directory; + + while (@nodes>1) { # the last node is the file name + $path = $path . shift (@nodes) . "/"; + unless (-e $path) { + mkdir($path, $perms) + or warn "Failed to create directory $path with start directory $start_directory "; + system("cvs add $path"); + } + + } + + $path = $path . shift(@nodes); + return $path; +} + +$dir = dirname($newpath); +$fname = basename($newpath); + +surePathToFile($newpath); + +if(not open(OUF, ">$newpath")) { + print "Cannot write to $newpath ... quitting\n"; + exit(); +} + +# Make the directory if we have to + + +print OUF <<"HERE"; +# This file is just a pointer to the file +# +# "Library/$existpath" +# +# You may want to change your problem set to use that problem +# directly, especially if you want to make a copy of the problem +# for modification. + +DOCUMENT(); +includePGproblem("Library/$existpath"); +ENDDOCUMENT(); + +## These tags keep this problem from being added to the NPL database +## +## DBsubject('ZZZ-Inserted Text') +## DBchapter('ZZZ-Inserted Text') +## DBsection('ZZZ-Inserted Text') + +HERE + +close(OUF); + +#system("cvs add $newpath"); + |
From: dpvc v. a. <we...@ma...> - 2008-06-14 23:08:00
|
Log Message: ----------- Fix typo in changes for "no strict refs". Modified Files: -------------- pg/lib/Parser: Variable.pm Revision Data ------------- Index: Variable.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Parser/Variable.pm,v retrieving revision 1.13 retrieving revision 1.14 diff -Llib/Parser/Variable.pm -Llib/Parser/Variable.pm -u -r1.13 -r1.14 --- lib/Parser/Variable.pm +++ lib/Parser/Variable.pm @@ -3,7 +3,7 @@ # Implements named variables # package Parser::Variable; -use strict; no stric "refs"; +use strict; no strict "refs"; our @ISA = qw(Parser::Item); $Parser::class->{Variable} = 'Parser::Variable'; |
From: dpvc v. a. <we...@ma...> - 2008-06-14 12:31:19
|
Log Message: ----------- Added no strict "refs" to try to avoid new error checking in Perl 5.10. Modified Files: -------------- pg/lib: Value.pm Parser.pm pg/lib/Value: Complex.pm Formula.pm Infinity.pm Interval.pm List.pm Matrix.pm Point.pm Real.pm Set.pm String.pm Union.pm Vector.pm pg/lib/Parser: BOP.pm Complex.pm Constant.pm Context.pm Function.pm Item.pm List.pm Number.pm String.pm UOP.pm Value.pm Variable.pm Revision Data ------------- Index: Value.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Value.pm,v retrieving revision 1.92 retrieving revision 1.93 diff -Llib/Value.pm -Llib/Value.pm -u -r1.92 -r1.93 --- lib/Value.pm +++ lib/Value.pm @@ -2,7 +2,7 @@ my $pkg = 'Value'; use vars qw($context $defaultContext %Type); use Scalar::Util; -use strict; +use strict; no strict "refs"; =head1 DESCRIPTION Index: Parser.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Parser.pm,v retrieving revision 1.48 retrieving revision 1.49 diff -Llib/Parser.pm -Llib/Parser.pm -u -r1.48 -r1.49 --- lib/Parser.pm +++ lib/Parser.pm @@ -1,6 +1,6 @@ package Parser; my $pkg = "Parser"; -use strict; +use strict; no strict "refs"; BEGIN { # Index: Real.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Value/Real.pm,v retrieving revision 1.41 retrieving revision 1.42 diff -Llib/Value/Real.pm -Llib/Value/Real.pm -u -r1.41 -r1.42 --- lib/Value/Real.pm +++ lib/Value/Real.pm @@ -6,7 +6,7 @@ package Value::Real; my $pkg = 'Value::Real'; -use strict; +use strict; no strict "refs"; our @ISA = qw(Value); # Index: Complex.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Value/Complex.pm,v retrieving revision 1.36 retrieving revision 1.37 diff -Llib/Value/Complex.pm -Llib/Value/Complex.pm -u -r1.36 -r1.37 --- lib/Value/Complex.pm +++ lib/Value/Complex.pm @@ -3,7 +3,7 @@ package Value::Complex; my $pkg = 'Value::Complex'; -use strict; +use strict; no strict "refs"; our @ISA = qw(Value); our $i; our $pi; Index: List.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Value/List.pm,v retrieving revision 1.27 retrieving revision 1.28 diff -Llib/Value/List.pm -Llib/Value/List.pm -u -r1.27 -r1.28 --- lib/Value/List.pm +++ lib/Value/List.pm @@ -5,7 +5,7 @@ package Value::List; my $pkg = 'Value::List'; -use strict; +use strict; no strict "refs"; our @ISA = qw(Value); # Index: String.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Value/String.pm,v retrieving revision 1.16 retrieving revision 1.17 diff -Llib/Value/String.pm -Llib/Value/String.pm -u -r1.16 -r1.17 --- lib/Value/String.pm +++ lib/Value/String.pm @@ -3,7 +3,7 @@ package Value::String; my $pkg = 'Value::String'; -use strict; +use strict; no strict "refs"; our @ISA = qw(Value); # Index: Union.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Value/Union.pm,v retrieving revision 1.42 retrieving revision 1.43 diff -Llib/Value/Union.pm -Llib/Value/Union.pm -u -r1.42 -r1.43 --- lib/Value/Union.pm +++ lib/Value/Union.pm @@ -3,7 +3,7 @@ package Value::Union; my $pkg = 'Value::Union'; -use strict; +use strict; no strict "refs"; our @ISA = qw(Value); # Index: Infinity.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Value/Infinity.pm,v retrieving revision 1.17 retrieving revision 1.18 diff -Llib/Value/Infinity.pm -Llib/Value/Infinity.pm -u -r1.17 -r1.18 --- lib/Value/Infinity.pm +++ lib/Value/Infinity.pm @@ -3,7 +3,7 @@ package Value::Infinity; my $pkg = 'Value::Infinity'; -use strict; +use strict; no strict "refs"; our @ISA = qw(Value); # Index: Vector.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Value/Vector.pm,v retrieving revision 1.38 retrieving revision 1.39 diff -Llib/Value/Vector.pm -Llib/Value/Vector.pm -u -r1.38 -r1.39 --- lib/Value/Vector.pm +++ lib/Value/Vector.pm @@ -5,7 +5,7 @@ package Value::Vector; my $pkg = 'Value::Vector'; -use strict; +use strict; no strict "refs"; our @ISA = qw(Value); # Index: Set.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Value/Set.pm,v retrieving revision 1.21 retrieving revision 1.22 diff -Llib/Value/Set.pm -Llib/Value/Set.pm -u -r1.21 -r1.22 --- lib/Value/Set.pm +++ lib/Value/Set.pm @@ -3,7 +3,7 @@ package Value::Set; my $pkg = 'Value::Set'; -use strict; +use strict; no strict "refs"; our @ISA = qw(Value); # Convert a value to a Set. The value can be Index: Formula.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Value/Formula.pm,v retrieving revision 1.60 retrieving revision 1.61 diff -Llib/Value/Formula.pm -Llib/Value/Formula.pm -u -r1.60 -r1.61 --- lib/Value/Formula.pm +++ lib/Value/Formula.pm @@ -5,7 +5,7 @@ package Value::Formula; my $pkg = 'Value::Formula'; -use strict; +use strict; no strict "refs"; our @ISA = qw(Parser Value); my $UNDEF = bless {}, "UNDEF"; # used for undefined points Index: Interval.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Value/Interval.pm,v retrieving revision 1.43 retrieving revision 1.44 diff -Llib/Value/Interval.pm -Llib/Value/Interval.pm -u -r1.43 -r1.44 --- lib/Value/Interval.pm +++ lib/Value/Interval.pm @@ -5,7 +5,7 @@ package Value::Interval; my $pkg = 'Value::Interval'; -use strict; +use strict; no strict "refs"; our @ISA = qw(Value); # Index: Matrix.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Value/Matrix.pm,v retrieving revision 1.34 retrieving revision 1.35 diff -Llib/Value/Matrix.pm -Llib/Value/Matrix.pm -u -r1.34 -r1.35 --- lib/Value/Matrix.pm +++ lib/Value/Matrix.pm @@ -7,7 +7,7 @@ package Value::Matrix; my $pkg = 'Value::Matrix'; -use strict; +use strict; no strict "refs"; our @ISA = qw(Value); # Index: Point.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Value/Point.pm,v retrieving revision 1.29 retrieving revision 1.30 diff -Llib/Value/Point.pm -Llib/Value/Point.pm -u -r1.29 -r1.30 --- lib/Value/Point.pm +++ lib/Value/Point.pm @@ -5,7 +5,7 @@ package Value::Point; my $pkg = 'Value::Point'; -use strict; +use strict; no strict "refs"; our @ISA = qw(Value); # Index: Number.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Parser/Number.pm,v retrieving revision 1.18 retrieving revision 1.19 diff -Llib/Parser/Number.pm -Llib/Parser/Number.pm -u -r1.18 -r1.19 --- lib/Parser/Number.pm +++ lib/Parser/Number.pm @@ -3,7 +3,7 @@ # Implements the Number class # package Parser::Number; -use strict; +use strict; no strict "refs"; our @ISA = qw(Parser::Item); $Parser::class->{Number} = 'Parser::Number'; Index: Complex.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Parser/Complex.pm,v retrieving revision 1.12 retrieving revision 1.13 diff -Llib/Parser/Complex.pm -Llib/Parser/Complex.pm -u -r1.12 -r1.13 --- lib/Parser/Complex.pm +++ lib/Parser/Complex.pm @@ -3,7 +3,7 @@ # Implements the Complex class # package Parser::Complex; -use strict; +use strict; no strict "refs"; our @ISA = qw(Parser::Item); $Parser::class->{Complex} = 'Parser::Complex'; Index: Value.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Parser/Value.pm,v retrieving revision 1.21 retrieving revision 1.22 diff -Llib/Parser/Value.pm -Llib/Parser/Value.pm -u -r1.21 -r1.22 --- lib/Parser/Value.pm +++ lib/Parser/Value.pm @@ -4,7 +4,7 @@ # (used to store constant Vector values, etc.) # package Parser::Value; -use strict; +use strict; no strict "refs"; our @ISA = qw(Parser::Item); $Parser::class->{Value} = 'Parser::Value'; Index: List.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Parser/List.pm,v retrieving revision 1.24 retrieving revision 1.25 diff -Llib/Parser/List.pm -Llib/Parser/List.pm -u -r1.24 -r1.25 --- lib/Parser/List.pm +++ lib/Parser/List.pm @@ -3,7 +3,7 @@ # Implements base List class. # package Parser::List; -use strict; +use strict; no strict "refs"; our @ISA = qw(Parser::Item); $Parser::class->{List} = 'Parser::List'; Index: Context.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Parser/Context.pm,v retrieving revision 1.23 retrieving revision 1.24 diff -Llib/Parser/Context.pm -Llib/Parser/Context.pm -u -r1.23 -r1.24 --- lib/Parser/Context.pm +++ lib/Parser/Context.pm @@ -2,7 +2,7 @@ package Parser::Context; my $pkg = "Parser::Context"; -use strict; +use strict; no strict "refs"; our @ISA = ("Value::Context"); # Index: Constant.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Parser/Constant.pm,v retrieving revision 1.15 retrieving revision 1.16 diff -Llib/Parser/Constant.pm -Llib/Parser/Constant.pm -u -r1.15 -r1.16 --- lib/Parser/Constant.pm +++ lib/Parser/Constant.pm @@ -3,7 +3,7 @@ # Implements named constants (e, pi, etc.) # package Parser::Constant; -use strict; +use strict; no strict "refs"; our @ISA = qw(Parser::Item); $Parser::class->{Constant} = 'Parser::Constant'; Index: String.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Parser/String.pm,v retrieving revision 1.14 retrieving revision 1.15 diff -Llib/Parser/String.pm -Llib/Parser/String.pm -u -r1.14 -r1.15 --- lib/Parser/String.pm +++ lib/Parser/String.pm @@ -4,7 +4,7 @@ # (Used for things like INFINITY, and so on) # package Parser::String; -use strict; +use strict; no strict "refs"; our @ISA = qw(Parser::Item); $Parser::class->{String} = 'Parser::String'; Index: BOP.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Parser/BOP.pm,v retrieving revision 1.22 retrieving revision 1.23 diff -Llib/Parser/BOP.pm -Llib/Parser/BOP.pm -u -r1.22 -r1.23 --- lib/Parser/BOP.pm +++ lib/Parser/BOP.pm @@ -4,7 +4,7 @@ # package Parser::BOP; -use strict; +use strict; no strict "refs"; our @ISA = qw(Parser::Item); $Parser::class->{BOP} = 'Parser::BOP'; Index: Variable.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Parser/Variable.pm,v retrieving revision 1.12 retrieving revision 1.13 diff -Llib/Parser/Variable.pm -Llib/Parser/Variable.pm -u -r1.12 -r1.13 --- lib/Parser/Variable.pm +++ lib/Parser/Variable.pm @@ -3,7 +3,7 @@ # Implements named variables # package Parser::Variable; -use strict; +use strict; no stric "refs"; our @ISA = qw(Parser::Item); $Parser::class->{Variable} = 'Parser::Variable'; Index: Function.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Parser/Function.pm,v retrieving revision 1.25 retrieving revision 1.26 diff -Llib/Parser/Function.pm -Llib/Parser/Function.pm -u -r1.25 -r1.26 --- lib/Parser/Function.pm +++ lib/Parser/Function.pm @@ -4,7 +4,7 @@ # package Parser::Function; -use strict; +use strict; no strict "refs"; our @ISA = qw(Parser::Item); $Parser::class->{Function} = 'Parser::Function'; Index: Item.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Parser/Item.pm,v retrieving revision 1.16 retrieving revision 1.17 diff -Llib/Parser/Item.pm -Llib/Parser/Item.pm -u -r1.16 -r1.17 --- lib/Parser/Item.pm +++ lib/Parser/Item.pm @@ -4,7 +4,7 @@ # are things like binary operator, function call, and so on. # package Parser::Item; -use strict; +use strict; no strict "refs"; use UNIVERSAL; use Scalar::Util; Index: UOP.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Parser/UOP.pm,v retrieving revision 1.21 retrieving revision 1.22 diff -Llib/Parser/UOP.pm -Llib/Parser/UOP.pm -u -r1.21 -r1.22 --- lib/Parser/UOP.pm +++ lib/Parser/UOP.pm @@ -3,7 +3,7 @@ # Implements the base Unary Operator class # package Parser::UOP; -use strict; +use strict; no strict "refs"; our @ISA = qw(Parser::Item); $Parser::class->{UOP} = 'Parser::UOP'; |
From: dpvc v. a. <we...@ma...> - 2008-06-14 12:12:56
|
Log Message: ----------- Fix typo in comments Modified Files: -------------- pg/lib/Parser/Function: complex.pm pg/lib/Value: Vector.pm Revision Data ------------- Index: complex.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Parser/Function/complex.pm,v retrieving revision 1.10 retrieving revision 1.11 diff -Llib/Parser/Function/complex.pm -Llib/Parser/Function/complex.pm -u -r1.10 -r1.11 --- lib/Parser/Function/complex.pm +++ lib/Parser/Function/complex.pm @@ -72,7 +72,7 @@ # # Special power operator that promotes negative real # bases to complex numbers before taking power (so that -# (-3)^(1/2) is define, for example). +# (-3)^(1/2) is defined, for example). # package Parser::Function::complex_power; use strict; Index: Vector.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Value/Vector.pm,v retrieving revision 1.37 retrieving revision 1.38 diff -Llib/Value/Vector.pm -Llib/Value/Vector.pm -u -r1.37 -r1.38 --- lib/Value/Vector.pm +++ lib/Value/Vector.pm @@ -10,7 +10,7 @@ # # Convert a value to a Vector. The value can be -# a list of numbers, or an reference to an array of numbers +# a list of numbers, or a reference to an array of numbers # a point or vector object (demote a vector) # a matrix if it is n x 1 or 1 x n # a string that parses to a vector |
From: dpvc v. a. <we...@ma...> - 2008-06-14 12:10:33
|
Log Message: ----------- Use \verb rather than \text, since it will show more characters properly, and will handle missmatched braces in student answers. Modified Files: -------------- pg/macros: PGstringevaluators.pl Revision Data ------------- Index: PGstringevaluators.pl =================================================================== RCS file: /webwork/cvs/system/pg/macros/PGstringevaluators.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -Lmacros/PGstringevaluators.pl -Lmacros/PGstringevaluators.pl -u -r1.2 -r1.3 --- macros/PGstringevaluators.pl +++ macros/PGstringevaluators.pl @@ -578,10 +578,11 @@ $rh_ans; }); $answer_evaluator->install_post_filter(sub { - my $rh_hash = shift; + my $rh_hash = shift; my $c = chr(128); ## something that won't be typed $rh_hash->{_filter_name} = "clean up preview strings"; $rh_hash->{'preview_text_string'} = $rh_hash->{student_ans}; - $rh_hash->{'preview_latex_string'} = "\\text{ ".$rh_hash->{student_ans}." }"; +# $rh_hash->{'preview_latex_string'} = "\\text{ ".$rh_hash->{student_ans}." }"; + $rh_hash->{'preview_latex_string'} = "\\verb".$c.$rh_hash->{student_ans}.$c; $rh_hash; }); return $answer_evaluator; |
From: dpvc v. a. <we...@ma...> - 2008-06-14 12:09:18
|
Log Message: ----------- Better check for constant formula. Modified Files: -------------- pg/macros: contextInequalities.pl Revision Data ------------- Index: contextInequalities.pl =================================================================== RCS file: /webwork/cvs/system/pg/macros/contextInequalities.pl,v retrieving revision 1.17 retrieving revision 1.18 diff -Lmacros/contextInequalities.pl -Lmacros/contextInequalities.pl -u -r1.17 -r1.18 --- macros/contextInequalities.pl +++ macros/contextInequalities.pl @@ -174,7 +174,7 @@ ($self->{varPos},$self->{numPos}) = ($self->{lop}->class eq 'Variable' || $self->{lop}{isInequality} ? ('lop','rop') : ('rop','lop')); my ($v,$n) = ($self->{$self->{varPos}},$self->{$self->{numPos}}); - if (($n->isNumber || $n->{isInfinite}) && $n->{isConstant}) { + if (($n->isNumber || $n->{isInfinite}) && ($n->{isConstant} || scalar(keys %{$n->getVariables}) == 0)) { if ($v->class eq 'Variable') { $self->{varName} = $v->{name}; delete $self->{equation}{variables}{$v->{name}} if $v->{isNew}; |
From: dpvc v. a. <we...@ma...> - 2008-06-14 12:03:23
|
Log Message: ----------- Make sure the previous answer is of the same MathObject class as the object being checked (so the comparison is done by the right object). This came up with the ImplicitEquation object). Modified Files: -------------- pg/lib/Value: AnswerChecker.pm Revision Data ------------- Index: AnswerChecker.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Value/AnswerChecker.pm,v retrieving revision 1.116 retrieving revision 1.117 diff -Llib/Value/AnswerChecker.pm -Llib/Value/AnswerChecker.pm -u -r1.116 -r1.117 --- lib/Value/AnswerChecker.pm +++ lib/Value/AnswerChecker.pm @@ -1647,7 +1647,8 @@ return $ans if $ans->{ans_message}; # don't overwrite other messages $ans->{prev_formula} = Parser::Formula($self->{context},$ans->{prev_ans}); if (defined($ans->{prev_formula}) && defined($ans->{student_formula})) { - $ans->{prev_equals_current} = Value::cmp_compare($ans->{student_formula},$ans->{prev_formula},{}); + my $prev = eval {$self->promote($ans->{prev_formula})}; break unless defined($prev); + $ans->{prev_equals_current} = Value::cmp_compare($prev,$ans->{student_formula},{}); if ( !$ans->{isPreview} # not preview mode and $ans->{prev_equals_current} # equivalent and $ans->{prev_ans} ne $ans->{original_student_ans}) # but not identical |
From: Arnie P. v. a. <we...@ma...> - 2008-06-11 20:09:25
|
Log Message: ----------- Backport changes Tags: ---- rel-2-4-dev Modified Files: -------------- pg/lib/WeBWorK: EquationCache.pm Revision Data ------------- Index: EquationCache.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/WeBWorK/EquationCache.pm,v retrieving revision 1.3 retrieving revision 1.3.6.1 diff -Llib/WeBWorK/EquationCache.pm -Llib/WeBWorK/EquationCache.pm -u -r1.3 -r1.3.6.1 --- lib/WeBWorK/EquationCache.pm +++ lib/WeBWorK/EquationCache.pm @@ -38,7 +38,7 @@ use warnings; use Digest::MD5 qw(md5_hex); use Fcntl qw(:DEFAULT :flock); -BEGIN { O_RDWR; O_CREAT; LOCK_EX } # get rid of "subroutine redefined" warnings +BEGIN { my @_junk = (O_RDWR,O_CREAT,LOCK_EX) } # get rid of "subroutine redefined" warnings =head1 METHODS |
From: Arnie P. v. a. <we...@ma...> - 2008-06-11 19:34:33
|
Log Message: ----------- correct syntax error in BEGIN that caused a warning in Perl 5.10 Modified Files: -------------- pg/lib/WeBWorK: EquationCache.pm Revision Data ------------- Index: EquationCache.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/WeBWorK/EquationCache.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -Llib/WeBWorK/EquationCache.pm -Llib/WeBWorK/EquationCache.pm -u -r1.3 -r1.4 --- lib/WeBWorK/EquationCache.pm +++ lib/WeBWorK/EquationCache.pm @@ -38,7 +38,7 @@ use warnings; use Digest::MD5 qw(md5_hex); use Fcntl qw(:DEFAULT :flock); -BEGIN { O_RDWR; O_CREAT; LOCK_EX } # get rid of "subroutine redefined" warnings +BEGIN { my @_junk = (O_RDWR,O_CREAT,LOCK_EX) } # get rid of "subroutine redefined" warnings =head1 METHODS |
From: Arnie P. v. a. <we...@ma...> - 2008-06-11 13:58:45
|
Log Message: ----------- Give practice users guest rather than student permission Modified Files: -------------- webwork2/courses.dist/modelCourse/templates: demoCourse.lst Revision Data ------------- Index: demoCourse.lst =================================================================== RCS file: /webwork/cvs/system/webwork2/courses.dist/modelCourse/templates/demoCourse.lst,v retrieving revision 1.2 retrieving revision 1.3 diff -Lcourses.dist/modelCourse/templates/demoCourse.lst -Lcourses.dist/modelCourse/templates/demoCourse.lst -u -r1.2 -r1.3 --- courses.dist/modelCourse/templates/demoCourse.lst +++ courses.dist/modelCourse/templates/demoCourse.lst @@ -1,9 +1,9 @@ -000-00-000a ,PRACTICE1 ,JANE ,C , , , , ,practice1 -000-00-000b ,PRACTICE2 ,JANE ,C , , , , ,practice2 -000-00-000c ,PRACTICE3 ,JANE ,C , , , , ,practice3 -000-00-000d ,PRACTICE4 ,JANE ,C , , , , ,practice4 -000-00-000e ,PRACTICE5 ,JANE ,C , , , , ,practice5 -000-00-000f ,PRACTICE6 ,JANE ,C , , , , ,practice6 -000-00-000g ,PRACTICE7 ,JANE ,C , , , , ,practice7 -000-00-000h ,PRACTICE8 ,JANE ,C , , , , ,practice8 -000-00-000i ,PRACTICE9 ,JANE ,C , , , , ,practice9 +practice1 ,PRACTICE1 ,JANE ,C , , , , ,practice1, ,-5 +practice2 ,PRACTICE2 ,JANE ,C , , , , ,practice2, ,-5 +practice3 ,PRACTICE3 ,JANE ,C , , , , ,practice3, ,-5 +practice4 ,PRACTICE4 ,JANE ,C , , , , ,practice4, ,-5 +practice5 ,PRACTICE5 ,JANE ,C , , , , ,practice5, ,-5 +practice6 ,PRACTICE6 ,JANE ,C , , , , ,practice6, ,-5 +practice7 ,PRACTICE7 ,JANE ,C , , , , ,practice7, ,-5 +practice8 ,PRACTICE8 ,JANE ,C , , , , ,practice8, ,-5 +practice9 ,PRACTICE9 ,JANE ,C , , , , ,practice9, ,-5 |
From: Mike G. v. a. <we...@ma...> - 2008-06-11 13:39:42
|
Log Message: ----------- Corrected documentation for the ?{4.56:%0.2f} and !{4.5645:%0.2f} constructions -- their behavior had been reversed. Indicated that the !{ } construction is deprecated since it behave just like {4.5645:%0.2f} Modified Files: -------------- pg/macros: PGbasicmacros.pl Revision Data ------------- Index: PGbasicmacros.pl =================================================================== RCS file: /webwork/cvs/system/pg/macros/PGbasicmacros.pl,v retrieving revision 1.50 retrieving revision 1.51 diff -Lmacros/PGbasicmacros.pl -Lmacros/PGbasicmacros.pl -u -r1.50 -r1.51 --- macros/PGbasicmacros.pl +++ macros/PGbasicmacros.pl @@ -1370,11 +1370,13 @@ Two additional legacy formatting constructions are also supported: -C<?{$c:%0.3f} > will give a number with 3 decimal places and a negative -sign if the number is negative, no sign if the number is positive. - -C<!{$c:%0.3f}> determines the sign and prints it -whether the number is positive or negative. +C<!{$c:%0.3f} > will give a number with 3 decimal places and a negative +sign if the number is negative, no sign if the number is positive. Since this is +identical to the behavior of C<{$c:%0.3f}> the use of this syntax is depricated. + +C<?{$c:%0.3f}> determines the sign and prints it +whether the number is positive or negative. You can use this +to force an expression such as C<+5.456>. =head3 EV2 |
From: Mike G. v. a. <we...@ma...> - 2008-06-03 02:52:43
|
Log Message: ----------- Corrected error in modification to NPL Modified Files: -------------- webwork2/bin: NPL-update Revision Data ------------- Index: NPL-update =================================================================== RCS file: /webwork/cvs/system/webwork2/bin/NPL-update,v retrieving revision 1.6 retrieving revision 1.7 diff -Lbin/NPL-update -Lbin/NPL-update -u -r1.6 -r1.7 --- bin/NPL-update +++ bin/NPL-update @@ -18,9 +18,8 @@ use Cwd; use DBI; -#hack until mysqls are more up to date. - -use constant MAXVARCHARLENGTH=>255; #(use 4096 for mysql > 5.0.3) + #(maximum varchar length is 255 for mysql version < 5.0.3. + #You can increase path length to 4096 for mysql > 5.0.3) BEGIN { die "WEBWORK_ROOT not found in environment.\n" @@ -63,7 +62,7 @@ '], ['NPL-path', ' path_id int(15) NOT NULL auto_increment, - path varchar(MAXVARCHARLENGTH) NOT NULL, + path varchar(255) NOT NULL, machine varchar(127), user varchar(127), KEY (path), |
From: Mike G. v. a. <we...@ma...> - 2008-06-03 02:50:08
|
Log Message: ----------- Lowered upper limit of path to 255 (can't use longer keys before mysql 5.0.3) Modified Files: -------------- webwork2/bin: NPL-update Revision Data ------------- Index: NPL-update =================================================================== RCS file: /webwork/cvs/system/webwork2/bin/NPL-update,v retrieving revision 1.5 retrieving revision 1.6 diff -Lbin/NPL-update -Lbin/NPL-update -u -r1.5 -r1.6 --- bin/NPL-update +++ bin/NPL-update @@ -18,6 +18,10 @@ use Cwd; use DBI; +#hack until mysqls are more up to date. + +use constant MAXVARCHARLENGTH=>255; #(use 4096 for mysql > 5.0.3) + BEGIN { die "WEBWORK_ROOT not found in environment.\n" unless exists $ENV{WEBWORK_ROOT}; @@ -59,7 +63,7 @@ '], ['NPL-path', ' path_id int(15) NOT NULL auto_increment, - path varchar(4096) NOT NULL, + path varchar(MAXVARCHARLENGTH) NOT NULL, machine varchar(127), user varchar(127), KEY (path), @@ -200,7 +204,7 @@ #### First read in textbook information if(open(IN, "$libraryRoot/Textbooks")) { - print "Reading in textbook data.\n"; + print "Reading in textbook data from Textbooks in the library $libraryRoot.\n"; my %textinfo = ( TitleText => '', EditionText =>'', AuthorText=>''); my $bookid = undef; while (my $line = <IN>) { @@ -307,7 +311,9 @@ } close(IN); } else{ - print "Textbooks file was not found. Updating from cvs should fix this problem.\n"; + print "Textbooks file was not found in library $libraryRoot. If the path to the problem library doesn't seem + correct, make modifications in webwork2/conf/global.conf (\$problemLibrary{root}). If that is correct then + updating from cvs should download the Textbooks file.\n"; } print "Converting data from tagged pgfiles into mysql.\n"; |
From: Mike G. v. a. <we...@ma...> - 2008-05-28 20:17:48
|
Log Message: ----------- Insure that all grades are added to the gradebook each time an "update" of an assignment module takes place. This is not perfect -- it would be better if grades were added to the gradebook "automatically" -- but this gives a manual way of updating the gradebook for a given wwassignment. Modified Files: -------------- wwmoodle/wwassignment4/moodle/mod/wwassignment: lib.php Revision Data ------------- Index: lib.php =================================================================== RCS file: /webwork/cvs/system/wwmoodle/wwassignment4/moodle/mod/wwassignment/lib.php,v retrieving revision 1.1 retrieving revision 1.2 diff -Lwwassignment4/moodle/mod/wwassignment/lib.php -Lwwassignment4/moodle/mod/wwassignment/lib.php -u -r1.1 -r1.2 --- wwassignment4/moodle/mod/wwassignment/lib.php +++ wwassignment4/moodle/mod/wwassignment/lib.php @@ -1,6 +1,7 @@ <?php global $CFG; require_once("locallib.php"); + // debug switch defined in locallib.php define('WWASSIGNMENT_DEBUG',0); //////////////////////////////////////////////////////////////// @@ -15,6 +16,10 @@ // wwassignment_get_user_grades // could be called from wwassignment/index.php pages (legacy??) // +// High level grade calls in gradelib.php (see end of file) +// +// +// // Internal grade calling structure // // wwassignment_update_grades($wwassignment=null, $userid=0, $nullifnone=true) -- updates grades for assignment instance or all instances @@ -105,10 +110,10 @@ _wwassignment_delete_events($wwassignment->id); _wwassignment_create_events($wwsetname,$wwassignment->id,$wwsetdata['open_date'],$wwsetdata['due_date']); - //notify gradebook -- updates grade_item only - + //notify gradebook -- update grades for this wwassignment only wwassignment_grade_item_update($wwassignment); - debugLog("End wwassignment_update_instance"); + wwassignment_update_grades($wwassignment); + debugLog("End wwassignment_update_instance"); return $returnid; } @@ -521,4 +526,52 @@ return true; } -?> \ No newline at end of file + +// High level grade calls ins gradelib.php + +/** + * Returns grading information for given activity - optionally with users grades + * Manual, course or category items can not be queried. + * @public + * @param int $courseid id of course + * @param string $itemtype 'mod', 'block' + * @param string $itemmodule 'forum, 'quiz', etc. + * @param int $iteminstance id of the item module + * @param int $userid_or_ids optional id of the graded user or array of ids; if userid not used, returns only information about grade_item + * @return array of grade information objects (scaleid, name, grade and locked status, etc.) indexed with itemnumbers + */ + +// function grade_get_grades($courseid, $itemtype, $itemmodule, $iteminstance, $userid_or_ids=null) { + + + /** + * Submit new or update grade; update/create grade_item definition. Grade must have userid specified, + * rawgrade and feedback with format are optional. rawgrade NULL means 'Not graded', missing property + * or key means do not change existing. + * + * Only following grade item properties can be changed 'itemname', 'idnumber', 'gradetype', 'grademax', + * 'grademin', 'scaleid', 'multfactor', 'plusfactor', 'deleted' and 'hidden'. 'reset' means delete all current grades including locked ones. + * + * Manual, course or category items can not be updated by this function. + * @public + * @param string $source source of the grade such as 'mod/assignment' + * @param int $courseid id of course + * @param string $itemtype type of grade item - mod, block + * @param string $itemmodule more specific then $itemtype - assignment, forum, etc.; maybe NULL for some item types + * @param int $iteminstance instance it of graded subject + * @param int $itemnumber most probably 0, modules can use other numbers when having more than one grades for each user + * @param mixed $grades grade (object, array) or several grades (arrays of arrays or objects), NULL if updating grade_item definition only + * @param mixed $itemdetails object or array describing the grading item, NULL if no change + */ +// function grade_update($source, $courseid, $itemtype, $itemmodule, $iteminstance, $itemnumber, $grades=NULL, $itemdetails=NULL) { + +/** + * Refetches data from all course activities + * @param int $courseid + * @param string $modname + * @return success + */ +// function grade_grab_course_grades($courseid, $modname=null) { + +?> + |
From: dpvc v. a. <we...@ma...> - 2008-05-24 23:21:11
|
Log Message: ----------- Moved previous_equivalence_message filter to Formula object directly, so it is no longer needed in the FUNCTION_CMP macro itself. Modified Files: -------------- pg/macros: PGfunctionevaluators.pl pg/lib/Value: AnswerChecker.pm Revision Data ------------- Index: PGfunctionevaluators.pl =================================================================== RCS file: /webwork/cvs/system/pg/macros/PGfunctionevaluators.pl,v retrieving revision 1.4 retrieving revision 1.5 diff -Lmacros/PGfunctionevaluators.pl -Lmacros/PGfunctionevaluators.pl -u -r1.4 -r1.5 --- macros/PGfunctionevaluators.pl +++ macros/PGfunctionevaluators.pl @@ -634,7 +634,7 @@ my $zeroLevel = $func_params{'zeroLevel'}; my $zeroLevelTol = $func_params{'zeroLevelTol'}; my $testPoints = $func_params{'test_points'}; - + # # Check that everything is defined: # @@ -643,14 +643,14 @@ my @VARS = get_var_array($var); my @limits = get_limits_array($ra_limits); my @PARAMS = @{$func_params{'params'} || []}; - + if ($tolType eq 'relative') { $tol = $functRelPercentTolDefault unless defined $tol; $tol *= .01; } else { $tol = $functAbsTolDefault unless defined $tol; } - + # # Ensure that the number of limits matches number of variables # @@ -685,7 +685,7 @@ $maxConstantOfIntegration = $functMaxConstantOfIntegration unless defined $maxConstantOfIntegration; $zeroLevel = $functZeroLevelDefault unless defined $zeroLevel; $zeroLevelTol = $functZeroLevelTolDefault unless defined $zeroLevelTol; - + $func_params{'var'} = \@VARS; $func_params{'params'} = \@PARAMS; $func_params{'limits'} = \@limits; @@ -696,7 +696,7 @@ $func_params{'maxConstantOfIntegration'} = $maxConstantOfIntegration; $func_params{'zeroLevel'} = $zeroLevel; $func_params{'zeroLevelTol'} = $zeroLevelTol; - + ######################################################## # End of cleanup of calling parameters ######################################################## @@ -741,91 +741,16 @@ my $cmp = $f->cmp(%options); &$Context($oldContext); - # - # Get previous answer from hidden field of form - # - $cmp->install_pre_filter( - sub { - my $rh_ans = shift; - $rh_ans->{_filter_name} = "fetch_previous_answer"; - $rh_ans->{prev_ans} = undef; - if ( defined($rh_ans->{ans_label} ) ) { - my $prev_ans_label = "previous_".$rh_ans->{ans_label}; - if ( defined $inputs_ref->{$prev_ans_label} and $inputs_ref->{$prev_ans_label} =~/\S/) { - $rh_ans->{prev_ans} = $inputs_ref->{$prev_ans_label}; - #warn "inputs reference is ", join(" ",%$inputs_ref); - #warn "$prev_ans_label is ",$rh_ans->{prev_ans}; - #FIXME -- previous answer item is not always being updated in inputs_ref (which comes from formField) - } - } - # if no ans_label or previous answer then leave undefined. - $rh_ans; # prev_ans contains previous answer or "undef" - } - ); - - - # - # Parse the previous answer, if any - # - $cmp->install_evaluator( - sub { - my $rh_ans = shift; - $rh_ans->{_filter_name} = "parse_previous_answer"; - return $rh_ans unless defined $rh_ans->{prev_ans}; - my $oldContext = &$Context(); - &$Context($rh_ans->{correct_value}{context}); - $rh_ans->{prev_formula} = Parser::Formula($rh_ans->{prev_ans}); - &$Context($oldContext); - $rh_ans; - } - ); - - # - # Check if previous answer equals this current one - # - $cmp->install_evaluator( - sub { - my $rh_ans = shift; - $rh_ans->{_filter_name} = "compare_to_previous_answer"; - return $rh_ans unless defined($rh_ans->{prev_formula}) && defined($rh_ans->{student_formula}); - $rh_ans->{prev_equals_current} = - Value::cmp_compare($rh_ans->{student_formula},$rh_ans->{prev_formula},{}); - $rh_ans; - } - ); - - # - # Show a message when the answer is equivalent to the previous answer. - # - # We want to show the message when we're not in preview mode AND the - # answers are equivalent AND the answers are not identical. We DON'T CARE - # whether the answers are correct or not, because that leaks information in - # multipart questions when $showPartialCorrectAnswers is off. - # - $cmp->install_post_filter( - sub { - my $rh_ans = shift; - $rh_ans->{_filter_name} = "produce_equivalence_message"; - - return $rh_ans unless !$rh_ans->{isPreview} # not preview mode - and $rh_ans->{prev_equals_current} # equivalent - and $rh_ans->{prev_ans} ne $rh_ans->{original_student_ans}; # not identical - - $rh_ans->{ans_message} = "This answer is equivalent to the one you just submitted."; - $rh_ans; - } - ); - return $cmp; } - + # # The original version, for backward compatibility # (can be removed when the Parser-based version is more fully tested.) # sub ORIGINAL_FUNCTION_CMP { my %func_params = @_; - + my $correctEqn = $func_params{'correctEqn'}; my $var = $func_params{'var'}; my $ra_limits = $func_params{'limits'}; @@ -837,7 +762,7 @@ my $zeroLevel = $func_params{'zeroLevel'}; my $zeroLevelTol = $func_params{'zeroLevelTol'}; my $ra_test_points = $func_params{'test_points'}; - + # Check that everything is defined: $func_params{debug} = 0 unless defined $func_params{debug}; $mode = 'std' unless defined $mode; @@ -845,7 +770,7 @@ my @limits = get_limits_array($ra_limits); my @PARAMS = (); @PARAMS = @{$func_params{'params'}} if defined $func_params{'params'}; - + my @evaluation_points; if(defined $ra_test_points) { # see if this is the standard format @@ -872,7 +797,7 @@ } } } # end of handling of user supplied evaluation points - + if ($mode eq 'antider') { # doctor the equation to allow addition of a constant my $CONSTANT_PARAM = 'Q'; # unfortunately parameters must be single letters. @@ -882,14 +807,14 @@ push @PARAMS, $CONSTANT_PARAM; } my $dim_of_param_space = @PARAMS; # dimension of equivalence space - + if($tolType eq 'relative') { $tol = $functRelPercentTolDefault unless defined $tol; $tol *= .01; } else { $tol = $functAbsTolDefault unless defined $tol; } - + #loop ensures that number of limits matches number of variables for(my $i = 0; $i < scalar @VARS; $i++) { $limits[$i][0] = $functLLimitDefault unless defined $limits[$i][0]; @@ -899,7 +824,7 @@ $maxConstantOfIntegration = $functMaxConstantOfIntegration unless defined $maxConstantOfIntegration; $zeroLevel = $functZeroLevelDefault unless defined $zeroLevel; $zeroLevelTol = $functZeroLevelTolDefault unless defined $zeroLevelTol; - + $func_params{'var'} = $var; $func_params{'limits'} = \@limits; $func_params{'tolerance'} = $tol; @@ -909,19 +834,19 @@ $func_params{'maxConstantOfIntegration'} = $maxConstantOfIntegration; $func_params{'zeroLevel'} = $zeroLevel; $func_params{'zeroLevelTol'} = $zeroLevelTol; - + ######################################################## # End of cleanup of calling parameters ######################################################## - + my $i; # for use with loops my $PGanswerMessage = ""; my $originalCorrEqn = $correctEqn; - + ###################################################################### # prepare the correct answer and check its syntax ###################################################################### - + my $rh_correct_ans = new AnswerHash; $rh_correct_ans->input($correctEqn); $rh_correct_ans = check_syntax($rh_correct_ans); Index: AnswerChecker.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Value/AnswerChecker.pm,v retrieving revision 1.115 retrieving revision 1.116 diff -Llib/Value/AnswerChecker.pm -Llib/Value/AnswerChecker.pm -u -r1.115 -r1.116 --- lib/Value/AnswerChecker.pm +++ lib/Value/AnswerChecker.pm @@ -117,7 +117,7 @@ my $context = $ans->{correct_value}{context} || $current; Parser::Context->current(undef,$context); # change to correct answser's context my $flags = contextSet($context,$self->cmp_contextFlags($ans)); # save old context flags - my $inputs = $self->getPG('$inputs_ref',{action=>""}); + my $inputs = $self->getPG('$inputs_ref'); $ans->{isPreview} = $inputs->{previewAnswers} || ($inputs->{action} =~ m/^Preview/); $ans->{cmp_class} = $self->cmp_class($ans) unless $ans->{cmp_class}; $ans->{error_message} = $ans->{ans_message} = ''; # clear any old messages @@ -1616,9 +1616,47 @@ $cmp->ans_hash(correct_value => $f); Parser::Context->current(undef,$current); } + $cmp->install_pre_filter(\&Value::Formula::cmp_call_filter,"cmp_prefilter"); + $cmp->install_post_filter(\&Value::Formula::cmp_call_filter,"cmp_postfilter"); return $cmp; } +sub cmp_call_filter { + my $ans = shift; my $method = shift; + return $ans->{correct_value}->$method($ans); +} + +sub cmp_prefilter { + my $self = shift; my $ans = shift; + $ans->{_filter_name} = "fetch_previous_answer"; + $ans->{prev_ans} = undef; + if (defined($ans->{ans_label})) { + my $label = "previous_".$ans->{ans_label}; + my $inputs = $self->getPG('$inputs_ref'); + if (defined $inputs->{$label} and $inputs->{$label} =~ /\S/) { + $ans->{prev_ans} = $inputs->{$label}; + #FIXME -- previous answer item is not always being updated in inputs_ref (which comes from formField) + } + } + return $ans; +} + +sub cmp_postfilter { + my $self = shift; my $ans = shift; + $ans->{_filter_name} = "produce_equivalence_message"; + return $ans if $ans->{ans_message}; # don't overwrite other messages + $ans->{prev_formula} = Parser::Formula($self->{context},$ans->{prev_ans}); + if (defined($ans->{prev_formula}) && defined($ans->{student_formula})) { + $ans->{prev_equals_current} = Value::cmp_compare($ans->{student_formula},$ans->{prev_formula},{}); + if ( !$ans->{isPreview} # not preview mode + and $ans->{prev_equals_current} # equivalent + and $ans->{prev_ans} ne $ans->{original_student_ans}) # but not identical + {$ans->{ans_message} = "This answer is equivalent to the one you just submitted."} + } + return $ans; +} + + sub cmp_equal { my $self = shift; my $ans = shift; # |
From: Mike G. v. a. <we...@ma...> - 2008-05-24 02:50:12
|
Log Message: ----------- removed code that tried to import all grades from webwork on upgrades the moodle -- webwork link might not be made in which case this operation would fail Modified Files: -------------- wwmoodle/wwassignment4/moodle/mod/wwassignment/db: upgrade.php Revision Data ------------- Index: upgrade.php =================================================================== RCS file: /webwork/cvs/system/wwmoodle/wwassignment4/moodle/mod/wwassignment/db/upgrade.php,v retrieving revision 1.2 retrieving revision 1.3 diff -Lwwassignment4/moodle/mod/wwassignment/db/upgrade.php -Lwwassignment4/moodle/mod/wwassignment/db/upgrade.php -u -r1.2 -r1.3 --- wwassignment4/moodle/mod/wwassignment/db/upgrade.php +++ wwassignment4/moodle/mod/wwassignment/db/upgrade.php @@ -52,13 +52,16 @@ /// Launch add field timemodified $result = $result && add_field($table, $field); - notify('Processing assignment grades, this may take a while if there are many assignments...', 'notifysuccess'); + // can't do this until you are connected to webwork -- which you won't be on initial upgrades + // add this either to wwlink block or to configuration + + //notify('Processing assignment grades, this may take a while if there are many assignments...', 'notifysuccess'); // change grade typo to text if no grades MDL-13920 - require_once $CFG->dirroot.'/mod/wwassignment/lib.php'; + //require_once $CFG->dirroot.'/mod/wwassignment/lib.php'; // too much debug output - $db->debug = false; - wwassignment_update_grades(); - $db->debug = true; + //$db->debug = false; + //wwassignment_update_grades(); + //$db->debug = true; } return $result; |
From: Mike G. v. a. <we...@ma...> - 2008-05-24 02:45:24
|
Log Message: ----------- removed a hardwired "require" reference Modified Files: -------------- wwmoodle/wwassignment4/moodle/mod/wwassignment: locallib.php wwmoodle/wwassignment4/moodle/mod/wwassignment/db: upgrade.php Revision Data ------------- Index: locallib.php =================================================================== RCS file: /webwork/cvs/system/wwmoodle/wwassignment4/moodle/mod/wwassignment/locallib.php,v retrieving revision 1.1 retrieving revision 1.2 diff -Lwwassignment4/moodle/mod/wwassignment/locallib.php -Lwwassignment4/moodle/mod/wwassignment/locallib.php -u -r1.1 -r1.2 --- wwassignment4/moodle/mod/wwassignment/locallib.php +++ wwassignment4/moodle/mod/wwassignment/locallib.php @@ -1,7 +1,6 @@ <?php global $CFG; require_once("$CFG->libdir/soap/nusoap.php"); -require_once("/Library/WebServer/Documents/moodle/lib/soap/nusoap.php"); define('WWASSIGNMENT_DEBUG',0); Index: upgrade.php =================================================================== RCS file: /webwork/cvs/system/wwmoodle/wwassignment4/moodle/mod/wwassignment/db/upgrade.php,v retrieving revision 1.1 retrieving revision 1.2 diff -Lwwassignment4/moodle/mod/wwassignment/db/upgrade.php -Lwwassignment4/moodle/mod/wwassignment/db/upgrade.php -u -r1.1 -r1.2 --- wwassignment4/moodle/mod/wwassignment/db/upgrade.php +++ wwassignment4/moodle/mod/wwassignment/db/upgrade.php @@ -47,7 +47,7 @@ /// Define field timemodified to be added to wwassignment $table = new XMLDBTable('wwassignment'); $field = new XMLDBField('timemodified'); - $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'grade'); + $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'webwork_set'); /// Launch add field timemodified $result = $result && add_field($table, $field); |
From: Mike G. v. a. <we...@ma...> - 2008-05-24 02:44:13
|
Log Message: ----------- by defining the function footer() we eliminate a constant error message Modified Files: -------------- wwmoodle/wwassignment4/moodle/blocks/wwlink: block_wwlink.php Revision Data ------------- Index: block_wwlink.php =================================================================== RCS file: /webwork/cvs/system/wwmoodle/wwassignment4/moodle/blocks/wwlink/block_wwlink.php,v retrieving revision 1.1 retrieving revision 1.2 diff -Lwwassignment4/moodle/blocks/wwlink/block_wwlink.php -Lwwassignment4/moodle/blocks/wwlink/block_wwlink.php -u -r1.1 -r1.2 --- wwassignment4/moodle/blocks/wwlink/block_wwlink.php +++ wwassignment4/moodle/blocks/wwlink/block_wwlink.php @@ -65,7 +65,9 @@ } else { $this->content->text = get_string('connected','block_wwlink') . ' ' . $record->webwork_course; } + $this->content->footer = ''; return $this->content; } + } ?> |
From: Mike G. v. a. <we...@ma...> - 2008-05-24 02:41:51
|
Log Message: ----------- Inserted commented out code that, when uncommented, will enable the WebworkSOAP interface that communicates with Moodle. Modified Files: -------------- webwork2/conf: webwork.apache-config.dist Revision Data ------------- Index: webwork.apache-config.dist =================================================================== RCS file: /webwork/cvs/system/webwork2/conf/webwork.apache-config.dist,v retrieving revision 1.21 retrieving revision 1.22 diff -Lconf/webwork.apache-config.dist -Lconf/webwork.apache-config.dist -u -r1.21 -r1.22 --- conf/webwork.apache-config.dist +++ conf/webwork.apache-config.dist @@ -94,5 +94,41 @@ $Location{$webwork_htdocs_url} = { SetHandler => "none" }; } +$ENV{WEBWORK_ROOT} = $webwork_dir; + +$PerlConfig .= <<EOF; + + +########## SOAP installation ########## +# + +# uncomment these three stanzas to use WeBWorK with Moodle + +# PerlModule WebworkSOAP + +# #WEBWORK SOAP CONFIGURATION +# <Location /webwork2_rpc> +# PerlHandler Apache::SOAP +# SetHandler perl-script +# PerlSetVar dispatch_to "WebworkSOAP" +# PerlSetVar options "compress_threshold => 10000" +# Order Allow,Deny +# Allow from All +# </Location> + +# #WEBWORK SOAP WSDL HANDLER :: TO BE REPLACED WITH A FILE FOR PRODUCTION SERVERS +# <Location /webwork2_wsdl> +# PerlSetVar dispatch_to "WebworkSOAP::WSDL" +# PerlSetVar options "compress_threshold => 10000" +# PerlHandler WebworkSOAP::WSDL +# SetHandler perl-script +# Order Allow,Deny +# Allow from All +# </Location> + +# end of WeBWorK -- Moodle stanzas + +EOF + </Perl> |
From: Mike G. v. a. <we...@ma...> - 2008-05-23 15:10:51
|
Log Message: ----------- Moved trim_spaces utility from AddUsers.pm to Utils.pm (data munger section) CourseAdmin page now calls trim_spaces to clean up data entered when creating a new course (spaces at beginning and end of entry are trimmed). This addresses bug #1442 Modified Files: -------------- webwork2/lib/WeBWorK: Utils.pm webwork2/lib/WeBWorK/ContentGenerator: CourseAdmin.pm webwork2/lib/WeBWorK/ContentGenerator/Instructor: AddUsers.pm Revision Data ------------- Index: Utils.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/Utils.pm,v retrieving revision 1.80 retrieving revision 1.81 diff -Llib/WeBWorK/Utils.pm -Llib/WeBWorK/Utils.pm -u -r1.80 -r1.81 --- lib/WeBWorK/Utils.pm +++ lib/WeBWorK/Utils.pm @@ -52,37 +52,38 @@ our @EXPORT = (); our @EXPORT_OK = qw( - runtime_use - readFile - readDirectory - listFilesRecursive - surePathToFile - makeTempDirectory - removeTempDirectory - path_is_subdir - formatDateTime - parseDateTime - textDateTime - intDateTime - timeToSec - before after + before between - writeLog - writeCourseLog - writeTimingLogEntry - list2hash - ref2string + constituency_hash + cryptPassword decodeAnswers + dequote encodeAnswers + fisher_yates_shuffle + formatDateTime + intDateTime + list2hash + listFilesRecursive + makeTempDirectory max + parseDateTime + path_is_subdir pretty_print_rh - cryptPassword - dequote - undefstr - fisher_yates_shuffle - constituency_hash + readDirectory + readFile + ref2string + removeTempDirectory + runtime_use sortByName + surePathToFile + textDateTime + timeToSec + trim_spaces + undefstr + writeCourseLog + writeLog + writeTimingLogEntry ); =head1 FUNCTIONS @@ -736,7 +737,12 @@ ################################################################################ # Data munging ################################################################################ - +## Utility function to trim whitespace off the start and end of its input +sub trim_spaces { + my $in = shift; + $in =~ s/^\s*(.*?)\s*$/$1/; + return($in); +} sub list2hash(@) { map {$_ => "0"} @_; } Index: CourseAdmin.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/CourseAdmin.pm,v retrieving revision 1.73 retrieving revision 1.74 diff -Llib/WeBWorK/ContentGenerator/CourseAdmin.pm -Llib/WeBWorK/ContentGenerator/CourseAdmin.pm -u -r1.73 -r1.74 --- lib/WeBWorK/ContentGenerator/CourseAdmin.pm +++ lib/WeBWorK/ContentGenerator/CourseAdmin.pm @@ -33,7 +33,7 @@ use IO::File; use URI::Escape; use WeBWorK::Debug; -use WeBWorK::Utils qw(cryptPassword writeLog listFilesRecursive); +use WeBWorK::Utils qw(cryptPassword writeLog listFilesRecursive trim_spaces); use WeBWorK::Utils::CourseManagement qw(addCourse renameCourse deleteCourse listCourses archiveCourse listArchivedCourses unarchiveCourse); use WeBWorK::Utils::DBImportExport qw(dbExport dbImport); @@ -312,10 +312,10 @@ " | ", CGI::a({href=>$self->systemLink($urlpath, params=>{subDisplay=>"delete_course"})}, "Delete Course"), " | ", - CGI::a({href=>$self->systemLink($urlpath, params=>{subDisplay=>"export_database"})}, "Export Database"), - " | ", - CGI::a({href=>$self->systemLink($urlpath, params=>{subDisplay=>"import_database"})}, "Import Database"), - " | ", + # CGI::a({href=>$self->systemLink($urlpath, params=>{subDisplay=>"export_database"})}, "Export Database"), + # " | ", + # CGI::a({href=>$self->systemLink($urlpath, params=>{subDisplay=>"import_database"})}, "Import Database"), + # " | ", CGI::a({href=>$self->systemLink($urlpath, params=>{subDisplay=>"archive_course"})}, "Archive Course"), "|", CGI::a({href=>$self->systemLink($urlpath, params=>{subDisplay=>"unarchive_course"})}, "Unarchive Course"), @@ -390,23 +390,26 @@ #my $authz = $r->authz; #my $urlpath = $r->urlpath; - my $add_courseID = $r->param("add_courseID") || ""; - my $add_courseTitle = $r->param("add_courseTitle") || ""; - my $add_courseInstitution = $r->param("add_courseInstitution") || ""; - - my $add_admin_users = $r->param("add_admin_users") || ""; - - my $add_initial_userID = $r->param("add_initial_userID") || ""; - my $add_initial_password = $r->param("add_initial_password") || ""; - my $add_initial_confirmPassword = $r->param("add_initial_confirmPassword") || ""; - my $add_initial_firstName = $r->param("add_initial_firstName") || ""; - my $add_initial_lastName = $r->param("add_initial_lastName") || ""; - my $add_initial_email = $r->param("add_initial_email") || ""; + my $add_courseID = trim_spaces( $r->param("add_courseID") ) || ""; + my $add_courseTitle = trim_spaces( $r->param("add_courseTitle") ) || ""; + my $add_courseInstitution = trim_spaces( $r->param("add_courseInstitution") ) || ""; + + my $add_admin_users = trim_spaces( $r->param("add_admin_users") ) || ""; + + my $add_initial_userID = trim_spaces( $r->param("add_initial_userID") ) || ""; + my $add_initial_password = trim_spaces( $r->param("add_initial_password") ) || ""; + my $add_initial_confirmPassword = trim_spaces( $r->param("add_initial_confirmPassword") ) || ""; + my $add_initial_firstName = trim_spaces( $r->param("add_initial_firstName") ) || ""; + my $add_initial_lastName = trim_spaces( $r->param("add_initial_lastName") ) || ""; + my $add_initial_email = trim_spaces( $r->param("add_initial_email") ) || ""; - my $add_templates_course = $r->param("add_templates_course") || ""; + my $add_templates_course = trim_spaces( $r->param("add_templates_course") ) || ""; - my $add_dbLayout = $r->param("add_dbLayout") || ""; + my $add_dbLayout = trim_spaces( $r->param("add_dbLayout") ) || ""; + + + my @dbLayouts = do { my @ordered_layouts; foreach my $layout (@{$ce->{dbLayout_order}}) { @@ -551,22 +554,28 @@ #my $authz = $r->authz; #my $urlpath = $r->urlpath; - my $add_courseID = $r->param("add_courseID") || ""; - my $add_courseTitle = $r->param("add_courseTitle") || ""; - my $add_courseInstitution = $r->param("add_courseInstitution") || ""; - - my $add_admin_users = $r->param("add_admin_users") || ""; - - my $add_initial_userID = $r->param("add_initial_userID") || ""; - my $add_initial_password = $r->param("add_initial_password") || ""; - my $add_initial_confirmPassword = $r->param("add_initial_confirmPassword") || ""; - my $add_initial_firstName = $r->param("add_initial_firstName") || ""; - my $add_initial_lastName = $r->param("add_initial_lastName") || ""; - my $add_initial_email = $r->param("add_initial_email") || ""; + + my $add_courseID = trim_spaces( $r->param("add_courseID") ) || ""; + my $add_courseTitle = trim_spaces( $r->param("add_courseTitle") ) || ""; + my $add_courseInstitution = trim_spaces( $r->param("add_courseInstitution") ) || ""; + + my $add_admin_users = trim_spaces( $r->param("add_admin_users") ) || ""; + + my $add_initial_userID = trim_spaces( $r->param("add_initial_userID") ) || ""; + my $add_initial_password = trim_spaces( $r->param("add_initial_password") ) || ""; + my $add_initial_confirmPassword = trim_spaces( $r->param("add_initial_confirmPassword") ) || ""; + my $add_initial_firstName = trim_spaces( $r->param("add_initial_firstName") ) || ""; + my $add_initial_lastName = trim_spaces( $r->param("add_initial_lastName") ) || ""; + my $add_initial_email = trim_spaces( $r->param("add_initial_email") ) || ""; + + my $add_templates_course = trim_spaces( $r->param("add_templates_course") ) || ""; - my $add_templates_course = $r->param("add_templates_course") || ""; + my $add_dbLayout = trim_spaces( $r->param("add_dbLayout") ) || ""; - my $add_dbLayout = $r->param("add_dbLayout") || ""; + + + + ###################### my @errors; @@ -629,23 +638,23 @@ my $authz = $r->authz; my $urlpath = $r->urlpath; - my $add_courseID = $r->param("add_courseID") || ""; - my $add_courseTitle = $r->param("add_courseTitle") || ""; - my $add_courseInstitution = $r->param("add_courseInstitution") || ""; - - my $add_admin_users = $r->param("add_admin_users") || ""; - - my $add_initial_userID = $r->param("add_initial_userID") || ""; - my $add_initial_password = $r->param("add_initial_password") || ""; - my $add_initial_confirmPassword = $r->param("add_initial_confirmPassword") || ""; - my $add_initial_firstName = $r->param("add_initial_firstName") || ""; - my $add_initial_lastName = $r->param("add_initial_lastName") || ""; - my $add_initial_email = $r->param("add_initial_email") || ""; + my $add_courseID = trim_spaces( $r->param("add_courseID") ) || ""; + my $add_courseTitle = trim_spaces( $r->param("add_courseTitle") ) || ""; + my $add_courseInstitution = trim_spaces( $r->param("add_courseInstitution") ) || ""; + + my $add_admin_users = trim_spaces( $r->param("add_admin_users") ) || ""; + + my $add_initial_userID = trim_spaces( $r->param("add_initial_userID") ) || ""; + my $add_initial_password = trim_spaces( $r->param("add_initial_password") ) || ""; + my $add_initial_confirmPassword = trim_spaces( $r->param("add_initial_confirmPassword") ) || ""; + my $add_initial_firstName = trim_spaces( $r->param("add_initial_firstName") ) || ""; + my $add_initial_lastName = trim_spaces( $r->param("add_initial_lastName") ) || ""; + my $add_initial_email = trim_spaces( $r->param("add_initial_email") ) || ""; - my $add_templates_course = $r->param("add_templates_course") || ""; + my $add_templates_course = trim_spaces( $r->param("add_templates_course") ) || ""; + + my $add_dbLayout = trim_spaces( $r->param("add_dbLayout") ) || ""; - my $add_dbLayout = $r->param("add_dbLayout") || ""; - my $ce2 = new WeBWorK::CourseEnvironment({ %WeBWorK::SeedCE, courseName => $add_courseID, @@ -2503,11 +2512,7 @@ print CGI::end_form(); } -sub registration_validate { -print "\nregistration validate form"; - -} sub do_registration { my $self = shift; @@ -2515,13 +2520,14 @@ my $registered_file_path = $ce->{courseDirs}->{root}."/$registered_file_name"; # warn qq!`echo "info" >$registered_file_path`!; `echo "info" >$registered_file_path`; -print "\n",CGI::p({style=>"text-align: center; width:60%"},q{Registration action completed. Thank you very much!"}); + +print "\n<center>",CGI::p({style=>"text-align: left; width:60%"},q{Registration action completed. Thank you very much for registering WeBWorK!"}); print CGI::start_form(-method=>"POST", -action=>$self->r->uri); print $self->hidden_authen_fields; -#print $self->hidden_fields("subDisplay"); print CGI::p({style=>"text-align: center"}, CGI::submit(-name=>"registration_completed", -label=>"Continue")); print CGI::end_form(); +print "</center>"; } ################################################################################ Index: AddUsers.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/Instructor/AddUsers.pm,v retrieving revision 1.24 retrieving revision 1.25 diff -Llib/WeBWorK/ContentGenerator/Instructor/AddUsers.pm -Llib/WeBWorK/ContentGenerator/Instructor/AddUsers.pm -u -r1.24 -r1.25 --- lib/WeBWorK/ContentGenerator/Instructor/AddUsers.pm +++ lib/WeBWorK/ContentGenerator/Instructor/AddUsers.pm @@ -28,7 +28,7 @@ use warnings; #use CGI qw(-nosticky ); use WeBWorK::CGI; -use WeBWorK::Utils qw/cryptPassword/; +use WeBWorK::Utils qw/cryptPassword trim_spaces/; sub initialize { my ($self) = @_; @@ -208,12 +208,7 @@ } -## Utility function to trim whitespace off the start and end of its input -sub trim_spaces { - my $in = shift; - $in =~ s/^\s*(.*?)\s*$/$1/; - return($in); -} + 1; |
From: Mike G. v. a. <we...@ma...> - 2008-05-23 15:07:09
|
Log Message: ----------- modifications to the <body> tag and to the submit tag so that applets are triggered upon submission of the problem. This is still a work in progress -- the timing issues with applets appear to be significant. Modified Files: -------------- webwork2/lib/WeBWorK/ContentGenerator: Problem.pm Revision Data ------------- Index: Problem.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/Problem.pm,v retrieving revision 1.213 retrieving revision 1.214 diff -Llib/WeBWorK/ContentGenerator/Problem.pm -Llib/WeBWorK/ContentGenerator/Problem.pm -u -r1.213 -r1.214 --- lib/WeBWorK/ContentGenerator/Problem.pm +++ lib/WeBWorK/ContentGenerator/Problem.pm @@ -985,7 +985,7 @@ # main form print "\n"; - print CGI::start_form(-method=>"POST", -action=> $r->uri,-name=>"problemMainForm", onSubmit=>"submitAction()"); + print CGI::start_form(-method=>"POST", -action=> $r->uri,-name=>"problemMainForm", onsubmit=>"submitAction()"); print $self->hidden_authen_fields; print "\n"; print CGI::start_div({class=>"problem"}); @@ -1037,7 +1037,10 @@ # apply to the student's records, not the professor's. print CGI::submit(-name=>"submitAnswers", -label=>"Submit Answers for $effectiveUser"); } else { - print CGI::submit(-name=>"submitAnswers", -label=>"Submit Answers"); + #print CGI::submit(-name=>"submitAnswers", -label=>"Submit Answers", -onclick=>"alert('submit button clicked')"); + print CGI::submit(-name=>"submitAnswers", -label=>"Submit Answers", -onclick=>""); + # FIXME for unknown reasons the -onclick label seems to have to be there in order to allow the forms onsubmit to trigger + # WFT??? } } |