Diff for /loncom/interface/loncreatecourse.pm between versions 1.101.2.1 and 1.108.2.1

version 1.101.2.1, 2007/06/01 18:07:47 version 1.108.2.1, 2008/07/01 05:22:59
Line 35  use Apache::lonnet; Line 35  use Apache::lonnet;
 use Apache::loncommon;  use Apache::loncommon;
 use Apache::londocs;  use Apache::londocs;
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::londropadd;  use Apache::lonuserutils;
 use Apache::lonclonecourse;  use Apache::lonclonecourse;
 use LONCAPA::batchcreatecourse;  use LONCAPA::batchcreatecourse;
 use LONCAPA;  use LONCAPA;
Line 71  sub print_course_creation_page { Line 71  sub print_course_creation_page {
     if ($crstype eq 'Course') {      if ($crstype eq 'Course') {
         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
         $enroll_table = &Apache::londropadd::date_setting_table($starttime,          $enroll_table = &Apache::lonuserutils::date_setting_table($starttime,
                                                 $endtime,'create_enrolldates');                                                $endtime,'create_enrolldates');
         $access_table = &Apache::londropadd::date_setting_table($starttime,          $access_table = &Apache::lonuserutils::date_setting_table($starttime,
                                                $endtime,'create_defaultdates');                                               $endtime,'create_defaultdates');
         ($krbdef,$krbdefdom) =          ($krbdef,$krbdefdom) =
         &Apache::loncommon::get_kerberos_defaults($defdom);          &Apache::loncommon::get_kerberos_defaults($defdom);
         $javascript_validations=&Apache::londropadd::javascript_validations(          $javascript_validations=&Apache::lonuserutils::javascript_validations(
                                                     'createcourse',$krbdefdom);                                                      'createcourse',$krbdefdom);
         my %param = ( formname      => 'document.ccrs',          my %param = ( formname      => 'document.ccrs',
                       kerb_def_dom  => $krbdefdom,                        kerb_def_dom  => $krbdefdom,
Line 129  function validate(formname) { Line 129  function validate(formname) {
                     'cid'  => "Course ID",                      'cid'  => "Course ID",
                     'dmn'  => "Domain",                      'dmn'  => "Domain",
                     'asov' => "Additional settings, if specified below, will override cloned settings",                      'asov' => "Additional settings, if specified below, will override cloned settings",
                       'ncd'  => "Do not clone date parameters",
                       'prd'  => 'Clone date parameters as-is',
                       'shd'  => 'Shift date parameters by number of days',
                     'assp' => "Assessment Parameters",                      'assp' => "Assessment Parameters",
                     'oaas' => "Open all assessments",                      'oaas' => "Open all assessments",
                     'mssg' => "Messaging",                      'mssg' => "Messaging",
Line 301  $lt{'stat'} Line 304  $lt{'stat'}
     $lt{'dmn'}: $cloneform      $lt{'dmn'}: $cloneform
 </label>  </label>
 <br />  <br />
    <label><input type="radio" name="datemode" value="delete" /> $lt{'ncd'}</label><br />
    <label><input type="radio" name="datemode" value="preserve" /> $lt{'prd'}</label><br />
    <label><input type="radio" name="datemode" value="shift" checked="checked" /> $lt{'shd'}</label>
    <input type="text" size="5" name="dateshift" value="365" /><br />
 &nbsp;<br />  &nbsp;<br />
 $lt{'asov'}.  $lt{'asov'}.
 </td></tr>  </td></tr>
Line 487  ENDDOCUMENT Line 494  ENDDOCUMENT
     $lt{'dmn'}: $cloneform      $lt{'dmn'}: $cloneform
 </label>  </label>
 <br />  <br />
 &nbsp;<br />   <label><input type="radio" name="datemode" value="delete" /> $lt{'ncd'}</label><br />
    <label><input type="radio" name="datemode" value="preserve" /> $lt{'prd'}</label><br />
    <label><input type="radio" name="datemode" value="shift" checked="checked" /> $lt{'shd'}</label>
    <input type="text" size="5" name="dateshift" value="365" /><br />&nbsp;<br />
 $lt{'asov'}.  $lt{'asov'}.
 </td></tr>  </td></tr>
 </table>  </table>
Line 576  sub create_course { Line 586  sub create_course {
         $crstype='Course';          $crstype='Course';
         $enrollstart=&Apache::lonhtmlcommon::get_date_from_form('startenroll');          $enrollstart=&Apache::lonhtmlcommon::get_date_from_form('startenroll');
         $enrollend=&Apache::lonhtmlcommon::get_date_from_form('endenroll');          $enrollend=&Apache::lonhtmlcommon::get_date_from_form('endenroll');
   
     }      }
     $startaccess = &Apache::lonhtmlcommon::get_date_from_form('startaccess');      $startaccess = &Apache::lonhtmlcommon::get_date_from_form('startaccess');
     $endaccess   = &Apache::lonhtmlcommon::get_date_from_form('endaccess');      $endaccess   = &Apache::lonhtmlcommon::get_date_from_form('endaccess');
Line 618  sub create_course { Line 627  sub create_course {
                crsquota => $env{'form.crsquota'},                 crsquota => $env{'form.crsquota'},
                clonecourse => $env{'form.clonecourse'},                 clonecourse => $env{'form.clonecourse'},
                clonedomain => $env{'form.clonedomain'},                 clonedomain => $env{'form.clonedomain'},
                  datemode => $env{'form.datemode'},
                  dateshift => $env{'form.dateshift'},
                crsid => $env{'form.crsid'},                 crsid => $env{'form.crsid'},
                curruser => $env{'user.name'}.':'.$env{'user.domain'},                 curruser => $env{'user.name'}.':'.$env{'user.domain'},
                crssections => $env{'form.crssections'},                 crssections => $env{'form.crssections'},
Line 651  sub create_course { Line 662  sub create_course {
     # Check the veracity of the course coordinator      # Check the veracity of the course coordinator
     if (&Apache::lonnet::homeserver($ccuname,$ccdomain) eq 'no_host') {      if (&Apache::lonnet::homeserver($ccuname,$ccdomain) eq 'no_host') {
  $r->print('<form action="/adm/createuser" method="post" name="crtuser">');   $r->print('<form action="/adm/createuser" method="post" name="crtuser">');
         $r->print(&mt('No such user').' '.$ccuname.' '.&mt('at').' '.$ccdomain.'.<br />');          $r->print('<div class="LC_warning">'
  $r->print(&mt("Please click Back on your browser and select another user, or "));                    .&mt('No such user [_1] at domain [_2].','<tt>'.$ccuname.'</tt>','<tt>'.$ccdomain.'</tt>')
  $r->print('                   .'</div>');
     <input type="hidden" name="phase" value="get_user_info" />   $r->print(&mt('Please click Back on your browser and select another user, or [_1]Create User[_2]'
             <input type="hidden" name="ccuname" value="'.$ccuname.'" />               , '<input type="hidden" name="phase" value="get_user_info" />'
             <input type="hidden" name="ccdomain" value="'.$ccdomain.'" />                        .'<input type="hidden" name="ccuname" value="'.$ccuname.'" />'
             <input name="userrole" type="submit" value="'.                        .'<input type="hidden" name="ccdomain" value="'.$ccdomain.'" />'
   &mt('Create User').'" />                        .'<input name="userrole" type="submit" value="'
  </form>'.&Apache::loncommon::end_page());                       , '" />'
                        )
                    .'</form>'.&Apache::loncommon::end_page()
                    );
  return;   return;
     }      }
     # Check the proposed home server for the course      # Check the proposed home server for the course
     my %host_servers =       my %host_servers = 
  &Apache::lonnet::get_servers($env{'request.role.domain'},'library');   &Apache::lonnet::get_servers($env{'request.role.domain'},'library');
     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: [_1]'
                   $env{'form.course_home'}.&Apache::loncommon::end_page());                       ,$env{'form.course_home'}.&Apache::loncommon::end_page()));
         return;          return;
     }      }
     my ($courseid,$crsudom,$crsunum);      my ($courseid,$crsudom,$crsunum);
     $r->print(&Apache::loncommon::construct_course($args,\$logmsg,\$courseid,\$crsudom,\$crsunum,$env{'user.domain'},$env{'user.name'}));      my ($success,$output) = 
    &Apache::loncommon::construct_course($args,\$logmsg,\$courseid,
 #       \$crsudom,\$crsunum,
 # Make the requested user a course coordinator or group coordinator       $env{'user.domain'},
 #       $env{'user.name'});
     if (($ccdomain) && ($ccuname)) {      $r->print($output);
         $r->print(&mt('Assigning role of [_1] Coordinator to [_2] at [_3]:',      if ($success) {
                      $crstype,$ccuname,$ccdomain).          #
                   &Apache::lonnet::assignrole($ccdomain,$ccuname,$courseid,   # Make the requested user a course coordinator or group coordinator
                                               'cc').'<p>');          #
     }   if (($ccdomain) && ($ccuname)) {
     if ($env{'form.setkeys'}) {      $r->print(&mt('Assigning role of [_1] Coordinator to [_2] at [_3]: ',
         $r->print(    $crstype,$ccuname,$ccdomain).
  '<p><a href="/adm/managekeys?cid='.$crsudom.'_'.$crsunum.'">'.&mt('Manage Access Keys').'</a></p>');        &Apache::lonnet::assignrole($ccdomain,$ccuname,$courseid,
     }    'cc','','','','','createcourse').'<p>');
 # Flush the course logs so reverse user roles immediately updated   }
     &Apache::lonnet::flushcourselogs();   if ($env{'form.setkeys'}) {
     $r->print('<p>'.&mt('Roles will be active at next login').'.</p>'.      $r->print(
       '<p><a href="/adm/createcourse?phase='.lc($crstype).'one">'.        '<p><a href="/adm/managekeys?cid='.$crsudom.'_'.$crsunum.'">'.&mt('Manage Access Keys').'</a></p>');
    }
           # Flush the course logs so reverse user roles immediately updated
    &Apache::lonnet::flushcourselogs();
    $r->print('<p>'.&mt('Roles will be active at next login').'.</p>');
       }
       $r->print('<p><a href="/adm/createcourse?phase='.lc($crstype).'one">'.
       &mt('Create Another [_1]',$crstype).'</a></p>'.        &mt('Create Another [_1]',$crstype).'</a></p>'.
       &Apache::loncommon::end_page());        &Apache::loncommon::end_page());
 }  }
Line 697  sub create_course { Line 717  sub create_course {
 sub print_intro_page {  sub print_intro_page {
     my $r = shift;      my $r = shift;
     my $start_page =      my $start_page =
   #        &Apache::loncommon::start_page('Create a New Course or Group Space');
         &Apache::loncommon::start_page('Create a New Course');          &Apache::loncommon::start_page('Create a New Course');
     my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Creation Options','Create_Course',undef,'Create_Courses');      my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Creation Options','Create_Course',undef,'Create_Courses');
     my $end_page =      my $end_page =
         &Apache::loncommon::end_page();          &Apache::loncommon::end_page();
     my $helplink=&Apache::loncommon::help_open_topic('Create_Course_GroupSpace',&mt('Help on Creating Courses and Groups'));  #    my $helplink=&Apache::loncommon::help_open_topic('Create_Course_GroupSpace',&mt('Help on Creating Courses and Groups'));
      my $helplink=&Apache::loncommon::help_open_topic('Create_Course_GroupSpace',&mt('Help on Creating Courses'));
   
     my @choices = ({ internal_name => 'courseone',      my @choices = ({ internal_name => 'courseone',
                      name => &mt('Create a single course'),                       name => &mt('Create a single course'),
Line 709  sub print_intro_page { Line 731  sub print_intro_page {
     &mt('Create a new course by completing an online form.'),      &mt('Create a new course by completing an online form.'),
                  },                   },
 #                   { internal_name => 'groupone',  #                   { internal_name => 'groupone',
 #                     name => &mt('Create a single collaborative group space '),  #                     name => &mt('Create a single collaborative group space'),
 #                     short_description =>  #                     short_description =>
 #    &mt('Create a new group space for non-course use by completing an online form .'),  #    &mt('Create a new group space for non-course use by completing an online form.'),
 #                 },  #                 },
                    { internal_name => 'batchone',                     { internal_name => 'batchone',
                      name => &mt('Create courses/groups by uploading an attributes file'),  #                     name => &mt('Create courses/groups by uploading an attributes file'),
                        name => &mt('Create courses by uploading an attributes file'),
                      short_description =>                       short_description =>
     &mt('Upload an attributes file containing specifications for one or more courses or groups in XML format'),      &mt('Upload an attributes file containing specifications for one or more courses or groups in XML format.'),
                      help => 'Batch_Creation',                       help => 'Batch_Creation',
                  },                   },
     );      );
Line 743  ENDDOCUMENT Line 766  ENDDOCUMENT
 sub upload_batchfile {  sub upload_batchfile {
     my $r = shift;      my $r = shift;
     my $start_page =      my $start_page =
         &Apache::loncommon::start_page('Create a New Course or Group Space');  #        &Apache::loncommon::start_page('Create a New Course or Group Space');
           &Apache::loncommon::start_page('Create a New Course');
   #    my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Upload Course/Group Attributes File','Create_Course',undef,'Create_Courses');
     my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Upload Course Attributes File','Create_Course',undef,'Create_Courses');      my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Upload Course Attributes File','Create_Course',undef,'Create_Courses');
     my $end_page =      my $end_page =
         &Apache::loncommon::end_page();          &Apache::loncommon::end_page();
     $r->print($start_page.$crumbs);      $r->print($start_page.$crumbs);
   #    $r->print('<h3>'.&mt('Upload a courses or groups attributes file').'</h3>');
     $r->print('<h3>'.&mt('Upload a courses attributes file').'</h3>');      $r->print('<h3>'.&mt('Upload a courses attributes file').'</h3>');
     $r->print('<form name="batchcreate" method="post" '.      $r->print('<form name="batchcreate" method="post" '.
                 'enctype="multipart/form-data" action="/adm/createcourse">'.                  'enctype="multipart/form-data" action="/adm/createcourse">'.
               '<input type="file" name="coursecreatorxml" />'.                '<input type="file" name="coursecreatorxml" />'.
               '<input type="hidden" name="phase" value="batchtwo"><br /><br />'.                '<input type="hidden" name="phase" value="batchtwo"><br /><br />'.
               '<input type="submit" name="batchsubmit" '.                '<input type="submit" name="batchsubmit" '.
               'value="Create Courses/Groups" /></form>');  #              'value="Create Courses/Groups" /></form>');
                 'value="'.&mt('Create Courses').'" /></form>');
     $r->print($end_page);      $r->print($end_page);
     return;      return;
 }  }
Line 762  sub upload_batchfile { Line 789  sub upload_batchfile {
 sub process_batchfile {  sub process_batchfile {
     my $r = shift;      my $r = shift;
     my $start_page =      my $start_page =
         &Apache::loncommon::start_page('Create a New Course or Group Space');  #        &Apache::loncommon::start_page('Create a New Course or Group Space');
           &Apache::loncommon::start_page('Create a New Course');
     my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Creation Outcome','Create_Course',undef,'Create_Courses');      my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Creation Outcome','Create_Course',undef,'Create_Courses');
     my $end_page =      my $end_page =
         &Apache::loncommon::end_page();          &Apache::loncommon::end_page();
Line 795  sub process_batchfile { Line 823  sub process_batchfile {
             }              }
         }          }
     }      }
     $r->print($start_page.$crumbs.$result.$end_page);      $r->print($start_page.$crumbs.$logmsg.$result.'<br /><a href="/adm/createcourse">'.
                 &mt('Creation options menu').'</a>'.$end_page);
     
 }  }
   

Removed from v.1.101.2.1  
changed lines
  Added in v.1.108.2.1


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>