From a11e0c84f1b22a3a5561fac0396036185c00ed36 Mon Sep 17 00:00:00 2001 From: Peter Staab Date: Fri, 14 Mar 2014 13:40:29 -0400 Subject: [PATCH 01/12] Creation of a link to webwork3 from the ww2 instructor tools. --- conf/defaults.config | 1 + conf/localOverrides.conf.dist | 5 +- lib/WeBWorK/ContentGenerator.pm | 16 +++-- .../ContentGenerator/Instructor/WW3.pm | 66 +++++++++++++++++++ lib/WeBWorK/URLPath.pm | 60 +++++++++++------ 5 files changed, 122 insertions(+), 26 deletions(-) create mode 100644 lib/WeBWorK/ContentGenerator/Instructor/WW3.pm diff --git a/conf/defaults.config b/conf/defaults.config index cdcf029bdb..843c08dc22 100644 --- a/conf/defaults.config +++ b/conf/defaults.config @@ -1136,6 +1136,7 @@ $webservices = { # The items below can be placed in localOverrides.conf override the settings in this file # One can also use $showeditors{classlisteditor1}=0; to override a setting. %showeditors = ( + ww3 => 1, classlisteditor1 => 0, classlisteditor2 => 1, diff --git a/conf/localOverrides.conf.dist b/conf/localOverrides.conf.dist index e49af7290a..1e7092e15f 100644 --- a/conf/localOverrides.conf.dist +++ b/conf/localOverrides.conf.dist @@ -243,13 +243,14 @@ $problemDefaults{max_attempts} = -1; # These will disappear (or at least decrease in number) once the final editor verisons # are determined. %showeditors = ( + ww3 => 1, # classlisteditor1 => 1, classlisteditor2 => 1, - classlisteditor3 => 1, +# classlisteditor3 => 1, # # homeworkseteditor1 => 1, homeworkseteditor2 => 1, - homeworkseteditor3 => 1, +# homeworkseteditor3 => 1, # # librarybrowsernojs => 1, librarybrowser1 => 1, diff --git a/lib/WeBWorK/ContentGenerator.pm b/lib/WeBWorK/ContentGenerator.pm index 0b7f0f12b4..0df6105404 100644 --- a/lib/WeBWorK/ContentGenerator.pm +++ b/lib/WeBWorK/ContentGenerator.pm @@ -754,14 +754,21 @@ sub links { print CGI::end_li(); print CGI::start_li(); print CGI::start_ul(); + + # WW3 redirect + print CGI::li(&$makelink("${pfx}WW3", urlpath_args=>{%args}, systemlink_args=>\%systemlink_args)) + if $ce->{showeditors}->{ww3}; + #class list editor print CGI::li(&$makelink("${pfx}UserList", urlpath_args=>{%args}, systemlink_args=>\%systemlink_args)) if $ce->{showeditors}->{classlisteditor1}; print CGI::li(&$makelink("${pfx}UserList2", urlpath_args=>{%args}, systemlink_args=>\%systemlink_args)) if $ce->{showeditors}->{classlisteditor2}; - print CGI::li(&$makelink("${pfx}UserList3", urlpath_args=>{%args}, systemlink_args=>\%systemlink_args)) - if $ce->{showeditors}->{classlisteditor3}; + + # the following is WW3 page which is being included elsewhere + # print CGI::li(&$makelink("${pfx}UserList3", urlpath_args=>{%args}, systemlink_args=>\%systemlink_args)) + # if $ce->{showeditors}->{classlisteditor3}; # Homework Set Editor @@ -770,8 +777,9 @@ sub links { print CGI::li(&$makelink("${pfx}ProblemSetList2", urlpath_args=>{%args}, systemlink_args=>\%systemlink_args)) if $ce->{showeditors}->{homeworkseteditor2}; - print CGI::li(&$makelink("${pfx}ProblemSetList3", urlpath_args=>{%args}, systemlink_args=>\%systemlink_args)) - if $ce->{showeditors}->{homeworkseteditor3}; + # the following is WW3 page which is being included elsewhere + # print CGI::li(&$makelink("${pfx}ProblemSetList3", urlpath_args=>{%args}, systemlink_args=>\%systemlink_args)) + # if $ce->{showeditors}->{homeworkseteditor3}; ## only show editor link for non-versioned sets if (defined $setID && $setID !~ /,v\d+$/ ) { diff --git a/lib/WeBWorK/ContentGenerator/Instructor/WW3.pm b/lib/WeBWorK/ContentGenerator/Instructor/WW3.pm new file mode 100644 index 0000000000..809908c05a --- /dev/null +++ b/lib/WeBWorK/ContentGenerator/Instructor/WW3.pm @@ -0,0 +1,66 @@ +################################################################################ +# WeBWorK Online Homework Delivery System +# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# $CVSHeader: +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of either: (a) the GNU General Public License as published by the +# Free Software Foundation; either version 2, or (at your option) any later +# version, or (b) the "Artistic License" which comes with this package. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the +# Artistic License for more details. +################################################################################ + +package WeBWorK::ContentGenerator::Instructor::WW3; +use base qw(WeBWorK); +use base qw(WeBWorK::ContentGenerator::Instructor); +use JSON qw(to_json); + +=head1 NAME + +WeBWorK::ContentGenerator::Instructor::WW3 - provides redirect to WW3 tools + +=cut + + + + +use strict; +use warnings; +#use CGI qw(-nosticky ); +use WeBWorK::CGI qw/redirect/; +use WeBWorK::Debug; + +sub footer(){ + my $self = shift; + my $r = $self->r; + my $ce = $r->ce; + my $ww_version = $ce->{WW_VERSION}||"unknown -- set ww version VERSION"; + my $pg_version = $ce->{PG_VERSION}||"unknown -- set pg version PG_VERSION link to ../pg/VERSION"; + my $theme = $ce->{defaultTheme}||"unknown -- set defaultTheme in localOverides.conf"; + my $copyright_years = $ce->{WW_COPYRIGHT_YEARS}||"1996-2011"; + # print CGI::div({-id=>"last-modified"}, $r->maketext("Page generated at [_1]", timestamp($self))); + print CGI::div({-id=>"copyright",class=>"nav navbar-text"}, "WeBWorK © $copyright_years", "| theme: $theme | ww_version: $ww_version | pg_version: $pg_version|", CGI::a({-href=>"http://webwork.maa.org/"}, $r->maketext("The WeBWorK Project"), )); + return "" +} + + +sub pre_header_initialize { + my $self = shift; + my $r = $self->r; + my $urlpath = $r->urlpath; + print redirect("/webwork3/courses/". $urlpath->arg("courseID") . "/manager"); + +} + + + +1; +=head1 AUTHOR + +Written by Peter Staab at (pstaab at fitchburgstate.edu) + +=cut diff --git a/lib/WeBWorK/URLPath.pm b/lib/WeBWorK/URLPath.pm index ad5e32e3e0..e6f762a1b3 100644 --- a/lib/WeBWorK/URLPath.pm +++ b/lib/WeBWorK/URLPath.pm @@ -356,7 +356,8 @@ our %pathTypes = ( instructor_tools => { name => 'Instructor Tools', parent => 'set_list', - kids => [ qw/instructor_user_list instructor_user_list2 instructor_user_list3 instructor_set_list instructor_set_list2 instructor_set_list3 + kids => [ qw/ww3_course_manager instructor_user_list instructor_user_list2 instructor_user_list3 + instructor_set_list instructor_set_list2 instructor_set_list3 instructor_add_users instructor_achievement_list instructor_set_assigner instructor_file_manager instructor_problem_editor instructor_problem_editor2 instructor_problem_editor3 instructor_simple_editor @@ -374,6 +375,23 @@ our %pathTypes = ( display => 'WeBWorK::ContentGenerator::Instructor::Index', }, + ################################################################################ + # + # Link to WW3 Course Manager + # + ################################################################################ + + ww3_course_manager => { + name => 'WeBWorK3', + parent => 'instructor_tools', + kids => [ qw// ], + match => qr|^ww3/|, + capture => [ qw// ], + produce => 'ww3', + display => 'WeBWorK::ContentGenerator::Instructor::WW3', + + }, + ################################################################################ instructor_user_list => { @@ -394,15 +412,16 @@ our %pathTypes = ( produce => 'users2/', display => 'WeBWorK::ContentGenerator::Instructor::UserList2', }, - instructor_user_list3 => { - name => 'Classlist Manager', - parent => 'instructor_tools', - kids => [ qw/instructor_user_detail/ ], - match => qr|^users3/|, - capture => [ qw// ], - produce => 'users3/', - display => 'WeBWorK::ContentGenerator::Instructor::UserList3', - }, + # This is a WW3 page that is being included else. + # instructor_user_list3 => { + # name => 'Classlist Manager', + # parent => 'instructor_tools', + # kids => [ qw/instructor_user_detail/ ], + # match => qr|^users3/|, + # capture => [ qw// ], + # produce => 'users3/', + # display => 'WeBWorK::ContentGenerator::Instructor::UserList3', + # }, instructor_user_detail => { name => 'Sets assigned to $userID', parent => 'instructor_user_list', @@ -442,16 +461,17 @@ our %pathTypes = ( produce => 'sets2/', display => 'WeBWorK::ContentGenerator::Instructor::ProblemSetList2', }, - - instructor_set_list3 => { - name => 'Homework Manager', - parent => 'instructor_tools', - kids => [ qw/instructor_set_detail/ ], - match => qr|^sets3/|, - capture => [ qw// ], - produce => 'sets3/', - display => 'WeBWorK::ContentGenerator::Instructor::ProblemSetList3', - }, + # This is a WW3 page that is being included elsewhere + # + # instructor_set_list3 => { + # name => 'Homework Manager', + # parent => 'instructor_tools', + # kids => [ qw/instructor_set_detail/ ], + # match => qr|^sets3/|, + # capture => [ qw// ], + # produce => 'sets3/', + # display => 'WeBWorK::ContentGenerator::Instructor::ProblemSetList3', + # }, instructor_set_detail => { From 1e71ab8392753d708f7b4f36683d82fed6e40958 Mon Sep 17 00:00:00 2001 From: Peter Staab Date: Sat, 22 Mar 2014 06:46:32 -0400 Subject: [PATCH 02/12] removed classlisteditor3 and homeworkseteditor3 from %showeditors --- conf/localOverrides.conf.dist | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/conf/localOverrides.conf.dist b/conf/localOverrides.conf.dist index 1e7092e15f..e00c6047a2 100644 --- a/conf/localOverrides.conf.dist +++ b/conf/localOverrides.conf.dist @@ -246,11 +246,10 @@ $problemDefaults{max_attempts} = -1; ww3 => 1, # classlisteditor1 => 1, classlisteditor2 => 1, -# classlisteditor3 => 1, + # # homeworkseteditor1 => 1, homeworkseteditor2 => 1, -# homeworkseteditor3 => 1, # # librarybrowsernojs => 1, librarybrowser1 => 1, From ddb27820b757d2a2805eb2349c60e425901c2224 Mon Sep 17 00:00:00 2001 From: Geoff Goehle Date: Sun, 23 Mar 2014 19:53:09 -0400 Subject: [PATCH 03/12] Changed things so that the dancer components of webwork3 are served via apache using cgi. --- conf/webwork.apache2-config.dist | 27 +++++++++++++++------------ conf/webwork.apache2.4-config.dist | 18 +++++++++++++++--- webwork3/bin/app.pl | 14 +++++++------- webwork3/public/dispatch.cgi | 2 +- webwork3/public/dispatch.fcgi | 2 +- 5 files changed, 39 insertions(+), 24 deletions(-) diff --git a/conf/webwork.apache2-config.dist b/conf/webwork.apache2-config.dist index 828574d6ad..57a6f866bc 100644 --- a/conf/webwork.apache2-config.dist +++ b/conf/webwork.apache2-config.dist @@ -35,9 +35,7 @@ # The "show source" button is most useful for webwork "courses" used to train new authors # It is not desirable to expose the code of regular homework questions to students -ScriptAliasMatch /webwork2_course_files/([^/]*)/show-source.cgi/(.*) /opt/webwork/courses/$1/html/show-source.cgi/$2 - - +#ScriptAliasMatch /webwork2_course_files/([^/]*)/show-source.cgi/(.*) /opt/webwork/courses/$1/html/show-source.cgi/$2 PerlModule mod_perl2 @@ -97,7 +95,6 @@ eval "use lib '$pg_dir/lib'"; die $@ if $@; require Apache::WeBWorK; # force compilation of pretty much everything - # At this point, the following configuration variables should be present for use # in wiring WeBWorK into Apache: # @@ -149,16 +146,22 @@ if ($webwork_url eq "") { $Location{$webwork_htdocs_url} = { SetHandler => "none" }; } - - -#################################################################### -# The RESTful webservice is to be running on port 3000 and this allows -# proper connection to it. -#################################################################### +# This sets up webwork 3 to be served via dancer via cgi +my $webwork3_htdocs_dir = $webwork_dir."/webwork3/public"; +# Set up /webwork3 to point to the dispatch cgi +push @ScriptAlias, [ "/webwork3" => "$webwork3_htdocs_dir/dispatch.fcgi" ]; + +# Allow cgi to run in the webwork3 dir +Directory{"$webwork3_htdocs_dir"} = { + AllowOverride => "None", + Options => "+ExecCGI -MultiViews +SymLinksIfOwnerMatch", + Order => "allow,deny", + Allow => "from all", + AddHandler => "fastcgi-script .fcgi", +}; + -#ProxyPass /webwork3 http://localhost:3000 -#ProxyPassReverse /webwork3 http://localhost:3000 #################################################################### diff --git a/conf/webwork.apache2.4-config.dist b/conf/webwork.apache2.4-config.dist index 48418838a3..626b4a21f8 100644 --- a/conf/webwork.apache2.4-config.dist +++ b/conf/webwork.apache2.4-config.dist @@ -35,9 +35,7 @@ # The "show source" button is most useful for webwork "courses" used to train new authors # It is not desirable to expose the code of regular homework questions to students -ScriptAliasMatch /webwork2_course_files/([^/]*)/show-source.cgi/(.*) /opt/webwork/courses/$1/html/show-source.cgi/$2 - - +#ScriptAliasMatch /webwork2_course_files/([^/]*)/show-source.cgi/(.*) /opt/webwork/courses/$1/html/show-source.cgi/$2 PerlModule mod_perl2 @@ -145,6 +143,20 @@ if ($webwork_url eq "") { $Location{$webwork_htdocs_url} = { SetHandler => "none" }; } +# This sets up webwork 3 to be served via dancer via cgi +my $webwork3_htdocs_dir = $webwork_dir."/webwork3/public"; +# Set up /webwork3 to point to the dispatch cgi +push @ScriptAlias, [ "/webwork3" => "$webwork3_htdocs_dir/dispatch.fcgi" ]; + +# Allow cgi to run in the webwork3 dir +Directory{"$webwork3_htdocs_dir"} = { + AllowOverride => "None", + Options => "+ExecCGI -MultiViews +SymLinksIfOwnerMatch", + Require => "all granted", + AddHandler => "fastcgi-script .fcgi", +}; + + #################################################################### diff --git a/webwork3/bin/app.pl b/webwork3/bin/app.pl index 499c4b8e99..11c7742a33 100755 --- a/webwork3/bin/app.pl +++ b/webwork3/bin/app.pl @@ -1,8 +1,13 @@ #!/usr/bin/env perl use Dancer; use Dancer::Plugin::Database; -use WeBWorK::DB; + +# link to WeBWorK code libraries +use lib config->{webwork_dir}.'/lib'; +use lib config->{pg_dir}.'/lib'; + use WeBWorK::CourseEnvironment; +use WeBWorK::DB; use WeBWorK::Authen; ## note: Routes::Authenication must be passed first @@ -14,10 +19,6 @@ use Routes::Settings; use Routes::PastAnswers; - - - - set serializer => 'JSON'; hook 'before' => sub { @@ -77,7 +78,7 @@ } else { return {logged_in=>0}; - } + } }; @@ -97,7 +98,6 @@ session_name=>config->{session_name}, session_secure=>config->{session_secure}, session_is_http_only=>config->{session_is_http_only}, - }; }; diff --git a/webwork3/public/dispatch.cgi b/webwork3/public/dispatch.cgi index 3bb7f2a3d0..aed085fffd 100755 --- a/webwork3/public/dispatch.cgi +++ b/webwork3/public/dispatch.cgi @@ -7,7 +7,7 @@ use Plack::Runner; # correctly to the dispatchers, so forcing PSGI and env here # is safer. set apphandler => 'PSGI'; -set environment => 'production'; +set environment => 'development'; my $psgi = path($RealBin, '..', 'bin', 'app.pl'); die "Unable to read startup script: $psgi" unless -r $psgi; diff --git a/webwork3/public/dispatch.fcgi b/webwork3/public/dispatch.fcgi index 8c42e3a4c4..d8be61a740 100755 --- a/webwork3/public/dispatch.fcgi +++ b/webwork3/public/dispatch.fcgi @@ -7,7 +7,7 @@ use Plack::Handler::FCGI; # correctly to the dispatchers, so forcing PSGI and env here # is safer. set apphandler => 'PSGI'; -set environment => 'production'; +set environment => 'development'; my $psgi = path($RealBin, '..', 'bin', 'app.pl'); my $app = do($psgi); From 51e3a85b420f866fe1acbad24af2d68171abd6f3 Mon Sep 17 00:00:00 2001 From: Geoff Goehle Date: Sun, 23 Mar 2014 21:53:40 -0400 Subject: [PATCH 04/12] Forogt to copy over changes to a .dist --- webwork3/environments/development.yml.dist | 1 + 1 file changed, 1 insertion(+) diff --git a/webwork3/environments/development.yml.dist b/webwork3/environments/development.yml.dist index f0f49fa124..20d43fbaa1 100644 --- a/webwork3/environments/development.yml.dist +++ b/webwork3/environments/development.yml.dist @@ -4,6 +4,7 @@ # The webwork directory needs to be set webwork_dir: "/opt/webwork/webwork2" +pg_dir: "/opt/webwork/pg" # the logger engine to use # console: log messages to STDOUT (your console where you started the From 48ffbcd570d97755bba1cf6f5f2f8fd593f780d7 Mon Sep 17 00:00:00 2001 From: Geoff Goehle Date: Sun, 23 Mar 2014 21:59:36 -0400 Subject: [PATCH 05/12] Added proxypass lines back in --- conf/webwork.apache2-config.dist | 12 +++++++++++- conf/webwork.apache2.4-config.dist | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/conf/webwork.apache2-config.dist b/conf/webwork.apache2-config.dist index 57a6f866bc..f02ca03a0d 100644 --- a/conf/webwork.apache2-config.dist +++ b/conf/webwork.apache2-config.dist @@ -146,7 +146,15 @@ if ($webwork_url eq "") { $Location{$webwork_htdocs_url} = { SetHandler => "none" }; } + +########################################################################## +# WeBWork 3 # This sets up webwork 3 to be served via dancer via cgi +# If you want to serve webwork 3 directly through dancer comment +# out the following block, and then uncomment the proxy pass lines below +# You will need to start dancer manually, or set it up as service +########################################################################## + my $webwork3_htdocs_dir = $webwork_dir."/webwork3/public"; # Set up /webwork3 to point to the dispatch cgi push @ScriptAlias, [ "/webwork3" => "$webwork3_htdocs_dir/dispatch.fcgi" ]; @@ -162,7 +170,9 @@ Directory{"$webwork3_htdocs_dir"} = { - +# These lines are for service WeBWork 3 through dancer directly. +#ProxyPass /webwork3 http://localhost:3000 +#ProxyPassReverse /webwork3 http://localhost:3000 #################################################################### # WebworkSOAP handlers (for integration with moodle) diff --git a/conf/webwork.apache2.4-config.dist b/conf/webwork.apache2.4-config.dist index 626b4a21f8..7d9fe06686 100644 --- a/conf/webwork.apache2.4-config.dist +++ b/conf/webwork.apache2.4-config.dist @@ -143,7 +143,14 @@ if ($webwork_url eq "") { $Location{$webwork_htdocs_url} = { SetHandler => "none" }; } +########################################################################## +# WeBWork 3 # This sets up webwork 3 to be served via dancer via cgi +# If you want to serve webwork 3 directly through dancer comment +# out the following block, and then uncomment the proxy pass lines below +# You will need to start dancer manually, or set it up as service +########################################################################## + my $webwork3_htdocs_dir = $webwork_dir."/webwork3/public"; # Set up /webwork3 to point to the dispatch cgi push @ScriptAlias, [ "/webwork3" => "$webwork3_htdocs_dir/dispatch.fcgi" ]; @@ -156,9 +163,12 @@ Directory{"$webwork3_htdocs_dir"} = { AddHandler => "fastcgi-script .fcgi", }; - +# These lines are for service WeBWork 3 through dancer directly. +#ProxyPass /webwork3 http://localhost:3000 +#ProxyPassReverse /webwork3 http://localhost:3000 + #################################################################### # WebworkSOAP handlers (for integration with moodle) #################################################################### From 2bbec108352bfe44929b6476fc6113a14cb748ed Mon Sep 17 00:00:00 2001 From: Geoff Goehle Date: Mon, 24 Mar 2014 09:25:57 -0400 Subject: [PATCH 06/12] Changed the configuration to speed things up a bit. Now static files in js or css or images are served directly by apache in the new configuration, saving some calls to dancer. --- conf/webwork.apache2-config.dist | 5 ++++- conf/webwork.apache2.4-config.dist | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/conf/webwork.apache2-config.dist b/conf/webwork.apache2-config.dist index f02ca03a0d..65776ca315 100644 --- a/conf/webwork.apache2-config.dist +++ b/conf/webwork.apache2-config.dist @@ -157,7 +157,10 @@ if ($webwork_url eq "") { my $webwork3_htdocs_dir = $webwork_dir."/webwork3/public"; # Set up /webwork3 to point to the dispatch cgi -push @ScriptAlias, [ "/webwork3" => "$webwork3_htdocs_dir/dispatch.fcgi" ]; +push @Alias, [ "/webwork3/js" => "$webwork3_htdocs_dir/js"]; +push @Alias, [ "/webwork3/css" => "$webwork3_htdocs_dir/css"]; +push @Alias, [ "/webwork3/images" => "$webwork3_htdocs_dir/images"]; +push @PerlConfig, "ScriptAlias /webwork3 $webwork3_htdocs_dir/dispatch.fcgi"; # Allow cgi to run in the webwork3 dir Directory{"$webwork3_htdocs_dir"} = { diff --git a/conf/webwork.apache2.4-config.dist b/conf/webwork.apache2.4-config.dist index 7d9fe06686..10eb6d01c1 100644 --- a/conf/webwork.apache2.4-config.dist +++ b/conf/webwork.apache2.4-config.dist @@ -153,7 +153,10 @@ if ($webwork_url eq "") { my $webwork3_htdocs_dir = $webwork_dir."/webwork3/public"; # Set up /webwork3 to point to the dispatch cgi -push @ScriptAlias, [ "/webwork3" => "$webwork3_htdocs_dir/dispatch.fcgi" ]; +push @Alias, [ "/webwork3/js" => "$webwork3_htdocs_dir/js"]; +push @Alias, [ "/webwork3/css" => "$webwork3_htdocs_dir/css"]; +push @Alias, [ "/webwork3/images" => "$webwork3_htdocs_dir/images"]; +push @PerlConfig, "ScriptAlias /webwork3 $webwork3_htdocs_dir/dispatch.fcgi"; # Allow cgi to run in the webwork3 dir Directory{"$webwork3_htdocs_dir"} = { From 668519b5f4416c9b401f92730b9d651a45dac01e Mon Sep 17 00:00:00 2001 From: Geoff Goehle Date: Mon, 24 Mar 2014 20:19:54 -0400 Subject: [PATCH 07/12] Changed config files so they are all in one place. Change dispatch.fcgi to only start one instance of perl. --- .gitignore | 1 - .../development.yml.dist => conf/webwork3.conf.dist | 11 ++++++++--- webwork3/environments/development.yml | 1 + webwork3/public/dispatch.fcgi | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) rename webwork3/environments/development.yml.dist => conf/webwork3.conf.dist (74%) create mode 120000 webwork3/environments/development.yml diff --git a/.gitignore b/.gitignore index 2700983926..a925cc3c41 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,6 @@ courses.dist library-directory-tree.json library-subject-tree.json textbook-tree.json -development.yml *~ <<<<<<< HEAD /webwork3/public/js/bower_components/* diff --git a/webwork3/environments/development.yml.dist b/conf/webwork3.conf.dist similarity index 74% rename from webwork3/environments/development.yml.dist rename to conf/webwork3.conf.dist index 20d43fbaa1..5a3b2775c7 100644 --- a/webwork3/environments/development.yml.dist +++ b/conf/webwork3.conf.dist @@ -1,5 +1,6 @@ -# configuration file for development environment - +# configuration file for WeBWorK 3. This is a YAML formatted file, not Perl +# formatted like the other configuration files. The webwork_dir, pg_dir, +# and database information needs to be set for WeBWorK 3 to work. # # The webwork directory needs to be set @@ -9,7 +10,11 @@ pg_dir: "/opt/webwork/pg" # the logger engine to use # console: log messages to STDOUT (your console where you started the # application server) -# file: log message to a file in log/ +# file: log message to a file in logs/ +# Note: If you are running through apache and not a stand alone server you +# wont be able to see the log information. To see the log information you +# need to change this to file and then make sure that webwork2/webwork3/logs +# is owned, readable and writable by the wwdata group. logger: "console" # the log level for this environment diff --git a/webwork3/environments/development.yml b/webwork3/environments/development.yml new file mode 120000 index 0000000000..dcf0aa4953 --- /dev/null +++ b/webwork3/environments/development.yml @@ -0,0 +1 @@ +../../conf/webwork3.conf \ No newline at end of file diff --git a/webwork3/public/dispatch.fcgi b/webwork3/public/dispatch.fcgi index d8be61a740..f493cbbd81 100755 --- a/webwork3/public/dispatch.fcgi +++ b/webwork3/public/dispatch.fcgi @@ -12,6 +12,6 @@ set environment => 'development'; my $psgi = path($RealBin, '..', 'bin', 'app.pl'); my $app = do($psgi); die "Unable to read startup script: $@" if $@; -my $server = Plack::Handler::FCGI->new(nproc => 5, detach => 1); +my $server = Plack::Handler::FCGI->new(nproc => 1, detach => 1); $server->run($app); From 90794e01a1159f8c2e4087bed068cef2da043268 Mon Sep 17 00:00:00 2001 From: Peter Staab Date: Wed, 26 Mar 2014 11:52:09 -0400 Subject: [PATCH 08/12] fixed bugs associated with session data and YAML. --- webwork3/bin/app.pl | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/webwork3/bin/app.pl b/webwork3/bin/app.pl index 11c7742a33..80e4be3ed0 100755 --- a/webwork3/bin/app.pl +++ b/webwork3/bin/app.pl @@ -67,15 +67,14 @@ if($result){ my $key = $authen->create_session(params->{user}); - session->{user} = params->{user}; - session->{key} = $key; + session user => params->{user}; + session key => $key; + my $permission = vars->{db}->getPermissionLevel(session->{user}); - session->{permission} = $permission->{permission}; + session permission => $permission->{permission}; - debug session; return {session_key=>$key, user=>params->{user},logged_in=>1}; - } else { return {logged_in=>0}; } From 75b6ea0fd29a41e21ee25094722c28536967327c Mon Sep 17 00:00:00 2001 From: Peter Staab Date: Wed, 26 Mar 2014 20:31:51 -0400 Subject: [PATCH 09/12] Missing $ on Directory for webwork3 configuration --- conf/webwork.apache2-config.dist | 2 +- conf/webwork.apache2.4-config.dist | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/webwork.apache2-config.dist b/conf/webwork.apache2-config.dist index 65776ca315..010b722542 100644 --- a/conf/webwork.apache2-config.dist +++ b/conf/webwork.apache2-config.dist @@ -163,7 +163,7 @@ push @Alias, [ "/webwork3/images" => "$webwork3_htdocs_dir/images"]; push @PerlConfig, "ScriptAlias /webwork3 $webwork3_htdocs_dir/dispatch.fcgi"; # Allow cgi to run in the webwork3 dir -Directory{"$webwork3_htdocs_dir"} = { +$Directory{"$webwork3_htdocs_dir"} = { AllowOverride => "None", Options => "+ExecCGI -MultiViews +SymLinksIfOwnerMatch", Order => "allow,deny", diff --git a/conf/webwork.apache2.4-config.dist b/conf/webwork.apache2.4-config.dist index 10eb6d01c1..43bcb81dce 100644 --- a/conf/webwork.apache2.4-config.dist +++ b/conf/webwork.apache2.4-config.dist @@ -159,7 +159,7 @@ push @Alias, [ "/webwork3/images" => "$webwork3_htdocs_dir/images"]; push @PerlConfig, "ScriptAlias /webwork3 $webwork3_htdocs_dir/dispatch.fcgi"; # Allow cgi to run in the webwork3 dir -Directory{"$webwork3_htdocs_dir"} = { +$Directory{"$webwork3_htdocs_dir"} = { AllowOverride => "None", Options => "+ExecCGI -MultiViews +SymLinksIfOwnerMatch", Require => "all granted", From a696b54a552a5953d4faf76192f2255fbd0d38ca Mon Sep 17 00:00:00 2001 From: Peter Staab Date: Wed, 26 Mar 2014 20:35:29 -0400 Subject: [PATCH 10/12] deleting references to the old Homework Manager and Classlist manager. This interfered getting to the library browser. --- lib/WeBWorK/URLPath.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/WeBWorK/URLPath.pm b/lib/WeBWorK/URLPath.pm index e6f762a1b3..ee5ee78409 100644 --- a/lib/WeBWorK/URLPath.pm +++ b/lib/WeBWorK/URLPath.pm @@ -356,8 +356,8 @@ our %pathTypes = ( instructor_tools => { name => 'Instructor Tools', parent => 'set_list', - kids => [ qw/ww3_course_manager instructor_user_list instructor_user_list2 instructor_user_list3 - instructor_set_list instructor_set_list2 instructor_set_list3 + kids => [ qw/ww3_course_manager instructor_user_list instructor_user_list2 + instructor_set_list instructor_set_list2 instructor_add_users instructor_achievement_list instructor_set_assigner instructor_file_manager instructor_problem_editor instructor_problem_editor2 instructor_problem_editor3 instructor_simple_editor From 134a2c04faa6d0b4675c9a2d157eadd13300d367 Mon Sep 17 00:00:00 2001 From: Peter Staab Date: Wed, 26 Mar 2014 20:59:42 -0400 Subject: [PATCH 11/12] Created a link back to ww2. --- webwork3/public/js/apps/CourseManager/CourseManager.js | 2 ++ webwork3/views/layouts/manager.tt | 1 + 2 files changed, 3 insertions(+) diff --git a/webwork3/public/js/apps/CourseManager/CourseManager.js b/webwork3/public/js/apps/CourseManager/CourseManager.js index 36ca37c7da..7b3255fa2a 100644 --- a/webwork3/public/js/apps/CourseManager/CourseManager.js +++ b/webwork3/public/js/apps/CourseManager/CourseManager.js @@ -141,6 +141,8 @@ var CourseManager = WebPage.extend({ }); }}); + $(".ww2-link").attr("href","/webwork2/"+config.courseSettings.course_id); // create a link back to ww2. + }, // can a lot of this be handled by the individual views? diff --git a/webwork3/views/layouts/manager.tt b/webwork3/views/layouts/manager.tt index 0506c283cb..8f85721fcf 100644 --- a/webwork3/views/layouts/manager.tt +++ b/webwork3/views/layouts/manager.tt @@ -56,6 +56,7 @@ Powered by Dancer [% dancer_versio
  • Classlist Manager
  • Import and Export HW sets
  • Settings
  • +
  • WeBWorK2
  • From e55698b4c9da26cc3c8a9674e656ad64ef913fd9 Mon Sep 17 00:00:00 2001 From: Peter Staab Date: Wed, 26 Mar 2014 21:13:59 -0400 Subject: [PATCH 12/12] Added code to update the timestamp in the course_key db. --- webwork3/lib/Routes/Authentication.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/webwork3/lib/Routes/Authentication.pm b/webwork3/lib/Routes/Authentication.pm index 3176abb563..6cb863c676 100644 --- a/webwork3/lib/Routes/Authentication.pm +++ b/webwork3/lib/Routes/Authentication.pm @@ -84,20 +84,22 @@ sub authenticate { if(! defined(session 'key')){ my $key = vars->{db}->getKey(session 'user'); - debug $key; - if ($key->{key} eq params->{session_key}) { session key => params->{session_key}; } + + } if(! defined(session 'key')){ send_error("The session key has not been defined or is not correct. You may need to authenticate again",401); } - # debug "Checking if session->{permission} is defined"; - # debug session->{permission}; + # update the timestamp in the database so the user isn't logged out prematurely. + my $key = vars->{db}->getKey(session 'user'); + $key->{timestamp} = time(); + vars->{db}->putKey($key); if (! defined(session 'permission')){ my $permission = vars->{db}->getPermissionLevel(session 'user');