diff --git a/Dockerfile b/Dockerfile index 8a1610744a..6f413e5280 100644 --- a/Dockerfile +++ b/Dockerfile @@ -85,7 +85,7 @@ RUN mkdir -p $APP_ROOT/courses $APP_ROOT/libraries $APP_ROOT/webwork2 # Block to include webwork2 in the container, when needed, instead of getting it from a bind mount. # Uncomment when needed, and set the correct branch name on the following line. -#ENV WEBWORK_BRANCH=master # need a valid branch name from https://github.com/openwebwork/webwork2 +#ENV WEBWORK_BRANCH=develop # need a valid branch name from https://github.com/openwebwork/webwork2 #RUN curl -fSL https://github.com/openwebwork/webwork2/archive/${WEBWORK_BRANCH}.tar.gz -o /tmp/${WEBWORK_BRANCH}.tar.gz \ # && cd /tmp \ # && tar xzf /tmp/${WEBWORK_BRANCH}.tar.gz \ diff --git a/PG_VERSION b/PG_VERSION index c2a29f7f1a..9ac8801102 100644 --- a/PG_VERSION +++ b/PG_VERSION @@ -1,4 +1,4 @@ -$PG_VERSION ='PG-2.14'; +$PG_VERSION ='develop'; $PG_COPYRIGHT_YEARS = '1996-2019'; 1; diff --git a/README b/README index ca428fb85d..0777afbc52 100644 --- a/README +++ b/README @@ -3,8 +3,8 @@ Version 2.* Branch: github.com/openwebwork - http://webwork.maa.org/wiki/Release_notes_for_WeBWorK_2.13 - Copyright 2000-2017, The WeBWorK Project + http://webwork.maa.org/wiki/Release_notes_for_WeBWorK_2.14 + Copyright 2000-2019, The WeBWorK Project http://webwork.maa.org All rights reserved. diff --git a/VERSION b/VERSION index 7fa863cf31..81710a9d6b 100644 --- a/VERSION +++ b/VERSION @@ -1,5 +1,5 @@ -$WW_VERSION = 'WeBWorK-2.14'; +$WW_VERSION = 'develop'; $WW_COPYRIGHT_YEARS = '1996-2019'; 1; diff --git a/bin/OPL-update b/bin/OPL-update index 72382f38cd..95e2206442 100755 --- a/bin/OPL-update +++ b/bin/OPL-update @@ -21,7 +21,6 @@ use File::Basename; use Cwd; use DBI; - #(maximum varchar length is 255 for mysql version < 5.0.3. #You can increase path length to 4096 for mysql > 5.0.3) @@ -93,9 +92,12 @@ my $dbh = DBI->connect( { PrintError => 0, RaiseError => 1, + mysql_enable_utf8 => 1, }, ); +$dbh->prepare("SET NAMES 'utf8'")->execute(); + my $libraryRoot = $ce->{problemLibrary}->{root}; $libraryRoot =~ s|/+$||; my $libraryVersion = $ce->{problemLibrary}->{version}; @@ -346,7 +348,7 @@ my ($name,$pgfile,$pgpath); #### First read in textbook information -if(open(IN, "$libraryRoot/Textbooks")) { +if(open(IN, '<:encoding(UTF-8)', "$libraryRoot/Textbooks")) { print "Reading in textbook data from Textbooks in the library $libraryRoot.\n"; my %textinfo = ( TitleText => '', EditionText =>'', AuthorText=>''); my $bookid = undef; @@ -445,10 +447,10 @@ my $tagtaxo = []; my ($chaplist, $seclist) = ([],[]); my $canopenfile = 0; -if(open(IN, "$libraryRoot/Taxonomy2")) { +if(open(IN, '<:encoding(UTF-8)', "$libraryRoot/Taxonomy2")) { print "Reading in OPL taxonomy from Taxonomy2 in the library $libraryRoot.\n"; $canopenfile = 1; -} elsif(open(IN, "$libraryRoot/Taxonomy")) { +} elsif(open(IN, '<:encoding(UTF-8)', "$libraryRoot/Taxonomy")) { print "Reading in OPL taxonomy from Taxonomy in the library $libraryRoot.\n"; $canopenfile = 1; } else { @@ -516,6 +518,7 @@ if($canopenfile) { my $webwork_htdocs = $ce->{webwork_dir}."/htdocs"; my $file = "$webwork_htdocs/DATA/tagging-taxonomy.json"; open(OUTF, ">$file") or die "Cannot open $file"; +binmode(OUTF,':encoding(UTF-8)'); print OUTF to_json($tagtaxo,{pretty=>1}) or die "Cannot write to $file"; close(OUTF); print "Saved taxonomy to $file.\n"; diff --git a/bin/addcourse b/bin/addcourse index c360808c47..111d256be2 100755 --- a/bin/addcourse +++ b/bin/addcourse @@ -1,8 +1,7 @@ #!/usr/bin/env perl ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ -# $CVSHeader: webwork2/bin/addcourse,v 1.20 2006/12/09 03:29:56 sh002i Exp $ +# Copyright © 2000-2018 The WeBWorK Project, https://github.com/openwebwork # # 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 diff --git a/bin/check_latex.tex b/bin/check_latex.tex index b75cb28180..0238df7a53 100644 --- a/bin/check_latex.tex +++ b/bin/check_latex.tex @@ -1,6 +1,6 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % WeBWorK Online Homework Delivery System -% Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +% Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ % $CVSHeader: webwork2/bin/check_latex.tex,v 1.2 2004/10/06 21:09:33 gage Exp $ % % This program is free software; you can redistribute it and/or modify it under diff --git a/bin/delcourse b/bin/delcourse index eb49d0c2c3..3c6e432066 100755 --- a/bin/delcourse +++ b/bin/delcourse @@ -1,7 +1,7 @@ #!/usr/bin/env perl ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/bin/delcourse,v 1.4 2006/01/25 23:13:45 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/bin/dump_past_answers b/bin/dump_past_answers index 6b45ae45a5..ace64481ee 100755 --- a/bin/dump_past_answers +++ b/bin/dump_past_answers @@ -2,7 +2,7 @@ ############################################################################## # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/bin/wwdb,v 1.13 2006/01/25 23:13:45 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/bin/fix_copyright.sh b/bin/fix_copyright.sh new file mode 100755 index 0000000000..a44a16034e --- /dev/null +++ b/bin/fix_copyright.sh @@ -0,0 +1,14 @@ +#!/bin/sh +sed -i .bak '/Copyright/c\ +# Copyright © 2000-2019. The WeBWorK Project. https://github.com/openwebwork/webwork2\ +' $1 + + + +#obtained by trial and error after much toil -- mostly error. +# this version works on a mac +# the space after -i might need to be removed for linux. +# produces $1.bak file + +# use with the find command: +# find . -name course.conf -exec /opt/webwork/webwork2/bin/fix_copyright.sh {} ';' \ No newline at end of file diff --git a/bin/integrity_check.pl b/bin/integrity_check.pl index 69bf341075..523e513029 100644 --- a/bin/integrity_check.pl +++ b/bin/integrity_check.pl @@ -1,7 +1,7 @@ #!/usr/bin/env perl ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/bin/wwdb_upgrade,v 1.17 2007/08/13 22:59:50 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/bin/newpassword b/bin/newpassword index 60c40818db..358a54262b 100755 --- a/bin/newpassword +++ b/bin/newpassword @@ -1,7 +1,7 @@ #!/usr/bin/env perl ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/bin/newpassword,v 1.3 2006/01/25 23:13:45 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/bin/old_scripts/timing b/bin/old_scripts/timing index b44e004f55..64db42617f 100755 --- a/bin/old_scripts/timing +++ b/bin/old_scripts/timing @@ -1,7 +1,7 @@ #!/usr/bin/env perl ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/bin/timing,v 1.5 2006/01/25 23:13:45 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/bin/old_scripts/wwaddindexing b/bin/old_scripts/wwaddindexing index a258d7edfa..7dfa7418a8 100755 --- a/bin/old_scripts/wwaddindexing +++ b/bin/old_scripts/wwaddindexing @@ -1,7 +1,7 @@ #!/usr/bin/env perl ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/bin/wwaddindexing,v 1.3 2006/01/25 23:13:45 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/bin/old_scripts/wwdb_addgw b/bin/old_scripts/wwdb_addgw index 939bbf7c94..3ca4c12c1e 100755 --- a/bin/old_scripts/wwdb_addgw +++ b/bin/old_scripts/wwdb_addgw @@ -1,7 +1,7 @@ #!/usr/bin/perl -w ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/bin/wwdb_addgw,v 1.3 2006/01/25 23:13:45 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/bin/old_scripts/wwdb_check b/bin/old_scripts/wwdb_check index a624523058..2b4e00207a 100755 --- a/bin/old_scripts/wwdb_check +++ b/bin/old_scripts/wwdb_check @@ -1,7 +1,7 @@ #!/usr/bin/env perl ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/bin/wwdb_check,v 1.7 2006/08/14 17:23:56 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/bin/old_scripts/wwdb_upgrade b/bin/old_scripts/wwdb_upgrade index 9a4b6ac859..208f33239b 100755 --- a/bin/old_scripts/wwdb_upgrade +++ b/bin/old_scripts/wwdb_upgrade @@ -1,7 +1,7 @@ #!/usr/bin/env perl ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/bin/wwdb_upgrade,v 1.16 2007/07/22 05:24:20 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/bin/pg-append-textbook-tags b/bin/pg-append-textbook-tags index 009ab087c9..4275f831b0 100755 --- a/bin/pg-append-textbook-tags +++ b/bin/pg-append-textbook-tags @@ -1,7 +1,7 @@ #!/usr/bin/env perl ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/bin/pg-append-textbook-tags,v 1.1 2007/10/17 16:56:16 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/bin/pg-find-tags b/bin/pg-find-tags index 1cd81486bc..3136a0f9d2 100755 --- a/bin/pg-find-tags +++ b/bin/pg-find-tags @@ -1,7 +1,7 @@ #!/usr/bin/env perl ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/bin/pg-find-tags,v 1.1 2007/10/17 16:56:16 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/bin/pg-pull b/bin/pg-pull index 143d3a3fe2..c54208b467 100755 --- a/bin/pg-pull +++ b/bin/pg-pull @@ -1,7 +1,7 @@ #!/usr/bin/env perl ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/bin/pg-pull,v 1.3 2007/10/22 20:32:38 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/bin/remove_stale_images b/bin/remove_stale_images index bb2aac50f5..f0780a0350 100755 --- a/bin/remove_stale_images +++ b/bin/remove_stale_images @@ -1,7 +1,7 @@ #!/usr/bin/env perl ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/bin/remove_stale_images,v 1.7 2008/06/24 22:54:03 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/bin/setfilepermissions b/bin/setfilepermissions index eb9ab9e03c..09ab0e5595 100755 --- a/bin/setfilepermissions +++ b/bin/setfilepermissions @@ -1,7 +1,7 @@ #!/usr/bin/env perl ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/bin/newpassword,v 1.3 2006/01/25 23:13:45 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/bin/update-OPL-statistics b/bin/update-OPL-statistics index 528b165f1c..6e59e2a2bc 100755 --- a/bin/update-OPL-statistics +++ b/bin/update-OPL-statistics @@ -2,7 +2,7 @@ ############################################################################## # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/bin/wwdb,v 1.13 2006/01/25 23:13:45 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/bin/upgrade_admin_db.pl b/bin/upgrade_admin_db.pl index 21b45ee6ed..73cc8166d7 100755 --- a/bin/upgrade_admin_db.pl +++ b/bin/upgrade_admin_db.pl @@ -2,7 +2,7 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/bin/wwdb,v 1.13 2006/01/25 23:13:45 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/bin/upload-OPL-statistics b/bin/upload-OPL-statistics index 6f26e85ea9..49a354358c 100755 --- a/bin/upload-OPL-statistics +++ b/bin/upload-OPL-statistics @@ -2,7 +2,7 @@ ############################################################################## # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/bin/wwdb,v 1.13 2006/01/25 23:13:45 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/bin/wwapache2ctl.dist b/bin/wwapache2ctl.dist index 4b263b25f0..4a3e310b7e 100755 --- a/bin/wwapache2ctl.dist +++ b/bin/wwapache2ctl.dist @@ -1,7 +1,7 @@ #!/bin/sh ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/bin/wwapache2ctl.dist,v 1.3 2007/08/13 22:59:50 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/bin/wwapachectl.dist b/bin/wwapachectl.dist index 3a6b8a6cc6..83363e82d8 100755 --- a/bin/wwapachectl.dist +++ b/bin/wwapachectl.dist @@ -1,7 +1,7 @@ #!/bin/sh ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/bin/wwapachectl.dist,v 1.17 2006/05/31 18:25:18 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/bin/wwdb b/bin/wwdb index 834fadf86d..44aa435c00 100755 --- a/bin/wwdb +++ b/bin/wwdb @@ -1,7 +1,7 @@ #!/usr/bin/perl ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/bin/wwdb,v 1.13 2006/01/25 23:13:45 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/bin/wwsh b/bin/wwsh index 75c3ecfd7f..9219fec6b9 100755 --- a/bin/wwsh +++ b/bin/wwsh @@ -1,7 +1,7 @@ #!/usr/bin/perl ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/bin/wwsh,v 1.10 2006/05/31 01:07:25 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/clients/sendXMLRPC.pl b/clients/sendXMLRPC.pl index 68b6a8573a..6e8f355cac 100755 --- a/clients/sendXMLRPC.pl +++ b/clients/sendXMLRPC.pl @@ -269,6 +269,7 @@ BEGIN } $ENV{MOD_PERL_API_VERSION} = 2; use lib "$main::dirname"; +print "home directory ".$main::dirname; #use lib "."; # is this needed? # some files such as FormatRenderedProblem.pm may need to be in the same directory @@ -290,7 +291,7 @@ BEGIN } } - +use lib "$WeBWorK::Constants::WEBWORK_DIRECTORY/lib"; use Carp; diff --git a/conf/database.conf.dist b/conf/database.conf.dist index e6458f3920..0da6b717cf 100644 --- a/conf/database.conf.dist +++ b/conf/database.conf.dist @@ -1,7 +1,7 @@ #!perl ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/conf/database.conf.dist,v 1.38 2007/08/13 22:59:51 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/conf/defaults.config b/conf/defaults.config index 7773cb771a..ae54771b43 100644 --- a/conf/defaults.config +++ b/conf/defaults.config @@ -1,7 +1,7 @@ #!perl ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright � 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/conf/defaults.config,v 1.225 2010/05/18 18:03:31 apizer Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -223,6 +223,14 @@ $pg{options}{periodicRandomizationPeriod} = 5; $language = "en"; # tr = turkish, en=english +# $perProblemLangAndDirSettingMode controls how and whether LANG and/or DIR +# attributes are added to the DIV element enveloping a problem +# which helps handle proper display of problems with a text direction +# different from that used course-wide. Ex: enables English problems to +# be displayed properly in a Hebrew course site, which helps select problems +# to be translated to Hebrew. +$perProblemLangAndDirSettingMode = "force::ltr"; + ################################################################################ # System-wide locations (directories and URLs) ################################################################################ @@ -1211,6 +1219,8 @@ $pg{specialPGEnvironmentVars}{problemPostamble} = { TeX => '', HTML=>'' }; # should appear as [qw(Mymodule.pm, Dependency1.pm, Dependency2.pm)] ${pg}{modules} = [ + [qw(Encode)], + [qw(Encode::Encoding)], [qw(HTML::Parser)], [qw(HTML::Entities)], [qw(DynaLoader)], @@ -1439,6 +1449,12 @@ $ConfigValues = [ values => [qw(en tr es fr zh_hk heb)], type => 'popuplist' }, + { var => 'perProblemLangAndDirSettingMode', + doc => 'Mode in which the LANG and DIR settings for a single problem are determined.', + doc2 => 'Mode in which the LANG and DIR settings for a single problem are determined.

The system will set the LANGuage attribute to either a value determined from the problem, a course-wide default, or the system default of en-US, depending on the mode selected. The tag will only be added to the DIV enclosing the problem if it is different than the value which should be set in the main HTML tag set for the entire course based on the course language.

There are two options for the DIRection attribute: \"ltr\" for left-to-write sripts, and \"rtl\" for right-to-left scripts like Arabic and Hebrew.

The DIRection attribute is needed to trigger proper display of the question text when the problem text-direction is different than that used by the current language of the course. For example, English problems from the library browser would display improperly in RTL mode for a Hebrew course, unless the problen Direction is set to LTR.

The feature to set a problem language and direction was only added in 2018 to the PG language, so most problems will not declare their language, and the system needs to fall back to determining the language and direction in a different manner. The OPL itself is all English, so the system wide fallback is to en-US in LTR mode.

Since the defaults fall back to the LTR direction, most sites should be fine with the \"auto::\" mode, but may want to select the one which matches their course language. The mode \"force::ltr\" would also be an option for a course which runs into trouble with the \"auto\" modes.

Modes:

', + values => [qw(none auto:: force::ltr force::rtl force:en:ltr auto:en:ltr force:tr:ltr auto:tr:ltr force:es:ltr auto:es:ltr force:fr:ltr auto:fr:ltr force:zh_hk:ltr auto:zh_hk:ltr force:he:rtl auto:he:rtl )], + type => 'popuplist' + }, { var => 'sessionKeyTimeout', doc => 'Inactivity time before a user is required to login again', doc2 => 'Length of time, in seconds, a user has to be inactive before he is required to login again.

This value should be entered as a number, so as 3600 instead of 60*60 for one hour', diff --git a/conf/site.conf.dist b/conf/site.conf.dist index 3a3c273577..022e020076 100644 --- a/conf/site.conf.dist +++ b/conf/site.conf.dist @@ -1,7 +1,7 @@ #!perl ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/conf/site.conf.dist,v 1.225 2010/05/18 18:03:31 apizer Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/conf/snippets/hardcopyThemes/oneColumn/hardcopyPreamble.tex b/conf/snippets/hardcopyThemes/oneColumn/hardcopyPreamble.tex index 1cf495954b..95e98fe653 100644 --- a/conf/snippets/hardcopyThemes/oneColumn/hardcopyPreamble.tex +++ b/conf/snippets/hardcopyThemes/oneColumn/hardcopyPreamble.tex @@ -11,7 +11,13 @@ \usepackage{epsfig} \usepackage{pslatex} \usepackage{fullpage} + \usepackage[utf8]{inputenc} + +\usepackage{eurosym} % the euro symbol +\DeclareUnicodeCharacter{20AC}{\euro} % make it possible to use the UTF-8 character for the euro symbol in problems + + \pagestyle{plain} \def\endline{\bigskip\hrule width \hsize height 0.8pt } \newcommand{\lt}{<} diff --git a/conf/snippets/hardcopyThemes/twoColumn/hardcopyPreamble.tex b/conf/snippets/hardcopyThemes/twoColumn/hardcopyPreamble.tex index dd6522997a..8c57181151 100644 --- a/conf/snippets/hardcopyThemes/twoColumn/hardcopyPreamble.tex +++ b/conf/snippets/hardcopyThemes/twoColumn/hardcopyPreamble.tex @@ -10,7 +10,12 @@ \usepackage{epsf} \usepackage{epsfig} \usepackage{pslatex} + \usepackage[utf8]{inputenc} + +\usepackage{eurosym} % the euro symbol +\DeclareUnicodeCharacter{20AC}{\euro} % make it possible to use the UTF-8 character for the euro symbol in problems + \pagestyle{plain} \textheight 9in \oddsidemargin = -0.42in diff --git a/courses.dist/modelCourse/course.conf b/courses.dist/modelCourse/course.conf index 43d5e40ab2..a41321518d 100644 --- a/courses.dist/modelCourse/course.conf +++ b/courses.dist/modelCourse/course.conf @@ -1,7 +1,7 @@ #!perl ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2016 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # # 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 diff --git a/htdocs/helpFiles/Grades.html b/htdocs/helpFiles/Grades.html index 4560895fd9..9108e1182f 100644 --- a/htdocs/helpFiles/Grades.html +++ b/htdocs/helpFiles/Grades.html @@ -2,7 +2,7 @@ + Student Grades Help Page diff --git a/htdocs/helpFiles/InstructorAddUsers.html b/htdocs/helpFiles/InstructorAddUsers.html index cd65d30ed0..c207d73295 100644 --- a/htdocs/helpFiles/InstructorAddUsers.html +++ b/htdocs/helpFiles/InstructorAddUsers.html @@ -5,7 +5,7 @@ + Add User Help Page diff --git a/htdocs/helpFiles/InstructorAssigner.html b/htdocs/helpFiles/InstructorAssigner.html index 8f23707b0c..22977c27f6 100644 --- a/htdocs/helpFiles/InstructorAssigner.html +++ b/htdocs/helpFiles/InstructorAssigner.html @@ -2,7 +2,7 @@ + Set Assigner Help Page diff --git a/htdocs/helpFiles/InstructorConfig.html b/htdocs/helpFiles/InstructorConfig.html index 6ff1c68963..54cf572c3e 100644 --- a/htdocs/helpFiles/InstructorConfig.html +++ b/htdocs/helpFiles/InstructorConfig.html @@ -5,7 +5,7 @@ + Course Configuration Help Page diff --git a/htdocs/helpFiles/InstructorFileManager.html b/htdocs/helpFiles/InstructorFileManager.html index 847a0172fb..08c42aa42d 100644 --- a/htdocs/helpFiles/InstructorFileManager.html +++ b/htdocs/helpFiles/InstructorFileManager.html @@ -5,7 +5,7 @@ + File Manager Help Page diff --git a/htdocs/helpFiles/InstructorFileTransfer.html b/htdocs/helpFiles/InstructorFileTransfer.html index 3c8c6c7e83..f5cbd85c60 100644 --- a/htdocs/helpFiles/InstructorFileTransfer.html +++ b/htdocs/helpFiles/InstructorFileTransfer.html @@ -5,7 +5,7 @@ + File Transfer Help Page diff --git a/htdocs/helpFiles/InstructorIndex.html b/htdocs/helpFiles/InstructorIndex.html index 665e6790d6..d2e159f116 100644 --- a/htdocs/helpFiles/InstructorIndex.html +++ b/htdocs/helpFiles/InstructorIndex.html @@ -6,7 +6,7 @@ + Instructor Tools Help Page diff --git a/htdocs/helpFiles/InstructorPGProblemEditor.html b/htdocs/helpFiles/InstructorPGProblemEditor.html index 005e2b09bd..d92564d2e7 100644 --- a/htdocs/helpFiles/InstructorPGProblemEditor.html +++ b/htdocs/helpFiles/InstructorPGProblemEditor.html @@ -6,7 +6,7 @@ + PG Problem Editor Help Page diff --git a/htdocs/helpFiles/InstructorProblemSetDetail.html b/htdocs/helpFiles/InstructorProblemSetDetail.html index 2e37e75be2..21bad7f1d6 100644 --- a/htdocs/helpFiles/InstructorProblemSetDetail.html +++ b/htdocs/helpFiles/InstructorProblemSetDetail.html @@ -5,7 +5,7 @@ + Instructor Links Help Page diff --git a/htdocs/helpFiles/no_help.html b/htdocs/helpFiles/no_help.html index b5b973e900..7cdbe7dbf2 100644 --- a/htdocs/helpFiles/no_help.html +++ b/htdocs/helpFiles/no_help.html @@ -4,7 +4,7 @@ -

+
>
diff --git a/htdocs/themes/math4-ar/lbtwo.template b/htdocs/themes/math4-ar/lbtwo.template index 2c9a2bfea1..a700faf43a 100644 --- a/htdocs/themes/math4-ar/lbtwo.template +++ b/htdocs/themes/math4-ar/lbtwo.template @@ -96,13 +96,13 @@ -
+
>

Warning -- there may be something wrong with this question. Please inform your instructor including the warning messages below.

