--- loncom/interface/loncommon.pm 2019/05/02 23:09:38 1.1329
+++ loncom/interface/loncommon.pm 2020/06/09 21:32:32 1.1343
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1329 2019/05/02 23:09:38 raeburn Exp $
+# $Id: loncommon.pm,v 1.1343 2020/06/09 21:32:32 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -80,7 +80,6 @@ use Text::Aspell;
use Authen::Captcha;
use Captcha::reCAPTCHA;
use JSON::DWIW;
-use LWP::UserAgent;
use Crypt::DES;
use DynaLoader; # for Crypt::DES version
use MIME::Lite;
@@ -436,7 +435,7 @@ sub studentbrowser_javascript {
OFFLOAD
- }
}
}
}
@@ -8937,8 +9073,7 @@ sub modal_link {
$target_attr = 'target="'.$target.'"';
}
return <<"ENDLINK";
-
- $linktext
+$linktext
ENDLINK
}
@@ -15094,6 +15229,8 @@ Inputs:
from - Sender's email address
+replyto - Reply-To email address
+
to - Email address of recipient
subject - Subject of email
@@ -15104,8 +15241,6 @@ cc_string - Carbon copy email ad
bcc - Blind carbon copy email address
-type - File type of attachment
-
attachment_path - Path of file to be attached
file_name - Name of file to be attached
@@ -15122,8 +15257,9 @@ attachment_text - The body of an attac
############################################################
sub mime_email {
- my ($from, $to, $subject, $body, $cc_string, $bcc, $attachment_path,
- $file_name, $attachment_text) = @_;
+ my ($from,$replyto,$to,$subject,$body,$cc_string,$bcc,$attachment_path,
+ $file_name,$attachment_text) = @_;
+
my $msg = MIME::Lite->new(
From => $from,
To => $to,
@@ -15131,6 +15267,9 @@ sub mime_email {
Type =>'TEXT',
Data => $body,
);
+ if ($replyto ne '') {
+ $msg->add("Reply-To" => $replyto);
+ }
if ($cc_string ne '') {
$msg->add("Cc" => $cc_string);
}
@@ -15924,7 +16063,8 @@ sub construct_course {
$outcome .= $clonemsg.$linefeed;
my %oldcenv=&Apache::lonnet::dump('environment',$$crsudom,$$crsunum);
# Copy all files
- &Apache::lonclonecourse::copycoursefiles($cloneid,$$courseid,$args->{'datemode'},$args->{'dateshift'});
+ &Apache::lonclonecourse::copycoursefiles($cloneid,$$courseid,$args->{'datemode'},
+ $args->{'dateshift'},$args->{'crscode'});
# Restore URL
$cenv{'url'}=$oldcenv{'url'};
# Restore title
@@ -16191,12 +16331,17 @@ sub construct_course {
# Open all assignments
#
if ($args->{'openall'}) {
+ my $opendate = time;
+ if ($args->{'openallfrom'} =~ /^\d+$/) {
+ $opendate = $args->{'openallfrom'};
+ }
my $storeunder=$$crsudom.'_'.$$crsunum.'.0.opendate';
- my %storecontent = ($storeunder => time,
+ my %storecontent = ($storeunder => $opendate,
$storeunder.'.type' => 'date_start');
-
- $outcome .= &mt('Opening all assignments').': '.&Apache::lonnet::cput
- ('resourcedata',\%storecontent,$$crsudom,$$crsunum).$linefeed;
+ $outcome .= &mt('All assignments open starting [_1]',
+ &Apache::lonlocal::locallocaltime($opendate)).': '.
+ &Apache::lonnet::cput
+ ('resourcedata',\%storecontent,$$crsudom,$$crsunum).$linefeed;
}
#
# Set first page
@@ -18195,7 +18340,7 @@ sub shorten_symbs {
sub is_nonframeable {
my ($url,$absolute,$hostname,$ip,$nocache) = @_;
my ($remprotocol,$remhost) = ($url =~ m{^(https?)\://(([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,})}i);
- return if (($remprotocol eq '') || ($remhost eq ''));
+ return if (($remprotocol eq '') || ($remhost eq ''));
$remprotocol = lc($remprotocol);
$remhost = lc($remhost);
@@ -18203,7 +18348,7 @@ sub is_nonframeable {
if ($remprotocol eq 'https') {
$remport = 443;
}
- my ($result,$cached) = &Apache::lonnet::is_cached_new('exturlnoiframe',$remhost.':'.$remport);
+ my ($result,$cached) = &Apache::lonnet::is_cached_new('noiframe',$remhost.':'.$remport);
if ($cached) {
unless ($nocache) {
if ($result) {