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: Mike G. <ga...@de...> - 2005-05-26 13:00:53
|
Log Message: ----------- This is the model course that we use as a template to create new courses on the development machine. Added Files: ----------- webwork-modperl/courses/modelCourse: course.conf Revision Data ------------- --- /dev/null +++ courses/modelCourse/course.conf @@ -0,0 +1,90 @@ +#!perl +########################################################################= ######## +# WeBWorK Online Homework Delivery System +# Copyright =A9 2000-2003 The WeBWorK Project, http://openwebwork.sf.net= / +#=20 +# This program is free software; you can redistribute it and/or modify i= t under +# the terms of either: (a) the GNU General Public License as published b= y the +# Free Software Foundation; either version 2, or (at your option) any la= ter +# version, or (b) the "Artistic License" which comes with this package. +#=20 +# This program is distributed in the hope that it will be useful, but WI= THOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or = FITNESS +# FOR A PARTICULAR PURPOSE. See either the GNU General Public License o= r the +# Artistic License for more details. +########################################################################= ######## + +# This file is used to override the global WeBWorK course environment fo= r +# requests to this course. All package variables set in this file are ad= ded to +# the course environment. If you wish to set a variable here but omit it= from +# the course environment, use the "my" keyword. Commonly changed config= uration +# options are noted below. + +# Database Layout (global value typically defined in global.conf) +#=20 +# Several database are defined in the file conf/database.conf and stored= in the +# hash %dbLayouts. +#=20 +# The database layout is always set here, since one should be able to ch= ange the +# default value in global.conf without disrupting existing courses. +#=20 +# global.conf values: +# $dbLayoutName =3D 'sql_single'; +# *dbLayout =3D $dbLayouts{$dbLayoutName}; + +$dbLayoutName =3D 'sql_single'; +*dbLayout =3D $dbLayouts{$dbLayoutName}; + +# Global User ID (global value typically defined in database.conf) +#=20 +# The globalUserID parameter given for the set and problem tables denote= s the ID +# of the user that the GlobalTableEmulator will use to store data for th= e set +# and problem tables. +#=20 +# If a course will be used under WeBWorK 1.x, this value should be overr= idden on +# a course-by-course basis to the ID of the professor who is most likely= to be +# involved in creating new problem sets. Sets which have not been assign= ed will +# only be visible to this user when logging into WeBWorK 1.x. +#=20 +# The global user ID is always set here, since one should be able to cha= nge the +# default value in database.conf without disrupting existing courses. +#=20 +# global.conf values: +# $dbLayouts{gdbm}->{set}->{params}->{globalUserID} =3D 'global_user'; +# $dbLayouts{gdbm}->{problem}->{params}->{globalUserID} =3D 'global_use= r'; + +$dbLayouts{gdbm}->{set}->{params}->{globalUserID} =3D 'global_user'; +$dbLayouts{gdbm}->{problem}->{params}->{globalUserID} =3D 'global_user'; + +# Allowed Mail Recipients (global value typically not defined) +#=20 +# Defines addresses to which the PG system is allowed to send mail. This= should +# probably be set to the addresses of professors of this course. Sending= mail +# from the PG system (i.e. questionaires, essay questions) will fail if = this is +# not set. +#=20 +# global.conf values: +# $mail{allowedRecipients} =3D ['ga...@ma...']; + +$mail{allowedRecipients} =3D ['ga...@ma...']; + +# Feedback Mail Recipients (global value typically not defined) +#=20 +# Defines recipients for feedback mail. If not defined, mail is sent to = all +# instructors and TAs. +#=20 +# global.conf values: +# $mail{feedbackRecipients} =3D ['ga...@ma...']; + + + + +# Users for whom to label problems with the PG file name (global value t= ypically "professor") +#=20 +# For users in this list, PG will display the source file name when rend= ering a problem. +#=20 +# global.conf values: +# $pg{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR} =3D ['gage', 'api= zer', 'sh002i', 'professor']; + +$pg{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR} =3D ['global_user', = 'toenail', 'sam', 'apizer', 'gage']; + |
From: Mike G. <ga...@de...> - 2005-05-26 12:59:58
|
Update of /webwork/cvs/system/webwork-modperl/courses/modelCourse/templates In directory devel.webwork.rochester.edu:/home/gage/webwork/webwork-modperl/courses/modelCourse/templates Log Message: Directory /webwork/cvs/system/webwork-modperl/courses/modelCourse/templates added to the repository |
From: Mike G. <ga...@de...> - 2005-05-26 12:59:57
|
Update of /webwork/cvs/system/webwork-modperl/courses/modelCourse/logs In directory devel.webwork.rochester.edu:/home/gage/webwork/webwork-modperl/courses/modelCourse/logs Log Message: Directory /webwork/cvs/system/webwork-modperl/courses/modelCourse/logs added to the repository |
From: Mike G. <ga...@de...> - 2005-05-26 12:59:56
|
Update of /webwork/cvs/system/webwork-modperl/courses/modelCourse/scoring In directory devel.webwork.rochester.edu:/home/gage/webwork/webwork-modperl/courses/modelCourse/scoring Log Message: Directory /webwork/cvs/system/webwork-modperl/courses/modelCourse/scoring added to the repository |
From: Mike G. <ga...@de...> - 2005-05-26 12:59:56
|
Update of /webwork/cvs/system/webwork-modperl/courses/modelCourse/DATA In directory devel.webwork.rochester.edu:/home/gage/webwork/webwork-modperl/courses/modelCourse/DATA Log Message: Directory /webwork/cvs/system/webwork-modperl/courses/modelCourse/DATA added to the repository |
From: Mike G. <ga...@de...> - 2005-05-26 12:59:50
|
Update of /webwork/cvs/system/webwork-modperl/courses/modelCourse/html In directory devel.webwork.rochester.edu:/home/gage/webwork/webwork-modperl/courses/modelCourse/html Log Message: Directory /webwork/cvs/system/webwork-modperl/courses/modelCourse/html added to the repository |
From: Mike G. <ga...@de...> - 2005-05-26 12:59:36
|
Update of /webwork/cvs/system/webwork-modperl/courses/modelCourse In directory devel.webwork.rochester.edu:/home/gage/webwork/webwork-modperl/courses/modelCourse Log Message: Directory /webwork/cvs/system/webwork-modperl/courses/modelCourse added to the repository |
From: Mike G. <ga...@de...> - 2005-05-20 16:35:41
|
Log Message: ----------- Added a location for site_info.txt Modified Files: -------------- webwork-modperl/conf: global.conf.dist Revision Data ------------- Index: global.conf.dist =================================================================== RCS file: /webwork/cvs/system/webwork-modperl/conf/global.conf.dist,v retrieving revision 1.118 retrieving revision 1.119 diff -Lconf/global.conf.dist -Lconf/global.conf.dist -u -r1.118 -r1.119 --- conf/global.conf.dist +++ conf/global.conf.dist @@ -259,6 +259,8 @@ # A PG template for creation of new problems. $webworkFiles{screenSnippets}{blankProblem} = "$webworkDirs{conf}/snippets/blankProblem.pg"; # screenSetHeader.pg" +# A site info "message of the day" file +$webworkFiles{site_info} = "$webworkDirs{htdocs}/site_info.txt"; ################################################################################ # Course-specific files ################################################################################ |
From: Mike G. <ga...@de...> - 2005-05-20 16:32:55
|
Log Message: ----------- The info section of the login picks up HTML text contained in the webwork2/htdocs/site_info.txt file. This allows a site administrator to post a message of the day or urgent site information which is read by everyone logging into webwork. The contents of the course/templates/login_info.txt file is printed after the site_info.txt message. Modified Files: -------------- webwork-modperl/lib/WeBWorK/ContentGenerator: Login.pm Revision Data ------------- Index: Login.pm =================================================================== RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/ContentGenerator/Login.pm,v retrieving revision 1.25 retrieving revision 1.26 diff -Llib/WeBWorK/ContentGenerator/Login.pm -Llib/WeBWorK/ContentGenerator/Login.pm -u -r1.25 -r1.26 --- lib/WeBWorK/ContentGenerator/Login.pm +++ lib/WeBWorK/ContentGenerator/Login.pm @@ -40,6 +40,31 @@ my $r = $self->r; my $ce = $r->ce; + + my $site_info = $ce->{webworkFiles}->{site_info}; + + if (defined $site_info and $site_info) { + my $site_info_path = $site_info; + + # deal with previewing a temporary file + if (defined $r->param("editMode") and $r->param("editMode") eq "temporaryFile" + and defined $r->param("editFileSuffix")) { + $site_info_path .= $r->param("editFileSuffix"); + } + + if (-f $site_info_path) { + my $text = eval { readFile($site_info_path) }; + if ($@) { + print CGI::div({class=>"ResultsWithError"}, + CGI::p("$@"), + ); + } else { + print CGI::p(CGI::b("Important Message")), $text,CGI::hr(); + } + } + + + } my $login_info = $ce->{courseFiles}->{login_info}; if (defined $login_info and $login_info) { @@ -62,8 +87,11 @@ } } - return ""; + } + + + return ""; } sub body { |
From: Mike G. <ga...@de...> - 2005-05-20 16:29:57
|
Log Message: ----------- Modifications that support import and export to gzipped disk files Modified Files: -------------- webwork-modperl/lib/WeBWorK/ContentGenerator: CourseAdmin.pm Revision Data ------------- Index: CourseAdmin.pm =================================================================== RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/ContentGenerator/CourseAdmin.pm,v retrieving revision 1.33 retrieving revision 1.34 diff -Llib/WeBWorK/ContentGenerator/CourseAdmin.pm -Llib/WeBWorK/ContentGenerator/CourseAdmin.pm -u -r1.33 -r1.34 --- lib/WeBWorK/ContentGenerator/CourseAdmin.pm +++ lib/WeBWorK/ContentGenerator/CourseAdmin.pm @@ -29,7 +29,8 @@ use Data::Dumper; use File::Temp qw/tempfile/; use WeBWorK::CourseEnvironment; -use WeBWorK::Utils qw(cryptPassword writeLog); +use IO::File; +use WeBWorK::Utils qw(cryptPassword writeLog listFilesRecursive); use WeBWorK::Utils::CourseManagement qw(addCourse renameCourse deleteCourse listCourses); use WeBWorK::Utils::DBImportExport qw(dbExport dbImport); @@ -173,15 +174,15 @@ sub header { my ($self) = @_; my $method_to_call = $self->{method_to_call}; - if (defined $method_to_call and $method_to_call eq "do_export_database") { - my $r = $self->r; - my $courseID = $r->param("export_courseID"); - $r->content_type("application/octet-stream"); - $r->header_out("Content-Disposition" => "attachment; filename=\"${courseID}_database.xml\""); - $r->send_http_header; - } else { +# if (defined $method_to_call and $method_to_call eq "do_export_database") { +# my $r = $self->r; +# my $courseID = $r->param("export_courseID"); +# $r->content_type("application/octet-stream"); +# $r->header_out("Content-Disposition" => "attachment; filename=\"${courseID}_database.xml\""); +# $r->send_http_header; +# } else { $self->SUPER::header; - } +# } } # sends: @@ -197,7 +198,8 @@ my ($self) = @_; my $method_to_call = $self->{method_to_call}; if (defined $method_to_call and $method_to_call eq "do_export_database") { - $self->do_export_database; + #$self->do_export_database; + $self->SUPER::content; } else { $self->SUPER::content; } @@ -217,6 +219,19 @@ unless ($authz->hasPermissions($user, "create_and_delete_courses")) { return ""; } + my $method_to_call = $self->{method_to_call}; + my $methodMessage =""; + + (defined($method_to_call) and $method_to_call eq "do_export_database") && do { + my @export_courseID = $r->param("export_courseID"); + my $course_ids = join(", ", @export_courseID); + $methodMessage = CGI::p("Exporting database for course(s) $course_ids"). + CGI::p(".... please wait.... + If your browser times out you will + still be able to download the exported database using the + file manager.").CGI::hr(); + }; + print CGI::p({style=>"text-align: center"}, CGI::a({href=>$self->systemLink($urlpath, params=>{subDisplay=>"add_course"})}, "Add Course"), @@ -228,12 +243,18 @@ 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::hr(), + $methodMessage, + ); - print CGI::hr(); + print CGI::p("The ability to import and to export databases is still under development. + It seems to work but it is <b>VERY</b> slow on large courses. You may prefer to + use webwork2/bin/wwdb or the mysql dump facility for archiving large courses. + Please send bug reports if you find errors. "); my @errors = @{$self->{errors}}; - my $method_to_call = $self->{method_to_call}; + if (@errors) { print CGI::div({class=>"ResultsWithError"}, @@ -1299,7 +1320,7 @@ my $export_courseID = $r->param("export_courseID") || ""; my @export_tables = $r->param("export_tables"); - + @export_tables = @tables unless @export_tables; my @courseIDs = listCourses($ce); @@ -1336,7 +1357,7 @@ -values => \@courseIDs, -default => $export_courseID, -size => 10, - -multiple => 0, + -multiple => 1, -labels => \%courseLabels, ), ), @@ -1367,13 +1388,13 @@ #my $authz = $r->authz; #my $urlpath = $r->urlpath; - my $export_courseID = $r->param("export_courseID") || ""; + my @export_courseID = $r->param("export_courseID") || (); my @export_tables = $r->param("export_tables"); - + my @errors; - - if ($export_courseID eq "") { - push @errors, "You must specify a course name."; + + unless ( @export_courseID) { + push @errors, "You must specify at least one course name."; } unless (@export_tables) { @@ -1391,32 +1412,64 @@ #my $authz = $r->authz; my $urlpath = $r->urlpath; - my $export_courseID = $r->param("export_courseID"); + my @export_courseID = $r->param("export_courseID"); my @export_tables = $r->param("export_tables"); - my $ce2 = WeBWorK::CourseEnvironment->new( - $ce->{webworkDirs}->{root}, - $ce->{webworkURLs}->{root}, - $ce->{pg}->{directories}->{root}, - $export_courseID, - ); - - my $db2 = new WeBWorK::DB($ce2->{dbLayout}); - - #my ($fh, $export_file) = tempfile("db_export_XXXXXX", DIR => $ce->{webworkDirs}->{tmp}); - #my ($random_chars) = $export_file =~ m/db_export_(\w+)$/; + foreach my $export_courseID (@export_courseID) { + + my $ce2 = WeBWorK::CourseEnvironment->new( + $ce->{webworkDirs}->{root}, + $ce->{webworkURLs}->{root}, + $ce->{pg}->{directories}->{root}, + $export_courseID, + ); + + my $db2 = new WeBWorK::DB($ce2->{dbLayout}); + + #my ($fh, $export_file) = tempfile("db_export_XXXXXX", DIR => $ce->{webworkDirs}->{tmp}); + #my ($random_chars) = $export_file =~ m/db_export_(\w+)$/; + # export to the admin/templates directory + my $exportFileName = "$export_courseID.exported.xml"; + my $exportFilePath = $ce->{courseDirs}->{templates}."/$exportFileName"; + # get a unique name + my $number =1; + while (-e "$exportFilePath.$number.gz") { + $number++; + last if $number>9; + } + if ($number<=9 ) { + $exportFilePath = "$exportFilePath.$number"; + $exportFileName = "$exportFileName.$number"; + } else { + $self->addbadmessage(CGI::p("There are more than 9 exported files for this course! Please + remove some of these files.")); + $exportFilePath = "$exportFilePath.999"; + $exportFileName = "$exportFileName.999"; + } - my @errors; + my $outputFileHandle = new IO::File(">$exportFilePath") or warn "Unable to create $exportFilePath"; - eval { - @errors = dbExport( - db => $db2, - #xml => $fh, - xml => *STDOUT, - tables => \@export_tables, - ); - }; + my @errors; + eval { + @errors = dbExport( + db => $db2, + #xml => $fh, + xml => $outputFileHandle, + tables => \@export_tables, + ); + }; + + $outputFileHandle->close(); + my $gzipMessage = system( 'gzip', $exportFilePath); + if ( !$gzipMessage ) { + $self->addgoodmessage(CGI::p( "Database saved to templates/$exportFileName.gzip. + You may download it with the file manager.")); + } else { + $self->addbadmessage(CGI::p( "Failed to gzip file $exportFilePath")); + } + unlink $exportFilePath; + } # end export of one course #push @errors, "Fatal exception: $@" if $@; # #if (@errors) { @@ -1469,6 +1522,23 @@ $courseLabels{$courseID} = "$courseID (" . $tempCE->{dbLayoutName} . ")"; } + # find databases: + my $templatesDir = $ce->{courseDirs}->{templates}; + my %probLibs = %{ $r->ce->{courseFiles}->{problibs} }; + my $exempt_dirs = join("|", keys %probLibs); + + my @databaseFiles = listFilesRecursive( + $templatesDir, + qr/.\.exported\.xml\.\d*\.gz$/, # match these files #FIXME this is too restricive!! + qr/^(?:$exempt_dirs|CVS)$/, # prune these directories + 0, # match against file name only + 1, # prune against path relative to $templatesDir + ); + + my %databaseLabels = map { ($_ => $_) } @databaseFiles; + + ####### + print CGI::h2("Import Database"); print CGI::start_form("POST", $r->uri, &CGI::MULTIPART); @@ -1478,12 +1548,23 @@ print CGI::table({class=>"FormLayout"}, CGI::Tr( CGI::th({class=>"LeftHeader"}, "Database XML File:"), +# CGI::td( +# CGI::filefield( +# -name => "import_file", +# -size => 50, +# ), +# ), CGI::td( - CGI::filefield( + CGI::scrolling_list( -name => "import_file", - -size => 50, + -values => \@databaseFiles, + -default => undef, + -size => 10, + -multiple => 0, + -labels => \%databaseLabels, ), - ), + + ) ), CGI::Tr( CGI::th({class=>"LeftHeader"}, "Tables to Import:"), @@ -1547,7 +1628,7 @@ my @errors; if ($import_file eq "") { - push @errors, "You must specify a database file to upload."; + push @errors, "You must specify a database file to import."; } if ($import_courseID eq "") { @@ -1583,26 +1664,36 @@ my $db2 = new WeBWorK::DB($ce2->{dbLayout}); + # locate file + my $templateDir = $ce->{courseDirs}->{templates}; + my $filePath = "$templateDir/$import_file"; + + my $gunzipMessage = system( 'gunzip', $filePath); + #FIXME + #warn "gunzip ", $gunzipMessage; + $filePath =~ s/\.gz$//; + #warn "new file path is $filePath"; + my $fileHandle = new IO::File("<$filePath"); # retrieve upload from upload cache - my ($id, $hash) = split /\s+/, $import_file; - my $upload = WeBWorK::Upload->retrieve($id, $hash, - dir => $ce->{webworkDirs}->{uploadCache} - ); +# my ($id, $hash) = split /\s+/, $import_file; +# my $upload = WeBWorK::Upload->retrieve($id, $hash, +# dir => $ce->{webworkDirs}->{uploadCache} +# ); my @errors; eval { @errors = dbImport( db => $db2, - xml => $upload->fileHandle, + # xml => $upload->fileHandle, + xml => $fileHandle, tables => \@import_tables, conflict => $import_conflict, ); }; - $upload->dispose; - push @errors, "Fatal exception: $@" if $@; + push @errors, $gunzipMessage if $gunzipMessage; if (@errors) { print CGI::div({class=>"ResultsWithError"}, |
From: Mike G. <ga...@de...> - 2005-05-20 16:29:11
|
Log Message: ----------- Import and Export now create gzipped files in the template directory of the admin course. These files can than be downloaded using the FileManager. The export and import process are still VERY slow, but at least it no longer matters if your browser times out. Modified Files: -------------- webwork-modperl/lib/WeBWorK/Utils: DBImportExport.pm Revision Data ------------- Index: DBImportExport.pm =================================================================== RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/Utils/DBImportExport.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -Llib/WeBWorK/Utils/DBImportExport.pm -Llib/WeBWorK/Utils/DBImportExport.pm -u -r1.5 -r1.6 --- lib/WeBWorK/Utils/DBImportExport.pm +++ lib/WeBWorK/Utils/DBImportExport.pm @@ -152,7 +152,7 @@ @tables = @TABLE_ORDER unless @tables; my %tables; @tables{@tables} = (); - + my $writer = new XML::Writer(OUTPUT => $options{xml}, NEWLINES => 0, DATA_MODE => 1); $writer->startTag("webwork", version => $DB_VERSION); |
From: Mike G. <ga...@de...> - 2005-05-19 20:54:45
|
Log Message: ----------- Fixed problems with calculating the average grade correctly. Regularized the code in Stats and StudentProgress the next step is to a good chunk of the code which does the actual arithmetic to a spot in Utils/ so that it can be called by both Stats and StudentProgress. This fixes bug 784 Modified Files: -------------- webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor: Stats.pm StudentProgress.pm Revision Data ------------- Index: Stats.pm =================================================================== RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/Stats.pm,v retrieving revision 1.51 retrieving revision 1.52 diff -Llib/WeBWorK/ContentGenerator/Instructor/Stats.pm -Llib/WeBWorK/ContentGenerator/Instructor/Stats.pm -u -r1.51 -r1.52 --- lib/WeBWorK/ContentGenerator/Instructor/Stats.pm +++ lib/WeBWorK/ContentGenerator/Instructor/Stats.pm @@ -324,9 +324,6 @@ next if $studentRecord->last_name =~/^practice/i; # don't show practice users next if $studentRecord->status !~/C/; # don't show dropped students FIXME $number_of_active_students++; - my $status = 0; - my $attempted = 0; - my $longStatus = ''; my $string = ''; my $twoString = ''; my $totalRight = 0; @@ -359,62 +356,72 @@ # $correct_answers_for_problem{$probID} # # $string (formatting output) + # $twoString (more formatted output) # $total # $totalRight ################################### foreach my $problemRecord (@problemRecords) { next unless ref($problemRecord); - my $num_of_attempts = 0; - my $probID = $problemRecord->problem_id; - - - my $valid_status = 0; - unless (defined($problemRecord) ){ # warn "Can't find record for problem $prob in set $setName for $student"; # FIXME check the legitimate reasons why a student record might not be defined - next; - } - $status = $problemRecord->status || 0; - $attempted = $problemRecord->attempted; + #################################################################### + # Grab data from the database + #################################################################### + # It's possible that $problemRecord->num_correct or $problemRecord->num_correct + # or $problemRecord->status is an empty + # or blank string instead of 0. The || clause fixes this and prevents + # warning messages in the comparisons below. + + my $probID = $problemRecord->problem_id; + my $attempted = $problemRecord->attempted; + my $num_correct = $problemRecord->num_correct || 0; + my $num_incorrect = $problemRecord->num_incorrect || 0; + my $num_of_attempts = $num_correct + $num_incorrect; + + # initialize the number of correct answers for this problem + # if the value has not been defined. + $correct_answers_for_problem{$probID} = 0 unless defined($correct_answers_for_problem{$probID}); + + + my $probValue = $problemRecord->value; + # set default problem value here + $probValue = 1 unless defined($probValue) and $probValue ne ""; # FIXME?? set defaults here? + + my $status = $problemRecord->status || 0; + # sanity check that the status (score) is between 0 and 1 + my $valid_status = ($status >= 0 and $status <=1 ) ? 1 : 0; + + ################################################################### + # Determine the string $longStatus which will display the student's current score + ################################################################### + my $longStatus = ''; if (!$attempted){ - $longStatus = '. '; - } - elsif ($status >= 0 and $status <=1 ) { - $valid_status = 1; + $longStatus = '.'; + } elsif ($valid_status) { $longStatus = int(100*$status+.5); - if ($longStatus == 100) { - $longStatus = 'C '; - } - else { - $longStatus = &threeSpaceFill($longStatus); - } - } - else { - $longStatus = 'X '; + $longStatus = ($longStatus == 100) ? 'C' : $longStatus; + } else { + $longStatus = 'X'; } - my $num_correct = $problemRecord->num_correct || 0; - my $num_incorrect = $problemRecord->num_incorrect || 0; - # It's possible that $incorrect is an empty or blank string instead of 0 the || clause fixes this and prevents - # warning messages in the comparison below. - $string .= $longStatus; + $string .= threeSpaceFill($longStatus); $twoString .= threeSpaceFill($num_incorrect); - my $probValue = $problemRecord->value; - $probValue = 1 unless defined($probValue) and $probValue ne ""; # FIXME?? set defaults here? + $total += $probValue; $totalRight += round_score($status*$probValue) if $valid_status; - $num_of_attempts += $num_correct + $num_incorrect; - $h_problemData{$probID} = $num_incorrect; - $correct_answers_for_problem{$probID} = 0 unless defined($correct_answers_for_problem{$probID}); + + + # add on the scores for this problem if (defined($attempted) and $attempted) { $number_of_students_attempting_problem{$probID}++; push( @{ $attempts_list_for_problem{$probID} } , $num_of_attempts); $number_of_attempts_for_problem{$probID} += $num_of_attempts; + $h_problemData{$probID} = $num_incorrect; $total_num_of_attempts_for_set += $num_of_attempts; $correct_answers_for_problem{$probID} += $status; } @@ -458,7 +465,7 @@ lc($a->{last_name}) cmp lc($b->{last_name} ) } @augmentedUserRecords; # sort the problem IDs - my @problemIDs = sort {$a<=>$b} keys %correct_answers_for_problem; + my @problemIDs = sort {$a<=>$b} keys %correct_answers_for_problem; # determine index quartiles my @brackets1 = (90,80,70,60,50,40,30,20,10); #% students having scores or indices above this cutoff value my @brackets2 = (95, 75,50,25,5,1); # % students having this many incorrect attempts or more Index: StudentProgress.pm =================================================================== RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/StudentProgress.pm,v retrieving revision 1.10 retrieving revision 1.11 diff -Llib/WeBWorK/ContentGenerator/Instructor/StudentProgress.pm -Llib/WeBWorK/ContentGenerator/Instructor/StudentProgress.pm -u -r1.10 -r1.11 --- lib/WeBWorK/ContentGenerator/Instructor/StudentProgress.pm +++ lib/WeBWorK/ContentGenerator/Instructor/StudentProgress.pm @@ -337,14 +337,11 @@ next if $studentRecord->last_name =~/^practice/i; # don't show practice users next if $studentRecord->status !~/C/; # don't show dropped students FIXME $number_of_active_students++; - my $status = 0; - my $attempted = 0; - my $longStatus = ''; my $string = ''; my $twoString = ''; my $totalRight = 0; my $total = 0; - my $num_of_attempts = 0; + my $total_num_of_attempts_for_set = 0; my %h_problemData = (); my $probNum = 0; @@ -354,60 +351,94 @@ $WeBWorK::timer->continue("End obtaining problem records for user $student set $setName") if defined($WeBWorK::timer); my $num_of_problems = @problemRecords; $max_num_problems = ($max_num_problems>= $num_of_problems) ? $max_num_problems : $num_of_problems; - + ######################################## + # Notes for factoring the calculation in this loop. + # + # Inputs include: + # + # + # @problemRecords + # returns + # $num_of_attempts + # $status + # updates + # $number_of_students_attempting_problem{$probID}++; + # @{ $attempts_list_for_problem{$probID} } + # $number_of_attempts_for_problem{$probID} + # $total_num_of_attempts_for_set + # $correct_answers_for_problem{$probID} + # + # $string (formatting output) + # $twoString (more formatted output) + # $total + # $totalRight + ################################### + foreach my $problemRecord (@problemRecords) { next unless ref($problemRecord); - my $probID = $problemRecord->problem_id; - - my $valid_status = 0; - unless (defined($problemRecord) ){ # warn "Can't find record for problem $prob in set $setName for $student"; # FIXME check the legitimate reasons why a student record might not be defined - next; - } - $status = $problemRecord->status || 0; - $attempted = $problemRecord->attempted; + #################################################################### + # Grab data from the database + #################################################################### + # It's possible that $problemRecord->num_correct or $problemRecord->num_correct + # or $problemRecord->status is an empty + # or blank string instead of 0. The || clause fixes this and prevents + # warning messages in the comparisons below. + + my $probID = $problemRecord->problem_id; + my $attempted = $problemRecord->attempted; + my $num_correct = $problemRecord->num_correct || 0; + my $num_incorrect = $problemRecord->num_incorrect || 0; + my $num_of_attempts = $num_correct + $num_incorrect; + + # initialize the number of correct answers for this problem + # if the value has not been defined. + $correct_answers_for_problem{$probID} = 0 unless defined($correct_answers_for_problem{$probID}); + + + my $probValue = $problemRecord->value; + # set default problem value here + $probValue = 1 unless defined($probValue) and $probValue ne ""; # FIXME?? set defaults here? + + my $status = $problemRecord->status || 0; + # sanity check that the status (score) is between 0 and 1 + my $valid_status = ($status >= 0 and $status <=1 ) ? 1 : 0; + + ################################################################### + # Determine the string $longStatus which will display the student's current score + ################################################################### + my $longStatus = ''; if (!$attempted){ - $longStatus = '. '; - } - elsif ($status >= 0 and $status <=1 ) { - $valid_status = 1; + $longStatus = '.'; + } elsif ($valid_status) { $longStatus = int(100*$status+.5); - if ($longStatus == 100) { - $longStatus = 'C '; - } - else { - $longStatus = &threeSpaceFill($longStatus); - } - } - else { - $longStatus = 'X '; + $longStatus = ($longStatus == 100) ? 'C' : $longStatus; + } else { + $longStatus = 'X'; } - my $num_correct = $problemRecord->num_correct || 0; - my $num_incorrect = $problemRecord->num_incorrect || 0; - # It's possible that $incorrect is an empty or blank string instead of 0 the || clause fixes this and prevents - # warning messages in the comparison below. - $string .= $longStatus; + $string .= threeSpaceFill($longStatus); $twoString .= threeSpaceFill($num_incorrect); - my $probValue = $problemRecord->value; - $probValue = 1 unless defined($probValue) and $probValue ne ""; # FIXME?? set defaults here? + $total += $probValue; $totalRight += round_score($status*$probValue) if $valid_status; - $num_of_attempts += $num_correct + $num_incorrect; - $h_problemData{$probID} = $num_incorrect; - $correct_answers_for_problem{$probID} = 0 unless defined($correct_answers_for_problem{$probID}); + + + # add on the scores for this problem if (defined($attempted) and $attempted) { $number_of_students_attempting_problem{$probID}++; push( @{ $attempts_list_for_problem{$probID} } , $num_of_attempts); $number_of_attempts_for_problem{$probID} += $num_of_attempts; + $h_problemData{$probID} = $num_incorrect; + $total_num_of_attempts_for_set += $num_of_attempts; $correct_answers_for_problem{$probID} += $status; } - + } @@ -417,8 +448,9 @@ my $email = $studentRecord->email_address; # FIXME this needs formatting - my $avg_num_attempts = ($num_of_problems) ? $num_of_attempts/$num_of_problems : 0; + my $avg_num_attempts = ($num_of_problems) ? $total_num_of_attempts_for_set/$num_of_problems : 0; my $successIndicator = ($avg_num_attempts) ? ($totalRight/$total)**2/$avg_num_attempts : 0 ; + my $temp_hash = { user_id => $studentRecord->user_id, last_name => $studentRecord->last_name, first_name => $studentRecord->first_name, @@ -445,11 +477,13 @@ || lc($a->{last_name}) cmp lc($b->{last_name} ) } @augmentedUserRecords; -##################################################################################### + # construct header my $problem_header = ''; + my @list_problems = sort {$a<=> $b } $db->listGlobalProblems($setName ); + $problem_header = '<pre>'.join("", map {&threeSpaceFill($_)} @list_problems ).'</pre>'; - +##################################################################################### print CGI::br(), CGI::br(), |
From: Mike G. <ga...@de...> - 2005-05-19 16:19:02
|
Log Message: ----------- Use base64 to save answers -- this ensures that symbols in the answer won't cause trouble. I have added a string to the beginning of the encoded passage: base64_encoded:AFDWERADADFRET -- Mike Modified Files: -------------- webwork-modperl/lib/WeBWorK: Utils.pm Revision Data ------------- Index: Utils.pm =================================================================== RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/Utils.pm,v retrieving revision 1.61 retrieving revision 1.62 diff -Llib/WeBWorK/Utils.pm -Llib/WeBWorK/Utils.pm -u -r1.61 -r1.62 --- lib/WeBWorK/Utils.pm +++ lib/WeBWorK/Utils.pm @@ -31,8 +31,6 @@ use Date::Format; use Time::Zone; use MIME::Base64; -#use Date::Manip; -#use DateTime::Format::DateManip; use Errno; use File::Path qw(rmtree); use Carp; @@ -650,11 +648,15 @@ $result .= defined $ref ? $ref : '<font color="red">undef</font>'; } } - +use constant BASE64_ENCODED => 'base64_encoded:'; sub decodeAnswers($) { my $string = shift; - $string = decode_base64($string); return unless defined $string and $string; + if ($string =~/^BASE64_ENCODED/) { + $string =~ s/^BASE64_ENCODED//; + $string = decode_base64($string); + } + my @array = split m/##/, $string; $array[$_] =~ s/\\#\\/#/g foreach 0 .. $#array; push @array, "" if @array%2; @@ -681,7 +683,9 @@ $string .= "$name##$value##"; # this is also not my fault } $string =~ s/##$//; # remove last pair of hashs - $string = encode_base64($string); + + $string = BASE64_ENCODED.encode_base64($string); + return $string; } |
From: Sam H. <sh...@de...> - 2005-05-19 15:36:15
|
Log Message: ----------- useless commit to test logging Modified Files: -------------- webwork2: README Revision Data ------------- Index: README =================================================================== RCS file: /webwork/cvs/system/webwork2/README,v retrieving revision 1.10 retrieving revision 1.11 diff -LREADME -LREADME -u -r1.10 -r1.11 --- README +++ README @@ -1,4 +1,4 @@ - +this is a test WeBWorK Online Homework Delivery System Version 2.1 |
From: Mike G. <ga...@de...> - 2005-05-19 01:10:22
|
Log Message: ----------- Committing a new xmlrpc client to replace xmlrpc_client4 Added Files: ----------- webwork2/clients: webwork_xmlrpc_client.pl Revision Data ------------- --- /dev/null +++ clients/webwork_xmlrpc_client.pl @@ -0,0 +1,277 @@ +#!/usr/local/bin/perl -w + +use XMLRPC::Lite; + +# configuration section +use constant HOSTURL => 'devel.webwork.rochester.edu'; +use constant HOSTPORT => 8002; +use constant TRANSPORT_METHOD => 'XMLRPC::Lite'; +use constant REQUEST_CLASS =>'WebworkXMLRPC'; # WebworkXMLRPC is used for soap also!! +use constant REQUEST_URI =>'mod_xmlrpc'; +my @COMMANDS = qw( listLibraries renderProblem ); #listLib readFile tex2pdf + +# $pg{displayModes} = [ +# "plainText", # display raw TeX for math expressions +# "formattedText", # format math expressions using TtH +# "images", # display math expressions as images generated by dvipng +# "jsMath", # render TeX math expressions on the client side using jsMath +# "asciimath", # render TeX math expressions on the client side using ASCIIMathML +# ]; +use constant DISPLAYMODE => 'images'; + +# end configuration section +use MIME::Base64 qw( encode_base64 decode_base64); + + +print STDERR "inputs are ", join (" | ", @ARGV), "\n"; +our $source; + +if (@ARGV) { + my $command = $ARGV[0]; + + warn "executing WebworkXMLRPC.$command"; + $source = (defined $ARGV[1]) ? `cat $ARGV[1]` : '' ; + xmlrpcCall($command); + + +} else { + + print STDERR "Useage: .xmlrpc_client4.pl command file_name\n"; + print STDERR "For example: .xmlrpc_client4.pl renderProblem input.txt\n"; + print STDERR "For example: .xmlrpc_client4.pl listLibraries \n"; + print STDERR "Commands are: ", join(" ", @COMMANDS), "\n"; + +} + + + +sub xmlrpcCall { + my $command = shift; + $command = 'listLibraries' unless $command; + + my $requestResult = TRANSPORT_METHOD + #->uri('http://'.HOSTURL.':'.HOSTPORT.'/'.REQUEST_CLASS) + -> proxy('http://'.HOSTURL.':'.HOSTPORT.'/'.REQUEST_URI); + + my $test = [3,4,5,6]; + my $input = setInputTable(); + print "displayMode=",$input->{envir}->{displayMode},"\n"; + local( $result); + # use eval to catch errors + eval { $result = $requestResult->call(REQUEST_CLASS.'.'.$command,$input) }; + print STDERR "There were a lot of errors\n" if $@; + print "Errors: \n $@\n End Errors\n" if $@; + + print "result is|", ref($result),"|"; + + unless (ref($result) and $result->fault) { + + if (ref($result->result())=~/HASH/ and defined($result->result()->{text}) ) { + $result->result()->{text} = decode_base64($result->result()->{text}); + } + print pretty_print_rh($result->result()),"\n"; #$result->result() + } else { + print 'oops ', join ', ', + $result->faultcode, + $result->faultstring; + } +} + +sub source { + encode_base64($source); +} +sub pretty_print_rh { + shift if UNIVERSAL::isa($_[0] => __PACKAGE__); + my $rh = shift; + my $indent = shift || 0; + my $out = ""; + my $type = ref($rh); + + if (defined($type) and $type) { + $out .= " type = $type; "; + } elsif (! defined($rh )) { + $out .= " type = UNDEFINED; "; + } + return $out." " unless defined($rh); + + if ( ref($rh) =~/HASH/ or "$rh" =~/HASH/ ) { + $out .= "{\n"; + $indent++; + foreach my $key (sort keys %{$rh}) { + $out .= " "x$indent."$key => " . pretty_print_rh( $rh->{$key}, $indent ) . "\n"; + } + $indent--; + $out .= "\n"." "x$indent."}\n"; + + } elsif (ref($rh) =~ /ARRAY/ or "$rh" =~/ARRAY/) { + $out .= " ( "; + foreach my $elem ( @{$rh} ) { + $out .= pretty_print_rh($elem, $indent); + + } + $out .= " ) \n"; + } elsif ( ref($rh) =~ /SCALAR/ ) { + $out .= "scalar reference ". ${$rh}; + } elsif ( ref($rh) =~/Base64/ ) { + $out .= "base64 reference " .$$rh; + } else { + $out .= $rh; + } + + return $out." "; +} + +sub setInputTable_for_listLib { + $out = { + #password => 'geometry', + pw => 'geometry', + set => 'set0', + library_name => 'rochesterLibrary', + command => 'all', + }; + + $out; +} +sub setInputTable { + $out = { + #password => 'geometry', + pw => 'geometry', + set => 'set0', + library_name => 'rochesterLibrary', + command => 'all', + answer_form_submitted => 1, + course => 'daemon_course', + extra_packages_to_load => [qw( AlgParserWithImplicitExpand Expr + ExprWithImplicitExpand AnswerEvaluator + AnswerEvaluatorMaker + )], + mode => 'HTML_dpng', + modules_to_evaluate => [ qw( +Exporter + +DynaLoader + + +GD +WWPlot +Fun +Circle +Label + + +PGrandom +Units +Hermite + +List + + +Match +Multiple +Select + + +AlgParser + +AnswerHash + + +Fraction +VectorField + + +Complex1 +Complex + + +MatrixReal1 Matrix + + +Distributions + +Regression + + )], + envir => environment(), + problem_state => { + + num_of_correct_ans => 2, + num_of_incorrect_ans => 4, + recorded_score => 1.0, + }, + source => source(), #base64 encoded + + + + }; + + $out; +} + +sub environment { + my $envir = { + answerDate => '4014438528', + CAPA_Graphics_URL=>'http://webwork-db.math.rochester.edu/capa_graphics/', + CAPA_GraphicsDirectory =>'/ww/webwork/CAPA/CAPA_Graphics/', + CAPA_MCTools=>'/ww/webwork/CAPA/CAPA_MCTools/', + CAPA_Tools=>'/ww/webwork/CAPA/CAPA_Tools/', + cgiDirectory=>'Not defined', + cgiURL => 'Not defined', + classDirectory=> 'Not defined', + courseName=>'Not defined', + courseScriptsDirectory=>'/ww/webwork/system/courseScripts/', + displayMode=>DISPLAYMODE, + dueDate=> '4014438528', + externalGif2EpsPath=>'not defined', + externalPng2EpsPath=>'not defined', + externalTTHPath=>'/usr/local/bin/tth', + fileName=>'set0/prob1a.pg', + formattedAnswerDate=>'6/19/00', + formattedDueDate=>'6/19/00', + formattedOpenDate=>'6/19/00', + functAbsTolDefault=> 0.0000001, + functLLimitDefault=>0, + functMaxConstantOfIntegration=> 1000000000000.0, + functNumOfPoints=> 5, + functRelPercentTolDefault=> 0.000001, + functULimitDefault=>1, + functVarDefault=> 'x', + functZeroLevelDefault=> 0.000001, + functZeroLevelTolDefault=>0.000001, + htmlDirectory =>'/ww/webwork/courses/gage_course/html/', + htmlURL =>'http://webwork-db.math.rochester.edu/gage_course/', + inputs_ref => { + AnSwEr1 => '', + AnSwEr2 => '', + AnSwEr3 => '', + }, + macroDirectory=>'/ww/webwork/courses/gage_course/templates/macros/', + numAbsTolDefault=>0.0000001, + numFormatDefault=>'%0.13g', + numOfAttempts=> 0, + numRelPercentTolDefault => 0.0001, + numZeroLevelDefault =>0.000001, + numZeroLevelTolDefault =>0.000001, + openDate=> '3014438528', + PRINT_FILE_NAMES_FOR => [ 'gage'], + probFileName => 'set0/prob1a.pg', + problemSeed => 1234, + problemValue =>1, + probNum => 13, + psvn => 54321, + psvnNumber=> 54321, + questionNumber => 1, + scriptDirectory => 'Not defined', + sectionName => 'Gage', + sectionNumber => 1, + sessionKey=> 'Not defined', + setNumber =>'MAAtutorial', + studentLogin =>'gage', + studentName => 'Mike Gage', + tempDirectory => '/ww/htdocs/tmp/gage_course/', + templateDirectory=>'/ww/webwork/courses/gage_course/templates/', + tempURL=>'http://webwork-db.math.rochester.edu/tmp/gage_course/', + webworkDocsURL => 'http://webwork.math.rochester.edu/webwork_gage_system_html', + }; + $envir; +}; \ No newline at end of file |
From: Mike G. <ga...@de...> - 2005-05-19 01:08:44
|
Log Message: ----------- Add a stub to allow SOAP access to webservice Modified Files: -------------- webwork-modperl/conf: webwork.apache-config.dist Revision Data ------------- Index: webwork.apache-config.dist =================================================================== RCS file: /webwork/cvs/system/webwork-modperl/conf/webwork.apache-config.dist,v retrieving revision 1.6 retrieving revision 1.7 diff -Lconf/webwork.apache-config.dist -Lconf/webwork.apache-config.dist -u -r1.6 -r1.7 --- conf/webwork.apache-config.dist +++ conf/webwork.apache-config.dist @@ -80,7 +80,9 @@ # Alias $webwork_htdocs_url $webwork_htdocs_dir <Directory $webwork_htdocs_dir> - Options None + Order Allow,Deny + Allow from All + Options FollowSymLinks AllowOverride None </Directory> @@ -88,6 +90,8 @@ # AliasMatch $webwork_courses_url/([^/]*)/(.*) $webwork_courses_dir/\$1/html/\$2 <Directory $webwork_courses_dir/*/html> + Order Allow,Deny + Allow from All Options FollowSymLinks AllowOverride None </Directory> @@ -101,6 +105,17 @@ Order Allow,Deny Allow from All </Location> + +########## SOAP installation ############ +<Location /mod_soap> + SetHandler perl-script + PerlHandler Apache::SOAP + PerlSetVar dispatch_to "WebworkXMLRPC" + PerlSetVar options "compress_threshold => 10000" + Order Allow,Deny + Allow from All +</Location> + EOF </Perl> |
From: Mike G. <ga...@de...> - 2005-05-19 01:07:18
|
Log Message: ----------- Clean up commented out code. Modified Files: -------------- webwork-modperl/lib: WebworkWebservice.pm Revision Data ------------- Index: WebworkWebservice.pm =================================================================== RCS file: /webwork/cvs/system/webwork-modperl/lib/WebworkWebservice.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -Llib/WebworkWebservice.pm -Llib/WebworkWebservice.pm -u -r1.2 -r1.3 --- lib/WebworkWebservice.pm +++ lib/WebworkWebservice.pm @@ -22,7 +22,6 @@ $WebworkWebservice::SeedCE = $ce; $WebworkWebservice::HOST_NAME = Apache->server->server_hostname; $WebworkWebservice::HOST_PORT = Apache->server->port; - #$WebworkWebservice::HOST_PATH = Apache->server->path(); $WebworkWebservice::PASSWORD = 'geometry'; $WebworkWebservice::COURSENAME = 'daemon2_course'; # default course |
From: Mike G. <ga...@de...> - 2005-05-19 00:57:01
|
Log Message: ----------- I've updated the clients so they work with the current configuration of the apache server running in my directory (http://devel.webwork.rochester.edu:8002) Once the webwork.apache-config files have been updated they should work on other systems that are up-to-date with the cvs. -- Mike Modified Files: -------------- webwork2/clients: README Added Files: ----------- webwork2/clients: hello_world_soap_client.pl hello_world_xmlrpc_client.pl webwork_soap_client.pl Removed Files: ------------- webwork2/clients: xmlrpc_client4.pl Revision Data ------------- --- /dev/null +++ clients/webwork_soap_client.pl @@ -0,0 +1,278 @@ +#!/usr/local/bin/perl -w + +use SOAP::Lite; + +# configuration section +use constant HOSTURL => 'devel.webwork.rochester.edu'; +use constant HOSTPORT => 8002; +use constant TRANSPORT_METHOD => 'SOAP::Lite'; +use constant REQUEST_CLASS =>'WebworkXMLRPC'; # WebworkXMLRPC is used for soap also!! +use constant REQUEST_URI =>'mod_soap'; + +my @COMMANDS = qw( listLibraries renderProblem ); #listLib readFile tex2pdf + +# $pg{displayModes} = [ +# "plainText", # display raw TeX for math expressions +# "formattedText", # format math expressions using TtH +# "images", # display math expressions as images generated by dvipng +# "jsMath", # render TeX math expressions on the client side using jsMath +# "asciimath", # render TeX math expressions on the client side using ASCIIMathML +# ]; +use constant DISPLAYMODE => 'images'; + +# end configuration section +use MIME::Base64 qw( encode_base64 decode_base64); + + +print STDERR "inputs are ", join (" | ", @ARGV), "\n"; +our $source; + +if (@ARGV) { + my $command = $ARGV[0]; + + warn "executing WebworkXMLRPC.$command"; + $source = (defined $ARGV[1]) ? `cat $ARGV[1]` : '' ; + xmlrpcCall($command); + + +} else { + + print STDERR "Useage: ./webwork_soap_client.pl command inputs\n"; + print STDERR "For example: ./webwork_soap_client renderProblem input.txt\n"; + print STDERR "For example: ./webwork_soap_client listLibraries \n"; + print STDERR "Commands are: ", join(" ", @COMMANDS), "\n"; + +} + + + +sub xmlrpcCall { + my $command = shift; + $command = 'listLibraries' unless $command; + + my $requestResult = TRANSPORT_METHOD + ->uri('http://'.HOSTURL.':'.HOSTPORT.'/'.REQUEST_CLASS) + -> proxy('http://'.HOSTURL.':'.HOSTPORT.'/'.REQUEST_URI); + + my $test = [3,4,5,6]; + my $input = setInputTable(); + print "displayMode=",$input->{envir}->{displayMode},"\n"; + local( $result); + # use eval to catch errors + eval { $result = $requestResult->call("$command",$input) }; + print STDERR "There were a lot of errors\n" if $@; + print "Errors: \n $@\n End Errors\n" if $@; + + print "result is|", ref($result),"|"; + + unless (ref($result) and $result->fault) { + + if (ref($result->result())=~/HASH/ and defined($result->result()->{text}) ) { + $result->result()->{text} = decode_base64($result->result()->{text}); + } + print pretty_print_rh($result->result()),"\n"; #$result->result() + } else { + print 'oops ', join ', ', + $result->faultcode, + $result->faultstring; + } +} + +sub source { + encode_base64($source); +} +sub pretty_print_rh { + shift if UNIVERSAL::isa($_[0] => __PACKAGE__); + my $rh = shift; + my $indent = shift || 0; + my $out = ""; + my $type = ref($rh); + + if (defined($type) and $type) { + $out .= " type = $type; "; + } elsif (! defined($rh )) { + $out .= " type = UNDEFINED; "; + } + return $out." " unless defined($rh); + + if ( ref($rh) =~/HASH/ or "$rh" =~/HASH/ ) { + $out .= "{\n"; + $indent++; + foreach my $key (sort keys %{$rh}) { + $out .= " "x$indent."$key => " . pretty_print_rh( $rh->{$key}, $indent ) . "\n"; + } + $indent--; + $out .= "\n"." "x$indent."}\n"; + + } elsif (ref($rh) =~ /ARRAY/ or "$rh" =~/ARRAY/) { + $out .= " ( "; + foreach my $elem ( @{$rh} ) { + $out .= pretty_print_rh($elem, $indent); + + } + $out .= " ) \n"; + } elsif ( ref($rh) =~ /SCALAR/ ) { + $out .= "scalar reference ". ${$rh}; + } elsif ( ref($rh) =~/Base64/ ) { + $out .= "base64 reference " .$$rh; + } else { + $out .= $rh; + } + + return $out." "; +} + +sub setInputTable_for_listLib { + $out = { + #password => 'geometry', + pw => 'geometry', + set => 'set0', + library_name => 'rochesterLibrary', + command => 'all', + }; + + $out; +} +sub setInputTable { + $out = { + #password => 'geometry', + pw => 'geometry', + set => 'set0', + library_name => 'rochesterLibrary', + command => 'all', + answer_form_submitted => 1, + course => 'daemon_course', + extra_packages_to_load => [qw( AlgParserWithImplicitExpand Expr + ExprWithImplicitExpand AnswerEvaluator + AnswerEvaluatorMaker + )], + mode => 'HTML_dpng', + modules_to_evaluate => [ qw( +Exporter + +DynaLoader + + +GD +WWPlot +Fun +Circle +Label + + +PGrandom +Units +Hermite + +List + + +Match +Multiple +Select + + +AlgParser + +AnswerHash + + +Fraction +VectorField + + +Complex1 +Complex + + +MatrixReal1 Matrix + + +Distributions + +Regression + + )], + envir => environment(), + problem_state => { + + num_of_correct_ans => 2, + num_of_incorrect_ans => 4, + recorded_score => 1.0, + }, + source => source(), #base64 encoded + + + + }; + + $out; +} + +sub environment { + my $envir = { + answerDate => '4014438528', + CAPA_Graphics_URL=>'http://webwork-db.math.rochester.edu/capa_graphics/', + CAPA_GraphicsDirectory =>'/ww/webwork/CAPA/CAPA_Graphics/', + CAPA_MCTools=>'/ww/webwork/CAPA/CAPA_MCTools/', + CAPA_Tools=>'/ww/webwork/CAPA/CAPA_Tools/', + cgiDirectory=>'Not defined', + cgiURL => 'Not defined', + classDirectory=> 'Not defined', + courseName=>'Not defined', + courseScriptsDirectory=>'/ww/webwork/system/courseScripts/', + displayMode=>DISPLAYMODE, + dueDate=> '4014438528', + externalGif2EpsPath=>'not defined', + externalPng2EpsPath=>'not defined', + externalTTHPath=>'/usr/local/bin/tth', + fileName=>'set0/prob1a.pg', + formattedAnswerDate=>'6/19/00', + formattedDueDate=>'6/19/00', + formattedOpenDate=>'6/19/00', + functAbsTolDefault=> 0.0000001, + functLLimitDefault=>0, + functMaxConstantOfIntegration=> 1000000000000.0, + functNumOfPoints=> 5, + functRelPercentTolDefault=> 0.000001, + functULimitDefault=>1, + functVarDefault=> 'x', + functZeroLevelDefault=> 0.000001, + functZeroLevelTolDefault=>0.000001, + htmlDirectory =>'/ww/webwork/courses/gage_course/html/', + htmlURL =>'http://webwork-db.math.rochester.edu/gage_course/', + inputs_ref => { + AnSwEr1 => '', + AnSwEr2 => '', + AnSwEr3 => '', + }, + macroDirectory=>'/ww/webwork/courses/gage_course/templates/macros/', + numAbsTolDefault=>0.0000001, + numFormatDefault=>'%0.13g', + numOfAttempts=> 0, + numRelPercentTolDefault => 0.0001, + numZeroLevelDefault =>0.000001, + numZeroLevelTolDefault =>0.000001, + openDate=> '3014438528', + PRINT_FILE_NAMES_FOR => [ 'gage'], + probFileName => 'set0/prob1a.pg', + problemSeed => 1234, + problemValue =>1, + probNum => 13, + psvn => 54321, + psvnNumber=> 54321, + questionNumber => 1, + scriptDirectory => 'Not defined', + sectionName => 'Gage', + sectionNumber => 1, + sessionKey=> 'Not defined', + setNumber =>'MAAtutorial', + studentLogin =>'gage', + studentName => 'Mike Gage', + tempDirectory => '/ww/htdocs/tmp/gage_course/', + templateDirectory=>'/ww/webwork/courses/gage_course/templates/', + tempURL=>'http://webwork-db.math.rochester.edu/tmp/gage_course/', + webworkDocsURL => 'http://webwork.math.rochester.edu/webwork_gage_system_html', + }; + $envir; +}; \ No newline at end of file --- /dev/null +++ clients/hello_world_xmlrpc_client.pl @@ -0,0 +1,19 @@ +#!/usr/bin/perl -w + +# +use XMLRPC::Lite; + my $soap = XMLRPC::Lite + # ->uri('http://webwork-db.math.rochester.edu/Demo/') + -> proxy('http://devel.webwork.rochester.edu:8002/mod_xmlrpc/'); + + + my $result = $soap->call("WebworkXMLRPC.hi"); + + + unless ($result->fault) { + print $result->result(),"\n"; + } else { + print join ', ', + $result->faultcode, + $result->faultstring; + } --- /dev/null +++ clients/hello_world_soap_client.pl @@ -0,0 +1,21 @@ +#!/usr/bin/perl -w + + +use SOAP::Lite; +my $soap = SOAP::Lite +-> uri('http://devel.webwork.rochester.edu:8002/WebworkXMLRPC') +-> proxy('http://devel.webwork.rochester.edu:8002/mod_soap/WebworkWebservice') +; + + +my $result = $soap->hi(); + +unless ($result->fault) { + print $result->result(); +} else { + print join ', ', + $result->faultcode, + $result->faultstring; +} + + --- clients/xmlrpc_client4.pl +++ /dev/null @@ -1,280 +0,0 @@ -#!/usr/bin/perl -w - -# configuration section -use constant HOSTURL => 'devel.webwork.rochester.edu'; -use constant HOSTPORT => 8002; - -my @COMMANDS = qw( listLibraries renderProblem ); #listLib tex2pdf - -# $pg{displayModes} = [ -# "plainText", # display raw TeX for math expressions -# "formattedText", # format math expressions using TtH -# "images", # display math expressions as images generated by dvipng -# "jsMath", # render TeX math expressions on the client side using jsMath -# "asciimath", # render TeX math expressions on the client side using ASCIIMathML -# ]; -use constant DISPLAYMODE => 'images'; - -# end configuration section -use MIME::Base64 qw( encode_base64 decode_base64); - - -# -- SOAP::Lite -- soaplite.com -- Copyright (C) 2001 Paul Kulchenko -- - -# use XMLRPC::Lite; -# -# print XMLRPC::Lite -# -> proxy('http://devel.webwork.rochester.edu:11002/mod_xmlrpc') -# -> call('Demo:bye', 25) -# -> result; -print STDERR "inputs are ", join (" | ", @ARGV), "\n"; -our $source; - -if (@ARGV) { - my $command = $ARGV[0]; - - warn "executing WebworkXMLRPC.$command"; - $source = (defined $ARGV[1]) ? `cat $ARGV[1]` : '' ; - xmlrpcCall($command); - - -} else { - - print STDERR "Useage: .xmlrpc_client4.pl command file_name\n"; - print STDERR "For example: .xmlrpc_client4.pl renderProblem input.txt\n"; - print STDERR "Commands are: ", join(" ", @COMMANDS), "\n"; - -} - - - - - - -sub xmlrpcCall { - my $command = shift; - $command = 'listLibraries' unless $command; - use XMLRPC::Lite; - my $xmlrpc = XMLRPC::Lite - # ->uri('http://webwork-db.math.rochester.edu/Demo/') - -> proxy('http://'.HOSTURL.':'.HOSTPORT.'/mod_xmlrpc'); - - my $test = [3,4,5,6]; - my $input = setInputTable(); - print "displayMode=",$input->{envir}->{displayMode},"\n"; - local( $result); - eval { $result = $xmlrpc->call("WebworkXMLRPC.$command",$input) }; - print STDERR "There were a lot of errors\n" if $@; - print "Errors: \n $@\n End Errors\n" if $@; - - print "result is|", ref($result),"|"; - - unless (ref($result) and $result->fault) { - - if (ref($result->result())=~/HASH/ and defined($result->result()->{text}) ) { - $result->result()->{text} = decode_base64($result->result()->{text}); - } - print pretty_print_rh($result->result()),"\n"; #$result->result() - } else { - print 'oops ', join ', ', - $result->faultcode, - $result->faultstring; - } -} - -sub source { - encode_base64($source); -} -sub pretty_print_rh { - shift if UNIVERSAL::isa($_[0] => __PACKAGE__); - my $rh = shift; - my $indent = shift || 0; - my $out = ""; - my $type = ref($rh); - - if (defined($type) and $type) { - $out .= " type = $type; "; - } elsif (! defined($rh )) { - $out .= " type = UNDEFINED; "; - } - if ( ref($rh) =~/HASH/ or "$rh" =~/HASH/ ) { - $out .= "{\n"; - $indent++; - foreach my $key (sort keys %{$rh}) { - $out .= " "x$indent."$key => " . pretty_print_rh( $rh->{$key}, $indent ) . "\n"; - } - $indent--; - $out .= "\n"." "x$indent."}\n"; - - } elsif (ref($rh) =~ /ARRAY/ or "$rh" =~/ARRAY/) { - $out .= " ( "; - foreach my $elem ( @{$rh} ) { - $out .= pretty_print_rh($elem, $indent); - - } - $out .= " ) \n"; - } elsif ( ref($rh) =~ /SCALAR/ ) { - $out .= "scalar reference ". ${$rh}; - } elsif ( ref($rh) =~/Base64/ ) { - $out .= "base64 reference " .$$rh; - } else { - $out .= $rh; - } - - return $out." "; -} - -sub setInputTable_for_listLib { - $out = { - #password => 'geometry', - pw => 'geometry', - set => 'set0', - library_name => 'rochesterLibrary', - command => 'all', - }; - - $out; -} -sub setInputTable { - $out = { - #password => 'geometry', - pw => 'geometry', - set => 'set0', - library_name => 'rochesterLibrary', - command => 'all', - answer_form_submitted => 1, - course => 'daemon_course', - extra_packages_to_load => [qw( AlgParserWithImplicitExpand Expr - ExprWithImplicitExpand AnswerEvaluator - AnswerEvaluatorMaker - )], - mode => 'HTML_dpng', - modules_to_evaluate => [ qw( -Exporter - -DynaLoader - - -GD -WWPlot -Fun -Circle -Label - - -PGrandom -Units -Hermite - -List - - -Match -Multiple -Select - - -AlgParser - -AnswerHash - - -Fraction -VectorField - - -Complex1 -Complex - - -MatrixReal1 Matrix - - -Distributions - -Regression - - )], - envir => environment(), - problem_state => { - - num_of_correct_ans => 2, - num_of_incorrect_ans => 4, - recorded_score => 1.0, - }, - source => source(), #base64 encoded - - - - }; - - $out; -} - -sub environment { - my $envir = { - answerDate => '4014438528', - CAPA_Graphics_URL=>'http://webwork-db.math.rochester.edu/capa_graphics/', - CAPA_GraphicsDirectory =>'/ww/webwork/CAPA/CAPA_Graphics/', - CAPA_MCTools=>'/ww/webwork/CAPA/CAPA_MCTools/', - CAPA_Tools=>'/ww/webwork/CAPA/CAPA_Tools/', - cgiDirectory=>'Not defined', - cgiURL => 'Not defined', - classDirectory=> 'Not defined', - courseName=>'Not defined', - courseScriptsDirectory=>'/ww/webwork/system/courseScripts/', - displayMode=>DISPLAYMODE, - dueDate=> '4014438528', - externalGif2EpsPath=>'not defined', - externalPng2EpsPath=>'not defined', - externalTTHPath=>'/usr/local/bin/tth', - fileName=>'set0/prob1a.pg', - formattedAnswerDate=>'6/19/00', - formattedDueDate=>'6/19/00', - formattedOpenDate=>'6/19/00', - functAbsTolDefault=> 0.0000001, - functLLimitDefault=>0, - functMaxConstantOfIntegration=> 1000000000000.0, - functNumOfPoints=> 5, - functRelPercentTolDefault=> 0.000001, - functULimitDefault=>1, - functVarDefault=> 'x', - functZeroLevelDefault=> 0.000001, - functZeroLevelTolDefault=>0.000001, - htmlDirectory =>'/ww/webwork/courses/gage_course/html/', - htmlURL =>'http://webwork-db.math.rochester.edu/gage_course/', - inputs_ref => { - AnSwEr1 => '', - AnSwEr2 => '', - AnSwEr3 => '', - }, - macroDirectory=>'/ww/webwork/courses/gage_course/templates/macros/', - numAbsTolDefault=>0.0000001, - numFormatDefault=>'%0.13g', - numOfAttempts=> 0, - numRelPercentTolDefault => 0.0001, - numZeroLevelDefault =>0.000001, - numZeroLevelTolDefault =>0.000001, - openDate=> '3014438528', - PRINT_FILE_NAMES_FOR => [ 'gage'], - probFileName => 'set0/prob1a.pg', - problemSeed => 1234, - problemValue =>1, - probNum => 13, - psvn => 54321, - psvnNumber=> 54321, - questionNumber => 1, - scriptDirectory => 'Not defined', - sectionName => 'Gage', - sectionNumber => 1, - sessionKey=> 'Not defined', - setNumber =>'MAAtutorial', - studentLogin =>'gage', - studentName => 'Mike Gage', - tempDirectory => '/ww/htdocs/tmp/gage_course/', - templateDirectory=>'/ww/webwork/courses/gage_course/templates/', - tempURL=>'http://webwork-db.math.rochester.edu/tmp/gage_course/', - webworkDocsURL => 'http://webwork.math.rochester.edu/webwork_gage_system_html', - }; - $envir; -}; \ No newline at end of file Index: README =================================================================== RCS file: /webwork/cvs/system/webwork2/clients/README,v retrieving revision 1.1 retrieving revision 1.2 diff -Lclients/README -Lclients/README -u -r1.1 -r1.2 --- clients/README +++ clients/README @@ -1,7 +1,12 @@ -Minimal commands to make this client work: +These test clients will process these two commands: -./xmlrpc_client4.pl renderProblem input.txt >foo.txt +./webwork_xmlrpc_client.pl renderProblem input.txt >foo.txt +./webwork_xmlrpc_client.pl listLibraries +or -You may need to adjust some hardwired parameters in xmlrpc_client4. :-) +./webwork_soap_client.pl renderProblem input.txt >foo.txt +./webwork_soap_client.pl listLibraries + + +You may need to adjust some hardwired parameters in the scripts. :-) -The |
From: Arnie P. <ap...@de...> - 2005-05-17 18:41:29
|
Log Message: ----------- Put a spce in after bolf faced words Modified Files: -------------- webwork-modperl/lib/WeBWorK/ContentGenerator: Login.pm Revision Data ------------- Index: Login.pm =================================================================== RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/ContentGenerator/Login.pm,v retrieving revision 1.24 retrieving revision 1.25 diff -Llib/WeBWorK/ContentGenerator/Login.pm -Llib/WeBWorK/ContentGenerator/Login.pm -u -r1.24 -r1.25 --- lib/WeBWorK/ContentGenerator/Login.pm +++ lib/WeBWorK/ContentGenerator/Login.pm @@ -96,7 +96,7 @@ print CGI::p("Please enter your username and password for ",CGI::b($course)," below:"); print CGI::p(dequote <<" EOT"); - If you check ${\( CGI::b("Remember Me") )} your login information will + If you check ${\( CGI::b("Remember Me") )} your login information will be remembered by the browser you are using, allowing you to visit WeBWorK pages without typing your user name and password (until your session expires). This feature is not safe for public workstations, @@ -150,7 +150,7 @@ print CGI::p(dequote <<" EOT"); This course supports guest logins. Click ${\( CGI::b("Guest Login") )} - to log into this course as a guest. + to log into this course as a guest. EOT print CGI::input({-type=>"submit", -name=>"login_practice_user", -value=>"Guest Login"}); |
From: dpvc <dp...@de...> - 2005-05-14 01:43:33
|
Log Message: ----------- Changed loadMacros() to use search for amcros files via a user-cusomizable path of directories. This is specified in the global.conf file, and can include any number of directories. The path can include "." to mean look in the .pg file's directory. This makes it possible to store special macros files with the code that uses them. By default, the path is ".", the course/templates/macro directory, then the pg/macros directory (in that order). This duplicates the current behaviour, except for the ".", which is new. You must also make the updates to the global.conf, webwork2/lib/WeBWorK/PG.pm, and webwork2/lib/WeBWorK/PG/Local/pm files. Modified Files: -------------- pg/macros: dangerousMacros.pl Revision Data ------------- Index: dangerousMacros.pl =================================================================== RCS file: /webwork/cvs/system/pg/macros/dangerousMacros.pl,v retrieving revision 1.33 retrieving revision 1.34 diff -Lmacros/dangerousMacros.pl -Lmacros/dangerousMacros.pl -u -r1.33 -r1.34 --- macros/dangerousMacros.pl +++ macros/dangerousMacros.pl @@ -101,16 +101,16 @@ # grab read only variables from the current safe compartment -my ($macroDirectory, - $courseScriptsDirectory, +my ($macrosPath, + $pwd, $templateDirectory, $scriptDirectory, $externalTTHPath, ); sub _dangerousMacros_init { #use envir instead of local variables? - $macroDirectory = eval('$main::envir{macroDirectory}') ; - $courseScriptsDirectory = eval('$main::envir{courseScriptsDirectory}'); + $macrosPath = eval('$main::envir{macrosPath}'); + $pwd = eval('$main::envir{fileName}'); $pwd =~ s!/[^/]*$!!; $templateDirectory = eval('$main::envir{templateDirectory}'); $scriptDirectory = eval('$main::envir{scriptDirectory}'); $externalTTHPath = eval('$main::envir{externalTTHPath}'); @@ -139,9 +139,10 @@ C<loadMacros(macrofile1,macrofile2,...)> loadMacros takes a list of file names and evaluates the contents of each file. This is used to load macros -which define and augment the PG language. The macro files are first searched for in the macro -directory of the course C<($macroDirectory)> and then, if not found, in the WeBWorK courseScripts -directory C<($courseScriptsDirectory)> where the default behavior of the PG language is defined. +which define and augment the PG language. The macro files are searched for in the directories specified by +C<($macrosPath)>, which by default is the course macros directory followed by WeBWorK's pg/macros directory. +The latter is where the default behaviour of the PG language is defined. The default path is set in +the C<(global.conf)> file. An individual course can modify the PG language, B<for that course only>, by duplicating one of the macro files in the courseScripts directory and placing this @@ -170,8 +171,7 @@ =cut # Global variables used -# ${main::macroDirectory} -# ${main::courseScriptsDirectory} +# ${main::macrosPath} # Global macros used # None @@ -226,6 +226,7 @@ $macro_file_name =~s/\.pl//; # trim off the extension $macro_file_name =~s/\.pg//; # sometimes the extension is .pg (e.g. CAPA files) my $init_subroutine_name = "_${macro_file_name}_init"; + $init_subroutine_name =~ s![^a-zA-Z0-9_]!_!g; # remove dangerous chars ############################################################################### # For some reason the "no stict" which works on webwork-db doesn't work on @@ -235,6 +236,7 @@ # Keep an eye on this ??? # webwork-db used perl 5.6.1 and webwork used perl 5.6.0 ############################################################################### + # compile initialization subroutine. (5.6.0 version) @@ -250,21 +252,18 @@ # use strict; ############################################################################### - # macros are searched for first in the $macroDirectory of the course - # and then in the webwork $courseScripts directory. + # macros are searched for in the directories listed in the $macrosPath array reference. my $macro_file_loaded = defined($init_subroutine) && defined(&$init_subroutine); warn "dangerousMacros: macro init $init_subroutine_name defined |$init_subroutine| |$macro_file_loaded|" if $debugON; unless ($macro_file_loaded) { - #print STDERR "loadMacros: loading macro file $fileName\n"; - if (-r "$macroDirectory$fileName") { - compile_file("$macroDirectory$fileName"); - - } elsif (-r "$courseScriptsDirectory$fileName" ) { - compile_file("$courseScriptsDirectory$fileName"); - } else { - die "Can't locate macro file via path: |$macroDirectory$fileName| or |$courseScriptsDirectory$fileName|"; - } + warn "loadMacros: loading macro file $fileName\n" if $debugON; + my $filePath = findMacroFile($fileName); + #### (check for renamed files here?) #### + if ($filePath) {compile_file($filePath)} + else { + die "Can't locate macro file |$fileName| via path: |".join("|, |",@{$macrosPath})."|"; + } } ############################################################################### # Try again to define the initialization subroutine. (5.6.0 version) @@ -294,6 +293,20 @@ eval{main::time_it("end load macros");}; } +# +# Look for a macro file in the directories specified in the macros path +# +sub findMacroFile { + my $fileName = shift; + my $filePath; + foreach my $dir (@{$macrosPath}) { + $filePath = "$dir/$fileName"; + $filePath =~ s!^\.\.?/!$templateDirectory$pwd/!; + return $filePath if (-r $filePath); + } + return; # no file found +} + # errors in compiling macros is not always being reported. sub compile_file { my $filePath = shift; |
From: dpvc <dp...@de...> - 2005-05-14 01:33:32
|
Log Message: ----------- Changes needed to make loadMacros() look through a path of directories rather than just course/templates/macros and pg/macros. You can specify the path in the global.conf file. You also need to make the update to pg/macros/dangerousMacros.pl Modified Files: -------------- webwork-modperl/conf: global.conf.dist webwork-modperl/lib/WeBWorK: PG.pm webwork-modperl/lib/WeBWorK/PG: Local.pm Revision Data ------------- Index: global.conf.dist =================================================================== RCS file: /webwork/cvs/system/webwork-modperl/conf/global.conf.dist,v retrieving revision 1.117 retrieving revision 1.118 diff -Lconf/global.conf.dist -Lconf/global.conf.dist -u -r1.117 -r1.118 --- conf/global.conf.dist +++ conf/global.conf.dist @@ -612,6 +612,16 @@ $pg{directories}{lib} = "$pg{directories}{root}/lib"; $pg{directories}{macros} = "$pg{directories}{root}/macros"; +# +# The macro file search path. Each directory in this list is seached +# (in this order) by loadMacros() when it looks for a .pl file. +# +$pg{directories}{macrosPath} = [ + ".", # search the problem file's directory + $courseDirs{macros}, + $pg{directories}{macros}, +]; + ##### "Special" PG environment variables. (Stuff that doesn't fit in anywhere else.) # Users for whom to print the file name of the PG file being processed. Index: PG.pm =================================================================== RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/PG.pm,v retrieving revision 1.59 retrieving revision 1.60 diff -Llib/WeBWorK/PG.pm -Llib/WeBWorK/PG.pm -u -r1.59 -r1.60 --- lib/WeBWorK/PG.pm +++ lib/WeBWorK/PG.pm @@ -137,21 +137,22 @@ # ADDED: dvipngTempDir # ADDED: jsMathURL # ADDED: asciimathURL + # ADDED: macrosPath + # REMOVED: macrosDirectory, courseScriptsDirectory $envir{cgiDirectory} = undef; $envir{cgiURL} = undef; $envir{classDirectory} = undef; - $envir{courseScriptsDirectory} = $ce->{pg}->{directories}->{macros}."/"; + $envir{macrosPath} = $ce->{pg}->{directories}{macrosPath}; $envir{htmlDirectory} = $ce->{courseDirs}->{html}."/"; $envir{htmlURL} = $ce->{courseURLs}->{html}."/"; - $envir{macroDirectory} = $ce->{courseDirs}->{macros}."/"; $envir{templateDirectory} = $ce->{courseDirs}->{templates}."/"; $envir{tempDirectory} = $ce->{courseDirs}->{html_temp}."/"; $envir{tempURL} = $ce->{courseURLs}->{html_temp}."/"; $envir{scriptDirectory} = undef; $envir{webworkDocsURL} = $ce->{webworkURLs}->{docs}."/"; $envir{localHelpURL} = $ce->{webworkURLs}->{local_help}."/"; - $envir{jsMathURL} = $ce->{webworkURLs}->{jsMath}; + $envir{jsMathURL} = $ce->{webworkURLs}->{jsMath}; $envir{asciimathURL} = $ce->{webworkURLs}->{asciimath}; # Information for sending mail Index: Local.pm =================================================================== RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/PG/Local.pm,v retrieving revision 1.16 retrieving revision 1.17 diff -Llib/WeBWorK/PG/Local.pm -Llib/WeBWorK/PG/Local.pm -u -r1.16 -r1.17 --- lib/WeBWorK/PG/Local.pm +++ lib/WeBWorK/PG/Local.pm @@ -95,8 +95,7 @@ # set the directory hash #warn "PG: setting the directory hash\n"; $translator->rh_directories({ - courseScriptsDirectory => $ce->{pg}->{directories}->{macros}, - macroDirectory => $ce->{courseDirs}->{macros}, + macrosPath => $ce->{courseDirs}->{macrosPath}, templateDirectory => $ce->{courseDirs}->{templates}, tempDirectory => $ce->{courseDirs}->{html_temp}, }); |
From: Mike G. v. a. <we...@ma...> - 2005-02-27 04:23:08
|
Log Message: ----------- Still fiddling with the links so that one can jump from instructor page editors to the actual display and back easily. Modified Files: -------------- webwork-modperl/lib/WeBWorK: ContentGenerator.pm Revision Data ------------- Index: ContentGenerator.pm =================================================================== RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/ContentGenerator.pm,v retrieving revision 1.134 retrieving revision 1.135 diff -Llib/WeBWorK/ContentGenerator.pm -Llib/WeBWorK/ContentGenerator.pm -u -r1.134 -r1.135 --- lib/WeBWorK/ContentGenerator.pm +++ lib/WeBWorK/ContentGenerator.pm @@ -472,9 +472,16 @@ # we're linking to other places in the same course, so grab the courseID from the current path my $courseID = $urlpath->arg("courseID"); + + # grab the effective user, set and problem + my $userID = $r->param("effectiveUser"); + my $setID = $urlpath->arg("setID"); + $setID = "" if (defined $setID && !(grep /$setID/, $db->listUserSets($userID))); + my $problemID = $urlpath->arg("problemID"); + $problemID = "" if (defined $problemID && !(grep /$problemID/, $db->listUserProblems($userID, $setID))); # to make things more concise - my %args = ( courseID => $courseID ); + my %args = ( courseID => $courseID); my $pfx = "WeBWorK::ContentGenerator::"; my $sets = $urlpath->newFromModule("${pfx}ProblemSets", %args); @@ -492,11 +499,35 @@ showOldAnswers => $self->{will}->{showOldAnswers} ); print CGI::start_ul({class=>"LinksMenu"}); - print CGI::li(CGI::span({style=>"font-size:larger"}, - CGI::a({href=>$self->systemLink($sets, + print CGI::start_li(), + CGI::span({style=>"font-size:larger"}, + CGI::a({href=>$self->systemLink($sets, params=>{ %displayOptions,} - )}, sp2nbsp("Homework Sets"))) + )}, sp2nbsp("Homework Sets")) ); + if (defined $setID and $setID ne "") { + my $setPath = $urlpath->newFromModule("${pfx}ProblemSet", courseID =>$courseID, setID =>$setID); + print CGI::start_ul(); + print CGI::li(CGI::a({href=>$self->systemLink($setPath, + params=>{ %displayOptions,} + )}, $setID) + ); +# Displaying a link back to the problem may not be necessary or useful. +# if (defined $problemID and $problemID ne "") { +# my $problemPath = $urlpath->newFromModule("${pfx}Problem", +# courseID =>$courseID, setID =>$setID, problemID =>$problemID); +# print CGI::start_ul(); +# CGI::li(CGI::a({href=>$self->systemLink($problemPath, +# params=>{ %displayOptions,} +# )}, $problemID) +# ); +# print CGI::end_ul(); +# } + + print CGI::end_ul(); + } + print CGI::end_li(); + if ($authz->hasPermissions($user, "change_password") or $authz->hasPermissions($user, "change_email_address")) { print CGI::li(CGI::a({href=>$self->systemLink($options, @@ -514,11 +545,6 @@ if ($authz->hasPermissions($user, "access_instructor_tools")) { my $ipfx = "${pfx}Instructor::"; - my $userID = $r->param("effectiveUser"); - my $setID = $urlpath->arg("setID"); - $setID = "" if (defined $setID && !(grep /$setID/, $db->listUserSets($userID))); - my $problemID = $urlpath->arg("problemID"); - $problemID = "" if (defined $problemID && !(grep /$problemID/, $db->listUserProblems($userID, $setID))); # instructor tools link my $instr = $urlpath->newFromModule("${ipfx}Index", %args); # Class list editor @@ -562,12 +588,14 @@ ## Homework sets editor and sub links print CGI::a({href=>$self->systemLink($setList,params=>{ %displayOptions,})}, sp2nbsp($setList->name)); if (defined $setID and $setID ne "") { + print CGI::start_ul(); print CGI::li( CGI::a({href=>$self->systemLink($setDetail,params=>{ %displayOptions,})}, $setID) ); if (defined $problemID and $problemID ne "") { print CGI::ul( CGI::li(CGI::a({href=>$self->systemLink($problemEditor,params=>{ %displayOptions,})}, $problemID)) ); } + print CGI::end_ul(); } print CGI::end_li(); ## Library browser @@ -576,30 +604,26 @@ ## Stats print CGI::li(CGI::a({href=>$self->systemLink($stats,params=>{ %displayOptions,})}, sp2nbsp($stats->name))); print CGI::start_li(); + print CGI::start_ul(); if (defined $userID and $userID ne "") { - print ' ', - CGI::a({href=>$self->systemLink($userStats,params=>{ %displayOptions,})}, $userID), - CGI::br(); + print CGI::li(CGI::a({href=>$self->systemLink($userStats,params=>{ %displayOptions,})}, $userID)), } if (defined $setID and $setID ne "") { - print ' ', - CGI::a({href=>$self->systemLink($setStats,params=>{ %displayOptions,})}, sp2nbsp($setID)), - CGI::br(); + print CGI::li(CGI::a({href=>$self->systemLink($setStats,params=>{ %displayOptions,})}, sp2nbsp($setID))), } + print CGI::end_ul(); print CGI::end_li(); ## Student Progress print CGI::li(CGI::a({href=>$self->systemLink($progress,params=>{ %displayOptions,})}, sp2nbsp($progress->name))); print CGI::start_li(); + print CGI::start_ul(); if (defined $userID and $userID ne "") { - print ' ', - CGI::a({href=>$self->systemLink($userProgress,params=>{ %displayOptions,})}, $userID), - CGI::br(); + print CGI::li(CGI::a({href=>$self->systemLink($userProgress,params=>{ %displayOptions,})}, $userID)); } if (defined $setID and $setID ne "") { - print ' ', - CGI::a({href=>$self->systemLink($setProgress,params=>{ %displayOptions,})}, sp2nbsp($setID)), - CGI::br(); + print CGI::li(CGI::a({href=>$self->systemLink($setProgress,params=>{ %displayOptions,})}, sp2nbsp($setID))); } + print CGI::end_ul(); print CGI::end_li(); ## Scoring tools print CGI::li(CGI::a({href=>$self->systemLink($scoring,params=>{ %displayOptions,})}, sp2nbsp($scoring->name))) if $authz->hasPermissions($user, "score_sets"); |
From: Mike G. v. a. <we...@ma...> - 2005-02-26 23:20:31
|
Log Message: ----------- Allow subclasses of AnswerEvalutor to be used. Check for a match with a substring AnswerEvaluator instead of equality. Modified Files: -------------- pg/lib/WeBWorK/PG: Translator.pm Revision Data ------------- Index: Translator.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/WeBWorK/PG/Translator.pm,v retrieving revision 1.11 retrieving revision 1.12 diff -Llib/WeBWorK/PG/Translator.pm -Llib/WeBWorK/PG/Translator.pm -u -r1.11 -r1.12 --- lib/WeBWorK/PG/Translator.pm +++ lib/WeBWorK/PG/Translator.pm @@ -1109,7 +1109,7 @@ if (ref($rf_fun) eq 'CODE' ) { $rh_ans_evaluation_result = $self->{safe} ->reval( '&{ $rf_fun }($temp_ans)' ) ; warn "Error in Translator.pm::process_answers: Answer $ans_name:<BR>\n $@\n" if $@; - } elsif (ref($rf_fun) eq 'AnswerEvaluator') { + } elsif (ref($rf_fun) =~ /AnswerEvaluator/) { $rh_ans_evaluation_result = $self->{safe} ->reval('$rf_fun->evaluate($temp_ans, ans_label => \''.$ans_name.'\')'); $@ = $errorTable{$@} if $@ && defined($errorTable{$@}); warn "Error in Translator.pm::process_answers: Answer $ans_name:<BR>\n $@\n" if $@; |
From: Gavin L. v. a. <we...@ma...> - 2005-02-23 01:44:06
|
Log Message: ----------- Gateway: add version_last_attempt_time to fields in ProblemSetList.pm Tags: ---- rel-2-1-a1 Modified Files: -------------- webwork2/lib/WeBWorK/ContentGenerator/Instructor: ProblemSetList.pm Revision Data ------------- Index: ProblemSetList.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList.pm,v retrieving revision 1.60.2.3 retrieving revision 1.60.2.4 diff -Llib/WeBWorK/ContentGenerator/Instructor/ProblemSetList.pm -Llib/WeBWorK/ContentGenerator/Instructor/ProblemSetList.pm -u -r1.60.2.3 -r1.60.2.4 --- lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList.pm +++ lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList.pm @@ -196,6 +196,11 @@ size => 10, access => "readonly", }, + version_last_attempt_time => { + type => "text", + size => 10, + access => "readonly", + }, }; sub pre_header_initialize { |
From: Gavin L. v. a. <we...@ma...> - 2005-02-22 23:24:43
|
Log Message: ----------- Gateway update: add version_last_attempt_time field in Set.pm and UserSet.pm Tags: ---- rel-2-1-a1 Modified Files: -------------- webwork2/lib/WeBWorK/DB/Record: Set.pm UserSet.pm Revision Data ------------- Index: UserSet.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/DB/Record/UserSet.pm,v retrieving revision 1.6.4.3 retrieving revision 1.6.4.4 diff -Llib/WeBWorK/DB/Record/UserSet.pm -Llib/WeBWorK/DB/Record/UserSet.pm -u -r1.6.4.3 -r1.6.4.4 --- lib/WeBWorK/DB/Record/UserSet.pm +++ lib/WeBWorK/DB/Record/UserSet.pm @@ -46,6 +46,7 @@ version_time_limit version_creation_time problem_randorder + version_last_attempt_time )} sub FIELDS {qw( @@ -65,6 +66,7 @@ version_time_limit version_creation_time problem_randorder + version_last_attempt_time )} 1; Index: Set.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/DB/Record/Set.pm,v retrieving revision 1.7.4.3 retrieving revision 1.7.4.4 diff -Llib/WeBWorK/DB/Record/Set.pm -Llib/WeBWorK/DB/Record/Set.pm -u -r1.7.4.3 -r1.7.4.4 --- lib/WeBWorK/DB/Record/Set.pm +++ lib/WeBWorK/DB/Record/Set.pm @@ -33,7 +33,7 @@ # added fields here for gateway testing: # assignment_type, attempts_per_version, time_interval, # versions_per_interval, version_time_limit, version_creation_time, -# problem_randorder +# version_last_attempt_time, problem_randorder sub NONKEYFIELDS {qw( set_header hardcopy_header @@ -48,6 +48,7 @@ version_time_limit version_creation_time problem_randorder + version_last_attempt_time )} sub FIELDS {qw( @@ -65,6 +66,7 @@ version_time_limit version_creation_time problem_randorder + version_last_attempt_time )} 1; |