Skip to content

Commit

Permalink
Merge pull request openwebwork#22 from openwebwork/release/2.7
Browse files Browse the repository at this point in the history
Release/2.7
  • Loading branch information
mgage committed Jun 15, 2013
2 parents 46ac055 + 415cf11 commit a821093
Show file tree
Hide file tree
Showing 194 changed files with 45,013 additions and 4,257 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ logs/*
conf/*.conf
conf/*.apache2-config
htdocs/site_info.txt
htdocs/applets/*.swf
bin/wwapache2ctl
webwork2.komodoproject
#courses.dist/*
5 changes: 2 additions & 3 deletions README
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

WeBWorK
Online Homework Delivery System
Version 2.6
Version 2.*
Branch: github.com/openwebwork

http://webwork.maa.org/wiki/Release_notes_for_WeBWorK_2.5.1.1 (now named 2.6)
http://webwork.maa.org/wiki/Release_notes_for_WeBWorK_2.7
Copyright 2000-2013, The WeBWorK Project
http://webwork.maa.org
All rights reserved.
Expand Down
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
##How to use this dev repo:
Click fork webwork2, all your future dev work will be done from your fork.

If you're using the commandline for git on your computer run these commands:

If you don't have a local repo yet:
```
git clone [email protected]:<your user name>/webwork2.git
```

If you already have a repo:
__warning these commands will just merge it with you're currently checkedout branch!__

```
git remote add webwork2 [email protected]:<your user name>/webwork2.git
git fetch webwork2
git merge webwork2/master
```

fix whatever problems are present

make some changes

commit

`git push webwork2 master`

go to your github webwork2 fork and click pull request. Create a new pull request to openwebwork/webwork2.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
$WW_VERSION ='2.6';
$WW_VERSION ='2.7';
$WW_COPYRIGHT_YEARS = '1996-2013';
1;
101 changes: 87 additions & 14 deletions bin/OPL-update
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ use DBI;
BEGIN {
die "WEBWORK_ROOT not found in environment.\n"
unless exists $ENV{WEBWORK_ROOT};
# Unused variable, but define it to avoid an error message.
$WeBWorK::Constants::WEBWORK_DIRECTORY = '';
}

### Data for creating the database tables
Expand All @@ -44,6 +46,8 @@ my %OPLtables = (
chapter => 'OPL_chapter',
section => 'OPL_section',
problem => 'OPL_problem',
morelt => 'OPL_morelt',
morelt_pgfile => 'OPL_morelt_pgfile',
pgfile_problem => 'OPL_pgfile_problem',
);

Expand All @@ -61,6 +65,8 @@ my %NPLtables = (
chapter => 'NPL-chapter',
section => 'NPL-section',
problem => 'NPL-problem',
morelt => 'NPL-morelt',
morelt_pgfile => 'NPL-morelt-pgfile',
pgfile_problem => 'NPL-pgfile-problem',
);

Expand All @@ -84,6 +90,7 @@ my $dbh = DBI->connect(
my $passwd = $ce->{database_password};
my $user = $ce->{database_username};
my $libraryRoot = $ce->{problemLibrary}->{root};
$libraryRoot =~ s|/+$||;
my $libraryVersion = $ce->{problemLibrary}->{version};
my $verbose = 0;
my $cnt2 = 0;
Expand Down Expand Up @@ -156,6 +163,7 @@ if($libraryVersion eq '2.5') {
institution tinyblob,
path_id int(15) NOT NULL,
filename varchar(255) NOT NULL,
morelt_id int(15),
PRIMARY KEY (pgfile_id)
'],
[$tables{keyword}, '
Expand Down Expand Up @@ -209,6 +217,19 @@ if($libraryVersion eq '2.5') {
KEY (section_id),
PRIMARY KEY (problem_id)
'],
[$tables{morelt}, '
morelt_id int(15) NOT NULL auto_increment,
name varchar(127) NOT NULL,
DBsection_id int(15),
leader int(15), # pgfile_id of the MLT leader
KEY (name),
PRIMARY KEY (morelt_id)
'],
[$tables{morelt_pgfile}, '
morelt_id int(15) DEFAULT 0 NOT NULL,
pgfile_id int(15) DEFAULT 0 NOT NULL,
PRIMARY KEY (morelt_id, pgfile_id)
'],
[$tables{pgfile_problem}, '
pgfile_id int(15) DEFAULT 0 NOT NULL,
problem_id int(15) DEFAULT 0 NOT NULL,
Expand Down Expand Up @@ -414,6 +435,7 @@ sub pgfiles {
my $name = $File::Find::name;
my ($subject, $chapter, $section, $date, $institution, $author, $text);
my ($edition, $textauthor, $textsection, $textproblem, $tagged);
my ($morelt, $morelt_leader);
%textinfo=();
my @textproblems = (-1);
if ($name =~ /swf$/) {
Expand All @@ -431,42 +453,54 @@ sub pgfiles {
$tagged = 0;
while (<IN>) {
SWITCH: {
if (/\bKEYWORDS\((.*)\)/i) {
if (/#.*\bKEYWORDS\((.*)\)/i) {
@keyword = keywordcleaner($1);
last SWITCH;
}
if (/\bDBsubject\s*\(\s*'?(.*?)'?\s*\)/) {
if (/#.*\bDBsubject\s*\(\s*'?(.*?)'?\s*\)/) {
$subject = $1;
$subject =~ s/'/\'/g;
last SWITCH;
}
if (/\bDBchapter\s*\(\s*'?(.*?)'?\s*\)/) {
if (/#.*\bDBchapter\s*\(\s*'?(.*?)'?\s*\)/) {
$chapter = $1;
$chapter =~ s/'/\'/g;
$tagged = 1;
last SWITCH;
}
if (/\bDBsection\s*\(\s*'?(.*?)'?\s*\)/) {
if (/#.*\bDBsection\s*\(\s*'?(.*?)'?\s*\)/) {
$section = $1;
$section =~ s/'/\'/g;
last SWITCH;
}
if (/\bDate\s*\(\s*'(.*?)'\s*\)/) {
if (/#.*\bDate\s*\(\s*'(.*?)'\s*\)/) {
$date = $1;
$date =~ s/'/\'/g;
last SWITCH;
}
if (/\bInstitution\s*\(\s*'(.*?)'\s*\)/) {
if (/#.*\bInstitution\s*\(\s*'(.*?)'\s*\)/) {
$institution = $1;
$institution =~ s/'/\'/g;
last SWITCH;
}
if (/\bAuthor\(\s*'?(.*?)'?\s*\)/) {
if (/#.*\bAuthor\(\s*'?(.*?)'?\s*\)/) {
$author = $1;
$author =~ s/'/\'/g;
last SWITCH;
}
if (/\bTitleText(\d+)\(\s*'?(.*?)'?\s*\)/) {
if (/#.*\bMLTleader\(\s*'?(.*?)'?\s*\)/) {
$morelt_leader = $1;
$morelt_leader =~ s/['"]//g;
$morelt_leader= ($morelt_leader =~ /\S/) ? 1 : 0;
last SWITCH;
}
if (/#.*\bMLT\(\s*'?(.*?)'?\s*\)/) {
$morelt = $1;
$morelt =~ s/'//g;
$morelt = lc($morelt);
last SWITCH;
}
if (/#.*\bTitleText(\d+)\(\s*'?(.*?)'?\s*\)/) {
$textno = $1;
$text = $2;
$text =~ s/'/\'/g;
Expand All @@ -476,7 +510,7 @@ sub pgfiles {
}
last SWITCH;
}
if (/\bEditionText(\d+)\(\s*'?(.*?)'?\s*\)/) {
if (/#.*\bEditionText(\d+)\(\s*'?(.*?)'?\s*\)/) {
$textno = $1;
$edition = $2;
$edition =~ s/'/\'/g;
Expand All @@ -486,7 +520,7 @@ sub pgfiles {
}
last SWITCH;
}
if (/\bAuthorText(\d+)\(\s*'?(.*?)'?\s*\)/) {
if (/#.*\bAuthorText(\d+)\(\s*'?(.*?)'?\s*\)/) {
$textno = $1;
$textauthor = $2;
$textauthor =~ s/'/\'/g;
Expand All @@ -496,7 +530,7 @@ sub pgfiles {
}
last SWITCH;
}
if (/\bSection(\d+)\(\s*'?(.*?)'?\s*\)/) {
if (/#.*\bSection(\d+)\(\s*'?(.*?)'?\s*\)/) {
$textno = $1;
$textsection = $2;
$textsection =~ s/'/\'/g;
Expand All @@ -513,7 +547,7 @@ sub pgfiles {
}
last SWITCH;
}
if (/\bProblem(\d+)\(\s*(.*?)\s*\)/) {
if (/#.*\bProblem(\d+)\(\s*(.*?)\s*\)/) {
$textno = $1;
$textproblem = $2;
$textproblem =~ s/\D/ /g;
Expand All @@ -537,6 +571,7 @@ sub pgfiles {
#
# kludge to fix the omission of a subject field
unless($subject) {
print "NO SUBJECT $name\n";
if ($text =~ /precalculus/i) {
$subject = "Precalculus";
} elsif ($text =~ /calculus/i) {
Expand Down Expand Up @@ -570,6 +605,10 @@ sub pgfiles {
# in that file.
#

# Fill in missing data with Misc. instead of blank
$chapter = 'Misc.' unless $chapter =~ /\S/;
$section = 'Misc.' unless $section =~ /\S/;

#selectrow_array returns first field of first row in scalar context or undef
# undef for failure also, $dbh->{RaiseError} = 1 should catch that case.
#
Expand Down Expand Up @@ -672,13 +711,47 @@ sub pgfiles {
\"$author_id\",
\"$institution\",
\"$path_id\",
\"$pgfile\"
\"$pgfile\",
\"\" # morelt_id filled in below
)"
);
dbug "INSERT INTO pgfile VALUES( \"\", \"$DBsection_id\", \"$author_id\", \"$institution\", \"$path_id\", \"$pgfile\", \"\" )\n";
$query = "SELECT pgfile_id FROM `$tables{pgfile}` WHERE filename = \"$pgfile\" and path_id=$path_id";
$query = "SELECT pgfile_id FROM `$tables{pgfile}` WHERE filename = \"$pgfile\" and path_id=\"$path_id\"";
$pgfile_id = $dbh->selectrow_array($query);

# morelt table, and morelt_pgfile many-many table
if($morelt) {
$query = "SELECT morelt_id FROM `$tables{morelt}` WHERE name = \"$morelt\"";
$morelt_id = $dbh->selectrow_array($query);
if (!defined($morelt_id)) {
$dbh->do("INSERT INTO `$tables{morelt}`
VALUES(
\"\",
\"$morelt\",
\"$DBsection_id\",
\"\"
)");
dbug "INSERT INTO morelt VALUES( \"\", \"$morelt\", \"$pgfile_id\" )\n";
}
$morelt_id = $dbh->selectrow_array($query);
$dbh->do("UPDATE `$tables{pgfile}` SET
morelt_id = \"$morelt_id\"
WHERE pgfile_id = \"$pgfile_id\" "
);
dbug "UPDATE pgfile morelt_id for $pgfile_id to $morelt_id\n";
if($morelt_leader) {
$dbh->do("UPDATE `$tables{morelt}` SET
leader = \"$pgfile_id\"
WHERE morelt_id = \"$morelt_id\" "
);
dbug "UPDATE morelt leader for $morelt_id to $pgfile_id\n";
}
$dbh->do("INSERT INTO `$tables{morelt_pgfile}`
VALUES(\"$morelt_id\", \"$pgfile_id\")");
dbug "INSERT INTO `$tables{morelt_pgfile}`
VALUES($morelt_id, $pgfile_id)";
}

# keyword table, and problem_keyword many-many table
#
foreach my $keyword (@keyword) {
Expand Down
2 changes: 2 additions & 0 deletions bin/check_modules.pl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
Getopt::Long
Getopt::Std
HTML::Entities
HTML::Scrubber
HTML::Tagset
HTML::Template
IO::File
Expand All @@ -72,6 +73,7 @@
MIME::Base64
Net::IP
Net::LDAPS
Net::OAuth
Net::SMTP
Opcode
PadWalker
Expand Down
2 changes: 1 addition & 1 deletion clients/renderProblem.pl
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ =head1 NAME
#
# sub read_session_credentials {
# local(*FH);
# open(FH, '<'.CREDENTIALFILE) or die "Can't open file ".CREDENTIALFILE()." for writing";
# open(FH, '<'.CREDENTIALFILE) or die "Can't open file ".CREDENTIALFILE()." for reading";
# local ($|);
# my $string = <FH>; # slurp the contents
# my $session_credentials = eval( $string);
Expand Down
17 changes: 14 additions & 3 deletions conf/database.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ $dbLayouts{sql_single} = {
source => $database_dsn,
params => { %sqlParams,
tableOverride => "${courseName}_set",
fieldOverride => { visible => "published" }, # for compatibility -- visible was originally called published
#fieldOverride => { visible => "published" }, # for compatibility -- visible was originally called published
},
},
set_user => {
Expand All @@ -165,7 +165,7 @@ $dbLayouts{sql_single} = {
source => $database_dsn,
params => { %sqlParams,
tableOverride => "${courseName}_set_user",
fieldOverride => { visible => "published" }, # for compatibility -- visible was originally called published
#fieldOverride => { visible => "published" }, # for compatibility -- visible was originally called published
},
},
set_merged => {
Expand All @@ -187,7 +187,7 @@ $dbLayouts{sql_single} = {
params => { %sqlParams,
non_native => 1,
tableOverride => "${courseName}_set_user",
fieldOverride => { visible => "published" }, # for compatibility -- visible was originally called published
#fieldOverride => { visible => "published" }, # for compatibility -- visible was originally called published

},
},
Expand Down Expand Up @@ -288,6 +288,15 @@ $dbLayouts{sql_single} = {
tableOverride => "${courseName}_achievement"
},
},
past_answer => {
record => "WeBWorK::DB::Record::PastAnswer",
schema => "WeBWorK::DB::Schema::NewSQL::Std",
driver => "WeBWorK::DB::Driver::SQL",
source => $database_dsn,
params => { %sqlParams,
tableOverride => "${courseName}_past_answer"
},
},

achievement_user => {
record => "WeBWorK::DB::Record::UserAchievement",
Expand All @@ -310,6 +319,8 @@ $dbLayouts{sql_single} = {

};

# include ("conf/database.conf"); # uncomment to provide local overrides


=head1 DATABASE LAYOUT METADATA
Expand Down
Loading

0 comments on commit a821093

Please sign in to comment.