version 1.78, 2005/04/07 06:56:23
|
version 1.86, 2006/03/21 18:34:23
|
Line 90 sub writefile {
|
Line 90 sub writefile {
|
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 160 sub copyresourcedb {
|
Line 159 sub copyresourcedb {
|
my %newdata=(); |
my %newdata=(); |
undef %newdata; |
undef %newdata; |
my $startdate=$data{$origcrsid.'.0.opendate'}; |
my $startdate=$data{$origcrsid.'.0.opendate'}; |
|
if (!$startdate) { |
|
# now global start date for assements try the enrollment start |
|
my %start=&Apache::lonnet::get('environment', |
|
['default_enrollment_start_date'], |
|
$origcrsdata{'domain'},$origcrsdata{'num'}); |
|
|
|
$startdate = $start{'default_enrollment_start_date'}; |
|
} |
my $today=time; |
my $today=time; |
my $delta=0; |
my $delta=0; |
if ($startdate) { |
if ($startdate) { |
Line 194 sub copyresourcedb {
|
Line 201 sub copyresourcedb {
|
$thiskey=~s/^$origcrsid/$newcrsid/; |
$thiskey=~s/^$origcrsid/$newcrsid/; |
$newdata{$thiskey}=$data{$_}; |
$newdata{$thiskey}=$data{$_}; |
if ($data{$_.'.type'}=~/^date_(start|end)$/) { |
if ($data{$_.'.type'}=~/^date_(start|end)$/) { |
$newdata{$thiskey}=$newdata{$thiskey}+$delta; |
if ($delta > 0) { |
|
$newdata{$thiskey}=$newdata{$thiskey}+$delta; |
|
} else { |
|
# no delta, it's unlikely we want the old dates and times |
|
delete($newdata{$thiskey}); |
|
delete($newdata{$thiskey.'.type'}); |
|
} |
} |
} |
} |
} |
return &Apache::lonnet::put |
return &Apache::lonnet::put |
Line 215 sub copyuserfiles {
|
Line 228 sub copyuserfiles {
|
|
|
sub copydbfiles { |
sub copydbfiles { |
my ($origcrsid,$newcrsid)=@_; |
my ($origcrsid,$newcrsid)=@_; |
|
|
|
my ($origcrs_discussion) = ($origcrsid=~m|^/(.*)|); |
|
$origcrs_discussion=~s|/|_|g; |
foreach (&crsdirlist($origcrsid)) { |
foreach (&crsdirlist($origcrsid)) { |
if ($_=~/\.db$/) { |
if ($_=~/\.db$/) { |
unless |
unless |
($_=~/^(nohist\_|discussiontimes|classlist|versionupdate|resourcedata)/) { |
($_=~/^(nohist\_|discussiontimes|classlist|versionupdate|resourcedata|\Q$origcrs_discussion\E|slots|slot_reservations|(grading|review)queue|CODEs)/) { |
©db($origcrsid,$newcrsid,$_); |
©db($origcrsid,$newcrsid,$_); |
|
my $histfile=$_; |
|
$histfile=~s/\.db$/\.hist/; |
|
©file($origcrsid,$newcrsid,$histfile); |
} |
} |
} |
} |
} |
} |
Line 250 sub print_course_creation_page {
|
Line 269 sub print_course_creation_page {
|
} |
} |
$course_home .= "\n</select>\n"; |
$course_home .= "\n</select>\n"; |
my $domform = &Apache::loncommon::select_dom_form($defdom,'ccdomain'); |
my $domform = &Apache::loncommon::select_dom_form($defdom,'ccdomain'); |
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'). |
Line 332 sub print_course_creation_page {
|
Line 350 sub print_course_creation_page {
|
'rshm' => 'Resource Space Home', |
'rshm' => 'Resource Space Home', |
'opco' => "Open Course" |
'opco' => "Open Course" |
); |
); |
my $html=&Apache::lonxml::xmlbegin(); |
my $js = <<END; |
$r->print(<<ENDDOCUMENT); |
<script type="text/javascript"> |
$html |
|
<head> |
|
<script language="JavaScript" type="text/javascript"> |
|
var editbrowser = null; |
var editbrowser = null; |
function openbrowser(formname,elementname) { |
function openbrowser(formname,elementname) { |
var url = '/res/?'; |
var url = '/res/?'; |
Line 357 function openbrowser(formname,elementnam
|
Line 372 function openbrowser(formname,elementnam
|
$javascript_validations |
$javascript_validations |
</script> |
</script> |
$coursebrowserjs |
$coursebrowserjs |
<title>The LearningOnline Network with CAPA</title> |
END |
</head> |
|
$bodytag |
my $start_page = |
|
&Apache::loncommon::start_page('Create a New Course',$js); |
|
my $end_page = |
|
&Apache::loncommon::end_page(); |
|
|
|
$r->print(<<ENDDOCUMENT); |
|
$start_page |
$helplink |
$helplink |
<form action="/adm/createcourse" method="post" name="ccrs"> |
<form action="/adm/createcourse" method="post" name="ccrs"> |
<h2>$lt{'cinf'}</h2> |
<h2>$lt{'cinf'}</h2> |
Line 563 $lt{'ndcl'}<br/>
|
Line 584 $lt{'ndcl'}<br/>
|
<input type="button" onClick="verify_message(this.form)" value="$lt{'opco'}" /> |
<input type="button" onClick="verify_message(this.form)" value="$lt{'opco'}" /> |
</p> |
</p> |
</form> |
</form> |
</body> |
$end_page |
</html> |
|
ENDDOCUMENT |
ENDDOCUMENT |
} |
} |
|
|
Line 602 sub create_course {
|
Line 622 sub create_course {
|
} |
} |
|
|
my $logmsg; |
my $logmsg; |
my $html=&Apache::lonxml::xmlbegin(); |
my $start_page=&Apache::loncommon::start_page('Create a New Course'); |
my $bodytag=&Apache::loncommon::bodytag('Create a New Course'); |
$r->print($start_page); |
$r->print(<<ENDENHEAD); |
|
$html |
|
<head> |
|
<title>The LearningOnline Network with CAPA</title> |
|
</head> |
|
$bodytag |
|
ENDENHEAD |
|
|
|
my $args = { |
my $args = { |
ccuname => $ccuname, |
ccuname => $ccuname, |
Line 664 ENDENHEAD
|
Line 677 ENDENHEAD
|
<input type="hidden" name="ccdomain" value="'.$ccdomain.'" /> |
<input type="hidden" name="ccdomain" value="'.$ccdomain.'" /> |
<input name="userrole" type="submit" value="'. |
<input name="userrole" type="submit" value="'. |
&mt('Create User').'" /> |
&mt('Create User').'" /> |
</form></body></html>'); |
</form>'.&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
# Check the proposed home server for the course |
# Check the proposed home server for the course |
Line 672 ENDENHEAD
|
Line 685 ENDENHEAD
|
($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'}.&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
my ($courseid,$crsudom,$crsunum); |
my ($courseid,$crsudom,$crsunum); |
Line 692 ENDENHEAD
|
Line 705 ENDENHEAD
|
} |
} |
# Flush the course logs so reverse user roles immediately updated |
# Flush the course logs so reverse user roles immediately updated |
&Apache::lonnet::flushcourselogs(); |
&Apache::lonnet::flushcourselogs(); |
$r->print('<p>'.&mt('Roles will be active at next login').'.</p></body></html>'); |
$r->print('<p>'.&mt('Roles will be active at next login').'.</p>'. |
|
&Apache::loncommon::end_page()); |
} |
} |
|
|
sub construct_course { |
sub construct_course { |
Line 782 sub construct_course {
|
Line 796 sub construct_course {
|
foreach my $item (@sections) { |
foreach my $item (@sections) { |
my ($sec,$gp) = split/:/,$item; |
my ($sec,$gp) = split/:/,$item; |
my $class = $args->{'crscode'}.$sec; |
my $class = $args->{'crscode'}.$sec; |
my $addcheck = &Apache::lonnet::auto_new_course($crsunum,$crsudom,$class,$cenv{'internal.courseowner'}); |
my $addcheck = &Apache::lonnet::auto_new_course($$crsunum,$$crsudom,$class,$cenv{'internal.courseowner'}); |
$cenv{'internal.sectionnums'} .= $item.','; |
$cenv{'internal.sectionnums'} .= $item.','; |
unless ($addcheck eq 'ok') { |
unless ($addcheck eq 'ok') { |
push @badclasses, $class; |
push @badclasses, $class; |