-
+
> diff --git a/htdocs/themes/math4-ar/math4.css b/htdocs/themes/math4-ar/math4.css index 3a286be034..3ff65e9f26 100644 --- a/htdocs/themes/math4-ar/math4.css +++ b/htdocs/themes/math4-ar/math4.css @@ -12,7 +12,14 @@ * FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the * Artistic License for more details. */ + +/* CodeMirror overrides */ +.CodeMirror-code { + outline: none; + direction: ltr !important; +} + /* Bootstrap overrides */ a:focus { outline-style:solid; diff --git a/htdocs/themes/math4-ar/simple.template b/htdocs/themes/math4-ar/simple.template index 7d26a7ac9e..2e21ef4253 100644 --- a/htdocs/themes/math4-ar/simple.template +++ b/htdocs/themes/math4-ar/simple.template @@ -9,7 +9,7 @@
-
+
>
diff --git a/htdocs/themes/math4-ar/system.template b/htdocs/themes/math4-ar/system.template index c59d834f5a..47ec242876 100644 --- a/htdocs/themes/math4-ar/system.template +++ b/htdocs/themes/math4-ar/system.template @@ -9,7 +9,7 @@
-
+
>
diff --git a/htdocs/themes/math4/achievements.css b/htdocs/themes/math4/achievements.css index 1f0a8f61f8..862dfb219d 100644 --- a/htdocs/themes/math4/achievements.css +++ b/htdocs/themes/math4/achievements.css @@ -8,7 +8,7 @@ } .cheevobigbox { - width:700px; + display:block; } .levelbox { @@ -47,6 +47,7 @@ .cheevoouterbox { height:50px; margin-bottom:15px; + clear:both; } .cheevoouterbox img { @@ -54,7 +55,6 @@ height:50px; width:50px; margin-top:5px; - } .unlocked { @@ -76,7 +76,8 @@ } .cheevotextbox { - margin-left:15px; + margin-left:10px; + margin-top:5px; float:left; } diff --git a/htdocs/themes/math4/gateway.template b/htdocs/themes/math4/gateway.template index 01dba89006..e8a9ca19cd 100644 --- a/htdocs/themes/math4/gateway.template +++ b/htdocs/themes/math4/gateway.template @@ -1,5 +1,8 @@ - +> + @@ -9,7 +12,7 @@ -
+
>
diff --git a/htdocs/themes/math4/lbtwo.template b/htdocs/themes/math4/lbtwo.template index 03eccfb595..36f94c3cb0 100644 --- a/htdocs/themes/math4/lbtwo.template +++ b/htdocs/themes/math4/lbtwo.template @@ -21,7 +21,7 @@ --> - +> /js/vendor/bootstrap/css/bootstrap.css"/> @@ -96,13 +96,13 @@ -
+
>

Warning -- there may be something wrong with this question. Please inform your instructor including the warning messages below.

-
+
> diff --git a/htdocs/themes/math4/math4.css b/htdocs/themes/math4/math4.css index 3a286be034..3ff65e9f26 100644 --- a/htdocs/themes/math4/math4.css +++ b/htdocs/themes/math4/math4.css @@ -12,7 +12,14 @@ * FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the * Artistic License for more details. */ + +/* CodeMirror overrides */ +.CodeMirror-code { + outline: none; + direction: ltr !important; +} + /* Bootstrap overrides */ a:focus { outline-style:solid; diff --git a/htdocs/themes/math4/simple.template b/htdocs/themes/math4/simple.template index 96bd818cf1..9934c0ceab 100644 --- a/htdocs/themes/math4/simple.template +++ b/htdocs/themes/math4/simple.template @@ -1,5 +1,8 @@ - +> + @@ -9,7 +12,7 @@
-
+
>
diff --git a/htdocs/themes/math4/system.template b/htdocs/themes/math4/system.template index 8beb69a6f8..ed7d411688 100644 --- a/htdocs/themes/math4/system.template +++ b/htdocs/themes/math4/system.template @@ -1,5 +1,8 @@ - +> + @@ -9,7 +12,7 @@
-
@@ -252,7 +254,7 @@ var tabberOptions = {manualStartup:true};
-
+
>
diff --git a/htdocs/unsupported-themes/math2/gateway.template b/htdocs/unsupported-themes/math2/gateway.template index 665663ea62..39721c0fc8 100644 --- a/htdocs/unsupported-themes/math2/gateway.template +++ b/htdocs/unsupported-themes/math2/gateway.template @@ -3,7 +3,7 @@ \n"; my $warnings = MP2 ? $r->notes->get("warnings") : $r->notes("warnings"); + $warnings = Encode::decode_utf8($warnings); print $self->warningOutput($warnings) if $warnings; print "\n"; @@ -1804,7 +1853,7 @@ sub url_args { foreach my $param (@fields) { my @values = $r->param($param); foreach my $value (@values) { - push @pairs, uri_escape($param) . "=" . uri_escape($value); + push @pairs, uri_escape_utf8($param) . "=" . uri_escape($value); } } @@ -2160,7 +2209,6 @@ sub warningOutput($$) { foreach my $warning (@warnings) { # Since these warnings have html they look better scrubbed - #$warning = HTML::Entities::encode_entities($warning); $warning = $scrubber->scrub($warning); $warning = CGI::li(CGI::code($warning)); diff --git a/lib/WeBWorK/ContentGenerator/Achievements.pm b/lib/WeBWorK/ContentGenerator/Achievements.pm index 0f2dff31ad..9a084fe2c0 100644 --- a/lib/WeBWorK/ContentGenerator/Achievements.pm +++ b/lib/WeBWorK/ContentGenerator/Achievements.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Skeleton.pm,v 1.5 2006/07/08 14:07:34 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -240,7 +240,7 @@ sub body { print CGI::start_div({id=>"modal_".$item->id(),class=>"modal hide fade"}); print CGI::start_div({class=>'modal-header'}); print CGI::a({href=>"#",class=>"close","data-dismiss"=>"modal", "aria-hidden"=>"true"},CGI::span({class=>"icon icon-remove"}),CGI::div({class=>"sr-only"},$r->maketext("close"))); - print CGI::h3($item->name()); + print CGI::h3($r->maketext($item->name())); print CGI::end_div(); print CGI::start_form({method=>"post", action=>$self->systemLink($urlpath,authen=>0), name=>"itemform_$itemnumber", class=>"achievementitemform"}); print CGI::start_div({class=>"modal-body"}); @@ -303,7 +303,7 @@ sub body { $imgSrc = $ce->{webworkURLs}->{htdocs}."/images/defaulticon.png"; } - print CGI::img({src=>$imgSrc, alt=>$userAchievement->earned ? 'Achievement Earned' : 'Achievement Unearned'}); + print CGI::div(CGI::img({src=>$imgSrc, alt=>$userAchievement->earned ? 'Achievement Earned' : 'Achievement Unearned'})); print CGI::start_div({class=>'cheevotextbox'}); print CGI::h3($achievement->name); print CGI::div(CGI::i($r->maketext("[_1] Points:", $achievement->{points})).' '.$achievement->{description}); diff --git a/lib/WeBWorK/ContentGenerator/CourseAdmin.pm b/lib/WeBWorK/ContentGenerator/CourseAdmin.pm index 118902dae1..177ced53ed 100644 --- a/lib/WeBWorK/ContentGenerator/CourseAdmin.pm +++ b/lib/WeBWorK/ContentGenerator/CourseAdmin.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/CourseAdmin.pm,v 1.91 2010/06/13 02:25:51 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/EquationDisplay.pm b/lib/WeBWorK/ContentGenerator/EquationDisplay.pm index bd3f8ad8ee..4272404775 100644 --- a/lib/WeBWorK/ContentGenerator/EquationDisplay.pm +++ b/lib/WeBWorK/ContentGenerator/EquationDisplay.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/EquationDisplay.pm,v 1.6 2006/07/12 01:23:54 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/GatewayQuiz.pm b/lib/WeBWorK/ContentGenerator/GatewayQuiz.pm index de0263f4a2..deff46e263 100644 --- a/lib/WeBWorK/ContentGenerator/GatewayQuiz.pm +++ b/lib/WeBWorK/ContentGenerator/GatewayQuiz.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/GatewayQuiz.pm,v 1.54 2008/07/01 13:12:56 glarose Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Grades.pm b/lib/WeBWorK/ContentGenerator/Grades.pm index 80aa652c19..809735365c 100644 --- a/lib/WeBWorK/ContentGenerator/Grades.pm +++ b/lib/WeBWorK/ContentGenerator/Grades.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Grades.pm,v 1.35 2007/07/10 14:41:54 glarose Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -109,7 +109,7 @@ sub scoring_info { my $header = ''; local(*FILE); if (-e "$filePath" and -r "$filePath") { - open FILE, "$filePath" || return("Can't open $filePath"); + open FILE, "<:utf8", "$filePath" || return("Can't open $filePath"); while ($header !~ s/Message:\s*$//m and not eof(FILE)) { $header .= ; } diff --git a/lib/WeBWorK/ContentGenerator/Hardcopy.pm b/lib/WeBWorK/ContentGenerator/Hardcopy.pm index abd67fa365..04293a0c00 100644 --- a/lib/WeBWorK/ContentGenerator/Hardcopy.pm +++ b/lib/WeBWorK/ContentGenerator/Hardcopy.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Hardcopy.pm,v 1.102 2009/09/25 00:39:49 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -692,7 +692,7 @@ sub generate_hardcopy { # create TeX file (callback write_multiuser_tex, or ??) ####################################### - my $open_result = open my $FH, ">", $tex_file_path; + my $open_result = open my $FH, ">:utf8", $tex_file_path; unless ($open_result) { $self->add_errors("Failed to open file '".CGI::code(CGI::escapeHTML($tex_file_path)) ."' for writing: ".CGI::code(CGI::escapeHTML($!))); @@ -859,7 +859,7 @@ sub generate_hardcopy_pdf { # read hardcopy.log and report first error my $hardcopy_log = "$temp_dir_path/hardcopy.log"; if (-e $hardcopy_log) { - if (open my $LOG, "<", $hardcopy_log) { + if (open my $LOG, "<:utf8", $hardcopy_log) { my $line; while ($line = <$LOG>) { last if $line =~ /^!\s+/; diff --git a/lib/WeBWorK/ContentGenerator/Home.pm b/lib/WeBWorK/ContentGenerator/Home.pm index b2a9eb88c6..202f757e2d 100644 --- a/lib/WeBWorK/ContentGenerator/Home.pm +++ b/lib/WeBWorK/ContentGenerator/Home.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Home.pm,v 1.19 2006/07/12 01:23:54 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Instructor.pm b/lib/WeBWorK/ContentGenerator/Instructor.pm index 144fb46386..914f815718 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor.pm,v 1.64 2007/08/13 22:59:55 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Instructor/AchievementEditor.pm b/lib/WeBWorK/ContentGenerator/Instructor/AchievementEditor.pm index c895f05e71..9147a655d6 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/AchievementEditor.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/AchievementEditor.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Skeleton.pm,v 1.5 2006/07/08 14:07:34 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -659,7 +659,7 @@ sub save_as_handler { my $viewURL = $self->systemLink($problemPage, params=>{ sourceFilePath => $relativeOutputFilePath, - status_message => uri_escape($self->{status_message})} + status_message => uri_escape_utf8($self->{status_message})} ); diff --git a/lib/WeBWorK/ContentGenerator/Instructor/AchievementList.pm b/lib/WeBWorK/ContentGenerator/Instructor/AchievementList.pm index 38bf64d840..9ecc6e6f88 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/AchievementList.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/AchievementList.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Instructor/AchievementUserEditor.pm b/lib/WeBWorK/ContentGenerator/Instructor/AchievementUserEditor.pm index 58d5d6d918..0ddb238817 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/AchievementUserEditor.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/AchievementUserEditor.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/UsersAssignedToSet.pm,v 1.23 2006/09/25 22:14:53 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Instructor/AddUsers.pm b/lib/WeBWorK/ContentGenerator/Instructor/AddUsers.pm index caca10256f..89f8441bc8 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/AddUsers.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/AddUsers.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/AddUsers.pm,v 1.24 2007/08/13 22:59:55 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Instructor/Assigner.pm b/lib/WeBWorK/ContentGenerator/Instructor/Assigner.pm index a69388f103..531c33b168 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/Assigner.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/Assigner.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/Assigner.pm,v 1.37 2006/09/25 22:14:53 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Instructor/Compare.pm b/lib/WeBWorK/ContentGenerator/Instructor/Compare.pm index 8b782f3db4..8b360d93cf 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/Compare.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/Compare.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $ $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Instructor/Config.pm b/lib/WeBWorK/ContentGenerator/Instructor/Config.pm index 9966a071c4..072ae82775 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/Config.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/Config.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/Config.pm,v 1.10 2007/07/26 18:53:06 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -245,9 +245,10 @@ sub save_string { my $varname = $self->{var}; my $newval = $self->convert_newval_source($newvalsource); my $displayoldval = $self->comparison_value($oldval); + my $r = $self->{Module}->r; return '' if($displayoldval eq $newval); my $str = '$'. $varname . " = '$newval';\n"; - $str = '$'. $varname . " = undef;\n" if $newval eq 'nobody'; + $str = '$'. $varname . " = undef;\n" if $newval eq $r->maketext('nobody'); return($str); } @@ -486,7 +487,7 @@ sub writeFile { my $writeFileErrors; eval { local *OUTPUTFILE; - if( open OUTPUTFILE, ">", $outputFilePath) { + if( open OUTPUTFILE, ">utf8:", $outputFilePath) { print OUTPUTFILE $contents; close OUTPUTFILE; } else { diff --git a/lib/WeBWorK/ContentGenerator/Instructor/FileManager.pm b/lib/WeBWorK/ContentGenerator/Instructor/FileManager.pm index 999b7427b1..6da6f5d3e5 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/FileManager.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/FileManager.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/FileManager.pm,v 1.30 2007/09/08 21:15:16 dpvc Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -17,6 +17,7 @@ package WeBWorK::ContentGenerator::Instructor::FileManager; use base qw(WeBWorK::ContentGenerator::Instructor); +use utf8; use WeBWorK::Utils qw(readDirectory readFile sortByName listFilesRecursive); use WeBWorK::Upload; use File::Path; @@ -538,7 +539,7 @@ sub Save { if (defined($data)) { $data =~ s/\r\n?/\n/g; # convert DOS and Mac line ends to unix local (*OUTFILE); - if (open(OUTFILE,">$file")) { + if (open(OUTFILE,">:utf8",$file)) { eval {print OUTFILE $data; close(OUTFILE)}; if ($@) {$self->addbadmessage($r->maketext("Failed to save: [_1]",$@))} else {$self->addgoodmessage($r->maketext("File saved"))} @@ -819,7 +820,7 @@ sub NewFile { my $name = $self->r->param('name'); if (my $file = $self->verifyName($name,"file")) { local (*NEWFILE); - if (open(NEWFILE,">$file")) { + if (open(NEWFILE,">:utf8",$file)) { close(NEWFILE); $self->RefreshEdit("",$name); return; @@ -925,14 +926,14 @@ sub Upload { if ($type eq 'Text') { $upload->dispose; $data =~ s/\r\n?/\n/g; - if (open(UPLOAD,">$file")) {print UPLOAD $data; close(UPLOAD)} + if (open(UPLOAD,">:utf8",$file)) {print UPLOAD $data; close(UPLOAD)} else {$self->addbadmessage($r->maketext("Can't create file '[_1]': [_2]", $name, $!))} } else { $upload->disposeTo($file); } if (-e $file) { - $self->addgoodmessage($r->maketext("File '[_2]' uploaded successfully",$name)); + $self->addgoodmessage($r->maketext("File '[_1]' uploaded successfully",$name)); if ($name =~ m/\.(tar|tar\.gz|tgz)$/ && $self->getFlag('unpack')) { if ($self->unpack($name) && $self->getFlag('autodelete')) { if (unlink($file)) {$self->addgoodmessage($r->maketext("Archive '[_1]' deleted", $name))} @@ -1269,12 +1270,13 @@ sub showHTML { ################################################## # # Check if a string is plain text -# (i.e., doesn't contain four non-regular -# characters in a row.) # sub isText { my $string = shift; - return $string !~ m/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]{2}/; + + # return $string !~ m/[^\s\x20-\x7E]{4}/; + return utf8::is_utf8($string); + # return $string !~ m/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]{2}/; } ################################################## diff --git a/lib/WeBWorK/ContentGenerator/Instructor/GetLibrarySetProblems.pm b/lib/WeBWorK/ContentGenerator/Instructor/GetLibrarySetProblems.pm index 3de4056882..6a306c9c3b 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/GetLibrarySetProblems.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/GetLibrarySetProblems.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm,v 1.85 2008/07/01 13:18:52 glarose Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -34,6 +34,7 @@ use WeBWorK::Debug; use WeBWorK::Form; use WeBWorK::Utils qw(readDirectory max sortByName); use WeBWorK::Utils::Tasks qw(renderProblems); +use WeBWorK::Utils::DetermineProblemLangAndDirection; use File::Find; require WeBWorK::Utils::ListingDB; @@ -280,9 +281,22 @@ sub make_data_row { my $isGatewaySet = ( defined($setRecord) && $setRecord->assignment_type =~ /gateway/ ); + my %problem_div_settings = ( -class=>"RenderSolo" ); + # Add what is needed for lang and dir settings + my @to_set_lang_dir = get_problem_lang_and_dir( $self, $pg ); + my $to_set_tag; + my $to_set_val; + while ( scalar(@to_set_lang_dir) > 0 ) { + $to_set_tag = shift( @to_set_lang_dir ); + $to_set_val = shift( @to_set_lang_dir ); + if ( defined( $to_set_val ) ) { + $problem_div_settings{ "$to_set_tag" } = "$to_set_val"; + } + } + my $problem_output = $pg->{flags}->{error_flag} ? CGI::div({class=>"ResultsWithError"}, CGI::em("This problem produced an error")) - : CGI::div({class=>"RenderSolo"}, $pg->{body_text}); + : CGI::div( \%problem_div_settings, $pg->{body_text}); $problem_output .= $pg->{flags}->{comment} if($pg->{flags}->{comment}); diff --git a/lib/WeBWorK/ContentGenerator/Instructor/GetTargetSetProblems.pm b/lib/WeBWorK/ContentGenerator/Instructor/GetTargetSetProblems.pm index 3ca961f6a1..51f7484381 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/GetTargetSetProblems.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/GetTargetSetProblems.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm,v 1.85 2008/07/01 13:18:52 glarose Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -34,6 +34,7 @@ use WeBWorK::Debug; use WeBWorK::Form; use WeBWorK::Utils qw(readDirectory max sortByName); use WeBWorK::Utils::Tasks qw(renderProblems); +use WeBWorK::Utils::DetermineProblemLangAndDirection; use File::Find; require WeBWorK::Utils::ListingDB; @@ -98,9 +99,22 @@ sub make_myset_data_row { my $isGatewaySet = ( defined($setRecord) && $setRecord->assignment_type =~ /gateway/ ); + my %problem_div_settings = ( -class=>"RenderSolo", -dir=>"ltr" ); + # Add what is needed for lang and dir settings + my @to_set_lang_dir = get_problem_lang_and_dir( $self, $pg ); + my $to_set_tag; + my $to_set_val; + while ( scalar(@to_set_lang_dir) > 0 ) { + $to_set_tag = shift( @to_set_lang_dir ); + $to_set_val = shift( @to_set_lang_dir ); + if ( defined( $to_set_val ) ) { + $problem_div_settings{ "$to_set_tag" } = "$to_set_val"; + } + } + my $problem_output = $pg->{flags}->{error_flag} ? CGI::div({class=>"ResultsWithError"}, CGI::em("This problem produced an error")) - : CGI::div({class=>"RenderSolo"}, $pg->{body_text}); + : CGI::div( \%problem_div_settings, $pg->{body_text}); $problem_output .= $pg->{flags}->{comment} if($pg->{flags}->{comment}); diff --git a/lib/WeBWorK/ContentGenerator/Instructor/Index.pm b/lib/WeBWorK/ContentGenerator/Instructor/Index.pm index 804ddb551b..fde096f9a1 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/Index.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/Index.pm @@ -1,6 +1,6 @@ ############################################################################### # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/Index.pm,v 1.59 2007/08/13 22:59:55 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm b/lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm index 86c9e0df2b..7327db362f 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm,v 1.99 2010/05/18 18:39:40 apizer Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -1079,7 +1079,7 @@ sub saveFileChanges { eval { local *OUTPUTFILE; - open OUTPUTFILE, ">$outputFilePath" + open OUTPUTFILE, ">:utf8", $outputFilePath or die "Failed to open $outputFilePath"; print OUTPUTFILE $problemContents; close OUTPUTFILE; @@ -1291,7 +1291,7 @@ sub view_handler { editMode => "temporaryFile", edit_level => $edit_level, sourceFilePath => $relativeTempFilePath, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); @@ -1308,7 +1308,7 @@ sub view_handler { editMode => "temporaryFile", edit_level => $edit_level, sourceFilePath => $relativeTempFilePath, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); @@ -1325,7 +1325,7 @@ sub view_handler { editMode => "temporaryFile", edit_level => $edit_level, sourceFilePath => $relativeTempFilePath, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); @@ -1340,7 +1340,7 @@ sub view_handler { editMode => "temporaryFile", edit_level => $edit_level, sourceFilePath => $relativeTempFilePath, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); } elsif ($file_type eq 'options_info') { # redirec to Options.pm @@ -1352,7 +1352,7 @@ sub view_handler { editMode => "temporaryFile", edit_level => $edit_level, sourceFilePath => $relativeTempFilePath, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); } else { @@ -1445,7 +1445,7 @@ sub add_problem_handler { editMode => "savedFile", edit_level => $edit_level, sourceFilePath => $relativeSourceFilePath, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); @@ -1472,7 +1472,7 @@ sub add_problem_handler { displayMode => $displayMode, editMode => "savedFile", edit_level => $edit_level, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); } else { @@ -1556,7 +1556,7 @@ sub save_handler { editMode => "savedFile", edit_level => 0, sourceFilePath => $relativeEditFilePath, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); @@ -1571,7 +1571,7 @@ sub save_handler { problemSeed => $problemSeed, editMode => "savedFile", edit_level => 0, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); @@ -1586,7 +1586,7 @@ sub save_handler { problemSeed => $problemSeed, editMode => "savedFile", edit_level => 0, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); @@ -1598,7 +1598,7 @@ sub save_handler { params => { editMode => ("savedFile"), edit_level => 0, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); } elsif ($file_type eq 'options_info') { # redirect to Options.pm @@ -1608,7 +1608,7 @@ sub save_handler { params => { editMode => ("savedFile"), edit_level => 0, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); } elsif ($file_type eq 'source_path_for_problem_file') { # redirect to ProblemSets.pm @@ -1623,7 +1623,7 @@ sub save_handler { edit_level => 0, sourceFilePath => $outputFilePath, #The path relative to the templates directory is required. file_type => 'source_path_for_problem_file', - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); @@ -1918,7 +1918,7 @@ sub save_as_handler { problemSeed => $problemSeed, edit_level => $edit_level, file_type => $new_file_type, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); diff --git a/lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor2.pm b/lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor2.pm index 59afa2ec0c..585eb9a139 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor2.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor2.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm,v 1.99 2010/05/18 18:39:40 apizer Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -1076,7 +1076,7 @@ sub saveFileChanges { eval { local *OUTPUTFILE; - open OUTPUTFILE, ">$outputFilePath" + open OUTPUTFILE, ">:utf8", $outputFilePath or die "Failed to open $outputFilePath"; print OUTPUTFILE $problemContents; close OUTPUTFILE; @@ -1292,7 +1292,7 @@ sub view_handler { editMode => "temporaryFile", edit_level => $edit_level, sourceFilePath => $relativeTempFilePath, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); @@ -1309,7 +1309,7 @@ sub view_handler { editMode => "temporaryFile", edit_level => $edit_level, sourceFilePath => $relativeTempFilePath, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); @@ -1326,7 +1326,7 @@ sub view_handler { editMode => "temporaryFile", edit_level => $edit_level, sourceFilePath => $relativeTempFilePath, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); @@ -1341,7 +1341,7 @@ sub view_handler { editMode => "temporaryFile", edit_level => $edit_level, sourceFilePath => $relativeTempFilePath, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); } elsif ($file_type eq 'options_info') { # redirec to Options.pm @@ -1353,7 +1353,7 @@ sub view_handler { editMode => "temporaryFile", edit_level => $edit_level, sourceFilePath => $relativeTempFilePath, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); } else { @@ -1460,7 +1460,7 @@ sub add_problem_handler { editMode => "savedFile", edit_level => $edit_level, sourceFilePath => $relativeSourceFilePath, - status_message => uri_escape($self->{status_message}), + status_message => uri_escape_utf8($self->{status_message}), file_type => 'problem', } @@ -1489,7 +1489,7 @@ sub add_problem_handler { displayMode => $displayMode, editMode => "savedFile", edit_level => $edit_level, - status_message => uri_escape($self->{status_message}), + status_message => uri_escape_utf8($self->{status_message}), } ); } elsif ($targetFileType eq 'hardcopy_header') { @@ -1515,7 +1515,7 @@ sub add_problem_handler { displayMode => $displayMode, editMode => "savedFile", edit_level => $edit_level, - status_message => uri_escape($self->{status_message}), + status_message => uri_escape_utf8($self->{status_message}), } ); } else { @@ -1599,7 +1599,7 @@ sub save_handler { editMode => "savedFile", edit_level => 0, sourceFilePath => $relativeEditFilePath, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); @@ -1614,7 +1614,7 @@ sub save_handler { problemSeed => $problemSeed, editMode => "savedFile", edit_level => 0, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); @@ -1629,7 +1629,7 @@ sub save_handler { problemSeed => $problemSeed, editMode => "savedFile", edit_level => 0, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); @@ -1641,7 +1641,7 @@ sub save_handler { params => { editMode => ("savedFile"), edit_level => 0, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); } elsif ($file_type eq 'options_info') { # redirect to Options.pm @@ -1651,7 +1651,7 @@ sub save_handler { params => { editMode => ("savedFile"), edit_level => 0, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); } elsif ($file_type eq 'source_path_for_problem_file') { # redirect to ProblemSets.pm @@ -1666,7 +1666,7 @@ sub save_handler { edit_level => 0, sourceFilePath => $outputFilePath, #The path relative to the templates directory is required. file_type => 'source_path_for_problem_file', - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); @@ -1810,7 +1810,7 @@ sub save_as_handler { # setting $do_not_save stops saving and any redirects $do_not_save = 1; $self->addbadmessage(CGI::p($r->maketext("File '[_1]' exists. File not saved. No changes have been made. You can change the file path for this problem manually from the 'Hmwk Sets Editor' page", $self->shortPath($outputFilePath)))); - $self->addgoodmessage(CGI::p($r->maketext($r->maketext("The text box now contains the source of the original problem. You can recover lost edits by using the Back button on your browser.")))); + $self->addgoodmessage(CGI::p($r->maketext("The text box now contains the source of the original problem. You can recover lost edits by using the Back button on your browser."))); } else { $self->{editFilePath} = $outputFilePath; $self->{tempFilePath} = ''; # nothing needs to be unlinked. @@ -1938,7 +1938,7 @@ sub save_as_handler { problemSeed => $problemSeed, edit_level => $edit_level, file_type => $new_file_type, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); diff --git a/lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor3.pm b/lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor3.pm index 7bf7b1579e..43fc31caf4 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor3.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor3.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm,v 1.99 2010/05/18 18:39:40 apizer Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -1154,8 +1154,8 @@ sub saveFileChanges { die "outputFilePath is unsafe!" unless path_is_subdir($outputFilePath, $ce->{courseDirs}->{templates}, 1); # 1==path can be relative to dir eval { - local *OUTPUTFILE; - open OUTPUTFILE, ">$outputFilePath" + local *OUTPUTFILE; + open (OUTPUTFILE, ">:encoding(UTF-8)",$outputFilePath) or die "Failed to open $outputFilePath"; print OUTPUTFILE $problemContents; close OUTPUTFILE; @@ -1368,7 +1368,7 @@ sub view_handler { editMode => "temporaryFile", edit_level => $edit_level, sourceFilePath => $relativeTempFilePath, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); @@ -1385,7 +1385,7 @@ sub view_handler { editMode => "temporaryFile", edit_level => $edit_level, sourceFilePath => $relativeTempFilePath, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); @@ -1402,7 +1402,7 @@ sub view_handler { editMode => "temporaryFile", edit_level => $edit_level, sourceFilePath => $relativeTempFilePath, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); @@ -1417,7 +1417,7 @@ sub view_handler { editMode => "temporaryFile", edit_level => $edit_level, sourceFilePath => $relativeTempFilePath, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); } elsif ($file_type eq 'options_info') { # redirec to Options.pm @@ -1429,7 +1429,7 @@ sub view_handler { editMode => "temporaryFile", edit_level => $edit_level, sourceFilePath => $relativeTempFilePath, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); } else { @@ -1535,7 +1535,7 @@ sub add_problem_handler { edit_level => $edit_level, sourceFilePath => $relativeSourceFilePath, file_type => 'problem', - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); @@ -1562,7 +1562,7 @@ sub add_problem_handler { displayMode => $displayMode, editMode => "savedFile", edit_level => $edit_level, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); } elsif ($targetFileType eq 'hardcopy_header') { @@ -1588,7 +1588,7 @@ sub add_problem_handler { displayMode => $displayMode, editMode => "savedFile", edit_level => $edit_level, - status_message => uri_escape($self->{status_message}), + status_message => uri_escape_utf8($self->{status_message}), } ); } else { @@ -1672,7 +1672,7 @@ sub save_handler { editMode => "savedFile", edit_level => 0, sourceFilePath => $relativeEditFilePath, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); @@ -1687,7 +1687,7 @@ sub save_handler { problemSeed => $problemSeed, editMode => "savedFile", edit_level => 0, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); @@ -1702,7 +1702,7 @@ sub save_handler { problemSeed => $problemSeed, editMode => "savedFile", edit_level => 0, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); @@ -1714,7 +1714,7 @@ sub save_handler { params => { editMode => ("savedFile"), edit_level => 0, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); } elsif ($file_type eq 'options_info') { # redirect to Options.pm @@ -1724,7 +1724,7 @@ sub save_handler { params => { editMode => ("savedFile"), edit_level => 0, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); } elsif ($file_type eq 'source_path_for_problem_file') { # redirect to ProblemSets.pm @@ -1739,7 +1739,7 @@ sub save_handler { edit_level => 0, sourceFilePath => $outputFilePath, #The path relative to the templates directory is required. file_type => 'source_path_for_problem_file', - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); @@ -1883,7 +1883,7 @@ sub save_as_handler { # setting $do_not_save stops saving and any redirects $do_not_save = 1; $self->addbadmessage(CGI::p($r->maketext("File '[_1]' exists. File not saved. No changes have been made. You can change the file path for this problem manually from the 'Hmwk Sets Editor' page", $self->shortPath($outputFilePath)))); - $self->addgoodmessage(CGI::p($r->maketext($r->maketext("The text box now contains the source of the original problem. You can recover lost edits by using the Back button on your browser.")))); + $self->addgoodmessage(CGI::p($r->maketext("The text box now contains the source of the original problem. You can recover lost edits by using the Back button on your browser."))); } else { $self->{editFilePath} = $outputFilePath; $self->{tempFilePath} = ''; # nothing needs to be unlinked. @@ -2014,7 +2014,7 @@ sub save_as_handler { problemSeed => $problemSeed, edit_level => $edit_level, file_type => $new_file_type, - status_message => uri_escape($self->{status_message}) + status_message => uri_escape_utf8($self->{status_message}) } ); diff --git a/lib/WeBWorK/ContentGenerator/Instructor/Preflight.pm b/lib/WeBWorK/ContentGenerator/Instructor/Preflight.pm index adf54963e0..fbd2e829b6 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/Preflight.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/Preflight.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/Preflight.pm,v 1.8 2006/09/25 22:14:53 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Instructor/ProblemGrader.pm b/lib/WeBWorK/ContentGenerator/Instructor/ProblemGrader.pm index 3609fb5adf..53d4028ad6 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/ProblemGrader.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/ProblemGrader.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Skeleton.pm,v 1.5 2006/07/08 14:07:34 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm b/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm index a8502f16ed..4fc4f0991c 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # # # This program is free software; you can redistribute it and/or modify it under @@ -2291,6 +2291,10 @@ sub body { ($error ? CGI::div({class=>"ResultsWithError", style=>"font-weight: bold"}, $error) : CGI::div({class=> "RenderSolo"}, $problem_html[0]->{body_text}) + # did not add code to the div above to handle problem language and text direction + # other RenderSolo objects make use of get_problem_lang_and_dir( $self, $pg ) + # and code to build a hash which sets the lang and dir attributes in addition to + # the class RenderSolo. ) . ($repeatFile ? CGI::div({class=>"ResultsWithError", style=>"font-weight: bold"}, $repeatFile) : ''), ])); diff --git a/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail2.pm b/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail2.pm index ebfc4324e7..622b7f832b 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail2.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail2.pm @@ -1,7 +1,7 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList.pm b/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList.pm index d7b9457edb..d540975e04 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList2.pm b/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList2.pm index f4cc229aec..256d293924 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList2.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList2.pm @@ -1,7 +1,7 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Instructor/Scoring.pm b/lib/WeBWorK/ContentGenerator/Instructor/Scoring.pm index f6595b8e0a..ef9aa80bf2 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/Scoring.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/Scoring.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/Scoring.pm,v 1.62 2007/03/07 17:34:42 glarose Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -747,7 +747,7 @@ sub writeCSV { rename $filename, $bakFileName or warn "Unable to rename $filename to $bakFileName"; } - open my $fh, ">", $filename or warn "Unable to open $filename for writing"; + open my $fh, ">:utf8", $filename or warn "Unable to open $filename for writing"; foreach my $row (@csv) { my @rowPadded = (); foreach (my $column = 0; $column < @$row; $column++) { @@ -775,7 +775,7 @@ sub readStandardCSV { sub writeStandardCSV { my ($self, $filename, @csv) = @_; - open my $fh, ">", $filename; + open my $fh, ">:utf8", $filename; foreach my $row (@csv) { print $fh (join ",", map {$self->quote($_)} @$row); print $fh "\n"; diff --git a/lib/WeBWorK/ContentGenerator/Instructor/ScoringDownload.pm b/lib/WeBWorK/ContentGenerator/Instructor/ScoringDownload.pm index 825a15e112..4123b1b3a8 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/ScoringDownload.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/ScoringDownload.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/ScoringDownload.pm,v 1.7 2006/07/12 04:36:07 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -89,7 +89,7 @@ sub content { print "You do not have permission to access scoring data"; } else { my $file = $r->param('getFile'); - open my $fh, "<", "$scoringDir/$file"; + open my $fh, "<:utf8", "$scoringDir/$file"; print while (<$fh>); close $fh; } diff --git a/lib/WeBWorK/ContentGenerator/Instructor/SendMail.pm b/lib/WeBWorK/ContentGenerator/Instructor/SendMail.pm index 5f8614040c..39625ef4c5 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/SendMail.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/SendMail.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/SendMail.pm,v 1.64 2007/08/13 22:59:55 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -776,7 +776,7 @@ sub saveProblem { my $self = shift; my ($body, $probFileName)= @_; local(*PROBLEM); - open (PROBLEM, ">$probFileName") || + open (PROBLEM, ">:utf8",$probFileName) || $self->addbadmessage(CGI::p("Could not open $probFileName for writing. Check that the permissions for this problem are 660 (-rw-rw----)")); print PROBLEM $body if -w $probFileName; @@ -794,9 +794,9 @@ sub read_input_file { my ($subject, $from, $replyTo); local(*FILE); if (-e "$filePath" and -r "$filePath") { - open FILE, "$filePath" || do { $self->addbadmessage(CGI::p($r->maketext("Can't open [_1]",$filePath))); return}; - while ($header !~ s/Message:\s*$//m and not eof(FILE)) { - $header .= ; + open FILE, "<:utf8", $filePath || do { $self->addbadmessage(CGI::p($r->maketext("Can't open [_1]",$filePath))); return}; + while ($header !~ s/Message:\s*$//m and not eof(FILE)) { + $header .= ; } $text = join( '', ); $text =~ s/^\s*//; # remove initial white space if any. diff --git a/lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm b/lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm index 3a8e09eca9..29867cef96 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm,v 1.85 2008/07/01 13:18:52 glarose Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -36,8 +36,10 @@ use WeBWorK::Utils qw(readDirectory max sortByName wwRound x); use WeBWorK::Utils::Tasks qw(renderProblems); use WeBWorK::Utils::Tags; use WeBWorK::Utils::LibraryStats; +use WeBWorK::Utils::DetermineProblemLangAndDirection; use File::Find; use MIME::Base64 qw(encode_base64); +use Encode; require WeBWorK::Utils::ListingDB; @@ -403,7 +405,7 @@ sub browse_local_panel { my $r = $self->r; my $library_selected = shift; my $lib = shift || ''; $lib =~ s/^browse_//; - my $name = ($lib eq '')? $r->maketext('Local') : $problib{$lib}; + my $name = ($lib eq '')? $r->maketext('Local') : Encode::decode_utf8($problib{$lib}); my $list_of_prob_dirs= get_problem_directories($r,$lib); if(scalar(@$list_of_prob_dirs) == 0) { @@ -834,7 +836,7 @@ sub make_top_row { ## Make buttons for additional problem libraries my $libs = ''; foreach my $lib (sort(keys(%problib))) { - $libs .= ' '. CGI::submit(-name=>"browse_$lib", -value=>$problib{$lib}, + $libs .= ' '. CGI::submit(-name=>"browse_$lib", -value=>Encode::decode_utf8($problib{$lib}), ($browse_which eq "browse_$lib")? (-disabled=>1): ()) if (-d "$ce->{courseDirs}{templates}/$lib"); } @@ -955,6 +957,7 @@ sub make_top_row { CGI::end_table())); } + sub make_data_row { my $self = shift; my $r = $self->r; @@ -986,9 +989,22 @@ sub make_data_row { my $isGatewaySet = ( defined($setRecord) && $setRecord->assignment_type =~ /gateway/ ); + my %problem_div_settings = ( class=>"RenderSolo", id=>"render$cnt" ); + # Add what is needed for lang and dir settings + my @to_set_lang_dir = get_problem_lang_and_dir( $self, $pg ); + my $to_set_tag; + my $to_set_val; + while ( scalar(@to_set_lang_dir) > 0 ) { + $to_set_tag = shift( @to_set_lang_dir ); + $to_set_val = shift( @to_set_lang_dir ); + if ( defined( $to_set_val ) ) { + $problem_div_settings{ "$to_set_tag" } = "$to_set_val"; + } + } + my $problem_output = $pg->{flags}->{error_flag} ? CGI::div({class=>"ResultsWithError"}, CGI::em("This problem produced an error")) - : CGI::div({class=>"RenderSolo", id=>"render$cnt"}, $pg->{body_text}); + : CGI::div( \%problem_div_settings, $pg->{body_text}); $problem_output .= $pg->{flags}->{comment} if($pg->{flags}->{comment}); my $problem_seed = $self->{'problem_seed'} || 1234; diff --git a/lib/WeBWorK/ContentGenerator/Instructor/SetMaker2.pm b/lib/WeBWorK/ContentGenerator/Instructor/SetMaker2.pm index dbe7169fdc..f970722571 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/SetMaker2.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/SetMaker2.pm @@ -34,6 +34,7 @@ use WeBWorK::Debug; use WeBWorK::Form; use WeBWorK::Utils qw(readDirectory max sortByName); use WeBWorK::Utils::Tasks qw(renderProblems); +use WeBWorK::Utils::DetermineProblemLangAndDirection; use File::Find; require WeBWorK::Utils::ListingDB; @@ -1015,9 +1016,22 @@ sub make_data_row { my $isGatewaySet = ( defined($setRecord) && $setRecord->assignment_type =~ /gateway/ ); + my %problem_div_settings = ( -class=>"RenderSolo" ); + # Add what is needed for lang and dir settings + my @to_set_lang_dir = get_problem_lang_and_dir( $self, $pg ); + my $to_set_tag; + my $to_set_val; + while ( scalar(@to_set_lang_dir) > 0 ) { + $to_set_tag = shift( @to_set_lang_dir ); + $to_set_val = shift( @to_set_lang_dir ); + if ( defined( $to_set_val ) ) { + $problem_div_settings{ "$to_set_tag" } = "$to_set_val"; + } + } + my $problem_output = $pg->{flags}->{error_flag} ? CGI::div({class=>"ResultsWithError"}, CGI::em("This problem produced an error")) - : CGI::div({class=>"RenderSolo"}, $pg->{body_text}); + : CGI::div( \%problem_div_settings, $pg->{body_text}); $problem_output .= $pg->{flags}->{comment} if($pg->{flags}->{comment}); @@ -1117,9 +1131,22 @@ sub make_myset_data_row { my $isGatewaySet = ( defined($setRecord) && $setRecord->assignment_type =~ /gateway/ ); + my %problem_div_settings = ( -class=>"RenderSolo" ); + # Add what is needed for lang and dir settings + my @to_set_lang_dir = get_problem_lang_and_dir( $self, $pg ); + my $to_set_tag; + my $to_set_val; + while ( scalar(@to_set_lang_dir) > 0 ) { + $to_set_tag = shift( @to_set_lang_dir ); + $to_set_val = shift( @to_set_lang_dir ); + if ( defined( $to_set_val ) ) { + $problem_div_settings{ "$to_set_tag" } = "$to_set_val"; + } + } + my $problem_output = $pg->{flags}->{error_flag} ? CGI::div({class=>"ResultsWithError"}, CGI::em("This problem produced an error")) - : CGI::div({class=>"RenderSolo"}, $pg->{body_text}); + : CGI::div( \%problem_div_settings, $pg->{body_text}); $problem_output .= $pg->{flags}->{comment} if($pg->{flags}->{comment}); diff --git a/lib/WeBWorK/ContentGenerator/Instructor/SetMakernojs.pm b/lib/WeBWorK/ContentGenerator/Instructor/SetMakernojs.pm index 58d950a0d5..c5f9586184 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/SetMakernojs.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/SetMakernojs.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm,v 1.85 2008/07/01 13:18:52 glarose Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -34,6 +34,7 @@ use WeBWorK::Debug; use WeBWorK::Form; use WeBWorK::Utils qw(readDirectory max sortByName); use WeBWorK::Utils::Tasks qw(renderProblems); +use WeBWorK::Utils::DetermineProblemLangAndDirection; use File::Find; require WeBWorK::Utils::ListingDB; @@ -880,9 +881,22 @@ sub make_data_row { my $isGatewaySet = ( defined($setRecord) && $setRecord->assignment_type =~ /gateway/ ); + my %problem_div_settings = ( -class=>"RenderSolo", -dir=>"ltr" ); + # Add what is needed for lang and dir settings + my @to_set_lang_dir = get_problem_lang_and_dir( $self, $pg ); + my $to_set_tag; + my $to_set_val; + while ( scalar(@to_set_lang_dir) > 0 ) { + $to_set_tag = shift( @to_set_lang_dir ); + $to_set_val = shift( @to_set_lang_dir ); + if ( defined( $to_set_val ) ) { + $problem_div_settings{ "$to_set_tag" } = "$to_set_val"; + } + } + my $problem_output = $pg->{flags}->{error_flag} ? CGI::div({class=>"ResultsWithError"}, CGI::em("This problem produced an error")) - : CGI::div({class=>"RenderSolo"}, $pg->{body_text}); + : CGI::div( (%problem_div_settings), $pg->{body_text}); $problem_output .= $pg->{flags}->{comment} if($pg->{flags}->{comment}); diff --git a/lib/WeBWorK/ContentGenerator/Instructor/SetsAssignedToUser.pm b/lib/WeBWorK/ContentGenerator/Instructor/SetsAssignedToUser.pm index 1aa267801e..419bd21171 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/SetsAssignedToUser.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/SetsAssignedToUser.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/SetsAssignedToUser.pm,v 1.26 2006/09/25 22:14:53 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Instructor/ShowAnswers.pm b/lib/WeBWorK/ContentGenerator/Instructor/ShowAnswers.pm index 7f5a34ffa9..d4f8e7c00e 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/ShowAnswers.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/ShowAnswers.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/ShowAnswers.pm,v 1.20 2006/10/10 10:58:54 dpvc Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -210,7 +210,7 @@ sub initialize { $filename .= '.csv'; - open my $fh, ">", $fullFilename or warn "Unable to open $fullFilename for writing"; + open my $fh, ">:utf8", $fullFilename or warn "Unable to open $fullFilename for writing"; my $csv = Text::CSV->new({"eol"=>"\n"}); my @columns; diff --git a/lib/WeBWorK/ContentGenerator/Instructor/Stats_old.pm b/lib/WeBWorK/ContentGenerator/Instructor/Stats_old.pm index 30187b7c2c..6be52da4b7 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/Stats_old.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/Stats_old.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/Stats.pm,v 1.68 2007/08/13 22:59:56 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Instructor/StudentProgress.pm b/lib/WeBWorK/ContentGenerator/Instructor/StudentProgress.pm index 3befebd934..632d0c7a50 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/StudentProgress.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/StudentProgress.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/StudentProgress.pm,v 1.36 2008/06/19 19:34:31 glarose Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Instructor/UserDetail.pm b/lib/WeBWorK/ContentGenerator/Instructor/UserDetail.pm index 00cc26eba6..771b1c715e 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/UserDetail.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/UserDetail.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Instructor/UserList.pm b/lib/WeBWorK/ContentGenerator/Instructor/UserList.pm index e1f6dbefb8..10ab55e5e9 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/UserList.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/UserList.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/UserList.pm,v 1.96 2010/05/14 00:52:48 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Instructor/UserList2.pm b/lib/WeBWorK/ContentGenerator/Instructor/UserList2.pm index 829825dc70..a34ddee740 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/UserList2.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/UserList2.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/UserList2.pm,v 1.96 2010/05/14 00:52:48 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Instructor/UsersAssignedToSet.pm b/lib/WeBWorK/ContentGenerator/Instructor/UsersAssignedToSet.pm index 9d0014bee3..3aca9e3869 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/UsersAssignedToSet.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/UsersAssignedToSet.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/UsersAssignedToSet.pm,v 1.23 2006/09/25 22:14:53 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Login.pm b/lib/WeBWorK/ContentGenerator/Login.pm index 62ae7943c3..105b5bc8b1 100644 --- a/lib/WeBWorK/ContentGenerator/Login.pm +++ b/lib/WeBWorK/ContentGenerator/Login.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Login.pm,v 1.47 2012/06/08 22:59:55 wheeler Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -29,9 +29,12 @@ use warnings; #use CGI qw(-nosticky ); use WeBWorK::CGI; use WeBWorK::Utils qw(readFile dequote jitar_id_to_seq); +use Encode; use mod_perl; use constant MP2 => ( exists $ENV{MOD_PERL_API_VERSION} and $ENV{MOD_PERL_API_VERSION} >= 2 ); +use Encode; + # This content generator is NOT logged in. # BUT one must return a 1 so that error messages can be displayed. @@ -185,6 +188,8 @@ sub body { # us to yell at the user for doing that, since Authen isn't a content- # generating module. my $authen_error = MP2 ? $r->notes->get("authen_error") : $r->notes("authen_error"); + $authen_error = Encode::decode_utf8($authen_error); + if ($authen_error) { print CGI::div({class=>"ResultsWithError", tabindex=>'0'}, CGI::p($authen_error) diff --git a/lib/WeBWorK/ContentGenerator/LoginProctor.pm b/lib/WeBWorK/ContentGenerator/LoginProctor.pm index ef8385e99f..8234b19b1c 100644 --- a/lib/WeBWorK/ContentGenerator/LoginProctor.pm +++ b/lib/WeBWorK/ContentGenerator/LoginProctor.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/LoginProctor.pm,v 1.10 2007/04/04 15:05:26 glarose Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Logout.pm b/lib/WeBWorK/ContentGenerator/Logout.pm index f413a811d8..d999c0632c 100644 --- a/lib/WeBWorK/ContentGenerator/Logout.pm +++ b/lib/WeBWorK/ContentGenerator/Logout.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Logout.pm,v 1.17 2012/06/08 22:50:50 wheeler Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Options.pm b/lib/WeBWorK/ContentGenerator/Options.pm index 78e545d5b5..47bd055262 100644 --- a/lib/WeBWorK/ContentGenerator/Options.pm +++ b/lib/WeBWorK/ContentGenerator/Options.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Options.pm,v 1.24 2006/07/24 23:28:41 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/PGtoTexRenderer.pm b/lib/WeBWorK/ContentGenerator/PGtoTexRenderer.pm index c8e6146627..be6e49e6ad 100644 --- a/lib/WeBWorK/ContentGenerator/PGtoTexRenderer.pm +++ b/lib/WeBWorK/ContentGenerator/PGtoTexRenderer.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/renderViaXMLRPC.pm,v 1.1 2010/05/11 15:27:08 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Problem.pm b/lib/WeBWorK/ContentGenerator/Problem.pm index 5b90b14a62..06c2e7ea4f 100644 --- a/lib/WeBWorK/ContentGenerator/Problem.pm +++ b/lib/WeBWorK/ContentGenerator/Problem.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Problem.pm,v 1.225 2010/05/28 21:29:48 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -42,9 +42,13 @@ require WeBWorK::Utils::ListingDB; use URI::Escape; use WeBWorK::Localize; use WeBWorK::Utils::Tasks qw(fake_set fake_problem); +use WeBWorK::Utils::DetermineProblemLangAndDirection; use WeBWorK::AchievementEvaluator; use WeBWorK::Utils::AttemptsTable; +use utf8; +#use open ':encoding(utf8)'; +binmode(STDOUT, ":utf8"); ################################################################################ # CGI param interface to this module (up-to-date as of v1.153) ################################################################################ @@ -1212,6 +1216,37 @@ sub output_form_start{ return ""; } +# output_problem_lang_and_dir subroutine + +# adds a lang and maybe also a dir setting to the DIV tag attributes, if +# needed by the PROBLEM language + +sub output_problem_lang_and_dir { + my $self = shift; + my $pg = $self->{pg}; + + my @to_set_lang_dir = get_problem_lang_and_dir( $self, $pg ); + my $to_set_tag; + my $to_set_val; + + # String with the HTML attributes to add + my $to_set = " "; + + # Put the requested tags and values into the string format + while ( scalar(@to_set_lang_dir) > 0 ) { + $to_set_tag = shift( @to_set_lang_dir ); + $to_set_val = shift( @to_set_lang_dir ); + if ( defined( $to_set_val ) ) { + $to_set .= " ${to_set_tag}=\"${to_set_val}\""; + } + } + + print "$to_set"; + return ""; +} + + + # output_problem_body subroutine # prints out the body of the current problem @@ -1222,6 +1257,7 @@ sub output_problem_body{ my %will = %{ $self->{will} }; print "\n"; + print CGI::div({id=>'output_problem_body'},$pg->{body_text}); return ""; @@ -2183,7 +2219,7 @@ sub output_JS{ # This is for tagging menus (if allowed) if ($r->authz->hasPermissions($r->param('user'), "modify_tags")) { - if (open(TAXONOMY, $ce->{webworkDirs}{root}.'/htdocs/DATA/tagging-taxonomy.json') ) { + if (open(TAXONOMY, "<:encoding(utf8)", $ce->{webworkDirs}{root}.'/htdocs/DATA/tagging-taxonomy.json') ) { my $taxo = '[]'; $taxo = join("", ); close TAXONOMY; diff --git a/lib/WeBWorK/ContentGenerator/ProblemRenderer.pm b/lib/WeBWorK/ContentGenerator/ProblemRenderer.pm index cd57a441f7..0323e353c7 100644 --- a/lib/WeBWorK/ContentGenerator/ProblemRenderer.pm +++ b/lib/WeBWorK/ContentGenerator/ProblemRenderer.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/ProblemRenderer.pm,v 1.1 2008/04/29 19:27:34 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/ProblemSet.pm b/lib/WeBWorK/ContentGenerator/ProblemSet.pm index b0f9c321f6..ca20ff8451 100644 --- a/lib/WeBWorK/ContentGenerator/ProblemSet.pm +++ b/lib/WeBWorK/ContentGenerator/ProblemSet.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/ProblemSet.pm,v 1.94 2009/11/02 16:54:15 apizer Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/ProblemSets.pm b/lib/WeBWorK/ContentGenerator/ProblemSets.pm index b8eedccd04..2260300172 100644 --- a/lib/WeBWorK/ContentGenerator/ProblemSets.pm +++ b/lib/WeBWorK/ContentGenerator/ProblemSets.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/ProblemSets.pm,v 1.94 2010/01/31 02:31:04 apizer Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/ProctoredGatewayQuiz.pm b/lib/WeBWorK/ContentGenerator/ProctoredGatewayQuiz.pm index 8c7789ab59..1526bf2b33 100644 --- a/lib/WeBWorK/ContentGenerator/ProctoredGatewayQuiz.pm +++ b/lib/WeBWorK/ContentGenerator/ProctoredGatewayQuiz.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/GatewayQuiz.pm,v 1.54 2008/07/01 13:12:56 glarose Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/ShowMeAnother.pm b/lib/WeBWorK/ContentGenerator/ShowMeAnother.pm index f301a35991..0a2c304fa8 100644 --- a/lib/WeBWorK/ContentGenerator/ShowMeAnother.pm +++ b/lib/WeBWorK/ContentGenerator/ShowMeAnother.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Problem.pm,v 1.225 2010/05/28 21:29:48 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Skeleton.pm b/lib/WeBWorK/ContentGenerator/Skeleton.pm index abfdb23ef1..f4ed425588 100644 --- a/lib/WeBWorK/ContentGenerator/Skeleton.pm +++ b/lib/WeBWorK/ContentGenerator/Skeleton.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Skeleton.pm,v 1.5 2006/07/08 14:07:34 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/Test.pm b/lib/WeBWorK/ContentGenerator/Test.pm index f64a08533e..795b900462 100644 --- a/lib/WeBWorK/ContentGenerator/Test.pm +++ b/lib/WeBWorK/ContentGenerator/Test.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Test.pm,v 1.16 2006/07/25 23:02:12 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/ContentGenerator/instructorXMLHandler.pm b/lib/WeBWorK/ContentGenerator/instructorXMLHandler.pm index 012e409a99..956a640c26 100644 --- a/lib/WeBWorK/ContentGenerator/instructorXMLHandler.pm +++ b/lib/WeBWorK/ContentGenerator/instructorXMLHandler.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # # 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 @@ -25,7 +25,6 @@ use warnings; package WeBWorK::ContentGenerator::instructorXMLHandler; use base qw(WeBWorK::ContentGenerator); -use MIME::Base64 qw( encode_base64 decode_base64); use WeBWorK::Debug; use WeBWorK::Utils qw(readFile); use PGUtil qw(not_null); @@ -34,8 +33,6 @@ our $UNIT_TESTS_ON = 0; # should be called DEBUG?? FIXME #use Crypt::SSLeay; #use XMLRPC::Lite; -#use MIME::Base64 qw( encode_base64 decode_base64); - use strict; use warnings; @@ -438,7 +435,8 @@ sub content { # it behaves differently when re-randomization in the library takes place # then during the initial rendering. # print only the text field (not the ra_out field) - # and print the text directly without formatting. + # and print the text directly without formatting. + if ($xmlrpc_client->return_object->{problem_out}->{text}) { print $xmlrpc_client->return_object->{problem_out}->{text}; } else { diff --git a/lib/WeBWorK/ContentGenerator/renderViaXMLRPC.pm b/lib/WeBWorK/ContentGenerator/renderViaXMLRPC.pm index 308fb29909..b35091ba37 100644 --- a/lib/WeBWorK/ContentGenerator/renderViaXMLRPC.pm +++ b/lib/WeBWorK/ContentGenerator/renderViaXMLRPC.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/renderViaXMLRPC.pm,v 1.1 2010/05/11 15:27:08 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/Cookie.pm b/lib/WeBWorK/Cookie.pm index e1a70f8301..08289237fc 100644 --- a/lib/WeBWorK/Cookie.pm +++ b/lib/WeBWorK/Cookie.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/Cookie.pm,v 1.1 2006/06/29 21:10:52 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/CourseEnvironment.pm b/lib/WeBWorK/CourseEnvironment.pm index 52c1983493..8c7a6addb3 100644 --- a/lib/WeBWorK/CourseEnvironment.pm +++ b/lib/WeBWorK/CourseEnvironment.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/CourseEnvironment.pm,v 1.37 2007/08/10 16:37:10 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -179,12 +179,16 @@ sub new { ${*{${$safe->root."::"}{courseFiles}}}{simpleConfig}; use strict 'refs'; - # read and evaluate the course environment file - # if readFile failed, we don't bother trying to reval - my $courseFileContents = eval { readFile($courseEnvironmentFile) }; # catch exceptions - $@ or $safe->reval($courseFileContents); - my $courseWebConfigContents = eval { readFile($courseWebConfigFile) }; # catch exceptions - $@ or $safe->reval($courseWebConfigContents); + # make sure the course environment file actually exists (it might not if we don't have a real course) + # before we try to read it + if(-r $courseEnvironmentFile){ + # read and evaluate the course environment file + # if readFile failed, we don't bother trying to reval + my $courseFileContents = eval { readFile($courseEnvironmentFile) }; # catch exceptions + $@ or $safe->reval($courseFileContents); + my $courseWebConfigContents = eval { readFile($courseWebConfigFile) }; # catch exceptions + $@ or $safe->reval($courseWebConfigContents); + } # get the safe compartment's namespace as a hash no strict 'refs'; diff --git a/lib/WeBWorK/DB.pm b/lib/WeBWorK/DB.pm index 315652d9a9..de0860bedb 100644 --- a/lib/WeBWorK/DB.pm +++ b/lib/WeBWorK/DB.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System> -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB.pm,v 1.112 2012/06/08 22:40:00 wheeler Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Driver.pm b/lib/WeBWorK/DB/Driver.pm index feffcb681e..8ff8d8175d 100644 --- a/lib/WeBWorK/DB/Driver.pm +++ b/lib/WeBWorK/DB/Driver.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Driver.pm,v 1.3 2006/01/25 23:13:54 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Driver/Null.pm b/lib/WeBWorK/DB/Driver/Null.pm index 20653430b9..df43107c29 100644 --- a/lib/WeBWorK/DB/Driver/Null.pm +++ b/lib/WeBWorK/DB/Driver/Null.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Driver/Null.pm,v 1.5 2006/01/25 23:13:54 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Driver/SQL.pm b/lib/WeBWorK/DB/Driver/SQL.pm index a3fbee75ff..7b48a0a649 100644 --- a/lib/WeBWorK/DB/Driver/SQL.pm +++ b/lib/WeBWorK/DB/Driver/SQL.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Driver/SQL.pm,v 1.15 2007/07/19 21:02:42 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -69,6 +69,7 @@ sub new($$$) { { PrintError => 0, RaiseError => 1, + mysql_enable_utf8 => 1, }, ); die $DBI::errstr unless defined $self->{handle}; diff --git a/lib/WeBWorK/DB/Record.pm b/lib/WeBWorK/DB/Record.pm index e6ab0c037a..e7addbd08d 100644 --- a/lib/WeBWorK/DB/Record.pm +++ b/lib/WeBWorK/DB/Record.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Record.pm,v 1.13 2007/07/22 05:25:14 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Record/Achievement.pm b/lib/WeBWorK/DB/Record/Achievement.pm index f9d178f379..845b248dc7 100644 --- a/lib/WeBWorK/DB/Record/Achievement.pm +++ b/lib/WeBWorK/DB/Record/Achievement.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Record/Set.pm,v 1.22 2007/08/13 22:59:57 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Record/Depths.pm b/lib/WeBWorK/DB/Record/Depths.pm index 8c58bf6104..ec592b9d85 100644 --- a/lib/WeBWorK/DB/Record/Depths.pm +++ b/lib/WeBWorK/DB/Record/Depths.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Record/Setting.pm,v 1.2 2007/07/22 05:25:17 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Record/GlobalUserAchievement.pm b/lib/WeBWorK/DB/Record/GlobalUserAchievement.pm index f5a92b3963..e3e262df5b 100644 --- a/lib/WeBWorK/DB/Record/GlobalUserAchievement.pm +++ b/lib/WeBWorK/DB/Record/GlobalUserAchievement.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Record/Set.pm,v 1.22 2007/08/13 22:59:57 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Record/Key.pm b/lib/WeBWorK/DB/Record/Key.pm index c70cd65af6..d54e08aad1 100644 --- a/lib/WeBWorK/DB/Record/Key.pm +++ b/lib/WeBWorK/DB/Record/Key.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Record/Key.pm,v 1.10 2006/10/02 15:04:27 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Record/Password.pm b/lib/WeBWorK/DB/Record/Password.pm index 24c94de9ca..8d3f27127a 100644 --- a/lib/WeBWorK/DB/Record/Password.pm +++ b/lib/WeBWorK/DB/Record/Password.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Record/Password.pm,v 1.9 2006/10/02 15:04:27 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Record/PastAnswer.pm b/lib/WeBWorK/DB/Record/PastAnswer.pm index 31333c3952..03fa727f29 100644 --- a/lib/WeBWorK/DB/Record/PastAnswer.pm +++ b/lib/WeBWorK/DB/Record/PastAnswer.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Record/Set.pm,v 1.22 2007/08/13 22:59:57 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Record/PermissionLevel.pm b/lib/WeBWorK/DB/Record/PermissionLevel.pm index db983b41a2..0750933ca4 100644 --- a/lib/WeBWorK/DB/Record/PermissionLevel.pm +++ b/lib/WeBWorK/DB/Record/PermissionLevel.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Record/PermissionLevel.pm,v 1.10 2006/10/02 15:04:27 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Record/Problem.pm b/lib/WeBWorK/DB/Record/Problem.pm index 518921e550..d876eaa50d 100644 --- a/lib/WeBWorK/DB/Record/Problem.pm +++ b/lib/WeBWorK/DB/Record/Problem.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Record/Problem.pm,v 1.9 2006/10/02 15:04:27 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Record/ProblemVersion.pm b/lib/WeBWorK/DB/Record/ProblemVersion.pm index eb5938f004..26857f16bd 100644 --- a/lib/WeBWorK/DB/Record/ProblemVersion.pm +++ b/lib/WeBWorK/DB/Record/ProblemVersion.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Record/ProblemVersion.pm,v 1.2 2007/02/22 01:25:11 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Record/Set.pm b/lib/WeBWorK/DB/Record/Set.pm index 42cea2e8d3..5a095151c7 100644 --- a/lib/WeBWorK/DB/Record/Set.pm +++ b/lib/WeBWorK/DB/Record/Set.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Record/Set.pm,v 1.22 2007/08/13 22:59:57 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Record/SetVersion.pm b/lib/WeBWorK/DB/Record/SetVersion.pm index 4c61b003d8..115f4952ac 100644 --- a/lib/WeBWorK/DB/Record/SetVersion.pm +++ b/lib/WeBWorK/DB/Record/SetVersion.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Record/SetVersion.pm,v 1.2 2007/02/22 01:25:11 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Record/Setting.pm b/lib/WeBWorK/DB/Record/Setting.pm index 4835455dbe..ab3700e760 100644 --- a/lib/WeBWorK/DB/Record/Setting.pm +++ b/lib/WeBWorK/DB/Record/Setting.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Record/Setting.pm,v 1.2 2007/07/22 05:25:17 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Record/User.pm b/lib/WeBWorK/DB/Record/User.pm index c3ad729b16..83908f22fc 100644 --- a/lib/WeBWorK/DB/Record/User.pm +++ b/lib/WeBWorK/DB/Record/User.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Record/User.pm,v 1.12 2006/10/02 15:04:27 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Record/UserAchievement.pm b/lib/WeBWorK/DB/Record/UserAchievement.pm index fe554e6b3e..0ec99728b5 100644 --- a/lib/WeBWorK/DB/Record/UserAchievement.pm +++ b/lib/WeBWorK/DB/Record/UserAchievement.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Record/Set.pm,v 1.22 2007/08/13 22:59:57 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Record/UserProblem.pm b/lib/WeBWorK/DB/Record/UserProblem.pm index b85bb39674..4fa8124644 100644 --- a/lib/WeBWorK/DB/Record/UserProblem.pm +++ b/lib/WeBWorK/DB/Record/UserProblem.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Record/UserProblem.pm,v 1.11 2007/08/13 22:59:57 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Record/UserSet.pm b/lib/WeBWorK/DB/Record/UserSet.pm index 60816038d6..53d48f464a 100644 --- a/lib/WeBWorK/DB/Record/UserSet.pm +++ b/lib/WeBWorK/DB/Record/UserSet.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Record/UserSet.pm,v 1.21 2007/08/13 22:59:57 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Schema.pm b/lib/WeBWorK/DB/Schema.pm index 3f08179cad..24efbbdf51 100644 --- a/lib/WeBWorK/DB/Schema.pm +++ b/lib/WeBWorK/DB/Schema.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Schema.pm,v 1.13 2009/01/25 15:30:35 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Schema/NewSQL.pm b/lib/WeBWorK/DB/Schema/NewSQL.pm index f7fbbc7278..6a3bb05c31 100644 --- a/lib/WeBWorK/DB/Schema/NewSQL.pm +++ b/lib/WeBWorK/DB/Schema/NewSQL.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Schema/NewSQL.pm,v 1.25 2008/06/21 16:38:49 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Schema/NewSQL/Merge.pm b/lib/WeBWorK/DB/Schema/NewSQL/Merge.pm index 9d6b6bef13..bf8af03f09 100644 --- a/lib/WeBWorK/DB/Schema/NewSQL/Merge.pm +++ b/lib/WeBWorK/DB/Schema/NewSQL/Merge.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Schema/NewSQL/Merge.pm,v 1.11 2007/03/02 23:26:30 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Schema/NewSQL/NonVersioned.pm b/lib/WeBWorK/DB/Schema/NewSQL/NonVersioned.pm index d49a353c99..1c9aa90e15 100644 --- a/lib/WeBWorK/DB/Schema/NewSQL/NonVersioned.pm +++ b/lib/WeBWorK/DB/Schema/NewSQL/NonVersioned.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Schema/NewSQL/NonVersioned.pm,v 1.5 2007/08/10 16:44:57 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Schema/NewSQL/Std.pm b/lib/WeBWorK/DB/Schema/NewSQL/Std.pm index 2cfaefb18b..2690da2c5d 100644 --- a/lib/WeBWorK/DB/Schema/NewSQL/Std.pm +++ b/lib/WeBWorK/DB/Schema/NewSQL/Std.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Schema/NewSQL/Std.pm,v 1.22 2009/02/02 03:18:09 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Schema/NewSQL/Versioned.pm b/lib/WeBWorK/DB/Schema/NewSQL/Versioned.pm index cb0558a6b3..3bacd432d3 100644 --- a/lib/WeBWorK/DB/Schema/NewSQL/Versioned.pm +++ b/lib/WeBWorK/DB/Schema/NewSQL/Versioned.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Schema/NewSQL/Versioned.pm,v 1.7 2007/03/02 23:11:42 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Schema/NewSQL/VersionedMerge.pm b/lib/WeBWorK/DB/Schema/NewSQL/VersionedMerge.pm index 67b1a58c48..4c35a2f076 100644 --- a/lib/WeBWorK/DB/Schema/NewSQL/VersionedMerge.pm +++ b/lib/WeBWorK/DB/Schema/NewSQL/VersionedMerge.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Schema/NewSQL/VersionedMerge.pm,v 1.1 2007/03/01 22:09:51 glarose Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Utils.pm b/lib/WeBWorK/DB/Utils.pm index a9739bdd2c..f6baea07ba 100644 --- a/lib/WeBWorK/DB/Utils.pm +++ b/lib/WeBWorK/DB/Utils.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Utils.pm,v 1.24 2007/08/13 22:59:56 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/DB/Utils/SQLAbstractIdentTrans.pm b/lib/WeBWorK/DB/Utils/SQLAbstractIdentTrans.pm index 8cf39548ce..c36b16f2e2 100644 --- a/lib/WeBWorK/DB/Utils/SQLAbstractIdentTrans.pm +++ b/lib/WeBWorK/DB/Utils/SQLAbstractIdentTrans.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/DB/Utils/SQLAbstractIdentTrans.pm,v 1.4 2007/03/02 23:12:28 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/Debug.pm b/lib/WeBWorK/Debug.pm index c81e4063ea..654efee14e 100644 --- a/lib/WeBWorK/Debug.pm +++ b/lib/WeBWorK/Debug.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/Debug.pm,v 1.10 2006/06/28 16:20:39 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/FakeRequest.pm b/lib/WeBWorK/FakeRequest.pm index 04b85874e4..7621f78251 100644 --- a/lib/WeBWorK/FakeRequest.pm +++ b/lib/WeBWorK/FakeRequest.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/Authen/Proctor.pm,v 1.5 2007/04/04 15:05:27 glarose Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/File/Classlist.pm b/lib/WeBWorK/File/Classlist.pm index cb0de88cfa..42d45b0099 100644 --- a/lib/WeBWorK/File/Classlist.pm +++ b/lib/WeBWorK/File/Classlist.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/File/Classlist.pm,v 1.10 2007/08/13 22:59:58 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/File/Scoring.pm b/lib/WeBWorK/File/Scoring.pm index 4634198b64..4d080dc97b 100644 --- a/lib/WeBWorK/File/Scoring.pm +++ b/lib/WeBWorK/File/Scoring.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/File/Scoring.pm,v 1.2 2007/08/09 17:22:37 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/Form.pm b/lib/WeBWorK/Form.pm index a3d9528dad..9479670e20 100644 --- a/lib/WeBWorK/Form.pm +++ b/lib/WeBWorK/Form.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/Form.pm,v 1.8 2008/04/26 23:13:59 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/HTML/ComboBox.pm b/lib/WeBWorK/HTML/ComboBox.pm index 7d722f7426..acbf3b6a06 100644 --- a/lib/WeBWorK/HTML/ComboBox.pm +++ b/lib/WeBWorK/HTML/ComboBox.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/HTML/DropdownList.pm b/lib/WeBWorK/HTML/DropdownList.pm index 29f5b05977..6214ae9046 100644 --- a/lib/WeBWorK/HTML/DropdownList.pm +++ b/lib/WeBWorK/HTML/DropdownList.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/HTML/InfoBox.pm b/lib/WeBWorK/HTML/InfoBox.pm index 4b82245fd5..d9c97166f1 100644 --- a/lib/WeBWorK/HTML/InfoBox.pm +++ b/lib/WeBWorK/HTML/InfoBox.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/HTML/InfoBox.pm,v 1.2 2006/01/25 23:13:55 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/HTML/OptionList.pm b/lib/WeBWorK/HTML/OptionList.pm index 3b2ae66440..ac5dc1885f 100644 --- a/lib/WeBWorK/HTML/OptionList.pm +++ b/lib/WeBWorK/HTML/OptionList.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/HTML/ScrollingRecordList.pm b/lib/WeBWorK/HTML/ScrollingRecordList.pm index f121b01c5c..2d430d161b 100644 --- a/lib/WeBWorK/HTML/ScrollingRecordList.pm +++ b/lib/WeBWorK/HTML/ScrollingRecordList.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/HTML/ScrollingRecordList.pm,v 1.9 2006/07/11 16:13:10 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/Localize.pm b/lib/WeBWorK/Localize.pm index 5c51f2cfae..ad921676e9 100644 --- a/lib/WeBWorK/Localize.pm +++ b/lib/WeBWorK/Localize.pm @@ -137,6 +137,13 @@ my $ConfigStrings = [ values => [qw(en tr es fr zh_hk heb)], type => 'popuplist' }, + { var => 'perProblemLangAndDirSettingMode', + doc => x('Mode in which the LANG and DIR settings for a single problem are determined.'), + # doc2 is very long so is being commented out here for now + # doc2 => x('Mode in which the LANG and DIR settings for a single problem are determined.

The system will set the LANGuage attribute to either a value determined from the problem, a course-wide default, or the system default of en-US, depending on the mode selected. The tag will only be added to the DIV enclosing the problem if it is different than the value which should be set in the main HTML tag set for the entire course based on the course language.

There are two options for the DIRection attribute: \"ltr\" for left-to-write sripts, and \"rtl\" for right-to-left scripts like Arabic and Hebrew.

The DIRection attribute is needed to trigger proper display of the question text when the problem text-direction is different than that used by the current language of the course. For example, English problems from the library browser would display improperly in RTL mode for a Hebrew course, unless the problen Direction is set to LTR.

The feature to set a problem language and direction was only added in 2018 to the PG language, so most problems will not declare their language, and the system needs to fall back to determining the language and direction in a different manner. The OPL itself is all English, so the system wide fallback is to en-US in LTR mode.

Since the defaults fall back to the LTR direction, most sites should be fine with the \"auto::\" mode, but may want to select the one which matches their course language. The mode \"force::ltr\" would also be an option for a course which runs into trouble with the \"auto\" modes.

Modes:

  • \"none\" prevents any additional LANG and/or DIR tag being added. The browser will use the main setting which was applied to the entire HTML page. This is likely to cause trouble when a problem of the other direction is displayed.
  • \"auto::\" allows the system to make the settings based on the language and direction reported by the problem (a new feature, so not set in almost all existing problems) and falling back to the expected default of en-US in LTR mode.
  • \"auto:LangCode:Dir\" allows the system to make the settings based on the language and direction reported by the problem (a new feature, so not set in almost all existing problems) but falling back to the language with the given LangCode and the direction Dir when problem settings are not available from PG.
  • \"auto::Dir\" for problems without PG settings, this will use the default en=english language, but force the direction to Dir. Problems with PG settings will get those settings.
  • \"auto:LangCode:\" for problems without PG settings, this will use the default LTR direction, but will set the language to LangCode.Problems with PG settings will get those settings.
  • \"force:LangCode:Dir\" will ignore any setting made by the PG code of the problem, and will force the system to set the language with the given LangCode and the direction to Dir for all problems.
  • \"force::Dir\" will ignore any setting made by the PG code of the problem, and will force the system to set the direction to Dir for all problems, but will avoid setting any language attribute for individual problem.
'), + values => [qw(none auto:: force::ltr force::rtl force:en:ltr auto:en:ltr force:tr:ltr auto:tr:ltr force:es:ltr auto:es:ltr force:fr:ltr auto:fr:ltr force:zh_hk:ltr auto:zh_hk:ltr force:he:rtl auto:he:rtl )], + type => 'popuplist' + }, { var => 'sessionKeyTimeout', doc => x('Inactivity time before a user is required to login again'), doc2 => x('Length of time, in seconds, a user has to be inactive before he is required to login again.

This value should be entered as a number, so as 3600 instead of 60*60 for one hour'), diff --git a/lib/WeBWorK/Localize/en.po b/lib/WeBWorK/Localize/en.po index 066e2e2773..281021e529 100644 --- a/lib/WeBWorK/Localize/en.po +++ b/lib/WeBWorK/Localize/en.po @@ -8733,7 +8733,8 @@ msgstr "" "any users answers using the form below and the answers will be colored " "according to correctness." -#: /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/UserList2.pm:467 +# +#: /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/UserList2.pm:464 msgid "_CLASSLIST_EDITOR_DESCRIPTION" msgstr "" "This is the classlist editor page, where you can view and edit the records " @@ -8753,6 +8754,7 @@ msgstr "" "%1 uses an external authentication system. You've authenticated through " "that system, but aren't allowed to log in to this course." +# #. (CGI::b($r->maketext("Guest Login") #: /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Login.pm:285 msgid "_GUEST_LOGIN_MESSAGE" @@ -8760,6 +8762,7 @@ msgstr "" "This course supports guest logins. Click %1 to log into this course as a " "guest." +# #: /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList2.pm:528 msgid "_HMWKSETS_EDITOR_DESCRIPTION" msgstr "" @@ -8798,6 +8801,7 @@ msgstr "" "in the edit assigned users field contains links which take you to a page " "where you can edit what students the set is assigned to." +# #: /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pm:2094 msgid "_REQUEST_ERROR" msgstr "" @@ -8807,8 +8811,9 @@ msgstr "" "corrected. If you are a professor, please consult the error output below for " "more information." -#: /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/UserList2.pm:1871 -#: /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/UserList2.pm:1873 +# +#: /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/UserList2.pm:1868 +#: /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/UserList2.pm:1870 msgid "_USER_TABLE_SUMMARY" msgstr "" "A table showing all the current users along with several fields of user " diff --git a/lib/WeBWorK/Localize/en_us.po b/lib/WeBWorK/Localize/en_us.po index 066e2e2773..4deffc900a 100644 --- a/lib/WeBWorK/Localize/en_us.po +++ b/lib/WeBWorK/Localize/en_us.po @@ -8712,6 +8712,7 @@ msgid "[Edit]" msgstr "[Edit]" #: /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/AchievementList.pm:265 +#, fuzzy msgid "_ACHIEVEMENTS_EDITOR_DESCRIPTION" msgstr "" "This is the homework sets editor page where you can view and edit the " @@ -8737,8 +8738,8 @@ msgstr "" msgid "_CLASSLIST_EDITOR_DESCRIPTION" msgstr "" "This is the classlist editor page, where you can view and edit the records " -"of all the students currently enrolled in this course. The top of the page " -"contains forms which allow you to filter which students to view, sort your " +"of all the studentscurrently enrolled in this course. The top of the page " +"contains forms which allow you to filterwhich students to view, sort your " "students in a chosen order, edit student records, give new passwords to " "students, import/export student records from/to external files, or add/" "delete students. To use, please select the action you would like to perform, " @@ -8746,6 +8747,7 @@ msgstr "" "Action!\" button at the bottom of the form. The bottom of the page contains " "a table containing the student usernames and their information." +# #. (CGI::strong($r->maketext($course) #: /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Login.pm:199 msgid "_EXTERNAL_AUTH_MESSAGE" @@ -8787,42 +8789,22 @@ msgstr "" #: /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList2.pm:2761 #: /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList2.pm:2763 msgid "_PROBLEM_SET_SUMMARY" -msgstr "" -"This is a table showing the current Homework sets for this class. The " -"fields from left to right are: Edit Set Data, Edit Problems, Edit Assigned " -"Users, Visibility to students, Reduced Scoring Enabled, Date it was opened, " -"Date it is due, and the Date during which the answers are posted. The Edit " -"Set Data field contains checkboxes for selection and a link to the set data " -"editing page. The cells in the Edit Problems fields contain links which " -"take you to a page where you can edit the containing problems, and the cells " -"in the edit assigned users field contains links which take you to a page " -"where you can edit what students the set is assigned to." +msgstr "_PROBLEM_SET_SUMMARY" #: /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pm:2094 msgid "_REQUEST_ERROR" msgstr "" -"WeBWorK has encountered a software error while attempting to process this " -"problem. It is likely that there is an error in the problem itself. If you " -"are a student, report this error message to your professor to have it " +"WeBWorK has encountered a software error while attempting to process " +"thisproblem. It is likely that there is an error in the problem itself. If " +"you are a student, report this error message to your professor to have it " "corrected. If you are a professor, please consult the error output below for " "more information." + #: /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/UserList2.pm:1871 #: /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/UserList2.pm:1873 msgid "_USER_TABLE_SUMMARY" -msgstr "" -"A table showing all the current users along with several fields of user " -"information. The fields from left to right are: Login Name, Login Status, " -"Assigned Sets, First Name, Last Name, Email Address, Student ID, Enrollment " -"Status, Section, Recitation, Comments, and Permission Level. Clicking on " -"the links in the column headers will sort the table by the field it " -"corresponds to. The Login Name fields contain checkboxes for selecting the " -"user. Clicking the link of the name itself will allow you to act as the " -"selected user. There will also be an image link following the name which " -"will take you to a page where you can edit the selected user's information. " -"Clicking the emails will allow you to email the corresponding user. " -"Clicking the links in the entries in the assigned sets columns will take you " -"to a page where you can view and reassign the sets for the selected user." +msgstr "_USER_TABLE_SUMMARY" # Context is "Create set ______ as a duplicate of the first selected set" #: /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/AchievementList.pm:707 diff --git a/lib/WeBWorK/NPL.pm b/lib/WeBWorK/NPL.pm index 3447388149..d38e16dd48 100644 --- a/lib/WeBWorK/NPL.pm +++ b/lib/WeBWorK/NPL.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/NPL.pm,v 1.1 2007/10/17 16:56:16 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/PG.pm b/lib/WeBWorK/PG.pm index 04d340a619..a2063e0b03 100644 --- a/lib/WeBWorK/PG.pm +++ b/lib/WeBWorK/PG.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/PG.pm,v 1.76 2009/07/18 02:52:51 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/PG/Local.pm b/lib/WeBWorK/PG/Local.pm index da17988032..20997a7e4d 100644 --- a/lib/WeBWorK/PG/Local.pm +++ b/lib/WeBWorK/PG/Local.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/PG/Local.pm,v 1.28 2009/10/17 15:50:33 apizer Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/PG/Remote.pm b/lib/WeBWorK/PG/Remote.pm index a46cdefac5..573c396eed 100644 --- a/lib/WeBWorK/PG/Remote.pm +++ b/lib/WeBWorK/PG/Remote.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/PG/Remote.pm,v 1.6 2007/08/13 22:59:58 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/RPC.pm b/lib/WeBWorK/RPC.pm index aa5a1087ab..0f05245cd3 100644 --- a/lib/WeBWorK/RPC.pm +++ b/lib/WeBWorK/RPC.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/RPC.pm,v 1.2 2006/08/05 02:15:31 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/RPC/Request.pm b/lib/WeBWorK/RPC/Request.pm index 0219d2d58f..2b5ab44070 100644 --- a/lib/WeBWorK/RPC/Request.pm +++ b/lib/WeBWorK/RPC/Request.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/RPC/Request.pm,v 1.1 2006/07/28 04:33:28 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/Request.pm b/lib/WeBWorK/Request.pm index 2715e8385f..6353ab539f 100644 --- a/lib/WeBWorK/Request.pm +++ b/lib/WeBWorK/Request.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/Request.pm,v 1.10 2007/07/23 04:06:32 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -28,7 +28,7 @@ use warnings; use mod_perl; use constant MP2 => ( exists $ENV{MOD_PERL_API_VERSION} and $ENV{MOD_PERL_API_VERSION} >= 2 ); - +use Encode; use WeBWorK::Localize; @@ -58,10 +58,14 @@ sub mutable_param { my $self = shift; if (not defined $self->{paramcache}) { - my @names = $self->SUPER::param; - @{$self->{paramcache}}{@names} = map { [ $self->SUPER::param($_) ] } @names; + my @names = $self->SUPER::param(); + foreach my $name (@names) { + my @params = $self->SUPER::param($name); + @params = map {Encode::decode_utf8($_)} @params; + $self->{paramcache}{$name} = [@params]; + } } - + @_ or return keys %{$self->{paramcache}}; my $name = shift; diff --git a/lib/WeBWorK/Template.pm b/lib/WeBWorK/Template.pm index a80088286d..0024fefde2 100644 --- a/lib/WeBWorK/Template.pm +++ b/lib/WeBWorK/Template.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/Template.pm,v 1.3 2006/01/25 23:13:51 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/Upload.pm b/lib/WeBWorK/Upload.pm index 7e452a6806..34257f89bb 100644 --- a/lib/WeBWorK/Upload.pm +++ b/lib/WeBWorK/Upload.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/Upload.pm,v 1.7 2006/01/25 23:13:51 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/Utils.pm b/lib/WeBWorK/Utils.pm index 890ae5162d..2487822af3 100644 --- a/lib/WeBWorK/Utils.pm +++ b/lib/WeBWorK/Utils.pm @@ -31,15 +31,20 @@ use DateTime; use DateTime::TimeZone; use Date::Parse; use Date::Format; +use Encode qw(encode_utf8 decode_utf8); use File::Copy; use File::Spec::Functions qw(canonpath); use Time::Zone; -use MIME::Base64; +use MIME::Base64 qw(encode_base64 decode_base64); use Errno; use File::Path qw(rmtree); use Storable; use Carp; #use Mail::Sender; +use Storable qw(nfreeze thaw); + + +use open IO => ':encoding(UTF-8)'; use constant MKDIR_ATTEMPTS => 10; @@ -68,8 +73,10 @@ our @EXPORT_OK = qw( constituency_hash cryptPassword decodeAnswers + decode_utf8_base64 dequote encodeAnswers + encode_utf8_base64 fisher_yates_shuffle formatDateTime has_aux_files @@ -78,6 +85,7 @@ our @EXPORT_OK = qw( listFilesRecursive makeTempDirectory max + nfreeze_base64 not_blank parseDateTime path_is_subdir @@ -93,6 +101,7 @@ our @EXPORT_OK = qw( textDateTime timeToSec trim_spaces + thaw_base64 undefstr writeCourseLog writeLog @@ -179,11 +188,41 @@ sub force_eoln($) { sub readFile($) { my $fileName = shift; + # debugging code: found error in CourseEnvironment.pm with this +# if ($fileName =~ /___/ or $fileName =~ /the-course-should-be-determined-at-run-time/) { +# print STDERR "File $fileName not found.\n Usually an unnecessary call to readFile from\n", +# join("\t ", caller()), "\n"; +# return(); +# } local $/ = undef; # slurp the whole thing into one string - open my $dh, "<", $fileName - or croak "failed to read file $fileName: $!"; - my $result = <$dh>; - close $dh; + my $result=''; # need this initialized because the file (e.g. simple.conf) may not exist + if (-r $fileName) { + eval{ + # CODING WARNING: + # if (open my $dh, "<", $fileName){ + # will cause a utf8 "\xA9" does not map to Unicode warning if © is in latin-1 file + # use the following instead + if (open my $dh, "<:raw", $fileName){ + $result = <$dh>; + decode_utf8($result) or die "failed to decode $fileName"; + close $dh; + } else { + print STDERR "File $fileName cannot be read."; # this is not a fatal error. + } + }; + if ($@) { + print STDERR "reading $fileName: error in Utils::readFile: $@\n"; + } + utf8::decode($result) or warn "Non-fatal warning: file $fileName contains at least one character code which ". + "is not valid in UTF-8. (The copyright sign is often a culprit -- use '&copy;' instead.)\n". + "While this is not fatal you should fix it\n"; + # FIXME + # utf8::decode($result) raises an error about the copyright sign + # decode_utf8 and Encode::decode_utf8 do not -- which is doing the right thing? + # Done:: should direct this to warn instead of STDERR to debug files written with accents + # in latin-1 files /Done + } + # returns the empty string if the file cannot be read return force_eoln($result); } @@ -777,7 +816,7 @@ sub writeCourseLog($$@) { my $logFile = $ce->{courseFiles}->{logs}->{$facility}; surePathToFile($ce->{courseDirs}->{root}, $logFile); local *LOG; - if (open LOG, ">>", $logFile) { + if (open LOG, ">>:utf8", $logFile) { print LOG "[", time2str("%a %b %d %H:%M:%S %Y", time), "] @message\n"; close LOG; } else { @@ -889,6 +928,10 @@ sub decodeAnswers($) { } } +sub decode_utf8_base64 { + return decode_utf8(decode_base64(shift)); +} + sub encodeAnswers(\%\@) { my %hash = %{shift()}; my @order = @{shift()}; @@ -900,8 +943,30 @@ sub encodeAnswers(\%\@) { } +sub encode_utf8_base64 { + return encode_base64(encode_utf8(shift)); +} + +sub nfreeze_base64 { + return encode_base64(nfreeze(shift)); +} + +sub thaw_base64 { + my $string = shift; + my $result; + eval { + $result = thaw(decode_base64($string)); + }; + if ($@) { + warn("Deleting corrupted achievement data."); + return {}; + } else { + return $result; + } + +} sub max(@) { my $soFar; foreach my $item (@_) { diff --git a/lib/WeBWorK/Utils/AttemptsTable.pm b/lib/WeBWorK/Utils/AttemptsTable.pm index 79775b82a5..aef254ccc9 100644 --- a/lib/WeBWorK/Utils/AttemptsTable.pm +++ b/lib/WeBWorK/Utils/AttemptsTable.pm @@ -3,7 +3,7 @@ use 5.010; ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WebworkClient.pm,v 1.1 2010/06/08 11:46:38 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/Utils/CourseIntegrityCheck.pm b/lib/WeBWorK/Utils/CourseIntegrityCheck.pm index 2121c1ee63..bea62c55e3 100644 --- a/lib/WeBWorK/Utils/CourseIntegrityCheck.pm +++ b/lib/WeBWorK/Utils/CourseIntegrityCheck.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/Utils/CourseIntegrityCheck.pm,v 1.8 2010/06/12 01:44:33 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/Utils/CourseManagement.pm b/lib/WeBWorK/Utils/CourseManagement.pm index d809036841..46d262e07f 100644 --- a/lib/WeBWorK/Utils/CourseManagement.pm +++ b/lib/WeBWorK/Utils/CourseManagement.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/Utils/CourseManagement.pm,v 1.48 2009/10/01 21:28:46 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -279,7 +279,7 @@ sub addCourse { ##### step 4: write course.conf file ##### my $courseEnvFile = $ce->{courseFiles}->{environment}; - open my $fh, ">", $courseEnvFile + open my $fh, ">:utf8", $courseEnvFile or die "failed to open $courseEnvFile for writing.\n"; writeCourseConf($fh, $ce, %courseOptions); close $fh; @@ -1247,7 +1247,7 @@ sub writeCourseConf { #!perl ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright 2000-2016 The WeBWorK Project, http://openwebwork.sf.net/ # # 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 diff --git a/lib/WeBWorK/Utils/CourseManagement/sql_moodle.pm b/lib/WeBWorK/Utils/CourseManagement/sql_moodle.pm index 8966f651ae..c7d4ba242b 100644 --- a/lib/WeBWorK/Utils/CourseManagement/sql_moodle.pm +++ b/lib/WeBWorK/Utils/CourseManagement/sql_moodle.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/Utils/CourseManagement/sql_moodle.pm,v 1.2 2006/09/29 19:41:36 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/Utils/CourseManagement/sql_single.pm b/lib/WeBWorK/Utils/CourseManagement/sql_single.pm index 5ef059474d..719432f21e 100644 --- a/lib/WeBWorK/Utils/CourseManagement/sql_single.pm +++ b/lib/WeBWorK/Utils/CourseManagement/sql_single.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/Utils/CourseManagement/sql_single.pm,v 1.16 2007/07/21 19:13:10 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/Utils/DBImportExport.pm b/lib/WeBWorK/Utils/DBImportExport.pm index 36878bb7a1..6977f131e6 100644 --- a/lib/WeBWorK/Utils/DBImportExport.pm +++ b/lib/WeBWorK/Utils/DBImportExport.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/Utils/DBImportExport.pm,v 1.10 2006/09/26 15:57:41 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/Utils/DBUpgrade.pm b/lib/WeBWorK/Utils/DBUpgrade.pm index bea9d3b10b..91ff790d50 100644 --- a/lib/WeBWorK/Utils/DBUpgrade.pm +++ b/lib/WeBWorK/Utils/DBUpgrade.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/Utils/DBUpgrade.pm,v 1.4 2007/08/13 22:59:59 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/Utils/DatePickerScripts.pm b/lib/WeBWorK/Utils/DatePickerScripts.pm index 9990f39e40..930e910518 100644 --- a/lib/WeBWorK/Utils/DatePickerScripts.pm +++ b/lib/WeBWorK/Utils/DatePickerScripts.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/Utils/CourseManagement.pm,v 1.48 2009/10/01 21:28:46 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/Utils/DelayedMailer.pm b/lib/WeBWorK/Utils/DelayedMailer.pm index 060997feaf..4f5311c9d1 100644 --- a/lib/WeBWorK/Utils/DelayedMailer.pm +++ b/lib/WeBWorK/Utils/DelayedMailer.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/Utils/DelayedMailer.pm,v 1.2 2007/08/13 22:59:59 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/Utils/DetermineProblemLangAndDirection.pm b/lib/WeBWorK/Utils/DetermineProblemLangAndDirection.pm new file mode 100644 index 0000000000..c3c2fdeef1 --- /dev/null +++ b/lib/WeBWorK/Utils/DetermineProblemLangAndDirection.pm @@ -0,0 +1,207 @@ +################################################################################ +# WeBWorK Online Homework Delivery System +# Copyright © 2000-2017 The WeBWorK Project, http://openwebwork.sf.net/ +# +# 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::Utils::DetermineProblemLangAndDirection; +use base qw(Exporter); + +=head1 NAME + +WeBWorK::Utils::DetermineProblemLangAndDirection - utilities to determine +the language and text direction of a problem based on settings from the +PG flags, the course configuration variable $perProblemLangAndDirSettingMode, +and the course language. + +=head1 SYNOPSIS + + use WeBWorK::Utils::DetermineProblemLangAndDirection; + +=head1 DESCRIPTION + +This module provides s function which determines the "recommended" +language and text direction of a problem based on settings from the +PG flags, the course configuration variable $perProblemLangAndDirSettingMode, and the course language. + +=cut + +use strict; +use warnings; +use Carp; +use WeBWorK::PG; +use WeBWorK::Debug; + +our @EXPORT = qw(get_problem_lang_and_dir); +our @EXPORT_OK = (); + + +=head1 FUNCTIONS + +=over + +=item get_problem_lang_and_dir subroutine + + @output = get_problem_lang_and_dir( $self, $pg ); + +returns an array of tagname tagvalue pairs. + +In some cases, the result is empty. + +=cut + +# get_problem_lang_and_dir subroutine + +# used to determine the language and maybe also the dir setting for the +# DIV tag attributes, if needed by the PROBLEM language + +# Return an array of key-value pairs key1 val1 key2 val2 + +sub get_problem_lang_and_dir { + my $self = shift; + my $pg = shift; + + my @result = (); + + my $ce_requested_mode = $self->r->ce->{perProblemLangAndDirSettingMode}; # Mode requested + + if ( $ce_requested_mode eq "none" ) { + # Requested mode is "none" so no output should be made. + return( @result ); + } + + # Get course-wide language setting + my $ce_lang = $self->r->ce->{language}; # Course wide setting + my $ce_dir = "ltr"; # default + + if ( $ce_lang =~ /^he/i ) { # supports also the current "heb" option + # Hebrew - requires RTL direction + $ce_lang = "he"; # Hebrew - standard form + $ce_dir = "rtl"; # RTL + } elsif ( $ce_lang =~ /^ar/i ) { + # Arabic - requires RTL direction + $ce_lang = "ar"; # Arabic + $ce_dir = "rtl"; # RTL + } + + my @tmp1 = split(':',$ce_requested_mode); + my $reqMode = $tmp1[0]; + my $reqLang = $tmp1[1]; + my $reqDir = $tmp1[2]; + + $reqLang = "none" if ( ! defined( $reqMode ) ); + $reqLang = "" if ( ! defined( $reqLang ) ); + $reqDir = "" if ( ! defined( $reqDir ) ); + + if ( $reqMode eq "force" ) { + # Requested mode is to force the LANG and DIR attributes regardless of lang data from problem PG code. + if ( $reqLang ne "" ) { + push( @result, "lang", $reqLang ); # forced setting + } + push( @result, "dir", $reqDir ); # forced setting + return( @result ); + } + + if ( $reqMode ne "auto" ) { + # The mode setting is not valid, treat like none + return( @result ); + } + + # We are now handling an "auto" setting, so want to handle data from PG + + my $pg_lang = "en-US"; # system default + my $pg_dir = "ltr"; # system default + + # Determine the language code to use + if ( defined( $pg->{flags}->{language} ) ) { + # Language set by PG + $pg_lang = $pg->{flags}->{language}; + } else { + # Language not set by PG, use provided default language (if set) or fall back to the system default + if ( $reqLang ne "" ) { + $pg_lang = $reqLang; + } + } + + # Determine the direction code to use + # we changed the order of precedence here. + if ( defined( $pg->{flags}->{textdirection} ) ) { + # Direction set by PG + $pg_dir = $pg->{flags}->{textdirection}; + } elsif ( defined( $pg->{flags}->{language} ) ) { + # Direction not set by PG, + # but PG did set the language. + # Fallback is to use LTR, except for Hebrew and Arabic. + $pg_dir = "ltr"; # correct for most languages + if ( ( $pg->{flags}->{language} =~ /^he/i ) || + ( $pg->{flags}->{language} =~ /^ar/i ) ) { + $pg_dir = "rtl"; # should be correct for these languages + } + } elsif ( $reqDir ne "" ) { + # We have a request for a direction when PG did not set it + $pg_dir = $reqDir; + } else { + # Direction not set by PG, nor was a default setting provided + # and PG did NOT set the language. + # For SetMaker, we are assuming that a problem without a PG direction + # setting should be in LTR mode. + $pg_dir = "ltr"; # correct for most languages + + # Even for Arabic and Hebrew do NOT change to RTL. + # The teacher should add the language and direction setting to + # the PG file of the problem. + } + + # Make these string all lowercase (just in case) + $pg_lang = lc( $pg_lang ); + $pg_dir = lc( $pg_dir ); + $ce_lang = lc( $ce_lang ); + $ce_dir = lc( $ce_dir ); + + # We are ALWAYS setting this for this mode. + push( @result, "lang", $pg_lang ); # send the problem language that was selected + + if ( ( $ce_dir eq "rtl" ) && # Possible hack for RTL direction courses and OPL problems + ( $reqDir eq "rtl" ) && + ! defined( $pg->{flags}->{textdirection} ) && # problem does not set the language or + ! defined( $pg->{flags}->{language} ) ) { # the text direction + # In a RTL language course, we may really want to force LTR use for unknown problems. + # that would best be handled by always including the language setting in RTL language + # problems, and using a setting which falls back to LTR when there is no setting from + # the problem (expected on OPL problems). + + # May want to issue a warning + + # Right now - we are not trying to do the following + # push( @result, "dir", "ltr" ); # override to problem textdirection or "expected" LTR textdirection + } + + # We are ALWAYS setting this for this mode. + push( @result, "dir", $pg_dir ); # override to $pg_dir + + # " ce_lang $ce_lang ce_dir $ce_dir reqMain $reqMain reqLang $reqLand reqDir $reqDir result_lang $pg_lang result_dir $pg_dir "; + + return( @result ); +} + + +=back + +=cut + +=head1 AUTHOR + +Written by Nathan Wallach, tani (at) mathnet.technion.ac.il + +=cut + +1; diff --git a/lib/WeBWorK/Utils/FilterRecords.pm b/lib/WeBWorK/Utils/FilterRecords.pm index fcfba4a1fa..0832ebc017 100644 --- a/lib/WeBWorK/Utils/FilterRecords.pm +++ b/lib/WeBWorK/Utils/FilterRecords.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/Utils/FilterRecords.pm,v 1.5 2006/09/25 22:14:54 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/Utils/FormatRecords.pm b/lib/WeBWorK/Utils/FormatRecords.pm index 457df47c38..da92c073d0 100644 --- a/lib/WeBWorK/Utils/FormatRecords.pm +++ b/lib/WeBWorK/Utils/FormatRecords.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/Utils/FormatRecords.pm,v 1.9 2007/04/09 21:01:50 glarose Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/Utils/ListingDB.pm b/lib/WeBWorK/Utils/ListingDB.pm index 987c1e9d9b..b94c303a3c 100644 --- a/lib/WeBWorK/Utils/ListingDB.pm +++ b/lib/WeBWorK/Utils/ListingDB.pm @@ -439,6 +439,12 @@ sub getDBListings { my $subj = $r->param('library_subjects') || ""; my $chap = $r->param('library_chapters') || ""; my $sec = $r->param('library_sections') || ""; + + # Make sure these strings are internally encoded in UTF-8 + utf8::upgrade($subj); + utf8::upgrade($chap); + utf8::upgrade($sec); + my $keywords = $r->param('library_keywords') || ""; # Next could be an array, an array reference, or nothing my @levels = $r->param('level'); @@ -510,6 +516,7 @@ sub getDBListings { # $kw2"; my $pg_id_ref; + $dbh->do(qq{SET NAMES 'utf8';}); if($haveTextInfo) { my $query = "SELECT $selectwhat from `$tables{pgfile}` pgf, `$tables{dbsection}` dbsc, `$tables{dbchapter}` dbc, `$tables{dbsubject}` dbsj, diff --git a/lib/WeBWorK/Utils/RestrictedClosureClass.pm b/lib/WeBWorK/Utils/RestrictedClosureClass.pm index 87051db478..5c603d4f40 100644 --- a/lib/WeBWorK/Utils/RestrictedClosureClass.pm +++ b/lib/WeBWorK/Utils/RestrictedClosureClass.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/Utils/RestrictedClosureClass.pm,v 1.4 2007/08/10 00:27:14 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/Utils/RestrictedMailer.pm b/lib/WeBWorK/Utils/RestrictedMailer.pm index c9124a326d..0b8bf659b6 100644 --- a/lib/WeBWorK/Utils/RestrictedMailer.pm +++ b/lib/WeBWorK/Utils/RestrictedMailer.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/Utils/RestrictedMailer.pm,v 1.2 2006/12/05 20:57:53 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/Utils/SortRecords.pm b/lib/WeBWorK/Utils/SortRecords.pm index b6668fbd5e..93e2d6ed38 100644 --- a/lib/WeBWorK/Utils/SortRecords.pm +++ b/lib/WeBWorK/Utils/SortRecords.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WeBWorK/Utils/SortRecords.pm,v 1.7 2006/09/25 22:14:54 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under diff --git a/lib/WeBWorK/Utils/Tags.pm b/lib/WeBWorK/Utils/Tags.pm index 6a1f7fdc5f..4333c7bb39 100644 --- a/lib/WeBWorK/Utils/Tags.pm +++ b/lib/WeBWorK/Utils/Tags.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright � 2000-1307 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-1307 The WeBWorK Project, http://openwebwork.sf.net/ # # 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 @@ -203,7 +203,7 @@ sub new { my $textno; my $textinfo=[]; - open(IN,"$name") or die "can not open $name: $!"; + open(IN,'<:encoding(UTF-8)',"$name") or die "can not open $name: $!"; if ($name !~ /pg$/ && $name !~ /\.pg\.[-a-zA-Z0-9_.@]*\.tmp$/) { warn "Not a pg file"; #print caused trouble with XMLRPC $self->{file}= undef; diff --git a/lib/WeBWorK/Utils/Tasks.pm b/lib/WeBWorK/Utils/Tasks.pm index cae73ec2c5..e83ab8d263 100644 --- a/lib/WeBWorK/Utils/Tasks.pm +++ b/lib/WeBWorK/Utils/Tasks.pm @@ -1,6 +1,6 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # # 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 diff --git a/lib/WebworkClient.pm b/lib/WebworkClient.pm index 8916c5ba38..190a1db861 100755 --- a/lib/WebworkClient.pm +++ b/lib/WebworkClient.pm @@ -2,7 +2,7 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WebworkClient.pm,v 1.1 2010/06/08 11:46:38 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -108,8 +108,7 @@ use Crypt::SSLeay; # needed for https use lib "$WeBWorK::Constants::WEBWORK_DIRECTORY/lib"; use lib "$WeBWorK::Constants::PG_DIRECTORY/lib"; use XMLRPC::Lite; -use MIME::Base64 qw( encode_base64 decode_base64); -use WeBWorK::Utils qw( wwRound); +use WeBWorK::Utils qw( wwRound encode_utf8_base64 decode_utf8_base64); use WeBWorK::Utils::AttemptsTable; use WeBWorK::CourseEnvironment; @@ -322,12 +321,12 @@ sub xmlrpcCall { $self->fault(1); # set fault flag to true return $self; } else { - if (ref($result->result())=~/HASH/ and defined($result->result()->{text}) ) { - $result->result()->{text} = decode_base64($result->result()->{text}); - } - if (ref($result->result())=~/HASH/ and defined($result->result()->{header_text}) ) { - $result->result()->{header_text} = decode_base64($result->result()->{header_text}); - } + if (ref($result->result())=~/HASH/ and defined($result->result()->{text}) ) { + $result->result()->{text} = decode_utf8_base64($result->result()->{text}); + } + if (ref($result->result())=~/HASH/ and defined($result->result()->{header_text}) ) { + $result->result()->{header_text} = decode_utf8_base64($result->result()->{header_text}); + } $self->return_object($result->result()); # print "\n retrieve result ", keys %{$self->return_object}; @@ -393,7 +392,7 @@ sub jsXmlrpcCall { sub encodeSource { my $self = shift; my $source = shift||''; - $self->{encoded_source} =encode_base64($source); + $self->{encoded_source} =encode_utf8_base64($source); } =head2 Accessor methods @@ -628,7 +627,7 @@ sub formatRenderedProblem { if ( defined ($rh_result->{WARNINGS}) and $rh_result->{WARNINGS} ){ $warnings = "

-

WARNINGS

".decode_base64($rh_result->{WARNINGS})."

"; +

WARNINGS

".decode_utf8_base64($rh_result->{WARNINGS})."

"; } #warn "keys: ", join(" | ", sort keys %{$rh_result }); diff --git a/lib/WebworkWebservice/CourseActions.pm b/lib/WebworkWebservice/CourseActions.pm index ea65c244f3..ebc4f91ada 100644 --- a/lib/WebworkWebservice/CourseActions.pm +++ b/lib/WebworkWebservice/CourseActions.pm @@ -11,12 +11,11 @@ use WebworkWebservice; use base qw(WebworkWebservice); use WeBWorK::DB; use WeBWorK::DB::Utils qw(initializeUserProblem); -use WeBWorK::Utils qw(runtime_use cryptPassword formatDateTime parseDateTime); +use WeBWorK::Utils qw(runtime_use cryptPassword formatDateTime parseDateTime encode_utf8_base64 decode_utf8_base64); use WeBWorK::Utils::CourseManagement qw(addCourse); use WeBWorK::Debug; use WeBWorK::ContentGenerator::Instructor::SendMail; use JSON; -use MIME::Base64 qw( encode_base64 decode_base64); use Time::HiRes qw/gettimeofday/; # for log timestamp use Date::Format; # for log timestamp @@ -143,14 +142,14 @@ sub listUsers { $out->{ra_out} = \@userInfo; - $out->{text} = encode_base64("Users for course: ".$self->{courseName}); + $out->{text} = encode_utf8_base64("Users for course: ".$self->{courseName}); return $out; } sub addUser { my ($self, $params) = @_; my $out = {}; - $out->{text} = encode_base64(""); + $out->{text} = encode_utf8_base64(""); my $db = $self->db; my $ce = $self->ce; @@ -291,7 +290,7 @@ sub deleteUser { my $out = {}; my $db = $self->db; my $ce = $self->ce; - $out->{text} = encode_base64(""); + $out->{text} = encode_utf8_base64(""); my $user = $params->{'id'}; @@ -326,12 +325,12 @@ sub deleteUser { { my $result; $result->{delete} = "success"; - $out->{text} .=encode_base64("User " . $user . " successfully deleted"); + $out->{text} .=encode_utf8_base64("User " . $user . " successfully deleted"); $out->{ra_out} .= "delete: success"; } else { - $out->{text}=encode_base64("User " . $user . " could not be deleted"); + $out->{text}=encode_utf8_base64("User " . $user . " could not be deleted"); $out->{ra_out} .= "delete : failed"; } @@ -348,7 +347,7 @@ sub editUser { my $ce = $self->ce; my $out = {}; debug("Webservices edit user request."); - $out->{text} = encode_base64(""); + $out->{text} = encode_utf8_base64(""); # make sure course actions are enabled #if (!$ce->{webservices}{enableCourseActions}) { # $out->{status} = "failure"; @@ -367,7 +366,7 @@ sub editUser { } } if($params->{'id'} eq $params->{'user'}){ - $out->{text} .= encode_base64("You cannot change your own permissions."); + $out->{text} .= encode_utf8_base64("You cannot change your own permissions."); } else { foreach my $field ($PermissionLevel->NONKEYFIELDS()) { my $param = "${field}"; @@ -395,7 +394,7 @@ sub editUser { $out->{ra_out} = $User; - $out->{text} .= encode_base64("Changes saved"); + $out->{text} .= encode_utf8_base64("Changes saved"); return $out; } @@ -410,7 +409,7 @@ sub changeUserPassword { my $out = {}; my $db = $self->db; my $ce = $self->ce; - $out->{text} = encode_base64(""); + $out->{text} = encode_utf8_base64(""); my $userid = $params->{'id'}; @@ -438,7 +437,7 @@ sub changeUserPassword { #my $User = $db->getUser($params->{'id'}); # checked if(!(defined $User)){ - $out->{text}=encode_base64("No record found for user: ". $params->{'id'}); + $out->{text}=encode_utf8_base64("No record found for user: ". $params->{'id'}); return $out; } @@ -453,7 +452,7 @@ sub changeUserPassword { } $self->{passwordMode} = 0; - $out->{text} = encode_base64("New passwords saved"); + $out->{text} = encode_utf8_base64("New passwords saved"); $out->{ra_out}= "password_change: success"; return $out; } @@ -579,7 +578,7 @@ sub getCourseSettings { my $out = {}; $out->{ra_out} = $ConfigValues; - $out->{text} = encode_base64("Successfully found the course settings"); + $out->{text} = encode_utf8_base64("Successfully found the course settings"); return $out; } @@ -665,7 +664,7 @@ sub updateSetting { my $out = {}; $out->{ra_out} = ""; - $out->{text} = encode_base64("Successfully updated the course settings"); + $out->{text} = encode_utf8_base64("Successfully updated the course settings"); return $out; } diff --git a/lib/WebworkWebservice/LibraryActions.pm b/lib/WebworkWebservice/LibraryActions.pm index 70f5d767dc..80abce3de1 100644 --- a/lib/WebworkWebservice/LibraryActions.pm +++ b/lib/WebworkWebservice/LibraryActions.pm @@ -23,12 +23,11 @@ use sigtrap; use Carp; use WWSafe; #use Apache; -use WeBWorK::Utils qw(readDirectory sortByName); +use WeBWorK::Utils qw(readDirectory sortByName encode_utf8_base64 decode_utf8_base64); use WeBWorK::CourseEnvironment; use WeBWorK::PG::Translator; use WeBWorK::PG::IO; use Benchmark; -use MIME::Base64 qw( encode_base64 decode_base64); ############################################## # Obtain basic information about directories, course name and host @@ -87,7 +86,7 @@ sub listLibraries { # list the problem libraries that are available. my @outListLib = sort keys %libraries; my $out = {}; $out->{ra_out} = \@outListLib; - $out->{text} = encode_base64("success"); + $out->{text} = encode_utf8_base64("success"); return $out; } @@ -120,7 +119,7 @@ sub readFile { open IN, "<$filePath"; local($/)=undef; my $text = ; - $out->{text}= encode_base64($text); + $out->{text}= encode_utf8_base64($text); my $sb=stat($filePath); $out->{size}=$sb->size; $out->{path}=$filePath; @@ -208,7 +207,7 @@ sub listLib { find({wanted=>$wanted,follow_fast=>1 }, $dirPath); @outListLib = sort @outListLib; $out->{ra_out} = \@outListLib; - $out->{text} = encode_base64( join("\n", @outListLib) ); + $out->{text} = encode_utf8_base64( join("\n", @outListLib) ); return($out); }; $command eq 'dirOnly' && do { @@ -225,7 +224,7 @@ sub listLib { warn "result: ", join(" ", %libDirectoryList); delete $libDirectoryList{""}; $out->{ra_out} = \%libDirectoryList; - $out->{text} = encode_base64("Loaded libraries"); + $out->{text} = encode_utf8_base64("Loaded libraries"); return($out); } else { warn "Can't open directory $dirPath2"; @@ -238,7 +237,7 @@ sub listLib { # $command eq 'dirOnly' && do { # my @subdirs = File::Find::Rule->directory->in( ($dirPath) ); # $out->{ra_out} = \@subdirs; -# $out->{text} = encode_base64("Loaded libraries".$dirPath); +# $out->{text} = encode_utf8_base64("Loaded libraries".$dirPath); # return($out); # }; $command eq 'buildtree' && do { @@ -248,7 +247,7 @@ sub listLib { #@outListLib = sort keys %libDirectoryList; $out->{ra_out} = $tree; warn "output of build_tree is ", %$tree; - $out->{text} = encode_base64("Loaded libraries"); + $out->{text} = encode_utf8_base64("Loaded libraries"); return($out); }; @@ -260,8 +259,8 @@ sub listLib { if ( -e $dirPath2 and $dirPath2 !~ m|//| ) { find($wanted, $dirPath2); @outListLib = sort @outListLib; - #$out ->{text} = encode_base64( join("", @outListLib ) ); - $out ->{text} = encode_base64( "Problems loaded" ); + #$out ->{text} = encode_utf8_base64( join("", @outListLib ) ); + $out ->{text} = encode_utf8_base64( "Problems loaded" ); $out->{ra_out} = \@outListLib; } else { warn "Can't open directory $dirPath2 in listLib files"; @@ -296,14 +295,14 @@ sub searchLib { #API for searching the NPL database 'getAllDBsubjects' eq $subcommand && do { my @subjects = WeBWorK::Utils::ListingDB::getAllDBsubjects($self); $out->{ra_out} = \@subjects; - $out->{text} = encode_base64("Subjects loaded."); + $out->{text} = encode_utf8_base64("Subjects loaded."); return($out); }; 'getAllDBchapters' eq $subcommand && do { $self->{library_subjects} = $rh->{library_subjects}; my @chaps = WeBWorK::Utils::ListingDB::getAllDBchapters($self); $out->{ra_out} = \@chaps; - $out->{text} = encode_base64("Chapters loaded."); + $out->{text} = encode_utf8_base64("Chapters loaded."); return($out); }; @@ -331,7 +330,7 @@ sub searchLib { #API for searching the NPL database my @section_listings = WeBWorK::Utils::ListingDB::getAllDBsections($self); $out->{ra_out} = \@section_listings; - $out->{text} = encode_base64("Sections loaded."); + $out->{text} = encode_utf8_base64("Sections loaded."); return($out); }; @@ -345,7 +344,7 @@ sub searchLib { #API for searching the NPL database $self->{library_textchapter} = $rh->{library_textchapter}; $self->{library_textsection} = $rh->{library_textsection}; my $count = WeBWorK::Utils::ListingDB::countDBListings($self); - $out->{text} = encode_base64("Count done."); + $out->{text} = encode_utf8_base64("Count done."); $out->{ra_out} = [$count]; return($out); }; @@ -407,7 +406,7 @@ sub getProblemDirectories { unshift @all_problem_directories, $main if($includetop); $out->{ra_out} = \@all_problem_directories; - $out->{text} = encode_base64("Problem Directories loaded."); + $out->{text} = encode_utf8_base64("Problem Directories loaded."); return($out); } @@ -439,7 +438,7 @@ sub buildBrowseTree { } } $out->{ra_out} = \@tree; - $out->{text} = encode_base64("Subjects, Chapters and Sections loaded."); + $out->{text} = encode_utf8_base64("Subjects, Chapters and Sections loaded."); return($out); } @@ -451,7 +450,7 @@ sub getProblemTags { # Get a pointer to a hash of DBchapter, ..., DBsection my $tags = WeBWorK::Utils::ListingDB::getProblemTags($path); $out->{ra_out} = $tags; - $out->{text} = encode_base64("Tags loaded."); + $out->{text} = encode_utf8_base64("Tags loaded."); return($out); } @@ -468,7 +467,7 @@ sub setProblemTags { # result is [success, message] with success = 0 or 1 my $result = WeBWorK::Utils::ListingDB::setProblemTags($path, $dbsubj, $dbchap, $dbsect, $level, $stat); my $out = {}; - $out->{text} = encode_base64($result->[1]); + $out->{text} = encode_utf8_base64($result->[1]); return($out); } diff --git a/lib/WebworkWebservice/RenderProblem.pm b/lib/WebworkWebservice/RenderProblem.pm index 58b0977e79..1c6254623c 100644 --- a/lib/WebworkWebservice/RenderProblem.pm +++ b/lib/WebworkWebservice/RenderProblem.pm @@ -2,7 +2,7 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/lib/WebworkWebservice/RenderProblem.pm,v 1.11 2010/06/08 11:22:43 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under @@ -33,13 +33,12 @@ use WeBWorK::PG::Translator; use WeBWorK::PG::Local; use WeBWorK::DB; use WeBWorK::Constants; -use WeBWorK::Utils qw(runtime_use formatDateTime makeTempDirectory); +use WeBWorK::Utils qw(runtime_use formatDateTime makeTempDirectory encode_utf8_base64 decode_utf8_base64); use WeBWorK::DB::Utils qw(global2user user2global); use WeBWorK::Utils::Tasks qw(fake_set fake_problem); use WeBWorK::PG::IO; use WeBWorK::PG::ImageGenerator; use Benchmark; -use MIME::Base64 qw( encode_base64 decode_base64); #print "rereading Webwork\n"; @@ -366,7 +365,7 @@ sub renderProblem { my $problem_source; my $r_problem_source =undef; if (defined($rh->{source}) and $rh->{source}) { - $problem_source = decode_base64($rh->{source}); + $problem_source = decode_utf8_base64($rh->{source}); $problem_source =~ tr /\r/\n/; $r_problem_source =\$problem_source; # warn "source included in request"; @@ -476,11 +475,11 @@ sub renderProblem { } # new version of output: my $out2 = { - text => encode_base64( $pg->{body_text} ), - header_text => encode_base64( $pg->{head_text} ), + text => encode_utf8_base64( $pg->{body_text} ), + header_text => encode_utf8_base64( $pg->{head_text} ), answers => $pg->{answers}, errors => $pg->{errors}, - WARNINGS => encode_base64( + WARNINGS => encode_utf8_base64( "WARNINGS\n".$warning_messages."\n
More
\n".$pg->{warnings} ), PG_ANSWERS_HASH => $pg->{pgcore}->{PG_ANSWERS_HASH}, @@ -491,7 +490,7 @@ sub renderProblem { debug_messages => $pgdebug_messages, internal_debug_messages => $internal_debug_messages, }; - + # Filter out bad reference types ################### # DEBUGGING CODE @@ -505,6 +504,7 @@ sub renderProblem { } $out2 = xml_filter($out2); # check this -- it might not be working correctly ################## + print DEBUGCODE "\n\nStop xml encoding\n"; close(DEBUGCODE) if $debugXmlCode; ################### @@ -548,8 +548,10 @@ sub xml_filter { $level++; my $tmp = []; foreach my $item (@{$input}) { + # print DEBUGCODE "-----checking $item of type\n",ref($item) if $debugXmlCode; $item = xml_filter($item,$level); push @$tmp, $item; + # print DEBUGCODE "-----end checking $item\n" if $debugXmlCode; } $input = $tmp; $level--; diff --git a/lib/WebworkWebservice/SetActions.pm b/lib/WebworkWebservice/SetActions.pm index 250866069c..42c48e8cbe 100644 --- a/lib/WebworkWebservice/SetActions.pm +++ b/lib/WebworkWebservice/SetActions.pm @@ -21,7 +21,7 @@ use sigtrap; use Carp; use WWSafe; #use Apache; -use WeBWorK::Utils; +use WeBWorK::Utils qw( encode_utf8_base64 decode_utf8_base64 ); use WeBWorK::Debug qw(debug); use JSON; use WeBWorK::CourseEnvironment; @@ -29,7 +29,6 @@ use WeBWorK::PG::Translator; use WeBWorK::DB::Utils qw(initializeUserProblem); use WeBWorK::PG::IO; use Benchmark; -use MIME::Base64 qw( encode_base64 decode_base64); ############################################## # Some of this may have to be moved, to allow for flexability @@ -52,7 +51,7 @@ sub listLocalSets{ @found_sets = $db->listGlobalSets; my $out = {}; $out->{ra_out} = \@found_sets; - $out->{text} = encode_base64("Loaded sets for course: ".$self->{courseName}); + $out->{text} = encode_utf8_base64("Loaded sets for course: ".$self->{courseName}); return $out; } @@ -96,7 +95,7 @@ sub listLocalSetProblems{ my $out = {}; $out->{ra_out} = \@problems; - $out->{text} = encode_base64("Loaded Problems for set: " . $setName); + $out->{text} = encode_utf8_base64("Loaded Problems for set: " . $setName); return $out; } @@ -121,7 +120,7 @@ sub getSets{ my $out = {}; $out->{ra_out} = \@all_sets; - $out->{text} = encode_base64("Sets for course: ".$self->{courseName}); + $out->{text} = encode_utf8_base64("Sets for course: ".$self->{courseName}); return $out; } @@ -148,7 +147,7 @@ sub getUserSets{ my $out = {}; $out->{ra_out} = \@userSets; - $out->{text} = encode_base64("Sets for course: ".$self->{courseName}); + $out->{text} = encode_utf8_base64("Sets for course: ".$self->{courseName}); return $out; } @@ -170,7 +169,7 @@ sub getSet { my $out = {}; $out->{ra_out} = $set; - $out->{text} = encode_base64("Sets for course: ".$self->{courseName}); + $out->{text} = encode_utf8_base64("Sets for course: ".$self->{courseName}); return $out; } @@ -247,7 +246,7 @@ sub updateSetProperties { my $out = {}; $out->{ra_out} = $set; - $out->{text} = encode_base64("Successfully updated set " . $params->{set_id}); + $out->{text} = encode_utf8_base64("Successfully updated set " . $params->{set_id}); return $out; } @@ -258,7 +257,7 @@ sub listSetUsers { my $out = {}; my @users = $db->listSetUsers($params->{set_id}); $out->{ra_out} = \@users; - $out->{text} = encode_base64("Successfully returned the users for set " . $params->{set_id}); + $out->{text} = encode_utf8_base64("Successfully returned the users for set " . $params->{set_id}); return $out; } @@ -282,7 +281,7 @@ sub createNewSet{ my $newSetRecord = $db->getGlobalSet($newSetName); if (defined($newSetRecord)) { - $out->{out}=encode_base64("Failed to create set, you may need to try another name."), + $out->{out}=encode_utf8_base64("Failed to create set, you may need to try another name."), $out->{ra_out} = {'success' => 'false'}; } else { # Do it! # DBFIXME use $db->newGlobalSet @@ -322,7 +321,7 @@ sub createNewSet{ $db->addGlobalSet($newSetRecord); if ($@) { - $out->{text} = encode_base64("Failed to create set, you may need to try another name."); + $out->{text} = encode_utf8_base64("Failed to create set, you may need to try another name."); #$self->addbadmessage("Problem creating set $newSetName
$@"); } else { my $selfassign = $params->{selfassign}; @@ -380,7 +379,7 @@ sub assignSetToUsers { my $out = {}; $out->{ra_out} = \@results; - $out->{text} = encode_base64("Successfully assigned users to set " . $params->{set_id}); + $out->{text} = encode_utf8_base64("Successfully assigned users to set " . $params->{set_id}); return $out; } @@ -421,7 +420,7 @@ sub deleteProblemSet { debug("deleted set: $setID"); debug($result); - my $out->{text} = encode_base64("Deleted Problem Set " . $setID); + my $out->{text} = encode_utf8_base64("Deleted Problem Set " . $setID); @@ -475,7 +474,7 @@ sub reorderProblems { my $out; - $out->{text} = encode_base64("Successfully reordered problems"); + $out->{text} = encode_utf8_base64("Successfully reordered problems"); return $out; } @@ -497,7 +496,7 @@ sub updateProblem{ } - my $out->{text} = encode_base64("Updated Problem Set " . $setID); + my $out->{text} = encode_utf8_base64("Updated Problem Set " . $setID); @@ -540,7 +539,7 @@ sub updateUserSet { my $out = {}; #$out->{ra_out} = $set; - $out->{text} = encode_base64("Successfully updated set " . $params->{set_id} . " for users " . $params->{users}); + $out->{text} = encode_utf8_base64("Successfully updated set " . $params->{set_id} . " for users " . $params->{users}); return $out; } @@ -564,7 +563,7 @@ sub getUserSets { my $out = {}; $out->{ra_out} = \@userData; - $out->{text} = encode_base64("Returning all users sets for set " . $params->{set_id}); + $out->{text} = encode_utf8_base64("Returning all users sets for set " . $params->{set_id}); return $out; } @@ -586,7 +585,7 @@ sub saveUserSets { my $out = {}; $out->{ra_out} = ""; - $out->{text} = encode_base64("Updating the overrides for set " . $params->{set_id}); + $out->{text} = encode_utf8_base64("Updating the overrides for set " . $params->{set_id}); return $out; } @@ -606,7 +605,7 @@ sub unassignSetFromUsers { my $result = $db->deleteUserSet($user, $params->{set_id}); } my $out = {}; - $out->{text} = encode_base64("Successfully unassigned users: " + $params->{users} + " from set " + $params->{set_id}); + $out->{text} = encode_utf8_base64("Successfully unassigned users: " + $params->{users} + " from set " + $params->{set_id}); } =item assignAllSetsToUser($userID) @@ -727,7 +726,7 @@ sub addProblem { #assignProblemToAllSetUsers($self, $problemRecord); - my $out->{text} = encode_base64("Problem added to ".$setName); + my $out->{text} = encode_utf8_base64("Problem added to ".$setName); return $out; } @@ -749,7 +748,7 @@ sub deleteProblem { $db->deleteGlobalProblem($setName, $problemRecord->problem_id); } } - my $out->{text} = encode_base64("Problem removed from ".$setName); + my $out->{text} = encode_utf8_base64("Problem removed from ".$setName); return $out; } diff --git a/t/grab_course_environment.pl b/t/grab_course_environment.pl index 9fda42594d..49841addc9 100755 --- a/t/grab_course_environment.pl +++ b/t/grab_course_environment.pl @@ -2,7 +2,7 @@ ################################################################################ # WeBWorK Online Homework Delivery System -# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ +# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/ # # 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