From raeburn at source.lon-capa.org Mon Feb 18 08:25:49 2019 From: raeburn at source.lon-capa.org (raeburn) Date: Mon, 18 Feb 2019 13:25:49 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /interface lonparmset.pm Message-ID: raeburn Mon Feb 18 13:25:49 2019 EDT Modified files: /loncom/interface lonparmset.pm Log: - For string-type parameters in table mode, when the suggested value for an unset parameter is based on the value recently set for the same parameter type, include specialized string types. Index: loncom/interface/lonparmset.pm diff -u loncom/interface/lonparmset.pm:1.588 loncom/interface/lonparmset.pm:1.589 --- loncom/interface/lonparmset.pm:1.588 Sun Jan 6 15:27:48 2019 +++ loncom/interface/lonparmset.pm Mon Feb 18 13:25:49 2019 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.588 2019/01/06 15:27:48 raeburn Exp $ +# $Id: lonparmset.pm,v 1.589 2019/02/18 13:25:49 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1071,7 +1071,7 @@ my ($type,$dis,$value,$marker,$return,$call,$recursive,$extra)=@_; my $winvalue=$value; unless ($winvalue) { - if (&isdateparm($type)) { + if ((&isdateparm($type) || (&is_specialstring($type))) { $winvalue=$env{'form.recent_'.$type}; } else { $winvalue=$env{'form.recent_'.(split(/\_/,$type))[0]}; @@ -1108,12 +1108,14 @@ $pjump_def function psub() { + var specstring = /^string_/i; if (document.parmform.pres_marker.value!='') { document.parmform.action+='#'+document.parmform.pres_marker.value; var typedef=new Array(); typedef=document.parmform.pres_type.value.split('_'); if (document.parmform.pres_type.value!='') { - if (typedef[0]=='date') { + if ((typedef[0]=='date') || + (specstring.test(document.parmform.pres_type.value) && (typedef[1]!='yesno'))) { eval('document.parmform.recent_'+ document.parmform.pres_type.value+ '.value=document.parmform.pres_value.value;'); @@ -2062,6 +2064,14 @@ return (($type=~/^date/) && (!($type eq 'date_interval'))); } +# Determine if parameter type is specialized string type (i.e., +# not just string or string_yesno. + +sub is_specialstring { + my $type=shift; + return (($type=~/^string_/) && ((!$type ne 'string_yesno'))); +} + # Prints the HTML and Javascript to select parameters, with various shortcuts. # # @param {Apache2::RequestRec} $r - the Apache request @@ -3268,7 +3278,10 @@ &startpage($r,$pssymb,$crstype); foreach my $item ('tolerance','date_default','date_start','date_end', - 'date_interval','int','float','string') { + 'date_interval','int','float','string','string_lenient', + 'string_examcode','string_deeplink','string_discussvote', + 'string_useslots','string_problemstatus','string_ip', + 'string_questiontype') { $r->print(''). '" name="recent_'.$item.'" />'); From raeburn at source.lon-capa.org Mon Feb 18 08:46:05 2019 From: raeburn at source.lon-capa.org (raeburn) Date: Mon, 18 Feb 2019 13:46:05 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /interface lonparmset.pm Message-ID: raeburn Mon Feb 18 13:46:05 2019 EDT Modified files: /loncom/interface lonparmset.pm Log: - Fix logic. Index: loncom/interface/lonparmset.pm diff -u loncom/interface/lonparmset.pm:1.589 loncom/interface/lonparmset.pm:1.590 --- loncom/interface/lonparmset.pm:1.589 Mon Feb 18 13:25:49 2019 +++ loncom/interface/lonparmset.pm Mon Feb 18 13:46:05 2019 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.589 2019/02/18 13:25:49 raeburn Exp $ +# $Id: lonparmset.pm,v 1.590 2019/02/18 13:46:05 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2069,7 +2069,7 @@ sub is_specialstring { my $type=shift; - return (($type=~/^string_/) && ((!$type ne 'string_yesno'))); + return (($type=~/^string_/) && (($type ne 'string_yesno'))); } # Prints the HTML and Javascript to select parameters, with various shortcuts. From raeburn at source.lon-capa.org Mon Feb 18 10:19:31 2019 From: raeburn at source.lon-capa.org (raeburn) Date: Mon, 18 Feb 2019 15:19:31 -0000 Subject: [LON-CAPA-cvs] cvs: loncom(version_2_11_X) /lonnet/perl lonnet.pm Message-ID: raeburn Mon Feb 18 15:19:31 2019 EDT Modified files: (Branch: version_2_11_X) /loncom/lonnet/perl lonnet.pm Log: - For 2.11 - Backport 1.1379 (part) omitted from changes in rev. 1.1172.2.96 Index: loncom/lonnet/perl/lonnet.pm diff -u loncom/lonnet/perl/lonnet.pm:1.1172.2.104 loncom/lonnet/perl/lonnet.pm:1.1172.2.105 --- loncom/lonnet/perl/lonnet.pm:1.1172.2.104 Fri Feb 15 21:34:43 2019 +++ loncom/lonnet/perl/lonnet.pm Mon Feb 18 15:19:30 2019 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.1172.2.104 2019/02/15 21:34:43 raeburn Exp $ +# $Id: lonnet.pm,v 1.1172.2.105 2019/02/18 15:19:30 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -12802,12 +12802,12 @@ &$func(\@content,$hashref); return; } - close($config); my $which = (split('/',$url))[3]; &logthis("unable to contact DNS defaulting to on disk file dns_$which.tab\n"); - open($config,"<","$perlvar{'lonTabDir'}/dns_$which.tab"); - my @content = <$config>; - &$func(\@content,$hashref); + if (open(my $config,"<","$perlvar{'lonTabDir'}/dns_$which.tab")) { + my @content = <$config>; + &$func(\@content,$hashref); + } return; } From raeburn at source.lon-capa.org Tue Feb 19 09:24:02 2019 From: raeburn at source.lon-capa.org (raeburn) Date: Tue, 19 Feb 2019 14:24:02 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /homework essayresponse.pm Message-ID: raeburn Tue Feb 19 14:24:02 2019 EDT Modified files: /loncom/homework essayresponse.pm Log: - White space changes only (replace tab with spaces). Index: loncom/homework/essayresponse.pm diff -u loncom/homework/essayresponse.pm:1.125 loncom/homework/essayresponse.pm:1.126 --- loncom/homework/essayresponse.pm:1.125 Tue Nov 20 19:14:14 2018 +++ loncom/homework/essayresponse.pm Tue Feb 19 14:24:01 2019 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # essay (ungraded) style responses # -# $Id: essayresponse.pm,v 1.125 2018/11/20 19:14:14 raeburn Exp $ +# $Id: essayresponse.pm,v 1.126 2019/02/19 14:24:01 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -246,10 +246,10 @@ &Apache::lonnet::put('nohist_essay_'.$apath, { $akey => $response },$adom,$aname); } - } + } } } - } + } } elsif ($target eq 'edit') { $result.=&Apache::edit::end_table(); From raeburn at source.lon-capa.org Tue Feb 19 09:24:38 2019 From: raeburn at source.lon-capa.org (raeburn) Date: Tue, 19 Feb 2019 14:24:38 -0000 Subject: [LON-CAPA-cvs] cvs: loncom(version_2_11_X) /homework essayresponse.pm Message-ID: raeburn Tue Feb 19 14:24:38 2019 EDT Modified files: (Branch: version_2_11_X) /loncom/homework essayresponse.pm Log: - For 2.11 Backport 1.125, 1.126 Index: loncom/homework/essayresponse.pm diff -u loncom/homework/essayresponse.pm:1.118 loncom/homework/essayresponse.pm:1.118.2.1 --- loncom/homework/essayresponse.pm:1.118 Tue Jan 21 14:38:55 2014 +++ loncom/homework/essayresponse.pm Tue Feb 19 14:24:38 2019 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # essay (ungraded) style responses # -# $Id: essayresponse.pm,v 1.118 2014/01/21 14:38:55 kruse Exp $ +# $Id: essayresponse.pm,v 1.118.2.1 2019/02/19 14:24:38 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -210,16 +210,30 @@ &escape($crsid)); my $essayurl= &Apache::lonnet::declutter($ENV{'REQUEST_URI'}); - my ($adom,$aname,$apath)= - ($essayurl=~/^($LONCAPA::domain_re)\/($LONCAPA::username_re)\/(.*)$/); - $apath=&escape($apath); - $apath=~s/\W/\_/gs; - &Apache::lonnet::put('nohist_essay_'.$apath, - { $akey => $response },$adom,$aname); - } + if ($essayurl eq 'lib/templates/simpleproblem.problem') { + my %crsinfo = &Apache::lonnet::coursedescription($crsid); + my $cdom = $crsinfo{'domain'}; + my $cnum = $crsinfo{'num'}; + my ($map,$id,$res) = &Apache::lonnet::decode_symb($symb); + if ($map =~ m{^\Quploaded/$cdom/$cnum/\E(default(?:|_\d+)\.(?:sequence|page))$}) { + my $apath = $1.'_'.$id; + $apath=~s/\W/\_/gs; + my $akey = join('.',&escape($name),&escape($domain)); + &Apache::lonnet::put('nohist_essay_'.$apath, + { $akey => $response },$cdom,$cnum); + } + } else { + my ($adom,$aname,$apath)= + ($essayurl=~/^($LONCAPA::domain_re)\/($LONCAPA::username_re)\/(.*)$/); + $apath=&escape($apath); + $apath=~s/\W/\_/gs; + &Apache::lonnet::put('nohist_essay_'.$apath, + { $akey => $response },$adom,$aname); + } + } } } - } + } } elsif ($target eq 'edit') { $result.=&Apache::edit::end_table(); From raeburn at source.lon-capa.org Tue Feb 19 14:03:43 2019 From: raeburn at source.lon-capa.org (raeburn) Date: Tue, 19 Feb 2019 19:03:43 -0000 Subject: [LON-CAPA-cvs] cvs: doc /install/linux install.pl Message-ID: raeburn Tue Feb 19 19:03:43 2019 EDT Modified files: /doc/install/linux install.pl Log: - Support both Mariadb 10.2 and newer, and MySQL 5.7.6 and newer. Index: doc/install/linux/install.pl diff -u doc/install/linux/install.pl:1.49 doc/install/linux/install.pl:1.50 --- doc/install/linux/install.pl:1.49 Fri Oct 26 17:49:14 2018 +++ doc/install/linux/install.pl Tue Feb 19 19:03:42 2019 @@ -77,7 +77,7 @@ &mt('Stopping execution.')."\n"; exit; } else { - print LOG '$Id: install.pl,v 1.49 2018/10/26 17:49:14 raeburn Exp $'."\n"; + print LOG '$Id: install.pl,v 1.50 2019/02/19 19:03:42 raeburn Exp $'."\n"; } # @@ -2368,8 +2368,9 @@ sub setup_mysql_permissions { my ($dbh,$has_pass, at mysql_lc_commands) = @_; my ($mysqlversion,$mysqlsubver,$mysqlname) = &get_mysql_version(); - my ($usesauth,$hasauthcol, at mysql_commands); + my ($usesauth,$is_mariadb,$hasauthcol, at mysql_commands); if ($mysqlname =~ /^MariaDB/i) { + $is_mariadb = 1; if ($mysqlversion >= 10.2) { $usesauth = 1; } elsif ($mysqlversion >= 5.5) { @@ -2383,8 +2384,12 @@ } } if ($usesauth) { - @mysql_commands = ("INSERT user (Host, User, ssl_cipher, x509_issuer, x509_subject, authentication_string) VALUES('localhost','www','','','','')", - "ALTER USER 'www'\@'localhost' IDENTIFIED BY 'localhostkey'"); + @mysql_commands = ("INSERT user (Host, User, ssl_cipher, x509_issuer, x509_subject, authentication_string) VALUES('localhost','www','','','','')"); + if ($is_mariadb) { + push(@mysql_commands,"ALTER USER 'www'\@'localhost' IDENTIFIED BY 'localhostkey'"); + } else { + push(@mysql_commands,"ALTER USER 'www'\@'localhost' IDENTIFIED WITH mysql_native_password BY 'localhostkey'"); + } } elsif ($hasauthcol) { @mysql_commands = ("INSERT user (Host, User, Password, ssl_cipher, x509_issuer, x509_subject, authentication_string) VALUES('localhost','www',password('localhostkey'),'','','','');"); } else { @@ -2439,7 +2444,7 @@ } } if ($got_passwd) { - my (@newpass_cmds) = &new_mysql_rootpasswd($newmysqlpass,$usesauth); + my (@newpass_cmds) = &new_mysql_rootpasswd($newmysqlpass,$usesauth,$is_mariadb); push(@mysql_commands, at newpass_cmds); } else { print_and_log(&mt('Failed to get MySQL root password from user input.')."\n"); @@ -2469,10 +2474,15 @@ } sub new_mysql_rootpasswd { - my ($currmysqlpass,$usesauth) = @_; + my ($currmysqlpass,$usesauth,$is_mariadb) = @_; if ($usesauth) { - return ("ALTER USER 'root'\@'localhost' IDENTIFIED BY '$currmysqlpass'", - "FLUSH PRIVILEGES;"); + if ($is_mariadb) { + return ("ALTER USER 'root'\@'localhost' IDENTIFIED WITH mysql_native_password BY '$currmysqlpass'", + "FLUSH PRIVILEGES;"); + } else { + return ("ALTER USER 'root'\@'localhost' IDENTIFIED BY '$currmysqlpass'", + "FLUSH PRIVILEGES;"); + } } else { return ("SET PASSWORD FOR 'root'\@'localhost'=PASSWORD('$currmysqlpass')", "FLUSH PRIVILEGES;"); From raeburn at source.lon-capa.org Tue Feb 19 14:14:54 2019 From: raeburn at source.lon-capa.org (raeburn) Date: Tue, 19 Feb 2019 19:14:54 -0000 Subject: [LON-CAPA-cvs] cvs: doc /install/linux install.pl Message-ID: raeburn Tue Feb 19 19:14:54 2019 EDT Modified files: /doc/install/linux install.pl Log: - Support both Mariadb 10.2 and newer, and MySQL 5.7.6 and newer. (logic was backwards in rev. 1.50). Index: doc/install/linux/install.pl diff -u doc/install/linux/install.pl:1.50 doc/install/linux/install.pl:1.51 --- doc/install/linux/install.pl:1.50 Tue Feb 19 19:03:42 2019 +++ doc/install/linux/install.pl Tue Feb 19 19:14:54 2019 @@ -77,7 +77,7 @@ &mt('Stopping execution.')."\n"; exit; } else { - print LOG '$Id: install.pl,v 1.50 2019/02/19 19:03:42 raeburn Exp $'."\n"; + print LOG '$Id: install.pl,v 1.51 2019/02/19 19:14:54 raeburn Exp $'."\n"; } # @@ -2477,10 +2477,10 @@ my ($currmysqlpass,$usesauth,$is_mariadb) = @_; if ($usesauth) { if ($is_mariadb) { - return ("ALTER USER 'root'\@'localhost' IDENTIFIED WITH mysql_native_password BY '$currmysqlpass'", + return ("ALTER USER 'root'\@'localhost' IDENTIFIED BY '$currmysqlpass'", "FLUSH PRIVILEGES;"); } else { - return ("ALTER USER 'root'\@'localhost' IDENTIFIED BY '$currmysqlpass'", + return ("ALTER USER 'root'\@'localhost' IDENTIFIED WITH mysql_native_password BY '$currmysqlpass'", "FLUSH PRIVILEGES;"); } } else { From raeburn at source.lon-capa.org Tue Feb 19 14:22:37 2019 From: raeburn at source.lon-capa.org (raeburn) Date: Tue, 19 Feb 2019 19:22:37 -0000 Subject: [LON-CAPA-cvs] cvs: doc /install/linux install.pl Message-ID: raeburn Tue Feb 19 19:22:37 2019 EDT Modified files: /doc/install/linux install.pl Log: - Standard indent is 4 spaces. Index: doc/install/linux/install.pl diff -u doc/install/linux/install.pl:1.51 doc/install/linux/install.pl:1.52 --- doc/install/linux/install.pl:1.51 Tue Feb 19 19:14:54 2019 +++ doc/install/linux/install.pl Tue Feb 19 19:22:36 2019 @@ -77,7 +77,7 @@ &mt('Stopping execution.')."\n"; exit; } else { - print LOG '$Id: install.pl,v 1.51 2019/02/19 19:14:54 raeburn Exp $'."\n"; + print LOG '$Id: install.pl,v 1.52 2019/02/19 19:22:36 raeburn Exp $'."\n"; } # @@ -2386,9 +2386,9 @@ if ($usesauth) { @mysql_commands = ("INSERT user (Host, User, ssl_cipher, x509_issuer, x509_subject, authentication_string) VALUES('localhost','www','','','','')"); if ($is_mariadb) { - push(@mysql_commands,"ALTER USER 'www'\@'localhost' IDENTIFIED BY 'localhostkey'"); + push(@mysql_commands,"ALTER USER 'www'\@'localhost' IDENTIFIED BY 'localhostkey'"); } else { - push(@mysql_commands,"ALTER USER 'www'\@'localhost' IDENTIFIED WITH mysql_native_password BY 'localhostkey'"); + push(@mysql_commands,"ALTER USER 'www'\@'localhost' IDENTIFIED WITH mysql_native_password BY 'localhostkey'"); } } elsif ($hasauthcol) { @mysql_commands = ("INSERT user (Host, User, Password, ssl_cipher, x509_issuer, x509_subject, authentication_string) VALUES('localhost','www',password('localhostkey'),'','','','');"); From raeburn at source.lon-capa.org Tue Feb 19 14:24:28 2019 From: raeburn at source.lon-capa.org (raeburn) Date: Tue, 19 Feb 2019 19:24:28 -0000 Subject: [LON-CAPA-cvs] cvs: doc(version_2_11_X) /install/linux install.pl Message-ID: raeburn Tue Feb 19 19:24:28 2019 EDT Modified files: (Branch: version_2_11_X) /doc/install/linux install.pl Log: - For 2.11 Backport 1.50, 1.51, 1.52 Index: doc/install/linux/install.pl diff -u doc/install/linux/install.pl:1.45.2.1 doc/install/linux/install.pl:1.45.2.2 --- doc/install/linux/install.pl:1.45.2.1 Sat Feb 16 16:19:11 2019 +++ doc/install/linux/install.pl Tue Feb 19 19:24:28 2019 @@ -75,7 +75,7 @@ &mt('Stopping execution.')."\n"; exit; } else { - print LOG '$Id: install.pl,v 1.45.2.1 2019/02/16 16:19:11 raeburn Exp $'."\n"; + print LOG '$Id: install.pl,v 1.45.2.2 2019/02/19 19:24:28 raeburn Exp $'."\n"; } # @@ -1953,8 +1953,9 @@ sub setup_mysql_permissions { my ($dbh,$has_pass, at mysql_lc_commands) = @_; my ($mysqlversion,$mysqlsubver,$mysqlname) = &get_mysql_version(); - my ($usesauth,$hasauthcol, at mysql_commands); + my ($usesauth,$is_mariadb,$hasauthcol, at mysql_commands); if ($mysqlname =~ /^MariaDB/i) { + $is_mariadb = 1; if ($mysqlversion >= 10.2) { $usesauth = 1; } elsif ($mysqlversion >= 5.5) { @@ -1968,8 +1969,12 @@ } } if ($usesauth) { - @mysql_commands = ("INSERT user (Host, User, ssl_cipher, x509_issuer, x509_subject, authentication_string) VALUES('localhost','www','','','','')", - "ALTER USER 'www'\@'localhost' IDENTIFIED BY 'localhostkey'"); + @mysql_commands = ("INSERT user (Host, User, ssl_cipher, x509_issuer, x509_subject, authentication_string) VALUES('localhost','www','','','','')"); + if ($is_mariadb) { + push(@mysql_commands,"ALTER USER 'www'\@'localhost' IDENTIFIED BY 'localhostkey'"); + } else { + push(@mysql_commands,"ALTER USER 'www'\@'localhost' IDENTIFIED WITH mysql_native_password BY 'localhostkey'"); + } } elsif ($hasauthcol) { @mysql_commands = ("INSERT user (Host, User, Password, ssl_cipher, x509_issuer, x509_subject, authentication_string) VALUES('localhost','www',password('localhostkey'),'','','','');"); } else { @@ -2024,7 +2029,7 @@ } } if ($got_passwd) { - my (@newpass_cmds) = &new_mysql_rootpasswd($newmysqlpass,$usesauth); + my (@newpass_cmds) = &new_mysql_rootpasswd($newmysqlpass,$usesauth,$is_mariadb); push(@mysql_commands, at newpass_cmds); } else { print_and_log(&mt('Failed to get MySQL root password from user input.')."\n"); @@ -2054,10 +2059,15 @@ } sub new_mysql_rootpasswd { - my ($currmysqlpass,$usesauth) = @_; + my ($currmysqlpass,$usesauth,$is_mariadb) = @_; if ($usesauth) { - return ("ALTER USER 'root'\@'localhost' IDENTIFIED BY '$currmysqlpass'", - "FLUSH PRIVILEGES;"); + if ($is_mariadb) { + return ("ALTER USER 'root'\@'localhost' IDENTIFIED BY '$currmysqlpass'", + "FLUSH PRIVILEGES;"); + } else { + return ("ALTER USER 'root'\@'localhost' IDENTIFIED WITH mysql_native_password BY '$currmysqlpass'", + "FLUSH PRIVILEGES;"); + } } else { return ("SET PASSWORD FOR 'root'\@'localhost'=PASSWORD('$currmysqlpass')", "FLUSH PRIVILEGES;"); From raeburn at source.lon-capa.org Tue Feb 19 14:58:06 2019 From: raeburn at source.lon-capa.org (raeburn) Date: Tue, 19 Feb 2019 19:58:06 -0000 Subject: [LON-CAPA-cvs] cvs: doc /loncapafiles loncapafiles.lpml Message-ID: raeburn Tue Feb 19 19:58:06 2019 EDT Modified files: /doc/loncapafiles loncapafiles.lpml Log: - Correct location for systemctl executable in Ubuntu 18LTS. Index: doc/loncapafiles/loncapafiles.lpml diff -u doc/loncapafiles/loncapafiles.lpml:1.978 doc/loncapafiles/loncapafiles.lpml:1.979 --- doc/loncapafiles/loncapafiles.lpml:1.978 Sun Jan 27 16:03:08 2019 +++ doc/loncapafiles/loncapafiles.lpml Tue Feb 19 19:58:05 2019 @@ -2,7 +2,7 @@ "http://lpml.sourceforge.net/DTD/lpml.dtd"> - + - + - + - + - + - +