--- loncom/interface/lonrequestcourse.pm 2009/08/04 20:15:50 1.2 +++ loncom/interface/lonrequestcourse.pm 2009/08/12 14:24:35 1.11 @@ -1,7 +1,7 @@ # The LearningOnline Network # Request a course # -# $Id: lonrequestcourse.pm,v 1.2 2009/08/04 20:15:50 raeburn Exp $ +# $Id: lonrequestcourse.pm,v 1.11 2009/08/12 14:24:35 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -55,7 +55,8 @@ use Apache::Constants qw(:common :http); use Apache::lonnet; use Apache::loncommon; use Apache::lonlocal; -use LONCAPA; +use Apache::loncoursequeueadmin; +use LONCAPA qw(:DEFAULT :match); sub handler { my ($r) = @_; @@ -112,7 +113,19 @@ sub handler { } } + my %trail = ( + crstype => 'Course Request Action', + codepick => 'Category', + courseinfo => 'Description', + enrollment => 'Enrollment', + personnel => 'Personnel', + review => 'Review', + process => 'Result', + pick_request => 'Display Summary', + ); + my $page = 0; + my $crumb; if (defined($action)) { my $done = 0; my $i=0; @@ -125,6 +138,28 @@ sub handler { $i++; } } + for (my $i=0; $i<@{$states{$action}}; $i++) { + if ($state eq $states{$action}[$i]) { + &Apache::lonhtmlcommon::add_breadcrumb( + {text=>"$trail{$state}"}); + $crumb = &Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests'); + last; + } else { + if (($state eq 'process') && ($i > 0)) { + &Apache::lonhtmlcommon::add_breadcrumb( + {href=>"javascript:backPage(document.requestcrs,'$states{$action}[0]')", + text=>"$trail{$states{$action}[$i]}"}); + } else { + &Apache::lonhtmlcommon::add_breadcrumb( + {href=>"javascript:backPage(document.requestcrs,'$states{$action}[$i]')", + text=>"$trail{$states{$action}[$i]}"}); + } + } + } + } else { + &Apache::lonhtmlcommon::add_breadcrumb( + {text=>'Pick Action'}); + $crumb = &Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests'); } my %can_request; @@ -132,23 +167,29 @@ sub handler { if ($action eq 'new') { if ($canreq) { if ($state eq 'crstype') { - &print_main_menu($r,\%can_request,\%states,$dom,$jscript,$loaditems); + &print_main_menu($r,\%can_request,\%states,$dom,$jscript,$loaditems, + $crumb); } else { &request_administration($r,$action,$state,$page,\%states,$dom,$jscript, - $loaditems); + $loaditems,$crumb); } } else { - $r->print(&header('Course Requests'). + $r->print(&header('Course Requests').$crumb. '
'. &mt('You do not have privileges to request creation of courses.'). '
'.&Apache::loncommon::end_page()); } } elsif ($action eq 'view') { - &print_request_status($jscript,$loaditems); + if ($state eq 'crstype') { + &print_main_menu($r,\%can_request,\%states,$dom,$jscript,'',$crumb); + } else { + &request_administration($r,$action,$state,$page,\%states,$dom,$jscript, + $loaditems,$crumb); + } } elsif ($action eq 'log') { - &print_request_logs($jscript,$loaditems); + &print_request_logs($jscript,$loaditems,$crumb); } else { - &print_main_menu($r,\%can_request,\%states,$dom,$jscript); + &print_main_menu($r,\%can_request,\%states,$dom,$jscript,'',$crumb); } return OK; } @@ -156,13 +197,16 @@ sub handler { sub header { my ($bodytitle,$jscript,$loaditems,$jsextra) = @_; if ($jscript) { - $jscript = ''."\n"; + $jscript = ''."\n"; } if ($loaditems) { - $loaditems = {'add_entries' => $loaditems,}; - } - return &Apache::loncommon::start_page($bodytitle,$jscript.$jsextra,$loaditems); + $loaditems = {'add_entries' => $loaditems,}; + return &Apache::loncommon::start_page($bodytitle,$jscript.$jsextra,$loaditems); + } else { + return &Apache::loncommon::start_page($bodytitle,$jscript.$jsextra); + } } sub form_elements { @@ -304,8 +348,9 @@ sub onload_action { sub check_can_request { my ($dom,$can_request) = @_; my $canreq = 0; - if (ref($can_request) eq 'HASH') { - foreach my $type ('official','unofficial','community') { + my ($types,$typename) = &course_types(); + if ((ref($can_request) eq 'HASH') && (ref($types) eq 'ARRAY')) { + foreach my $type (@{$types}) { if (&Apache::lonnet::usertools_access($env{'user.name'}, $env{'user.domain'}, $type,undef,'requestcourses')) { @@ -330,8 +375,20 @@ sub check_can_request { return $canreq; } +sub course_types { + my @types = ('official','unofficial','community'); + my %typename = ( + official => 'Official course', + unofficial => 'Unofficial course', + community => 'Community', + ); + return (\@types,\%typename); +} + + sub print_main_menu { - my ($r,$can_request,$states,$dom,$jscript,$loaditems) = @_; + my ($r,$can_request,$states,$dom,$jscript,$loaditems,$crumb) = @_; + my ($types,$typename) = &course_types(); my $onchange; unless ($env{'form.interface'} eq 'textual') { $onchange = 1; @@ -415,11 +472,11 @@ END END - $r->print(&header('Course Requests',$js.$jscript,$loaditems). - '

