version 1.75, 2005/01/20 16:30:52
|
version 1.79, 2005/06/26 15:42:52
|
Line 86 sub readfile {
|
Line 86 sub readfile {
|
# ============================================================ Write a userfile |
# ============================================================ Write a userfile |
|
|
sub writefile { |
sub writefile { |
(my $courseid, my $which,$ENV{'form.output'})=@_; |
(my $courseid, my $which,$env{'form.output'})=@_; |
my %crsdata=&Apache::lonnet::coursedescription($courseid); |
my %crsdata=&Apache::lonnet::coursedescription($courseid); |
return &Apache::lonnet::finishuserfileupload( |
return &Apache::lonnet::finishuserfileupload( |
$crsdata{'num'},$crsdata{'domain'}, |
$crsdata{'num'},$crsdata{'domain'}, |
$crsdata{'home'}, |
|
'output',$which); |
'output',$which); |
} |
} |
|
|
Line 238 sub copycoursefiles {
|
Line 237 sub copycoursefiles {
|
|
|
sub print_course_creation_page { |
sub print_course_creation_page { |
my $r=shift; |
my $r=shift; |
my $defdom=$ENV{'request.role.domain'}; |
my $defdom=$env{'request.role.domain'}; |
my %host_servers = &Apache::loncommon::get_library_servers($defdom); |
my %host_servers = &Apache::loncommon::get_library_servers($defdom); |
my $course_home = '<select name="course_home" size="1">'."\n"; |
my $course_home = '<select name="course_home" size="1">'."\n"; |
foreach my $server (sort(keys(%host_servers))) { |
foreach my $server (sort(keys(%host_servers))) { |
Line 253 sub print_course_creation_page {
|
Line 252 sub print_course_creation_page {
|
my $bodytag=&Apache::loncommon::bodytag('Create a New Course'); |
my $bodytag=&Apache::loncommon::bodytag('Create a New Course'); |
my $helplink=&Apache::loncommon::help_open_topic('Create_Course',&mt('Help on Creating Courses')); |
my $helplink=&Apache::loncommon::help_open_topic('Create_Course',&mt('Help on Creating Courses')); |
my $cloneform=&Apache::loncommon::select_dom_form |
my $cloneform=&Apache::loncommon::select_dom_form |
($ENV{'request.role.domain'},'clonedomain'). |
($env{'request.role.domain'},'clonedomain'). |
&Apache::loncommon::selectcourse_link |
&Apache::loncommon::selectcourse_link |
('ccrs','clonecourse','clonedomain'); |
('ccrs','clonecourse','clonedomain'); |
my $coursebrowserjs=&Apache::loncommon::coursebrowser_javascript($ENV{'request.role.domain'}); |
my $coursebrowserjs=&Apache::loncommon::coursebrowser_javascript($env{'request.role.domain'}); |
my $starttime = time; |
my $starttime = time; |
my $endtime = time+(6*30*24*60*60); # 6 months from now, approx |
my $endtime = time+(6*30*24*60*60); # 6 months from now, approx |
my $enroll_table = &Apache::londropadd::date_setting_table($starttime,$endtime,'create_enrolldates'); |
my $enroll_table = &Apache::londropadd::date_setting_table($starttime,$endtime,'create_enrolldates'); |
Line 327 sub print_course_creation_page {
|
Line 326 sub print_course_creation_page {
|
'pcda' => "Please choose the default authentication method to be used by new users added to this LON-CAPA domain by the automated enrollment process", |
'pcda' => "Please choose the default authentication method to be used by new users added to this LON-CAPA domain by the automated enrollment process", |
'nech' => "Notification of enrollment changes", |
'nech' => "Notification of enrollment changes", |
'nccl' => "Notification to course coordinator via LON-CAPA message when enrollment changes occur during the automated update?", |
'nccl' => "Notification to course coordinator via LON-CAPA message when enrollment changes occur during the automated update?", |
|
'ndcl' => "Notification to domain coordinator via LON-CAPA message when enrollment changes occur during the automated update?", |
'irsp' => "Include retrieval of student photographs?", |
'irsp' => "Include retrieval of student photographs?", |
'rshm' => 'Resource Space Home', |
'rshm' => 'Resource Space Home', |
'opco' => "Open Course" |
'opco' => "Open Course" |
); |
); |
|
my $html=&Apache::lonxml::xmlbegin(); |
$r->print(<<ENDDOCUMENT); |
$r->print(<<ENDDOCUMENT); |
<html> |
$html |
|
<head> |
<script language="JavaScript" type="text/javascript"> |
<script language="JavaScript" type="text/javascript"> |
var editbrowser = null; |
var editbrowser = null; |
function openbrowser(formname,elementname) { |
function openbrowser(formname,elementname) { |
Line 354 function openbrowser(formname,elementnam
|
Line 356 function openbrowser(formname,elementnam
|
$javascript_validations |
$javascript_validations |
</script> |
</script> |
$coursebrowserjs |
$coursebrowserjs |
<head> |
|
<title>The LearningOnline Network with CAPA</title> |
<title>The LearningOnline Network with CAPA</title> |
</head> |
</head> |
$bodytag |
$bodytag |
Line 523 $locform
|
Line 524 $locform
|
<b>$lt{'nech'}</b><br /> |
<b>$lt{'nech'}</b><br /> |
$lt{'nccl'}<br/> |
$lt{'nccl'}<br/> |
<label> |
<label> |
<input type="radio" name="notify" value="1" />$lt{'yes'} |
<input type="radio" name="notify_owner" value="1" />$lt{'yes'} |
</label> |
</label> |
<label> |
<label> |
<input type="radio" name="notify" value="0" checked="true" />$lt{'no'} |
<input type="radio" name="notify_owner" value="0" checked="true" />$lt{'no'} |
|
</label> |
|
<br /> |
|
$lt{'ndcl'}<br/> |
|
<label> |
|
<input type="radio" name="notify_dc" value="1" />$lt{'yes'} |
|
</label> |
|
<label> |
|
<input type="radio" name="notify_dc" value="0" checked="true" />$lt{'no'} |
</label> |
</label> |
</p><p> |
</p><p> |
<b>$lt{'irsp'}</b> |
<b>$lt{'irsp'}</b> |
Line 547 $lt{'nccl'}<br/>
|
Line 556 $lt{'nccl'}<br/>
|
<label> |
<label> |
<b>$lt{'dmn'}:</b> $domform |
<b>$lt{'dmn'}:</b> $domform |
</label> |
</label> |
</p><p> |
|
<label> |
|
<b>$lt{'ierc'}:</b> |
|
<input type="checkbox" name="expireown" checked /> |
|
</label> |
|
</p> |
</p> |
<p> |
<p> |
<input type="hidden" name="phase" value="two" /> |
<input type="hidden" name="phase" value="two" /> |
Line 567 ENDDOCUMENT
|
Line 571 ENDDOCUMENT
|
|
|
sub create_course { |
sub create_course { |
my $r=shift; |
my $r=shift; |
my $ccuname=$ENV{'form.ccuname'}; |
my $ccuname=$env{'form.ccuname'}; |
my $ccdomain=$ENV{'form.ccdomain'}; |
my $ccdomain=$env{'form.ccdomain'}; |
$ccuname=~s/\W//g; |
$ccuname=~s/\W//g; |
$ccdomain=~s/\W//g; |
$ccdomain=~s/\W//g; |
|
|
Line 580 sub create_course {
|
Line 584 sub create_course {
|
my $autharg; |
my $autharg; |
my $authtype; |
my $authtype; |
|
|
if ($ENV{'form.login'} eq 'krb') { |
if ($env{'form.login'} eq 'krb') { |
$authtype = 'krb'; |
$authtype = 'krb'; |
$authtype .=$ENV{'form.krbver'}; |
$authtype .=$env{'form.krbver'}; |
$autharg = $ENV{'form.krbarg'}; |
$autharg = $env{'form.krbarg'}; |
} elsif ($ENV{'form.login'} eq 'int') { |
} elsif ($env{'form.login'} eq 'int') { |
$authtype ='internal'; |
$authtype ='internal'; |
if ((defined($ENV{'form.intarg'})) && ($ENV{'form.intarg'})) { |
if ((defined($env{'form.intarg'})) && ($env{'form.intarg'})) { |
$autharg = $ENV{'form.intarg'}; |
$autharg = $env{'form.intarg'}; |
} |
} |
} elsif ($ENV{'form.login'} eq 'loc') { |
} elsif ($env{'form.login'} eq 'loc') { |
$authtype = 'localauth'; |
$authtype = 'localauth'; |
if ((defined($ENV{'form.locarg'})) && ($ENV{'form.locarg'})) { |
if ((defined($env{'form.locarg'})) && ($env{'form.locarg'})) { |
$autharg = $ENV{'form.locarg'}; |
$autharg = $env{'form.locarg'}; |
} |
} |
} |
} |
|
|
my $logmsg; |
my $logmsg; |
|
my $html=&Apache::lonxml::xmlbegin(); |
my $bodytag=&Apache::loncommon::bodytag('Create a New Course'); |
my $bodytag=&Apache::loncommon::bodytag('Create a New Course'); |
$r->print(<<ENDENHEAD); |
$r->print(<<ENDENHEAD); |
<html> |
$html |
<head> |
<head> |
<title>The LearningOnline Network with CAPA</title> |
<title>The LearningOnline Network with CAPA</title> |
</head> |
</head> |
Line 609 ENDENHEAD
|
Line 614 ENDENHEAD
|
my $args = { |
my $args = { |
ccuname => $ccuname, |
ccuname => $ccuname, |
ccdomain => $ccdomain, |
ccdomain => $ccdomain, |
cdescr => $ENV{'form.title'}, |
cdescr => $env{'form.title'}, |
curl => $ENV{'form.topmap'}, |
curl => $env{'form.topmap'}, |
course_domain => $ENV{'request.role.domain'}, |
course_domain => $env{'request.role.domain'}, |
course_home => $ENV{'form.course_home'}, |
course_home => $env{'form.course_home'}, |
nonstandard => $ENV{'form.nonstandard'}, |
nonstandard => $env{'form.nonstandard'}, |
crscode => $ENV{'form.crscode'}, |
crscode => $env{'form.crscode'}, |
clonecourse => $ENV{'form.clonecourse'}, |
clonecourse => $env{'form.clonecourse'}, |
clonedomain => $ENV{'form.clonedomain'}, |
clonedomain => $env{'form.clonedomain'}, |
crsid => $ENV{'form.crsid'}, |
crsid => $env{'form.crsid'}, |
curruser => $ENV{'user.name'}, |
curruser => $env{'user.name'}, |
crssections => $ENV{'form.crssections'}, |
crssections => $env{'form.crssections'}, |
crsxlist => $ENV{'form.crsxlist'}, |
crsxlist => $env{'form.crsxlist'}, |
autoadds => $ENV{'form.autoadds'}, |
autoadds => $env{'form.autoadds'}, |
autodrops => $ENV{'form.autodrops'}, |
autodrops => $env{'form.autodrops'}, |
notify => $ENV{'form.notify'}, |
notify_owner => $env{'form.notify_owner'}, |
no_end_date => $ENV{'form.no_end_date'}, |
notify_dc => $env{'form.notify_dc'}, |
showphotos => $ENV{'form.showphotos'}, |
no_end_date => $env{'form.no_end_date'}, |
|
showphotos => $env{'form.showphotos'}, |
authtype => $authtype, |
authtype => $authtype, |
autharg => $autharg, |
autharg => $autharg, |
enrollstart => $enrollstart, |
enrollstart => $enrollstart, |
enrollend => $enrollend, |
enrollend => $enrollend, |
startaccess => $startaccess, |
startaccess => $startaccess, |
endaccess => $endaccess, |
endaccess => $endaccess, |
setpolicy => $ENV{'form.setpolicy'}, |
setpolicy => $env{'form.setpolicy'}, |
setcontent => $ENV{'form.setcontent'}, |
setcontent => $env{'form.setcontent'}, |
reshome => $ENV{'form.reshome'}, |
reshome => $env{'form.reshome'}, |
setkeys => $ENV{'form.setkeys'}, |
setkeys => $env{'form.setkeys'}, |
keyauth => $ENV{'form.keyauth'}, |
keyauth => $env{'form.keyauth'}, |
disresdis => $ENV{'form.disresdis'}, |
disresdis => $env{'form.disresdis'}, |
disablechat => $ENV{'form.disablechat'}, |
disablechat => $env{'form.disablechat'}, |
openall => $ENV{'form.openall'}, |
openall => $env{'form.openall'}, |
firstres => $ENV{'form.firstres'} |
firstres => $env{'form.firstres'} |
}; |
}; |
|
|
# |
# |
Line 662 ENDENHEAD
|
Line 668 ENDENHEAD
|
} |
} |
# Check the proposed home server for the course |
# Check the proposed home server for the course |
my %host_servers = &Apache::loncommon::get_library_servers |
my %host_servers = &Apache::loncommon::get_library_servers |
($ENV{'request.role.domain'}); |
($env{'request.role.domain'}); |
if (! exists($host_servers{$ENV{'form.course_home'}})) { |
if (! exists($host_servers{$env{'form.course_home'}})) { |
$r->print(&mt('Invalid home server for course').': '. |
$r->print(&mt('Invalid home server for course').': '. |
$ENV{'form.course_home'}.'</body></html>'); |
$env{'form.course_home'}.'</body></html>'); |
return; |
return; |
} |
} |
my ($courseid,$crsudom,$crsunum); |
my ($courseid,$crsudom,$crsunum); |
$r->print(&construct_course($args,\$logmsg,\$courseid,\$crsudom,\$crsunum)); |
$r->print(&construct_course($args,\$logmsg,\$courseid,\$crsudom,\$crsunum,$env{'user.domain'},$env{'user.name'})); |
|
|
# |
# |
# Make current user course adminstrator |
# Make the requested user a course coordinator |
# |
|
my $end=undef; |
|
my $addition=''; |
|
if ($ENV{'form.expireown'}) { $end=time+5; $addition='expired'; } |
|
$r->print(&mt('Assigning').' '.$addition.' '.&mt('role of course coordinator to self').': '. |
|
&Apache::lonnet::assignrole( |
|
$ENV{'user.domain'},$ENV{'user.name'},$courseid,'cc',$end).'<br>'); |
|
# |
|
# Make additional user course administrator |
|
# |
# |
if (($ccdomain) && ($ccuname)) { |
if (($ccdomain) && ($ccuname)) { |
$r->print(&mt('Assigning role of course coordinator to').' '. |
$r->print(&mt('Assigning role of course coordinator to').' '. |
$ccuname.' at '.$ccdomain.': '. |
$ccuname.' at '.$ccdomain.': '. |
&Apache::lonnet::assignrole($ccdomain,$ccuname,$courseid,'cc').'<p>'); |
&Apache::lonnet::assignrole($ccdomain,$ccuname,$courseid,'cc').'<p>'); |
} |
} |
if ($ENV{'form.setkeys'}) { |
if ($env{'form.setkeys'}) { |
$r->print( |
$r->print( |
'<p><a href="/adm/managekeys?cid='.$crsudom.'_'.$crsunum.'">'.&mt('Manage Access Keys').'</a></p>'); |
'<p><a href="/adm/managekeys?cid='.$crsudom.'_'.$crsunum.'">'.&mt('Manage Access Keys').'</a></p>'); |
} |
} |
Line 698 ENDENHEAD
|
Line 695 ENDENHEAD
|
} |
} |
|
|
sub construct_course { |
sub construct_course { |
my ($args,$logmsg,$courseid,$crsudom,$crsunum) = @_; |
my ($args,$logmsg,$courseid,$crsudom,$crsunum,$udom,$uname) = @_; |
my $outcome; |
my $outcome; |
|
|
# |
# |
Line 822 sub construct_course {
|
Line 819 sub construct_course {
|
if ($args->{'autodrops'}) { |
if ($args->{'autodrops'}) { |
$cenv{'internal.autodrops'}=$args->{'autodrops'}; |
$cenv{'internal.autodrops'}=$args->{'autodrops'}; |
} |
} |
if ($args->{'notify'}) { |
# check for notification of enrollment changes |
if ($args->{'ccuname'}) { |
my @notified = (); |
$cenv{'internal.notifylist'} = $args->{'ccuname'}.'@'.$args->{'ccdomain'}; |
if ($args->{'notify_owner'}) { |
} |
if ($args->{'ccuname'} ne '') { |
|
push(@notified,$args->{'ccuname'}.'@'.$args->{'ccdomain'}); |
|
} |
|
} |
|
if ($args->{'notify_dc'}) { |
|
if ($uname ne '') { |
|
push(@notified,$uname.'@'.$udom); |
|
} |
|
} |
|
if (@notified > 0) { |
|
my $notifylist; |
|
if (@notified > 1) { |
|
$notifylist = join(',',@notified); |
|
} else { |
|
$notifylist = $notified[0]; |
|
} |
|
$cenv{'internal.notifylist'} = $notifylist; |
} |
} |
if (@badclasses > 0) { |
if (@badclasses > 0) { |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
Line 956 sub handler {
|
Line 969 sub handler {
|
return OK; |
return OK; |
} |
} |
|
|
if (&Apache::lonnet::allowed('ccc',$ENV{'request.role.domain'})) { |
if (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) { |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
|
|
if ($ENV{'form.phase'} eq 'two') { |
if ($env{'form.phase'} eq 'two') { |
&create_course($r); |
&create_course($r); |
} else { |
} else { |
&print_course_creation_page($r); |
&print_course_creation_page($r); |
} |
} |
} else { |
} else { |
$ENV{'user.error.msg'}= |
$env{'user.error.msg'}= |
"/adm/createcourse:ccc:0:0:Cannot create courses"; |
"/adm/createcourse:ccc:0:0:Cannot create courses"; |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |