Skip to content

Commit

Permalink
Merge pull request openwebwork#651 from openwebwork/release-2.11
Browse files Browse the repository at this point in the history
Release 2.11 Pull Request
  • Loading branch information
goehle committed Dec 22, 2015
2 parents 6543eb8 + 781e424 commit 2ecd522
Show file tree
Hide file tree
Showing 164 changed files with 30,593 additions and 3,449 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Online Homework Delivery System
Version 2.*

Copyright 2000-2015, The WeBWorK Project
Copyright 2000-2016, The WeBWorK Project
All rights reserved.

This program is free software; you can redistribute it and/or modify
Expand Down
4 changes: 2 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Version 2.*
Branch: github.com/openwebwork

http://webwork.maa.org/wiki/Release_notes_for_WeBWorK_2.10
Copyright 2000-2015, The WeBWorK Project
http://webwork.maa.org/wiki/Release_notes_for_WeBWorK_2.11
Copyright 2000-2016, The WeBWorK Project
http://webwork.maa.org
All rights reserved.

7 changes: 0 additions & 7 deletions README_js_organization
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ Please follow these guidelines for putting javascript in your webwork pages.
app: This directory contain the "new" finished apps for WeBWork.
Each app should have its own directory.

app-dev: A directory for apps that are being developed.

lib: Common files for the web apps.
|_ models: directory for the models
|
|_ views: directory for the views.

vendor: This is the directory for all 3rd party javascript files.
If it is a single file, then it should just go in the vendor directory
All bundles should go in a directory (i.e. Jquery and plugins.)
4 changes: 2 additions & 2 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$WW_VERSION = '2.10';
$WW_COPYRIGHT_YEARS = '1996-2015';
$WW_VERSION = '2.11';
$WW_COPYRIGHT_YEARS = '1996-2016';

1;
36 changes: 31 additions & 5 deletions bin/OPL-update
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ if($libraryVersion eq '2.5') {
morelt_id int(127) DEFAULT 0 NOT NULL,
level int(15),
language varchar(15),
static TINYINT,
MO TINYINT,
PRIMARY KEY (pgfile_id)
'],
[$tables{keyword}, '
Expand Down Expand Up @@ -436,6 +438,9 @@ if(open(IN, "$libraryRoot/Textbooks")) {
my $clsep = '<<<';
my $clinner = '__';
my @cllist = ();
# Record full taxonomy for tagging menus (does not include cross-lists)
my $tagtaxo = [];
my ($chaplist, $seclist) = ([],[]);

my $canopenfile = 0;
if(open(IN, "$libraryRoot/Taxonomy2")) {
Expand Down Expand Up @@ -475,17 +480,28 @@ if($canopenfile) {
# instead they go in a list of crosslists to deal with after
# the full taxonomy is read in
if($count == 0) { #DBsubject
$taxo->{$line} = {} if $oktag;
$cursub = $line;
if($oktag) {
$taxo->{$line} = {};
($chaplist, $seclist) = ([],[]);
push @{$tagtaxo}, {name=>$line, subfields=>$chaplist};
}
$subj = safe_get_id($tables{dbsubject}, 'DBsubject_id',
qq(WHERE name = ?), [$line], 1, "", $line);
} elsif($count == 1) { #DBchapter
$taxo->{$cursub}->{$line} = {} if $oktag;
if($oktag) {
$taxo->{$cursub}->{$line} = {};
$seclist=[];
push @{$chaplist}, {name=>$line, subfields=>$seclist};
}
$curchap = $line;
$chap = safe_get_id($tables{dbchapter}, 'DBchapter_id',
qq(WHERE name = ? and DBsubject_id = ?), [$line, $subj], 1, "", $line, $subj);
} else { #DBsection
$taxo->{$cursub}->{$curchap}->{$line} = [] if $oktag;
if($oktag) {
$taxo->{$cursub}->{$curchap}->{$line} = [];
push @{$seclist}, {name=>$line};
}
$sect = safe_get_id($tables{dbsection}, 'DBsection_id',
qq(WHERE name = ? and DBchapter_id = ?), [$line, $chap], 1, "", $line, $chap);
}
Expand All @@ -494,6 +510,14 @@ if($canopenfile) {
}
#### End of taxonomy/taxonomy2

#### Save the official taxonomy in json format
my $webwork_htdocs = $ce->{webwork_dir}."/htdocs";
my $file = "$webwork_htdocs/DATA/tagging-taxonomy.json";
open(OUTF, ">$file") or die "Cannot open $file";
print OUTF to_json($tagtaxo,{pretty=>1}) or die "Cannot write to $file";
close(OUTF);
print "Saved taxonomy to $file.\n";

#### Now deal with cross-listed sections
for my $clinfo (@cllist) {
my @scs = split /$clinner/, $clinfo->[1];
Expand Down Expand Up @@ -644,7 +668,7 @@ sub pgfiles {
my $path_id = safe_get_id($tables{path}, 'path_id',
qq(WHERE path = ?), [$pgpath], 1, "", $pgpath, "", "");

# pgfile table -- set 2 defaults first
# pgfile table -- set 4 defaults first

## TODO this is where we have to deal with crosslists, and pgfileid
## will be an array of id's
Expand All @@ -653,12 +677,14 @@ sub pgfiles {
my $level = $tags->{Level} || 0;
# Default language is English
my $lang = $tags->{Language} || "en";
my $mathobj = $tags->{MO} || 0;
my $static = $tags->{Static} || 0;

my @pgfile_ids = ();

for my $DBsection_id (@DBsection_ids) {
my $pgfile_id = safe_get_id($tables{pgfile}, 'pgfile_id',
qq(WHERE filename = ? AND path_id = ? AND DBsection_id = ? ), [$pgfile, $path_id, $DBsection_id], 1, "", $DBsection_id, $author_id, $tags->{Institution}, $path_id, $pgfile, 0, $level, $lang);
qq(WHERE filename = ? AND path_id = ? AND DBsection_id = ? ), [$pgfile, $path_id, $DBsection_id], 1, "", $DBsection_id, $author_id, $tags->{Institution}, $path_id, $pgfile, 0, $level, $lang, $static, $mathobj);
push @pgfile_ids, $pgfile_id;
}
#if (scalar(@pgfile_ids)>1) {
Expand Down
14 changes: 8 additions & 6 deletions bin/OPLUtils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ sub build_library_subject_tree {

my $sth = $dbh->prepare($selectClause.$whereClause);
$sth->execute;
my $numFiles= $sth->rows;
my $numFiles= scalar @{$sth->fetchall_arrayref()};

$section_tree->{num_files} = $numFiles;

my $clone = { %{ $section_tree } }; # need to clone it before pushing into the @subfield array.
Expand All @@ -231,7 +232,7 @@ sub build_library_subject_tree {

my $sth = $dbh->prepare($selectClause.$whereClause);
$sth->execute;
my $numFiles = $sth->rows;
my $numFiles = scalar @{$sth->fetchall_arrayref()};
# my $allFiles = $sth->fetchall_arrayref;
$chapter_tree->{num_files} = $numFiles;

Expand All @@ -253,7 +254,7 @@ sub build_library_subject_tree {

my $sth = $dbh->prepare($selectClause.$whereClause);
$sth->execute;
my $numFiles = $sth->rows;
my $numFiles = scalar @{$sth->fetchall_arrayref()};
$subject_tree->{num_files} = $numFiles;

$i++;
Expand Down Expand Up @@ -346,15 +347,15 @@ sub build_library_textbook_tree {

my $sth = $dbh->prepare($selectClause.$whereClause);
$sth->execute;
$section->{num_probs}=$sth->rows;
$section->{num_probs}=scalar @{$sth->fetchall_arrayref()};

}
my $whereClause ="WHERE ch.chapter_id='". $chapter->{chapter_id}."' AND "
."text.textbook_id='".$textbook->{textbook_id}."'";

my $sth = $dbh->prepare($selectClause.$whereClause);
$sth->execute;
$chapter->{num_probs}=$sth->rows;
$chapter->{num_probs}=scalar @{$sth->fetchall_arrayref()};

$chapter->{sections}=\@sections;

Expand All @@ -363,11 +364,12 @@ sub build_library_textbook_tree {

my $sth = $dbh->prepare($selectClause.$whereClause);
$sth->execute;
$textbook->{num_probs}=$sth->rows;
$textbook->{num_probs}=scalar @{$sth->fetchall_arrayref()};

$textbook->{chapters}=\@chapters;
}

print "\n";

my $webwork_htdocs = $ce->{webwork_dir}."/htdocs";
my $file = "$webwork_htdocs/DATA/textbook-tree.json";
Expand Down
2 changes: 1 addition & 1 deletion bin/addadmin
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ $db->addUser($db->newUser(user_id=>"admin", first_name=>"Prof", last_name=>"Admi

$db->addPassword($db->newPassword(user_id=>"admin", password=>crypt("admin", "dc")));

$db->addPermissionLevel($db->newPermissionLevel(user_id=>"admin", permission=>"10"));
$db->addPermissionLevel($db->newPermissionLevel(user_id=>"admin", permission=>"20"));


exit;
Expand Down
15 changes: 14 additions & 1 deletion bin/check_modules.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
#
use strict;
use warnings;
use version;

my @applicationsList = qw(
curl
mkdir
mv
mysql
Expand Down Expand Up @@ -40,6 +42,7 @@
Benchmark
Carp
CGI
Class::Accessor
Dancer
Dancer::Plugin::Database
Data::Dumper
Expand Down Expand Up @@ -73,6 +76,7 @@
JSON
Locale::Maketext::Lexicon
Locale::Maketext::Simple
LWP::Protocol::https
Mail::Sender
MIME::Base64
Net::IP
Expand Down Expand Up @@ -106,9 +110,12 @@
YAML
);

my %moduleVersion = (
'LWP::Protocol::https' => 6.06
);

# modules used by disabled code
# RQP::Render (RQP)
# SOAP::Lite (PG::Remote)

#main

Expand Down Expand Up @@ -163,6 +170,8 @@ sub check_modules {
print "\@INC=";
print join ("\n", map(" $_", @inc)), "\n\n";

no strict 'refs';

foreach my $module (@modulesList) {
eval "use $module";
if ($@) {
Expand All @@ -174,6 +183,10 @@ sub check_modules {
} else {
print "** $module found, but failed to load: $@";
}
} elsif (defined($moduleVersion{$module}) &&
version->parse(${$module.'::VERSION'}) <
version->parse($moduleVersion{$module})) {
print "** $module found, but not version $moduleVersion{$module} or better\n";
} else {
print " $module found and loaded\n";
}
Expand Down
10 changes: 10 additions & 0 deletions bin/putadmin
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

$db->putUser($db->newUser(user_id=>"admin", first_name=>"Prof", last_name=>"Admin",email_address=>"", student_id=>"admin", status=>"C",section=>"", recitation=>"",comment=>"administrator"));

$db->putPassword($db->newPassword(user_id=>"admin", password=>crypt("admin", "dc")));

$db->putPermissionLevel($db->newPermissionLevel(user_id=>"admin", permission=>"20"));


print "data changed for user admin\n" ;

38 changes: 26 additions & 12 deletions bin/wwsh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl -d
#!/usr/bin/perl
################################################################################
# WeBWorK Online Homework Delivery System
# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/
Expand All @@ -17,43 +17,57 @@

=head1 NAME
wwdb - command-line interface to the WeBWorK libraries.
wwsh - command-line interface to the WeBWorK libraries.
=cut

use strict;
use warnings;



BEGIN {
DB::parse_options("NonStop=1");
unless ($ENV{WEBWORK_ROOT}) {
die "WEBWORK_ROOT not found in environment.\n";
}
die "WEBWORK_ROOT not found in environment.\n"
unless exists $ENV{WEBWORK_ROOT};
}

our $ce;
our $db;

use lib "$ENV{WEBWORK_ROOT}/lib";
use WeBWorK::CourseEnvironment;
use WeBWorK::DB;
use Data::Dumper;

our $ce;
our $db;

my $courseID = shift @ARGV;
unless ($courseID) {
die "usage: $0 courseID\n";
my $scriptFile = shift @ARGV;

unless ($courseID and $scriptFile) {
die "usage: $0 courseID scriptFile\n";
}

$ce = WeBWorK::CourseEnvironment->new({
webwork_dir => $ENV{WEBWORK_ROOT},
courseName => $courseID,
});


$db = WeBWorK::DB->new($ce->{dbLayout});

print <<'EOF';
wwsh - The WeBWorK Shell
Available objects: $ce (WeBWorK::CourseEnvironment)
$db (WeBWorK::DB)
Available modules: Data::Dumper
EOF
print "courseID: $courseID and scriptFile: $scriptFile\n--------------------------------\n";
do "$scriptFile";
if ($@) {
print "errors ", $@,"\n" ;
} else {
print "--------------------------------\ndone\n";
}


DB::parse_options("NonStop=0");
Loading

0 comments on commit 2ecd522

Please sign in to comment.