'. + $r->print(&header('Course Requests',$js.$jscript,$loaditems).$crumb. + '
'. '
'. &Apache::lonhtmlcommon::start_pick_box(). - &Apache::lonhtmlcommon::row_title('Domain'). + &Apache::lonhtmlcommon::row_title('Course Domain'). &Apache::loncommon::select_dom_form($dom,'showdom','',1,$onchange)); if (!$onchange) { $r->print('  - - - - - + '); + if ((ref($types) eq 'ARRAY') && (ref($typename) eq 'HASH')) { + foreach my $type (@{$types}) { + my $selected = ''; + if ($type eq 'official') { + $selected = ' selected="selected"'; + } + $r->print(''."\n"); + } + } + $r->print(' '. &Apache::lonhtmlcommon::row_closure(1). &Apache::lonhtmlcommon::end_pick_box().'
@@ -457,7 +521,7 @@ END } sub request_administration { - my ($r,$action,$state,$page,$states,$dom,$jscript,$loaditems) = @_; + my ($r,$action,$state,$page,$states,$dom,$jscript,$loaditems,$crumb) = @_; my $js; if (($action eq 'new') || ($action eq 'view')) { $js = <print(&header('Request a course',$js.$jscript,$loaditems,$jsextra)); - if ($state eq 'review') { - &print_review($r,$state,$dom); - } elsif ($state eq 'process') { - &print_request_outcome($r,$state,$dom); - } else { - &print_request_form($r,$action,$state,$page,$states,$dom); - } + $r->print(&header('Request a course',$js.$jscript,$loaditems,$jsextra).$crumb); + &print_request_form($r,$action,$state,$page,$states,$dom); } elsif ($action eq 'view') { - $r->print(&header('Manage course requests',$js.$jscript,$loaditems)); + $r->print(&header('Manage course requests',$js.$jscript,$loaditems).$crumb); + if ($state eq 'pick_request') { + $r->print(&print_request_status($dom)); + } } elsif ($action eq 'log') { - $r->print(&coursereq_log('View request log',$jscript,$loaditems)); + $r->print(&coursereq_log('View request log',$jscript,$loaditems).$crumb); } $r->print(&Apache::loncommon::end_page()); return; @@ -501,17 +562,23 @@ sub print_request_form { my ($next,$prev,$message,$output,$codepicker,$crstype); $prev = $states->{$action}[$page-1]; $next = $states->{$action}[$page+1]; + my %navtxt = &Apache::lonlocal::texthash ( + prev => 'Back', + next => 'Next', + ); $crstype = $env{'form.crstype'}; $r->print(''); my (@codetitles,%cat_titles,%cat_order,@code_order,$instcode,$code_chk); if ($crstype eq 'official') { - &Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles, - \%cat_order,\@code_order); if ($env{'form.instcode'} ne '') { $instcode = $env{'form.instcode'}; } } if ($prev eq 'codepick') { + if ($crstype eq 'official') { + &Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles, + \%cat_order,\@code_order); + } if (@code_order > 0) { my $message; if ($instcode eq '') { @@ -545,6 +612,10 @@ sub print_request_form { } } if ($prev eq 'crstype') { + if ($crstype eq 'official') { + &Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles, + \%cat_order,\@code_order); + } if (@code_order > 0) { $codepicker = &coursecode_form($dom,'instcode',\@codetitles, \%cat_titles,\%cat_order); @@ -560,10 +631,26 @@ sub print_request_form { } elsif ($prev eq 'codepick') { $r->print(&courseinfo_form($dom,$formname,$crstype)); } elsif ($state eq 'enrollment') { + if ($crstype eq 'official') { + &Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles, + \%cat_order,\@code_order); + } $r->print(&print_enrollment_menu($formname,$instcode,$dom,\@codetitles, \%cat_titles,\%cat_order,\@code_order)); } elsif ($state eq 'personnel') { - $r->print(&print_personnel_menu($dom,$formname)); + $r->print(&print_personnel_menu($dom,$formname,$crstype)); + } elsif ($state eq 'review') { + &Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles, + \%cat_order,\@code_order); + $r->print(&print_review($formname,$dom,\@codetitles,\%cat_titles,\%cat_order, + \@code_order)); + $navtxt{'next'} = &mt('Submit course request'); + } elsif ($state eq 'process') { + if ($crstype eq 'official') { + &Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles, + \%cat_order,\@code_order); + } + my $result = &print_request_outcome($dom,\@codetitles,\@code_order); } my @excluded = ('counter'); my %elements = &form_elements($dom); @@ -589,7 +676,7 @@ sub print_request_form { push(@excluded,'instcode'); } $r->print(&Apache::lonhtmlcommon::echo_form_input(\@excluded).''); - &display_navbuttons($r,$formname,$prev,'Previous',$next,'Next'); + &display_navbuttons($r,$formname,$prev,$navtxt{'prev'},$next,$navtxt{'next'}); return; } @@ -722,7 +809,7 @@ sub date_setting_table { } sub print_personnel_menu { - my ($dom,$formname) = @_; + my ($dom,$formname,$crstype) = @_; my $output = '
'.&Apache::lonhtmlcommon::start_pick_box(); my $persontotal = $env{'form.persontotal'}; if (!defined($persontotal)) { @@ -736,8 +823,12 @@ sub print_personnel_menu { my $roleoptions; my @roles = &Apache::lonuserutils::roles_by_context('course'); + my $type = 'Course'; + if ($crstype eq 'community') { + $type = 'Community'; + } foreach my $role (@roles) { - my $plrole=&Apache::lonnet::plaintext($role); + my $plrole=&Apache::lonnet::plaintext($role,$type); $roleoptions .= ' '."\n"; } my %customroles=&Apache::lonuserutils::my_custom_roles(); @@ -783,13 +874,13 @@ sub print_personnel_menu { for (my $i=0; $i<$persontotal; $i++) { my @linkargs = map { 'person_'.$i.'_'.$_ } (@items); my $linkargstr = join("','",@linkargs); - my $userlink = &Apache::loncommon::selectuser_link($formname,@linkargs,$userlinktxt); + my $userlink = &Apache::loncommon::selectuser_link($formname,@linkargs,$dom,$userlinktxt); my $uname_form = ''; + 'openuserbrowser('."'$formname','$linkargstr','$dom'".');" />'; my $onchange = 'javascript:fix_domain('."'$formname','person_".$i."_dom',". "'person_".$i."_hidedom'".');'. - 'openuserbrowser('."'$formname','$linkargstr'".');'; + 'openuserbrowser('."'$formname','$linkargstr','$dom'".');'; my $udom_form = &Apache::loncommon::select_dom_form($dom,'person_'.$i.'_dom','', 1,$onchange). ''; @@ -833,16 +924,314 @@ sub print_personnel_menu { } sub print_request_status { - return; + my ($dom) = @_; + my %requests = &Apache::lonnet::dumpstore('courserequests',$env{'user.domain'}, + $env{'user.name'}); + my ($output,$formname,%queue_by_date); + foreach my $key (keys(%requests)) { + if (ref($requests{$key}) eq 'HASH') { + my ($cdom,$cnum) = split('_',$key); + next if ($cdom ne $dom); + my $entry; + my $timestamp = $requests{$key}{'timestamp'}; + my $crstype = $requests{$key}{'crstype'}; + my $status = $requests{$key}{'status'}; + next unless (($env{'form.crstype'} eq 'all') || + ($env{'form.crstype'} eq $crstype)); + next unless (($status eq 'approval') || ($status eq 'pending')); + if (ref($requests{$key}{'details'}) eq 'HASH') { + $entry = $key.':'.$crstype.':'.$requests{$key}{'details'}{'cdesc'}; + if ($crstype eq 'official') { + $entry .= ':'.$requests{$key}{'details'}{'instcode'}; + } + } + if ($entry ne '') { + if (exists($queue_by_date{$timestamp})) { + if (ref($queue_by_date{$timestamp}) eq 'ARRAY') { + push(@{$queue_by_date{$timestamp}},$entry); + } + } else { + @{$queue_by_date{$timestamp}} = ($entry); + } + } + } + } + $formname = 'requestcrs'; + my @sortedtimes = sort {$a <=> $b} (keys(%queue_by_date)); + $output = '
'."\n". + ''."\n". + ''."\n". + ''."\n"; + if (@sortedtimes > 0) { + $output .= &Apache::loncommon::start_data_table(). + &Apache::loncommon::start_data_table_header_row(). + ''.&mt('Action').''. + ''.&mt('Description').''; + if ($env{'form.crstype'} eq 'all') { + $output .= ''.&mt('Type').''; + } + if (($env{'form.crstype'} eq 'all') || ($env{'form.crstype'} eq 'official')) { + $output .= ''.&mt('Institutional Code').''; + } + $output .= ''.&mt('Date requested').''. + &Apache::loncommon::end_data_table_header_row(); + my $count = 0; + foreach my $item (@sortedtimes) { + my $showtime = &Apache::lonlocal::locallocaltime($item); + if (ref($queue_by_date{$item}) eq 'ARRAY') { + foreach my $request (sort(@{$queue_by_date{$item}})) { + my ($key,$type,$desc,$instcode) = split(':',$request); + my ($cdom,$cnum) = split('_',$key); + $output .= &Apache::loncommon::start_data_table_row(). + ''. + ''.$desc.''; + if ($env{'form.crstype'} eq 'all') { + $output .= ''.&course_types($type).''; + } + if (($env{'form.crstype'} eq 'all') || + ($env{'form.crstype'} eq 'official')) { + $output .= ''.$instcode.''; + } + $output .= ''.$showtime.''. + &Apache::loncommon::end_data_table_row(); + } + } + } + $output .= &Apache::loncommon::end_data_table(); + } else { + $output .= '
'.&mt('You have no matching course requests awaiting approval by a Domain Coordinator or held in a queue pending administrative action at your institution.').'
'; + } + $output .= ' + +
'; + return $output; } sub print_request_logs { + my ($jscript,$loaditems,$crumb) = @_; return; } sub print_review { - my ($r,$state,$dom) = @_; - return; + my ($formname,$dom,$codetitles,$cat_titles,$cat_order,$code_order) = @_; + my ($types,$typename) = &course_types(); + my ($owner,$ownername,$owneremail); + $owner = $env{'user.name'}.':'.$env{'user.domain'}; + $ownername = &Apache::loncommon::plainname($env{'user.name'}, + $env{'user.domain'},'first'); + my %emails = &Apache::loncommon::getemails(); + foreach my $email ('permanentemail','critnotification','notification') { + $owneremail = $emails{$email}; + last if ($owneremail ne ''); + } + my ($inst_headers,$inst_values,$crstypename,$enroll_headers,$enroll_values, + $section_headers,$section_values,$personnel_headers,$personnel_values); + + $crstypename = $env{'form.crstype'}; + if (ref($typename) eq 'HASH') { + unless ($typename->{$env{'form.crstype'}} eq '') { + $crstypename = $typename->{$env{'form.crstype'}}; + } + } + + $inst_headers = ''.&mt('Description').''.&mt('Type').''; + $inst_values = ''.$env{'form.cdescr'}.''.$crstypename.''; + + if ($env{'form.crstype'} eq 'official') { + if ((ref($codetitles) eq 'ARRAY') && (ref($cat_titles) eq 'HASH')) { + foreach my $title (@{$codetitles}) { + if ($env{'form.instcode_'.$title} ne '') { + $inst_headers .= ''.$title.''; + my $longitem = $env{'form.instcode_'.$title}; + if (ref($cat_titles->{$title}) eq 'HASH') { + if ($cat_titles->{$title}{$env{'form.instcode_'.$title}} ne '') { + $longitem = $cat_titles->{$title}{$env{'form.instcode_'.$title}}; + } + } + $inst_values .= ''.$longitem.''; + } + } + } + if (&Apache::lonnet::auto_run('',$dom)) { + $enroll_headers = ''.&mt('Automatic Adds').''. + ''.&mt('Automatic Drops').''. + ''.&mt('Enrollment Starts').''. + ''.&mt('Enrollment Ends').''; + $section_headers = ''.&mt('Sections').''. + ''.&mt('Crosslistings').''; + + my ($startenroll,$endenroll) = &dates_from_form('startenroll','endenroll'); + my @autoroster = (&mt('No'),&mt('Yes')); + $enroll_values = ''.$autoroster[$env{'form.autoadds'}].''. + ''.$autoroster[$env{'form.autodrops'}].''. + ''.&Apache::lonlocal::locallocaltime($startenroll).''. + ''.&Apache::lonlocal::locallocaltime($endenroll).''; + $section_values = ''. + ''; + my $secinfo; + if ($env{'form.sectotal'} > 0) { + for (my $i=0; $i<$env{'form.sectotal'}; $i++) { + if ($env{'form.sec_'.$i}) { + $secinfo .= ''; + } + } + } + if ($secinfo eq '') { + $secinfo = ''; + } + $section_values .= $secinfo.'
'. + &mt('Institutional section').''.&mt('LON-CAPA section').'
'.$env{'form.secnum_'.$i}.''; + if ($env{'form.loncapasec_'.$i} ne '') { + $secinfo .= $env{'form.loncapasec_'.$i}; + } else { + $secinfo .= &mt('None'); + } + $secinfo .= '
'.&mt('None').'
'. + ''. + ''; + my $xlistinfo; + if ($env{'form.crosslisttotal'}) { + for (my $i=0; $i<$env{'form.crosslisttotal'}; $i++) { + if ($env{'form.crosslist_'.$i}) { + $xlistinfo .= ''; + } + } + } + if ($xlistinfo eq '') { + $xlistinfo = ''; + } + $section_values .= $xlistinfo.'
'. + &mt('Institutional course/section').''.&mt('LON-CAPA section').'
'; + if (ref($code_order) eq 'ARRAY') { + if (@{$code_order} > 0) { + foreach my $item (@{$code_order}) { + $xlistinfo .= $env{'form.crosslist_'.$i.'_'.$item}; + } + } + } + $xlistinfo .= $env{'form.crosslist_'.$i.'_instsec'}.''; + if ($env{'form.crosslist_'.$i.'_lcsec'}) { + $xlistinfo .= $env{'form.crosslist_'.$i.'_lcsec'}; + } else { + $xlistinfo .= &mt('None'); + } + $xlistinfo .= '
'.&mt('None').'
'; + } + } + + my %ctxt = &clone_text(); + $inst_headers .= ''.&mt('Clone From').''; + if (($env{'form.clonecourse'} =~ /^$match_name$/) && + ($env{'form.clonedomain'} =~ /^$match_domain$/)) { + my %coursehash = + &Apache::lonnet::courseiddump($env{'form.clonedomain'},'.',1,'.','.', + $env{'form.clonecourse'},undef,undef,'.'); + my $cloneid = $env{'form.clonedomain'}.'_'.$env{'form.clonecourse'}; + if (ref($coursehash{$cloneid}) eq 'HASH') { + $inst_headers .= ''.$ctxt{'dsh'}.''; + my $clonedesc = $coursehash{$cloneid}{'description'}; + my $cloneinst = $coursehash{$cloneid}{'inst_code'}; + + $inst_values .= ''.$clonedesc.' '; + if ($cloneinst ne '') { + $inst_values .= &mt('([_1] in [_2])',$cloneinst,$env{'form.clonedomain'}); + } else { + $inst_values .= &mt('(from [_1])',$env{'form.clonedomain'}); + } + $inst_values .= ''; + if ($env{'form.datemode'} eq 'preserve') { + $inst_values .= $ctxt{'pcd'}; + } elsif ($env{'form.datemode'} eq 'shift') { + $inst_values .= &mt('Shift dates by [_1] days',$env{'form.dateshift'}); + } else { + $inst_values .= $ctxt{'ncd'}; + } + $inst_values .= ''; + } else { + $inst_values .= ''.&mt('Unknown').''; + } + } else { + $inst_values .= ''.&mt('None').''; + } + $enroll_headers .= ''.&mt('Access Starts').''. + ''.&mt('Access Ends').''; + my ($startaccess,$endaccess) = &dates_from_form('startaccess','endaccess'); + $enroll_values .= ''.&Apache::lonlocal::locallocaltime($startaccess).''; + if ($endaccess == 0) { + $enroll_values .= ''.&mt('No end date').''; + } else { + $enroll_values .= ''.&Apache::lonlocal::locallocaltime($endaccess).''; + } + + my $container = 'Course'; + if ($env{'form.crstype'} eq 'community') { + $container = 'Community'; + } + + $personnel_headers = ''.&mt('Name').''.&mt('Username:Domain'). + ''.&mt('Role').''.&mt('LON-CAPA Sections'). + ''; + $personnel_values .= ''.$ownername.''.$owner.''. + ''.&Apache::lonnet::plaintext('cc',$container).''. + ''.&mt('None').''; + for (my $i=0; $i<$env{'form.persontotal'}; $i++) { + if ($env{'form.person_'.$i.'_uname'} ne '') { + $personnel_values .= + ''.$env{'form.person_'.$i.'_first'}.' '. + $env{'form.person_'.$i.'_last'}.''. + ''.$env{'form.person_'.$i.'_uname'}.':'. + $env{'form.person_'.$i.'_dom'}.''. + ''.&Apache::lonnet::plaintext($env{'form.person_'.$i.'_role'}, + $container).''. + ''.$env{'form.person_'.$i.'_sections'}.''; + } + } + my $output = '

'.&mt('Review the details of the course request before submission.').'

'. + '
'.&Apache::lonhtmlcommon::start_pick_box(). + &Apache::lonhtmlcommon::row_title(&mt('Owner')). + ''. + ''. + ''. + ''. + ''."\n". + ''. + ''. + '
'.&mt('Name').''.&mt('Username:Domain').''.&mt('E-mail address').'
'.$ownername.''.$owner.''.$owneremail.'
'."\n". + &Apache::lonhtmlcommon::row_closure(). + &Apache::lonhtmlcommon::row_title(&mt('Description')). + ''.$inst_headers.''."\n". + ''.$inst_values.'
'."\n". + &Apache::lonhtmlcommon::row_closure(). + &Apache::lonhtmlcommon::row_title(&mt('Enrollment')). + ''.$enroll_headers.''."\n". + ''.$enroll_values.'
'."\n". + &Apache::lonhtmlcommon::row_closure(); + if ($section_headers ne '') { + $output .= &Apache::lonhtmlcommon::row_title(&mt('Sections')). + ''.$section_headers.''."\n". + ''.$section_values.'
'."\n". + &Apache::lonhtmlcommon::row_closure(); + } + $output .= &Apache::lonhtmlcommon::row_title(&mt('Personnel')). + ''.$personnel_headers.''."\n". + $personnel_values.'
'."\n". + &Apache::lonhtmlcommon::row_closure(1). + &Apache::lonhtmlcommon::end_pick_box(); + my $cnum = &Apache::lonnet::generate_coursenum($dom); + $output .= ''; + return $output; +} + +sub dates_from_form { + my ($startname,$endname) = @_; + my $startdate = &Apache::lonhtmlcommon::get_date_from_form($startname); + my $enddate = &Apache::lonhtmlcommon::get_date_from_form($endname); + if ($endname eq 'endaccess') { + if (exists($env{'form.no_end_date'}) ) { + $enddate = 0; + } + } + return ($startdate,$enddate); } sub courseinfo_form { @@ -864,14 +1253,7 @@ sub clone_form { } my $cloneform = &Apache::loncommon::select_dom_form($dom,'clonedomain'). &Apache::loncommon::selectcourse_link($formname,'clonecourse','clonedomain','','','',$type); - my %lt = &Apache::lonlocal::texthash( - 'cid' => 'Course ID', - 'dmn' => 'Domain', - 'dsh' => 'Date Shift', - 'ncd' => 'Do not clone date parameters', - 'prd' => 'Clone date parameters as-is', - 'shd' => 'Shift date parameters by number of days', - ); + my %lt = &clone_text(); my $output .= &Apache::lonhtmlcommon::start_pick_box(). &Apache::lonhtmlcommon::row_title($lt{'cid'}).'