From lon-capa-cvs-allow@mail.lon-capa.org Mon Jul 14 08:46:27 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (Peter Cherry) Date: Mon, 14 Jul 2008 03:46:27 -0400 Subject: [LON-CAPA-cvs] Dear lon-capa-cvs-allow@mail.lon-capa.org July 84% 0FF Message-ID: <20080714114625.6463.qmail@ftc-Bataan>
From lon-capa-cvs-allow@mail.lon-capa.org Mon Jul 14 09:26:59 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (raeburn) Date: Mon, 14 Jul 2008 08:26:59 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /interface createaccount.pm Message-ID: This is a MIME encoded message --raeburn1216024019 Content-Type: text/plain raeburn Mon Jul 14 04:26:59 2008 EDT Modified files: /loncom/interface createaccount.pm Log: - move generation of log-in screen to &login_box(). - additional possible phase - selfenroll_login - when log-in box is to be generated for users wishing to self-enroll in a course, who are not logged in, and clicked "logg-in" link. --raeburn1216024019 Content-Type: text/plain Content-Disposition: attachment; filename="raeburn-20080714042659.txt" Index: loncom/interface/createaccount.pm diff -u loncom/interface/createaccount.pm:1.19 loncom/interface/createaccount.pm:1.20 --- loncom/interface/createaccount.pm:1.19 Sun Jul 13 13:57:58 2008 +++ loncom/interface/createaccount.pm Mon Jul 14 04:26:57 2008 @@ -3,7 +3,7 @@ # institutional log-in ID (institutional authentication required - localauth # or kerberos) or an e-mail address. # -# $Id: createaccount.pm,v 1.19 2008/07/13 17:57:58 raeburn Exp $ +# $Id: createaccount.pm,v 1.20 2008/07/14 08:26:57 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -87,16 +87,39 @@ $r->print($start_page."\n".'

'.&mt('You are already logged in').'

'. '

'.&mt('Please either [_1]continue the current session[_2] or [_3]logout[_4].','','','',''). '

'.&mt('Login problems?').'

'.$end_page); - return OK; + return OK; } - $start_page = - &Apache::loncommon::start_page('Create a user account in LON-CAPA','', - {'no_inline_link' => 1,}); - if ($env{'form.phase'} eq 'username_activation') { + + my $courseid; + if (defined($env{'form.courseid'})) { + $courseid = &validate_course($env{'form.courseid'}); + } + if ($env{'form.phase'} eq 'selfenroll_login') { if ($env{'form.udom'} ne '') { $domain = $env{'form.udom'}; } + my ($result,$output) = + &username_validation($r,$env{'form.uname'},$domain,$domdesc, + + $contact_name,$contact_email,$courseid, + $lonhost); + if ($result eq 'existingaccount') { + $r->print($output); + $r->print(&Apache::loncommon::end_page()); + return OK; + } else { + $start_page = + &Apache::loncommon::start_page('Self-enroll in a LON-CAPA course','', + {'no_inline_link' => 1,}); + &print_header($r,$start_page); + $r->print($output.&Apache::loncommon::end_page()); + return OK; + } } + + $start_page = + &Apache::loncommon::start_page('Create a user account in LON-CAPA','', + {'no_inline_link' => 1,}); my @cancreate; my %domconfig = &Apache::lonnet::get_dom('configuration',['usercreation'],$domain); if (ref($domconfig{'usercreation'}) eq 'HASH') { @@ -120,11 +143,6 @@ return OK; } - my $courseid; - if (defined($env{'form.courseid'})) { - $courseid = &validate_course($env{'form.courseid'}); - } - if ($sso_username ne '') { &print_header($r,$start_page); my ($msg,$sso_logout); @@ -325,31 +343,10 @@ my %domdefaults = &Apache::lonnet::get_domain_defaults($domain); if ((($domdefaults{'auth_def'} =~/^krb/) && ($domdefaults{'auth_arg_def'} ne '')) || ($domdefaults{'auth_def'} eq 'localauth')) { $output = '

'.&mt('Create account with a username provided by this institution').'

'; - $output .= &mt('If you already have a log-in ID at this institution,[_1] you may be able to use it for LON-CAPA.','
').'

'.&mt('Type in your log-in ID and password to find out.').'

'; - my ($lkey,$ukey) = &Apache::lonpreferences::des_keys(); - my ($lextkey,$uextkey) = &getkeys($lkey,$ukey); - my $logtoken=Apache::lonnet::reply('tmpput:'.$ukey.$lkey.'&createaccount', - $lonhost); - $output .= &serverform($logtoken,$lonhost,undef,$courseid); - my $unameform = ''; - my $upassform = ''; my $submit_text = &mt('Create LON-CAPA account'); - $output .= '
'."\n". - &Apache::lonhtmlcommon::start_pick_box()."\n". - &Apache::lonhtmlcommon::row_title(&mt('Log-in ID'), - 'LC_pick_box_title')."\n". - $unameform."\n". - &Apache::lonhtmlcommon::row_closure(1)."\n". - &Apache::lonhtmlcommon::row_title(&mt('Password'), - 'LC_pick_box_title')."\n". - $upassform."\n".'

'."\n". - ''."\n". - &Apache::lonhtmlcommon::row_closure(1)."\n". - &Apache::lonhtmlcommon::end_pick_box().'

'."\n". - ''."\n". - ''."\n". - '
'; + $output .= &mt('If you already have a log-in ID at this institution,[_1] you may be able to use it for LON-CAPA.','
').'

'.&mt('Type in your log-in ID and password to find out.').'

'; + $output .= &login_box($now,$lonhost,$courseid,$submit_text, + $domain,'createaccount'); } } if (grep(/^email$/,@{$cancreate})) { @@ -389,6 +386,48 @@ return $output; } +sub login_box { + my ($now,$lonhost,$courseid,$submit_text,$domain,$context) = @_; + my $output; + my %titles = &Apache::lonlocal::texthash( + createaccount => 'Log-in ID', + selfenroll => 'Username', + ); + my ($lkey,$ukey) = &Apache::lonpreferences::des_keys(); + my ($lextkey,$uextkey) = &getkeys($lkey,$ukey); + my $logtoken=Apache::lonnet::reply('tmpput:'.$ukey.$lkey.'&createaccount', + $lonhost); + $output = &serverform($logtoken,$lonhost,undef,$courseid,$context); + my $unameform = ''; + my $upassform = ''; + $output .= '
'."\n". + &Apache::lonhtmlcommon::start_pick_box()."\n"; + if ($context eq 'selfenroll') { + my $udomform = ''; + $output .= &Apache::lonhtmlcommon::row_title(&mt('Domain'), + 'LC_pick_box_title')."\n". + $udomform."\n". + &Apache::lonhtmlcommon::row_closure(1)."\n"; + } + + $output .= &Apache::lonhtmlcommon::row_title($titles{$context}, + 'LC_pick_box_title')."\n". + $unameform."\n". + &Apache::lonhtmlcommon::row_closure(1)."\n". + &Apache::lonhtmlcommon::row_title(&mt('Password'), + 'LC_pick_box_title')."\n". + $upassform."\n".'

'."\n". + ''."\n". + &Apache::lonhtmlcommon::row_closure(1)."\n". + &Apache::lonhtmlcommon::end_pick_box().'

'."\n". + ''."\n". + ''."\n". + '
'; + return $output; +} + sub process_email_request { my ($useremail,$domain,$domdesc,$contact_name,$contact_email,$cancreate, $server,$settings,$courseid) = @_; @@ -1016,15 +1055,19 @@ } sub serverform { - my ($logtoken,$lonhost,$mailtoken,$courseid) = @_; + my ($logtoken,$lonhost,$mailtoken,$courseid,$context) = @_; + my $phase = 'username_validation"'; + if ($context eq 'selfenroll') { + $phase = 'selfenroll_login'; + } my $output .= < +
- +
ENDSERVERFORM --raeburn1216024019-- From lon-capa-cvs-allow@mail.lon-capa.org Mon Jul 14 09:32:36 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (raeburn) Date: Mon, 14 Jul 2008 08:32:36 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /interface selfenroll.pm Message-ID: raeburn Mon Jul 14 04:32:36 2008 EDT Modified files: /loncom/interface selfenroll.pm Log: - page_header() added to generate start_page and breadcrumbs. - new phase - login - which causes &createaccount::login_box() to be called to generate log-in box. - log-in link presented to self-enrollers no longer points at regular log-in screen (sets phase to login instead). - message provides reasssurance to user that self-enrollment in selected course will occur following log-in. Index: loncom/interface/selfenroll.pm diff -u loncom/interface/selfenroll.pm:1.9 loncom/interface/selfenroll.pm:1.10 --- loncom/interface/selfenroll.pm:1.9 Fri Jul 11 09:43:53 2008 +++ loncom/interface/selfenroll.pm Mon Jul 14 04:32:36 2008 @@ -1,7 +1,7 @@ # The LearningOnline Network # Allow users to self-enroll in a course # -# $Id: selfenroll.pm,v 1.9 2008/07/11 13:43:53 raeburn Exp $ +# $Id: selfenroll.pm,v 1.10 2008/07/14 08:32:36 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -33,6 +33,7 @@ use Apache::lonnet; use Apache::loncommon; use Apache::lonlocal; +use Apache::createaccount; use LONCAPA qw(:DEFAULT :match); sub handler { @@ -44,6 +45,7 @@ } my $handle = &Apache::lonnet::check_for_valid_session($r); my $lonidsdir=$r->dir_config('lonIDsDir'); + my $lonhost = $r->dir_config('lonHostID'); if ($handle ne '') { &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle); } @@ -51,28 +53,32 @@ &Apache::lonlocal::get_language_handle($r); &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['cid']); my ($coursechk,$cid) = &validate_course_id($env{'form.cid'}); - my $start_page = - &Apache::loncommon::start_page('Self-enroll in a LON-CAPA course','', - {'no_inline_link' => 1,}); - $r->print($start_page); - &Apache::lonhtmlcommon::clear_breadcrumbs(); - &Apache::lonhtmlcommon::add_breadcrumb - ({href=>"/adm/selfenroll?cid=$cid", - text=>"Self-enroll"}); - $r->print(&Apache::lonhtmlcommon::breadcrumbs('Self-enroll in course')); if ($coursechk ne 'ok') { + &page_header($r,$cid); $r->print('

'.&mt('Self-enrollment error').'

'. - ''.&mt('Invalid domain or course number').''); + ''. + &mt('Invalid domain or course number').''); $r->print(&Apache::loncommon::end_page()); return OK; } - my ($cdom,$cnum,$canenroll,$selfenroll_types,$selfenroll_registered, + my $now = time; + my $js; + if ($env{'form.phase'} eq 'login') { + $js = &Apache::createaccount::javascript_setforms($now); + } + &page_header($r,$cid,$js); + my $include = $r->dir_config('lonIncludes'); + if ($env{'form.phase'} eq 'login') { + my $jsh=Apache::File->new($include."/londes.js"); + $r->print(<$jsh>); + } + my ($cdom,$cnum,$desc,$canenroll,$selfenroll_types,$selfenroll_registered, @cancreate,$knownuser,$selfenroll_access_start,$selfenroll_access_end, $selfenroll_section,$selfenroll_future,%curr_role,%coursehash,$cdomdesc); - my $now = time; %coursehash = &Apache::lonnet::coursedescription($cid); $cdom = $coursehash{'domain'}; $cnum = $coursehash{'num'}; + $desc = $coursehash{'description'}; $selfenroll_types = $coursehash{'internal.selfenroll_types'}; $selfenroll_registered = $coursehash{'internal.selfenroll_registered'}; $selfenroll_section = $coursehash{'internal.selfenroll_section'}; @@ -184,11 +190,22 @@ &process_self_enroll($r,$cdom,$cnum,$selfenroll_types,$selfenroll_registered, $selfenroll_access_start,$selfenroll_access_end, $selfenroll_section,$now); + } elsif ($env{'form.phase'} eq 'login') { + my $submit_text = &mt('Log in'); + $r->print('

'.&mt('Log-in to LON-CAPA').'

'); + my $udom = &Apache::lonnet::default_login_domain(); + $r->print(&Apache::createaccount::login_box($now,$lonhost,$cid, + $submit_text,$udom,'selfenroll')); + $r->print(&mt('You will be able to self-enroll in the course you selected ([_1]) after you have successfully logged in.',''.$desc.''). + &Apache::loncommon::end_page()); + return OK; } elsif (@cancreate > 0) { $r->print(< function setPath(formaction,item,arg) { - document.forms.logmein.action = formaction; + if (formaction != '') { + document.forms.logmein.action = formaction; + } var itemid = getIndexByName("setting"); if (itemid > -1) { document.logmein.elements[itemid].name = item; @@ -211,7 +228,7 @@ END $r->print('

'.&mt('LON-CAPA account required').'

'. - &mt('You need to be logged into LON-CAPA to self-enroll in a course.').'
  • '.&mt('If you have an account in LON-CAPA, [_1]log-in[_2].','','').'
  • '); + &mt('You need to be logged into LON-CAPA to self-enroll in a course.').'
    • '.&mt('If you have an account in LON-CAPA, [_1]log-in[_2].','','').'
    • '); if (@cancreate > 1) { $r->print('
    • '.&mt('Otherwise:').'
      '); my $count = 0; @@ -261,12 +278,27 @@ $r->print(&mt('Submit a request to the LON-CAPA [_1]helpdesk[_2] for [_3] if you require assistance.','','',$cdomdesc)); } $r->print('
      '."\n". + ''."\n". ''."\n". '
      '."\n". &Apache::loncommon::end_page()); return OK; } +sub page_header { + my ($r,$cid,$js) = @_; + my $start_page = + &Apache::loncommon::start_page('Self-enroll in a LON-CAPA course',$js, + {'no_inline_link' => 1,}); + $r->print($start_page); + &Apache::lonhtmlcommon::clear_breadcrumbs(); + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>"/adm/selfenroll?cid=$cid", + text=>"Self-enroll"}); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('Self-enroll in course')); + return; +} + sub validate_course_id { my ($cid) = @_; my ($cdom,$cnum) = ($env{'form.cid'} =~ /^($match_domain)_($match_courseid)$/); From lon-capa-cvs-allow@mail.lon-capa.org Mon Jul 14 10:14:03 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (raeburn) Date: Mon, 14 Jul 2008 09:14:03 -0000 Subject: [LON-CAPA-cvs] cvs: loncom(version_2_7_X) /build Makefile Message-ID: raeburn Mon Jul 14 05:14:03 2008 EDT Modified files: (Branch: version_2_7_X) /loncom/build Makefile Log: - bump version Index: loncom/build/Makefile diff -u loncom/build/Makefile:1.186.2.1 loncom/build/Makefile:1.186.2.2 --- loncom/build/Makefile:1.186.2.1 Tue Jul 1 00:16:04 2008 +++ loncom/build/Makefile Mon Jul 14 05:14:02 2008 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA -# $Id: Makefile,v 1.186.2.1 2008/07/01 04:16:04 raeburn Exp $ +# $Id: Makefile,v 1.186.2.2 2008/07/14 09:14:02 raeburn Exp $ # TYPICAL USAGE of this Makefile is primarily for two targets: # "make build" and "make install". @@ -22,7 +22,7 @@ LAUNCHSAVE=$(OUTSTREAM) $(SAVE) METAMTARGET="" MTARGET="" -VERSION=2.6.99.0 +VERSION=2.6.99.1 # The current working definition for "RELEASE" is: changes not in the software, # but in the operating system dependent packaging of the software. Thus, the # generic tarball releases do not need to have a release number specified. From lon-capa-cvs-allow@mail.lon-capa.org Mon Jul 14 11:16:15 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (raeburn) Date: Mon, 14 Jul 2008 10:16:15 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /interface loncommon.pm Message-ID: raeburn Mon Jul 14 06:16:15 2008 EDT Modified files: /loncom/interface loncommon.pm Log: - remove duplicated line. Index: loncom/interface/loncommon.pm diff -u loncom/interface/loncommon.pm:1.670 loncom/interface/loncommon.pm:1.671 --- loncom/interface/loncommon.pm:1.670 Sun Jul 13 15:36:50 2008 +++ loncom/interface/loncommon.pm Mon Jul 14 06:16:11 2008 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.670 2008/07/13 19:36:50 raeburn Exp $ +# $Id: loncommon.pm,v 1.671 2008/07/14 10:16:11 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -7243,7 +7243,6 @@ } } } - my $getpropath = 1; if (($current_disk_usage + $filesize) > $disk_quota){ my $msg = ''. &mt('Unable to upload [_1]. (size = [_2] kilobytes). Disk quota will be exceeded.',''.$fname.'',$filesize).''. From lon-capa-cvs-allow@mail.lon-capa.org Mon Jul 14 11:17:43 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (raeburn) Date: Mon, 14 Jul 2008 10:17:43 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /interface createaccount.pm Message-ID: raeburn Mon Jul 14 06:17:43 2008 EDT Modified files: /loncom/interface createaccount.pm Log: - already declared. Index: loncom/interface/createaccount.pm diff -u loncom/interface/createaccount.pm:1.20 loncom/interface/createaccount.pm:1.21 --- loncom/interface/createaccount.pm:1.20 Mon Jul 14 04:26:57 2008 +++ loncom/interface/createaccount.pm Mon Jul 14 06:17:42 2008 @@ -3,7 +3,7 @@ # institutional log-in ID (institutional authentication required - localauth # or kerberos) or an e-mail address. # -# $Id: createaccount.pm,v 1.20 2008/07/14 08:26:57 raeburn Exp $ +# $Id: createaccount.pm,v 1.21 2008/07/14 10:17:42 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -431,7 +431,7 @@ sub process_email_request { my ($useremail,$domain,$domdesc,$contact_name,$contact_email,$cancreate, $server,$settings,$courseid) = @_; - my $useremail = $env{'form.useremail'}; + $useremail = $env{'form.useremail'}; my $output; if (ref($cancreate) eq 'ARRAY') { if (!grep(/^email$/,@{$cancreate})) { From lon-capa-cvs-allow@mail.lon-capa.org Mon Jul 14 11:21:53 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (raeburn) Date: Mon, 14 Jul 2008 10:21:53 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /auth lonroles.pm Message-ID: raeburn Mon Jul 14 06:21:53 2008 EDT Modified files: /loncom/auth lonroles.pm Log: - use showdom in coursecatalog query string to default to display of the course catalog for an appropriate domain. - eliminate duplicate declaration ($cdom, $cnum). Index: loncom/auth/lonroles.pm diff -u loncom/auth/lonroles.pm:1.200 loncom/auth/lonroles.pm:1.201 --- loncom/auth/lonroles.pm:1.200 Tue Jul 8 16:16:16 2008 +++ loncom/auth/lonroles.pm Mon Jul 14 06:21:52 2008 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # User Roles Screen # -# $Id: lonroles.pm,v 1.200 2008/07/08 20:16:16 raeburn Exp $ +# $Id: lonroles.pm,v 1.201 2008/07/14 10:21:52 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -43,6 +43,7 @@ use Apache::lonnavdisplay(); use GDBM_File; use LONCAPA qw(:DEFAULT :match); +use HTML::Entities; sub redirect_user { @@ -675,7 +676,8 @@ } else { if ($countactive > 0) { my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description'); - $r->print('

      '.&mt('[_1]Visit the [_2]Course Catalog[_3] to view all [_4] LON-CAPA courses.','','','',$domdesc).'
      '.&mt('If a course is [_1]not[_2] in your list of current courses below, you may be able to enroll if self-enrollment is permitted.','','').'

      '); + my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&'); + $r->print('

      '.&mt('[_1]Visit the [_2]Course Catalog[_3] to view all [_4] LON-CAPA courses.','','','',$domdesc).'
      '.&mt('If a course is [_1]not[_2] in your list of current courses below, you may be able to enroll if self-enrollment is permitted.','','').'

      '); } } @@ -791,11 +793,13 @@ } $r->print(&Apache::lonnet::getannounce()); if ($advanced) { + my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&'); $r->print('

      ' .&mt('This is LON-CAPA [_1]',$r->dir_config('lonVersion')) .'
      ' .''.&mt('Logout').'  ' - .''.&mt('Course Catalog') + .'' + .&mt('Course Catalog') .'

      '); } $r->print(&Apache::loncommon::end_page()); @@ -866,6 +870,7 @@ sub findcourse_advice { my ($r) = @_; my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description'); + my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&'); if (&Apache::lonnet::auto_run(undef,$env{'user.domain'})) { $r->print(&mt('If you were expecting to see an active role listed for a particular course in the [_1] domain, it may be missing for one of the following reasons:',$domdesc).'
        @@ -878,7 +883,7 @@ } else { $r->print(&mt('If you were expecting to see an active role listed for a particular course, that course may not have been created yet.').'
        '); } - $r->print('

        '.&mt('The [_1]Course Catalog[_2] provides information about all [_3] classes for which LON-CAPA courses have been created.','','',$domdesc).'
        '); + $r->print('

        '.&mt('The [_1]Course Catalog[_2] provides information about all [_3] classes for which LON-CAPA courses have been created.','','',$domdesc).'
        '); $r->print(&mt('You can search the course catalog for courses which permit self-enrollment, if you would like to enroll in a course.').'

        '); return; } @@ -1069,8 +1074,8 @@ sub adhoc_course_role { my ($then) = @_; my ($cdom,$cnum); - my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; - my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; if (&check_forcc($cdom,$cnum,$then)) { my $setprivs; if (!defined($env{'user.role.'.$env{'form.switchrole'}})) { From lon-capa-cvs-allow@mail.lon-capa.org Mon Jul 14 11:24:27 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (raeburn) Date: Mon, 14 Jul 2008 10:24:27 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /interface coursecatalog.pm Message-ID: raeburn Mon Jul 14 06:24:27 2008 EDT Modified files: /loncom/interface coursecatalog.pm Log: - eliminate duplicate decalarations. Index: loncom/interface/coursecatalog.pm diff -u loncom/interface/coursecatalog.pm:1.38 loncom/interface/coursecatalog.pm:1.39 --- loncom/interface/coursecatalog.pm:1.38 Sun Jul 13 16:13:10 2008 +++ loncom/interface/coursecatalog.pm Mon Jul 14 06:24:27 2008 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler for displaying the course catalog interface # -# $Id: coursecatalog.pm,v 1.38 2008/07/13 20:13:10 raeburn Exp $ +# $Id: coursecatalog.pm,v 1.39 2008/07/14 10:24:27 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -837,7 +837,7 @@ $cleandesc=~s/'/\\'/g; $cleandesc =~ s/^\s+//; my ($cdom,$cnum)=split(/\_/,$course); - my ($descr,$instcode,$singleowner,$ttype,$selfenroll_types, + my ($instcode,$singleowner,$ttype,$selfenroll_types, $selfenroll_start,$selfenroll_end,@owners,%ownernames,$categories); if (ref($courses->{$course}) eq 'HASH') { $descr = $courses->{$course}{'description'}; @@ -1093,7 +1093,7 @@ } } @secnums = sort {$a <=> $b} @secnums; - my $seclist = join(', ',@secnums); + $seclist = join(', ',@secnums); my $numsec = @secnums; return ($seclist,$numsec); } From lon-capa-cvs-allow@mail.lon-capa.org Mon Jul 14 11:25:25 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (raeburn) Date: Mon, 14 Jul 2008 10:25:25 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /interface selfenroll.pm Message-ID: raeburn Mon Jul 14 06:25:25 2008 EDT Modified files: /loncom/interface selfenroll.pm Log: - eliminate duplicate declaration. Index: loncom/interface/selfenroll.pm diff -u loncom/interface/selfenroll.pm:1.10 loncom/interface/selfenroll.pm:1.11 --- loncom/interface/selfenroll.pm:1.10 Mon Jul 14 04:32:36 2008 +++ loncom/interface/selfenroll.pm Mon Jul 14 06:25:25 2008 @@ -1,7 +1,7 @@ # The LearningOnline Network # Allow users to self-enroll in a course # -# $Id: selfenroll.pm,v 1.10 2008/07/14 08:32:36 raeburn Exp $ +# $Id: selfenroll.pm,v 1.11 2008/07/14 10:25:25 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -179,7 +179,7 @@ if ($sso_url eq '') { $sso_url = $login_path; } - my $missing_formitem = &mt('The link to the requested page could not be followed.')."\\n".&mt('The placeholder for the courseID is absent.'); + $missing_formitem = &mt('The link to the requested page could not be followed.')."\\n".&mt('The placeholder for the courseID is absent.'); if ($knownuser) { if (keys(%curr_role)) { $r->print('

        '.&mt('Self-enrollment unavailable').'

        '. From lon-capa-cvs-allow@mail.lon-capa.org Mon Jul 14 11:28:20 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (raeburn) Date: Mon, 14 Jul 2008 10:28:20 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /homework grades.pm Message-ID: raeburn Mon Jul 14 06:28:20 2008 EDT Modified files: /loncom/homework grades.pm Log: - typo. Index: loncom/homework/grades.pm diff -u loncom/homework/grades.pm:1.527 loncom/homework/grades.pm:1.528 --- loncom/homework/grades.pm:1.527 Tue Jul 8 04:08:44 2008 +++ loncom/homework/grades.pm Mon Jul 14 06:28:19 2008 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.527 2008/07/08 08:08:44 raeburn Exp $ +# $Id: grades.pm,v 1.528 2008/07/14 10:28:19 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -5149,7 +5149,7 @@ &Apache::lonpickcode::code_list($r,2); - $r>print('
        '. + $r->print('
        '. $default_form_data."\n". &Apache::loncommon::start_data_table('LC_scantron_action')."\n". &Apache::loncommon::start_data_table_header_row()."\n". From lon-capa-cvs-allow@mail.lon-capa.org Mon Jul 14 11:35:01 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (raeburn) Date: Mon, 14 Jul 2008 10:35:01 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /interface loncreateuser.pm Message-ID: raeburn Mon Jul 14 06:35:01 2008 EDT Modified files: /loncom/interface loncreateuser.pm Log: - eliminate duplicate declaration. Index: loncom/interface/loncreateuser.pm diff -u loncom/interface/loncreateuser.pm:1.254 loncom/interface/loncreateuser.pm:1.255 --- loncom/interface/loncreateuser.pm:1.254 Sun Jul 13 05:53:16 2008 +++ loncom/interface/loncreateuser.pm Mon Jul 14 06:35:00 2008 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.254 2008/07/13 09:53:16 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.255 2008/07/14 10:35:00 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -3706,7 +3706,7 @@ &mt('Context').''.&mt('Start').''.&mt('End').''. &Apache::loncommon::end_data_table_header_row(); my ($minshown,$maxshown); - my $minshown = 1; + $minshown = 1; my $count = 0; if ($curr{'show'} ne &mt('all')) { $maxshown = $curr{'page'} * $curr{'show'}; From lon-capa-cvs-allow@mail.lon-capa.org Mon Jul 14 11:36:28 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (raeburn) Date: Mon, 14 Jul 2008 10:36:28 -0000 Subject: [LON-CAPA-cvs] cvs: loncom(version_2_7_X) /interface loncreateuser.pm Message-ID: raeburn Mon Jul 14 06:36:28 2008 EDT Modified files: (Branch: version_2_7_X) /loncom/interface loncreateuser.pm Log: - backport 1.255 Index: loncom/interface/loncreateuser.pm diff -u loncom/interface/loncreateuser.pm:1.249.2.2 loncom/interface/loncreateuser.pm:1.249.2.3 --- loncom/interface/loncreateuser.pm:1.249.2.2 Sun Jul 13 05:57:29 2008 +++ loncom/interface/loncreateuser.pm Mon Jul 14 06:36:24 2008 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.249.2.2 2008/07/13 09:57:29 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.249.2.3 2008/07/14 10:36:24 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -3706,7 +3706,7 @@ &mt('Context').''.&mt('Start').''.&mt('End').''. &Apache::loncommon::end_data_table_header_row(); my ($minshown,$maxshown); - my $minshown = 1; + $minshown = 1; my $count = 0; if ($curr{'show'} ne &mt('all')) { $maxshown = $curr{'page'} * $curr{'show'}; From lon-capa-cvs-allow@mail.lon-capa.org Mon Jul 14 11:40:57 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (foxr) Date: Mon, 14 Jul 2008 10:40:57 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm Message-ID: foxr Mon Jul 14 06:40:57 2008 EDT Modified files: /loncom/interface lonprintout.pm Log: BZ4320 - Add ability to print selected problems from the >entire< course for selected students. Index: loncom/interface/lonprintout.pm diff -u loncom/interface/lonprintout.pm:1.535 loncom/interface/lonprintout.pm:1.536 --- loncom/interface/lonprintout.pm:1.535 Wed Jun 18 20:28:42 2008 +++ loncom/interface/lonprintout.pm Mon Jul 14 06:40:57 2008 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.535 2008/06/19 00:28:42 raeburn Exp $ +# $Id: lonprintout.pm,v 1.536 2008/07/14 10:40:57 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -504,8 +504,9 @@ # Unmodified. } else { # Error!!!! - + croak "bad SPLIT_PDFS: $split_pdf in lonprintout::adjust_number_to_print"; + } } @@ -1664,7 +1665,8 @@ ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_pages') or ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems') or ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_resources') or # BUGBUG - ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'select_sequences')) { + ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'select_sequences') + ) { #-- produce an output string @@ -1672,7 +1674,8 @@ $selectionmade = 2; } elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_pages') { $selectionmade = 3; - } elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems') { + } elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems') + ) { $selectionmade = 4; } elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_resources') { #BUGBUG $selectionmade = 4; @@ -1827,12 +1830,14 @@ } $result .= '\end{document}'; } elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_students') || + ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems_students') || ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'resources_for_students')){ #-- prints assignments for whole class or for selected students my $type; - if ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_students') { + if (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_students') || + ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems_students') ) { $selectionmade=5; $type='problems'; } elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'resources_for_students') { @@ -2699,6 +2704,7 @@ push @{$printChoices}, [&mtn('Selected Problems from entire course'), 'all_problems', 'ALL_PROBLEMS']; push @{$printChoices}, [&mtn('Selected Resources from entire course'), 'all_resources', 'ALL_RESOURCES']; + push @{$printChoices}, [&mtn('Selected Problems from entire course for selected people'), 'all_problems_students', 'ALL_PROBLEMS_STUDENTS']; &Apache::lonxml::xmlparse($r, 'helper', < + + + STUDENTS1 + return $isProblemOrMap; + return $isNotMap; + return $symbFilter; + $start_new_option + + + + Select sorting order of printout + + Sort by section then student + Sort by students across sections. + +


        + +
        + ALL_PROBLEMS if ($helper->{VARS}->{'assignment'}) { From lon-capa-cvs-allow@mail.lon-capa.org Tue Jul 15 11:49:04 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (foxr) Date: Tue, 15 Jul 2008 10:49:04 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /cgi/mimeTeX commands loncapanewcommands.h Message-ID: foxr Tue Jul 15 06:49:04 2008 EDT Added files: /loncom/cgi/mimeTeX loncapanewcommands.h Modified files: /loncom/cgi/mimeTeX commands Log: bz5632 - add support to render the following tex constructs in mimetex: \xleftarrow{x} - x on top of a left arrow. \xrightarrow{x} - x on top of a left arrow. \xleftrightharpoons{x} - X on top of left/right harpoons. \autorightleftharpoons{x}{y} x on top, y below left right harpoons. This has been done by using a supported mimetex extension for defining latex macros and using the constructs suggested by Ray Batchelor in the original request. Therefore - New file: loncapanewcommands.h - Modified commands to define NEWCOMMANDS such that loncapanewcommands.h is included by mimetex in its macro definition sections. No changes to mimetex.c were required... this is a supported way to add extensions to mimetex. Index: loncom/cgi/mimeTeX/commands diff -u loncom/cgi/mimeTeX/commands:1.1 loncom/cgi/mimeTeX/commands:1.2 --- loncom/cgi/mimeTeX/commands:1.1 Mon Feb 28 14:08:11 2005 +++ loncom/cgi/mimeTeX/commands Tue Jul 15 06:49:02 2008 @@ -1,3 +1,4 @@ #!/bin/sh -cc -DAA -DCACHEPATH=\"mimetexcache/\" mimetex.c gifsave.c -lm -o mimetex.cgi +cc -DAA -DCACHEPATH=\"mimetexcache/\" -DNEWCOMMANDS="\"loncapanewcommands.h\"" \ + mimetex.c gifsave.c -lm -o mimetex.cgi Index: loncom/cgi/mimeTeX/loncapanewcommands.h +++ loncom/cgi/mimeTeX/loncapanewcommands.h /* macro argcnt substitution */ { "\\xleftarrow", "1", "{\\overset{#1}{\\leftarrow}}" }, { "\\xrightarrow", "1", "{\\overset{#1}{\\rightarrow}}" }, { "\\xrightleftharpoons", "1", "{\\overset{#1}{\\rightleftharpoons}}"}, { "\\autorightleftharpoons", "2", "{\\overset{#1}{\\underset{#2}{\\rightleftharpoons}}}"}, From lon-capa-cvs-allow@mail.lon-capa.org Tue Jul 15 17:18:41 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (raeburn) Date: Tue, 15 Jul 2008 16:18:41 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /interface lonsearchcat.pm Message-ID: raeburn Tue Jul 15 12:18:41 2008 EDT Modified files: /loncom/interface lonsearchcat.pm Log: - Fix typo. Index: loncom/interface/lonsearchcat.pm diff -u loncom/interface/lonsearchcat.pm:1.295 loncom/interface/lonsearchcat.pm:1.296 --- loncom/interface/lonsearchcat.pm:1.295 Wed May 28 18:22:27 2008 +++ loncom/interface/lonsearchcat.pm Tue Jul 15 12:18:41 2008 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Search Catalog # -# $Id: lonsearchcat.pm,v 1.295 2008/05/28 22:22:27 www Exp $ +# $Id: lonsearchcat.pm,v 1.296 2008/07/15 16:18:41 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2118,7 +2118,7 @@ } # Check for custom rights if ($Metadata->{'copyright'} eq 'custom') { - return &Apache::lonnet::customacccess('bre',$Metadata->{'url'}); + return &Apache::lonnet::customaccess('bre',$Metadata->{'url'}); } return 1; } From lon-capa-cvs-allow@mail.lon-capa.org Tue Jul 15 20:43:18 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (raeburn) Date: Tue, 15 Jul 2008 19:43:18 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /interface coursecatalog.pm Message-ID: raeburn Tue Jul 15 15:43:18 2008 EDT Modified files: /loncom/interface coursecatalog.pm Log: Provide syllabus page with means to construct breadcrumbs to facilitate return to Catalog after viewing syllabus. - new subroutine: &syllabus_javascript() includes javascrript to dynamically set form action to URL for syllabus page and to submit form (includes catalog search parameters as hidden input). - Replace call to &Apache::loncommon::syllabuswrapper() for syllabus link with link including call to javascript:ToSyllabus(cdom,cnum). Index: loncom/interface/coursecatalog.pm diff -u loncom/interface/coursecatalog.pm:1.39 loncom/interface/coursecatalog.pm:1.40 --- loncom/interface/coursecatalog.pm:1.39 Mon Jul 14 06:24:27 2008 +++ loncom/interface/coursecatalog.pm Tue Jul 15 15:43:15 2008 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler for displaying the course catalog interface # -# $Id: coursecatalog.pm,v 1.39 2008/07/14 10:24:27 raeburn Exp $ +# $Id: coursecatalog.pm,v 1.40 2008/07/15 19:43:15 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -106,12 +106,14 @@ document.$formname.sortby.value = caller; document.$formname.submit(); } + function setCourseId(caller) { document.$formname.coursenum.value = caller; document.$formname.submit(); } ENDSCRIPT + $catjs .= &syllabus_javascript(); my $numtitles; if ($env{'form.currcat_0'} eq 'instcode::0') { $numtitles = &instcode_course_selector($r,$codedom,$formname,$domdesc, @@ -155,8 +157,10 @@ my $output; my %add_entries = (topmargin => "0", marginheight => "0",); + my $js = ''."\n"; my $start_page = - &Apache::loncommon::start_page('Course Catalog','', + &Apache::loncommon::start_page('Course Catalog',$js, { 'add_entries' => \%add_entries, 'no_inline_link' => 1,}); @@ -172,16 +176,33 @@ {text=>"Course details"}); $r->print(&Apache::lonhtmlcommon::breadcrumbs('Course Details')); $r->print('
        '.&mt('Detailed course information:').'

        '. - ''. &print_course_listing($codedom,undef,$trails,$allitems). '

        '); - $r->print(''. + $r->print(''. + ''. &mt('Back to course listing').''. - ''. - ''); + &Apache::lonhtmlcommon::echo_form_input(['coursenum','catalogfilter','showdetails']).''); + return; +} + +sub syllabus_javascript { + return <<"END"; + +function ToSyllabus(cdom,cnum) { + if (cdom == '' || cdom == null) { + return; + } + if (cnum == '' || cnum == null) { + return; + } + document.syllabuslaunch.action = "/public/"+cdom+"/"+cnum+"/syllabus"; + document.syllabuslaunch.submit(); +} + +END } + sub instcode_course_selector { my ($r,$codedom,$formname,$domdesc,$catlinks,$catjs) = @_; my %coursecodes = (); @@ -734,9 +755,9 @@ my %domconfig = &Apache::lonnet::get_dom('configuration',['usercreation'],$domain); $output .= &construct_data_table($knownuser,\%courses,$details,undef,$now,\%domconfig,$trails,$allitems); - if ($env{'form.coursenum'} ne '') { - $output .= &Apache::lonhtmlcommon::echo_form_input(['coursenum','state','catalogfilter','sortby','showdetails']); - } + $output .= "\n".'
        '. + ''. + &Apache::lonhtmlcommon::echo_form_input(['catalogfilter']).'
        '; return $output; } @@ -1039,7 +1060,7 @@ ''.$xlist_items.''. ''.$title.' '; if ($showsyllabus) { - $output .= &Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$cnum,$cdom); + $output .= ''.&mt('Syllabus').''; } else { $output .= ' '; } From lon-capa-cvs-allow@mail.lon-capa.org Tue Jul 15 20:50:40 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (raeburn) Date: Tue, 15 Jul 2008 19:50:40 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /interface lonsyllabus.pm Message-ID: raeburn Tue Jul 15 15:50:40 2008 EDT Modified files: /loncom/interface lonsyllabus.pm Log: When syllabus page was reached from link in Course Catalog, display breadcrumbs to facilitate return to the Course Catalog after viewing the syllabus. - javascript function: ToCatalog(caller) added in called from Course Catalog. - backtocat form (which includes course catalog search settings as hidden input) included if called from Course Catalog. Index: loncom/interface/lonsyllabus.pm diff -u loncom/interface/lonsyllabus.pm:1.64 loncom/interface/lonsyllabus.pm:1.65 --- loncom/interface/lonsyllabus.pm:1.64 Fri Jul 11 10:55:21 2008 +++ loncom/interface/lonsyllabus.pm Tue Jul 15 15:50:39 2008 @@ -1,7 +1,7 @@ # The LearningOnline Network # Syllabus # -# $Id: lonsyllabus.pm,v 1.64 2008/07/11 14:55:21 raeburn Exp $ +# $Id: lonsyllabus.pm,v 1.65 2008/07/15 19:50:39 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -110,14 +110,58 @@ # ----------------------------------------------------------------- Make header if ($target ne 'tex') { my $rss_link = &Apache::lonrss::rss_link($cnum,$cdom); + my $js; + if ($env{'form.backto'} eq 'coursecatalog') { + $js .= <<"ENDSCRIPT"; + + + +ENDSCRIPT + } my $start_page = - &Apache::loncommon::start_page("Syllabus", $rss_link, + &Apache::loncommon::start_page("Syllabus", $rss_link.$js, {'function' => $forcestudent, 'domain' => $cdom, 'force_register' => $env{'form.register'},}); - $r->print($start_page.'

        '.$courseenv{'description'}.'

        '. + $r->print($start_page); + if ($env{'form.backto'} eq 'coursecatalog') { + &Apache::lonhtmlcommon::clear_breadcrumbs(); + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>"javascript:ToCatalog()", + text=>"Course Catalog"}); + if ($env{'form.coursenum'} ne '') { + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>"javascript:ToCatalog('details')", + text=>"Course details"}); + } + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>$r->uri, + text=>"Course syllabus"}); + $r->print(&Apache::lonhtmlcommon::breadcrumbs()); + } + $r->print('

        '.$courseenv{'description'}.'

        '. &Apache::lonnet::domain($cdom,'description').'

        '); } else { $r->print('\noindent{\large\textbf{'.$courseenv{'description'}.'}}\\\\\\\\\textbf{'. @@ -347,6 +391,11 @@ if ($target ne 'tex') {$r->print('

        ');} } if ($target ne 'tex') { + if ($env{'form.backto'} eq 'coursecatalog') { + $r->print('
        '. + &Apache::lonhtmlcommon::echo_form_input(['backto']). + '
        '); + } $r->print(&Apache::loncommon::end_page()); } else { $r->print('\end{document}'); From lon-capa-cvs-allow@mail.lon-capa.org Tue Jul 15 21:01:00 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (raeburn) Date: Tue, 15 Jul 2008 20:01:00 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /interface lonparmset.pm Message-ID: raeburn Tue Jul 15 16:01:00 2008 EDT Modified files: /loncom/interface lonparmset.pm Log: - Suppress display of self-enrollment settings in course (these are set from "Manage Users" menu). - Suppress display of course type (ultimately, this is expected to be set by a DC; however it's not used currently). Index: loncom/interface/lonparmset.pm diff -u loncom/interface/lonparmset.pm:1.404 loncom/interface/lonparmset.pm:1.405 --- loncom/interface/lonparmset.pm:1.404 Wed Jul 9 07:10:06 2008 +++ loncom/interface/lonparmset.pm Tue Jul 15 16:00:58 2008 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.404 2008/07/09 11:10:06 bisitz Exp $ +# $Id: lonparmset.pm,v 1.405 2008/07/15 20:00:58 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2399,7 +2399,9 @@ 'disableexampointprint', 'task_messages','task_grading')); foreach my $parameter (sort(keys(%values))) { - unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./)) { + unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./) || + ($parameter =~ m/^selfenroll_/) || ($parameter =~ /_selfenroll$/) + || ($parameter eq 'type')) { if (! $descriptions{$parameter}) { $descriptions{$parameter}=$parameter; push(@Display_Order,$parameter); From lon-capa-cvs-allow@mail.lon-capa.org Wed Jul 16 13:06:32 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (raeburn) Date: Wed, 16 Jul 2008 12:06:32 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /interface loncreateuser.pm Message-ID: This is a MIME encoded message --raeburn1216209992 Content-Type: text/plain raeburn Wed Jul 16 08:06:32 2008 EDT Modified files: /loncom/interface loncreateuser.pm Log: - &visible_in_cat() added to determine whether a course is currently visible in the Course Catalog, and if not, to provide advice on how to change this. - Messages about visibility in catalog are displayed on the Self-enrollment configuration screen, and also after making modifications to self-enrollment config. - Some wording changes in row titles for self-enrollment configuration data table. - Course Coordinators should understand that changes to access dates apply to future users self-enrolling, not retroactively to users who previously self-erolled. --raeburn1216209992 Content-Type: text/plain Content-Disposition: attachment; filename="raeburn-20080716080632.txt" Index: loncom/interface/loncreateuser.pm diff -u loncom/interface/loncreateuser.pm:1.255 loncom/interface/loncreateuser.pm:1.256 --- loncom/interface/loncreateuser.pm:1.255 Mon Jul 14 06:35:00 2008 +++ loncom/interface/loncreateuser.pm Wed Jul 16 08:06:28 2008 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.255 2008/07/14 10:35:00 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.256 2008/07/16 12:06:28 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -3400,14 +3400,32 @@ return -1; } ENDSCRIPT + my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + my $output = ''."\n". - '

        '.$lt->{'selfenroll'}.'

        '."\n". - '
        '."\n". - &Apache::lonhtmlcommon::start_pick_box(); - my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; - my $cnum = $env{'course.'.$env{'request.course.id'},'.num'}; + '

        '.$lt->{'selfenroll'}.'

        '."\n"; + my ($visible,$cansetvis,$vismsgs,$visactions) = &visible_in_cat($cdom,$cnum); + if (ref($visactions) eq 'HASH') { + if ($visible) { + $output .= '

        '.$visactions->{'vis'}.'

        '; + } else { + $output .= $visactions->{'miss'}.'
        '.$visactions->{'yous'}. + '

        '.$visactions->{'gen'}.'
        '.$visactions->{'coca'}; + if (ref($vismsgs) eq 'ARRAY') { + $output .= '
        '.$visactions->{'make'}.'

          '; + foreach my $item (@{$vismsgs}) { + $output .= '
        • '.$visactions->{$item}.'
        • '; + } + $output .= '
        '; + } + $output .= '

        '; + } + } + $output .= ''."\n". + &Apache::lonhtmlcommon::start_pick_box(); if (ref($row) eq 'ARRAY') { foreach my $item (@{$row}) { my $title = $item; @@ -3559,6 +3577,128 @@ return; } +sub visible_in_cat { + my ($cdom,$cnum) = @_; + my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$cdom); + my ($cathash,%settable,@vismsgs,$cansetvis); + my %visactions = &Apache::lonlocal::texthash( + vis => 'Your course currently appears in the Course Catalog for this domain.', + gen => 'Courses can be both self-cataloging, based on an institutional code (e.g., fs08phy231), or can be assigned categories from a hierarchy defined for the domain.', + miss => 'Your course does not currently appear in the Course Catalog for this domain.', + yous => 'You should remedy this if you plan to allow self-enrollment, otherwise students will have difficulty finding your course.', + coca => 'Courses can be absent from the Catalog, because they do not have an institutional code, have no assigned category, or have been specifically excluded.', + make => 'Make any changes to self-enrollment settings below, click "Save changes", then take action to include the course in the Catalog:', + take => 'Take the following action to ensure the course appears in the Catalog:', + dc_unhide => 'Ask a domain coordinator to change the "Exclude from course catalog" setting.', + dc_addinst => 'Ask a domain coordinator to enable display the catalog of "Official courses (with institutional codes)".', + dc_instcode => 'Ask a domain coordinator to assign an institutional code (if this is an official course).', + dc_catalog => 'Ask a domain coordinator to enable or create at least one course category in the domain.', + dc_categories => 'Ask a domain coordinator to create a hierarchy of categories and sub categories for courses in the domain.', + dc_chgcat => 'Ask a domain coordinator to change the category assigned to the course, as the one currently assigned is no longer used in the domain', + dc_addcat => 'Ask a domain coordinator to assign a category to the course.', + ); + $visactions{'unhide'} = &mt('Use [_1]Set course environment[_2] to change the "Exclude from course catalog" setting.','',''); + $visactions{'chgcat'} = &mt('Use [_1]Set course environment[_2] to change the category assigned to the course, as the one currently assigned is no longer used in the domain.','',''); + $visactions{'addcat'} = &mt('Use [_1]Set course environment[_2] to assign a category to the course.','',''); + if (ref($domconf{'coursecategories'}) eq 'HASH') { + if ($domconf{'coursecategories'}{'togglecats'} eq 'crs') { + $settable{'togglecats'} = 1; + } + if ($domconf{'coursecategories'}{'categorize'} eq 'crs') { + $settable{'categorize'} = 1; + } + $cathash = $domconf{'coursecategories'}{'cats'}; + } + if ($settable{'togglecats'} && $settable{'categories'}) { + $cansetvis = &mt('You are able to both assign a course category and choose to exclude this course from the catalog.'); + } elsif ($settable{'togglecats'}) { + $cansetvis = &mt('You are able to choose to exclude this course from the catalog, but only a Domain Coordinator may assign a course category.'); + } elsif ($settable{'categories'}) { + $cansetvis = &mt('You may assign a course category, but only a Domain Coordinator may choose to exclude this course from the catalog.'); + } else { + $cansetvis = &mt('Only a Domain Coordinator may assign a course category or choose to exclude this course from the catalog.'); + } + + my %currsettings = + &Apache::lonnet::get('environment',['hidefromcat','categories','internal.coursecode'], + $cdom,$cnum); + my $visible = 0; + if ($currsettings{'internal.coursecode'} ne '') { + if (ref($domconf{'coursecategories'}) eq 'HASH') { + $cathash = $domconf{'coursecategories'}{'cats'}; + if (ref($cathash) eq 'HASH') { + if ($cathash->{'instcode::0'} eq '') { + push(@vismsgs,'dc_addinst'); + } else { + $visible = 1; + } + } else { + $visible = 1; + } + } else { + $visible = 1; + } + } else { + if (ref($cathash) eq 'HASH') { + if ($cathash->{'instcode::0'} ne '') { + push(@vismsgs,'dc_instcode'); + } + } else { + push(@vismsgs,'dc_instcode'); + } + } + if ($currsettings{'categories'} ne '') { + my $cathash; + if (ref($domconf{'coursecategories'}) eq 'HASH') { + $cathash = $domconf{'coursecategories'}{'cats'}; + if (ref($cathash) eq 'HASH') { + if (keys(%{$cathash}) == 0) { + push(@vismsgs,'dc_catalog'); + } elsif ((keys(%{$cathash}) == 1) && ($cathash->{'instcode::0'} ne '')) { + push(@vismsgs,'dc_categories'); + } else { + my @currcategories = split('&',$currsettings{'categories'}); + my $matched = 0; + foreach my $cat (@currcategories) { + if ($cathash->{$cat} ne '') { + $visible = 1; + $matched = 1; + last; + } + } + if (!$matched) { + if ($settable{'categories'}) { + push(@vismsgs,'chgcat'); + } else { + push(@vismsgs,'dc_chgcat'); + } + } + } + } + } + } else { + if (ref($cathash) eq 'HASH') { + if ((keys(%{$cathash}) > 1) || + (keys(%{$cathash}) == 1) && ($cathash->{'instcode::0'} eq '')) { + if ($settable{'categories'}) { + push(@vismsgs,'addcat'); + } else { + push(@vismsgs,'dc_addcat'); + } + } + } + } + if ($currsettings{'hidefromcat'} eq 'yes') { + $visible = 0; + if ($settable{'togglecats'}) { + unshift(@vismsgs,'unhide'); + } else { + unshift(@vismsgs,'dc_unhide') + } + } + return ($visible,$cansetvis,\@vismsgs,\%visactions); +} + sub new_selfenroll_dom_row { my ($newdom,$num) = @_; my $domdesc = &Apache::lonnet::domain($newdom); @@ -4717,6 +4857,21 @@ } else { $r->print(&mt('No changes were made to the existing self-enrollment settings in this course.')); } + my ($visible,$cansetvis,$vismsgs,$visactions) = &visible_in_cat($cdom,$cnum); + if (ref($visactions) eq 'HASH') { + if (!$visible) { + $r->print('
        '.$visactions->{'miss'}.'
        '.$visactions->{'yous'}. + '
        '); + if (ref($vismsgs) eq 'ARRAY') { + $r->print('
        '.$visactions->{'take'}.'
          '); + foreach my $item (@{$vismsgs}) { + $r->print('
        • '.$visactions->{$item}.'
        • '); + } + $r->print('
        '); + } + $r->print($cansetvis); + } + } return; } @@ -4726,8 +4881,8 @@ types => 'Users allowed to self-enroll in this course', registered => 'Restrict self-enrollment to students officially registered for the course', enroll_dates => 'Dates self-enrollment available', - access_dates => 'Course access dates for self-enrolled users', - section => 'Section assigned to self-enrolled users', + access_dates => 'Course access dates assigned to self-enrolling users', + section => 'Section assigned to self-enrolling users', ); return (\@row,\%lt); } --raeburn1216209992-- From lon-capa-cvs-allow@mail.lon-capa.org Wed Jul 16 13:32:14 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (raeburn) Date: Wed, 16 Jul 2008 12:32:14 -0000 Subject: [LON-CAPA-cvs] cvs: loncom(version_2_7_X) /interface loncreateuser.pm Message-ID: This is a MIME encoded message --raeburn1216211534 Content-Type: text/plain raeburn Wed Jul 16 08:32:14 2008 EDT Modified files: (Branch: version_2_7_X) /loncom/interface loncreateuser.pm Log: - backport 1.256. --raeburn1216211534 Content-Type: text/plain Content-Disposition: attachment; filename="raeburn-20080716083214.txt" Index: loncom/interface/loncreateuser.pm diff -u loncom/interface/loncreateuser.pm:1.249.2.3 loncom/interface/loncreateuser.pm:1.249.2.4 --- loncom/interface/loncreateuser.pm:1.249.2.3 Mon Jul 14 06:36:24 2008 +++ loncom/interface/loncreateuser.pm Wed Jul 16 08:32:11 2008 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.249.2.3 2008/07/14 10:36:24 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.249.2.4 2008/07/16 12:32:11 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -3400,14 +3400,32 @@ return -1; } ENDSCRIPT + my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + my $output = ''."\n". - '

        '.$lt->{'selfenroll'}.'

        '."\n". - ''."\n". - &Apache::lonhtmlcommon::start_pick_box(); - my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; - my $cnum = $env{'course.'.$env{'request.course.id'},'.num'}; + '

        '.$lt->{'selfenroll'}.'

        '."\n"; + my ($visible,$cansetvis,$vismsgs,$visactions) = &visible_in_cat($cdom,$cnum); + if (ref($visactions) eq 'HASH') { + if ($visible) { + $output .= '

        '.$visactions->{'vis'}.'

        '; + } else { + $output .= $visactions->{'miss'}.'
        '.$visactions->{'yous'}. + '

        '.$visactions->{'gen'}.'
        '.$visactions->{'coca'}; + if (ref($vismsgs) eq 'ARRAY') { + $output .= '
        '.$visactions->{'make'}.'

          '; + foreach my $item (@{$vismsgs}) { + $output .= '
        • '.$visactions->{$item}.'
        • '; + } + $output .= '
        '; + } + $output .= '

        '; + } + } + $output .= ''."\n". + &Apache::lonhtmlcommon::start_pick_box(); if (ref($row) eq 'ARRAY') { foreach my $item (@{$row}) { my $title = $item; @@ -3559,6 +3577,128 @@ return; } +sub visible_in_cat { + my ($cdom,$cnum) = @_; + my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$cdom); + my ($cathash,%settable,@vismsgs,$cansetvis); + my %visactions = &Apache::lonlocal::texthash( + vis => 'Your course currently appears in the Course Catalog for this domain.', + gen => 'Courses can be both self-cataloging, based on an institutional code (e.g., fs08phy231), or can be assigned categories from a hierarchy defined for the domain.', + miss => 'Your course does not currently appear in the Course Catalog for this domain.', + yous => 'You should remedy this if you plan to allow self-enrollment, otherwise students will have difficulty finding your course.', + coca => 'Courses can be absent from the Catalog, because they do not have an institutional code, have no assigned category, or have been specifically excluded.', + make => 'Make any changes to self-enrollment settings below, click "Save changes", then take action to include the course in the Catalog:', + take => 'Take the following action to ensure the course appears in the Catalog:', + dc_unhide => 'Ask a domain coordinator to change the "Exclude from course catalog" setting.', + dc_addinst => 'Ask a domain coordinator to enable display the catalog of "Official courses (with institutional codes)".', + dc_instcode => 'Ask a domain coordinator to assign an institutional code (if this is an official course).', + dc_catalog => 'Ask a domain coordinator to enable or create at least one course category in the domain.', + dc_categories => 'Ask a domain coordinator to create a hierarchy of categories and sub categories for courses in the domain.', + dc_chgcat => 'Ask a domain coordinator to change the category assigned to the course, as the one currently assigned is no longer used in the domain', + dc_addcat => 'Ask a domain coordinator to assign a category to the course.', + ); + $visactions{'unhide'} = &mt('Use [_1]Set course environment[_2] to change the "Exclude from course catalog" setting.','',''); + $visactions{'chgcat'} = &mt('Use [_1]Set course environment[_2] to change the category assigned to the course, as the one currently assigned is no longer used in the domain.','',''); + $visactions{'addcat'} = &mt('Use [_1]Set course environment[_2] to assign a category to the course.','',''); + if (ref($domconf{'coursecategories'}) eq 'HASH') { + if ($domconf{'coursecategories'}{'togglecats'} eq 'crs') { + $settable{'togglecats'} = 1; + } + if ($domconf{'coursecategories'}{'categorize'} eq 'crs') { + $settable{'categorize'} = 1; + } + $cathash = $domconf{'coursecategories'}{'cats'}; + } + if ($settable{'togglecats'} && $settable{'categories'}) { + $cansetvis = &mt('You are able to both assign a course category and choose to exclude this course from the catalog.'); + } elsif ($settable{'togglecats'}) { + $cansetvis = &mt('You are able to choose to exclude this course from the catalog, but only a Domain Coordinator may assign a course category.'); + } elsif ($settable{'categories'}) { + $cansetvis = &mt('You may assign a course category, but only a Domain Coordinator may choose to exclude this course from the catalog.'); + } else { + $cansetvis = &mt('Only a Domain Coordinator may assign a course category or choose to exclude this course from the catalog.'); + } + + my %currsettings = + &Apache::lonnet::get('environment',['hidefromcat','categories','internal.coursecode'], + $cdom,$cnum); + my $visible = 0; + if ($currsettings{'internal.coursecode'} ne '') { + if (ref($domconf{'coursecategories'}) eq 'HASH') { + $cathash = $domconf{'coursecategories'}{'cats'}; + if (ref($cathash) eq 'HASH') { + if ($cathash->{'instcode::0'} eq '') { + push(@vismsgs,'dc_addinst'); + } else { + $visible = 1; + } + } else { + $visible = 1; + } + } else { + $visible = 1; + } + } else { + if (ref($cathash) eq 'HASH') { + if ($cathash->{'instcode::0'} ne '') { + push(@vismsgs,'dc_instcode'); + } + } else { + push(@vismsgs,'dc_instcode'); + } + } + if ($currsettings{'categories'} ne '') { + my $cathash; + if (ref($domconf{'coursecategories'}) eq 'HASH') { + $cathash = $domconf{'coursecategories'}{'cats'}; + if (ref($cathash) eq 'HASH') { + if (keys(%{$cathash}) == 0) { + push(@vismsgs,'dc_catalog'); + } elsif ((keys(%{$cathash}) == 1) && ($cathash->{'instcode::0'} ne '')) { + push(@vismsgs,'dc_categories'); + } else { + my @currcategories = split('&',$currsettings{'categories'}); + my $matched = 0; + foreach my $cat (@currcategories) { + if ($cathash->{$cat} ne '') { + $visible = 1; + $matched = 1; + last; + } + } + if (!$matched) { + if ($settable{'categories'}) { + push(@vismsgs,'chgcat'); + } else { + push(@vismsgs,'dc_chgcat'); + } + } + } + } + } + } else { + if (ref($cathash) eq 'HASH') { + if ((keys(%{$cathash}) > 1) || + (keys(%{$cathash}) == 1) && ($cathash->{'instcode::0'} eq '')) { + if ($settable{'categories'}) { + push(@vismsgs,'addcat'); + } else { + push(@vismsgs,'dc_addcat'); + } + } + } + } + if ($currsettings{'hidefromcat'} eq 'yes') { + $visible = 0; + if ($settable{'togglecats'}) { + unshift(@vismsgs,'unhide'); + } else { + unshift(@vismsgs,'dc_unhide') + } + } + return ($visible,$cansetvis,\@vismsgs,\%visactions); +} + sub new_selfenroll_dom_row { my ($newdom,$num) = @_; my $domdesc = &Apache::lonnet::domain($newdom); @@ -4717,6 +4857,21 @@ } else { $r->print(&mt('No changes were made to the existing self-enrollment settings in this course.')); } + my ($visible,$cansetvis,$vismsgs,$visactions) = &visible_in_cat($cdom,$cnum); + if (ref($visactions) eq 'HASH') { + if (!$visible) { + $r->print('
        '.$visactions->{'miss'}.'
        '.$visactions->{'yous'}. + '
        '); + if (ref($vismsgs) eq 'ARRAY') { + $r->print('
        '.$visactions->{'take'}.'
          '); + foreach my $item (@{$vismsgs}) { + $r->print('
        • '.$visactions->{$item}.'
        • '); + } + $r->print('
        '); + } + $r->print($cansetvis); + } + } return; } @@ -4726,8 +4881,8 @@ types => 'Users allowed to self-enroll in this course', registered => 'Restrict self-enrollment to students officially registered for the course', enroll_dates => 'Dates self-enrollment available', - access_dates => 'Course access dates for self-enrolled users', - section => 'Section assigned to self-enrolled users', + access_dates => 'Course access dates assigned to self-enrolling users', + section => 'Section assigned to self-enrolling users', ); return (\@row,\%lt); } --raeburn1216211534-- From lon-capa-cvs-allow@mail.lon-capa.org Thu Jul 17 06:50:25 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (www) Date: Thu, 17 Jul 2008 05:50:25 -0000 Subject: [LON-CAPA-cvs] cvs: loncom / production_dns_domain.tab production_dns_hosts.tab Message-ID: www Thu Jul 17 01:50:25 2008 EDT Modified files: /loncom production_dns_domain.tab production_dns_hosts.tab Log: Alexander School District Index: loncom/production_dns_domain.tab diff -u loncom/production_dns_domain.tab:1.38 loncom/production_dns_domain.tab:1.39 --- loncom/production_dns_domain.tab:1.38 Wed Jul 9 12:59:16 2008 +++ loncom/production_dns_domain.tab Thu Jul 17 01:50:24 2008 @@ -93,6 +93,7 @@ fsuK12:Florida State University - K12:::en-US:Tallahassee, FL:-84.28:30.438:fsuk12l1 brs:Beaverton Rural Schools:::::::brsl2 +alexander:Alexander School District:::en-US:Albany,OH:-82.1:39.329:alexanderl1 athens:Athens Public Schools:::en-US:Athens, OH:-82.1:39.329:athensl1 vinton:Vinton County Public Schools:::en-US:Athens, OH:-82.1:39.329:vintonl1 pickerington:Pickerington Public Schools:::en-US:Athens, OH:-82.1:39.329:pickeringtonl1 Index: loncom/production_dns_hosts.tab diff -u loncom/production_dns_hosts.tab:1.40 loncom/production_dns_hosts.tab:1.41 --- loncom/production_dns_hosts.tab:1.40 Wed Jul 9 12:59:16 2008 +++ loncom/production_dns_hosts.tab Thu Jul 17 01:50:24 2008 @@ -113,6 +113,7 @@ sarasotal1:sarasota:library:shs-dunk-lin.shs.sarasota.k12.fl.us #ohio u hosted +alexanderl1:alexander:library:capa4.phy.ohiou.edu athensl1:athens:library:capa4.phy.ohiou.edu vintonl1:vinton:library:capa4.phy.ohiou.edu trimblel1:trimble:library:capa4.phy.ohiou.edu From lon-capa-cvs-allow@mail.lon-capa.org Thu Jul 17 13:00:28 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (raeburn) Date: Thu, 17 Jul 2008 12:00:28 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /interface coursecatalog.pm Message-ID: raeburn Thu Jul 17 08:00:28 2008 EDT Modified files: /loncom/interface coursecatalog.pm Log: - Change link to "Enroll in course" to javascript:ToSelfenroll() which submits linklaunch form. - Filters used in coursecatalog display passed to selfenroll to allow breadcrumbs there. - syllabuslaunch form renamed linklaunch form (no longer used for just syllabus). - &syllabus_javascript() renamed courselink_javascript() - broader use. - 'courseid' added as another element to exclude from echo of form input to avoid duplicate when coming from breadcrumb trail link in self-enroll. Index: loncom/interface/coursecatalog.pm diff -u loncom/interface/coursecatalog.pm:1.40 loncom/interface/coursecatalog.pm:1.41 --- loncom/interface/coursecatalog.pm:1.40 Tue Jul 15 15:43:15 2008 +++ loncom/interface/coursecatalog.pm Thu Jul 17 08:00:28 2008 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler for displaying the course catalog interface # -# $Id: coursecatalog.pm,v 1.40 2008/07/15 19:43:15 raeburn Exp $ +# $Id: coursecatalog.pm,v 1.41 2008/07/17 12:00:28 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -113,7 +113,7 @@ } ENDSCRIPT - $catjs .= &syllabus_javascript(); + $catjs .= &courselink_javascript(); my $numtitles; if ($env{'form.currcat_0'} eq 'instcode::0') { $numtitles = &instcode_course_selector($r,$codedom,$formname,$domdesc, @@ -158,7 +158,7 @@ my %add_entries = (topmargin => "0", marginheight => "0",); my $js = ''."\n"; + &courselink_javascript().''."\n"; my $start_page = &Apache::loncommon::start_page('Course Catalog',$js, { @@ -181,11 +181,12 @@ $r->print(''. ''. &mt('Back to course listing').''. - &Apache::lonhtmlcommon::echo_form_input(['coursenum','catalogfilter','showdetails']).''); + &Apache::lonhtmlcommon::echo_form_input(['coursenum','catalogfilter', + 'showdetails','courseid']).''); return; } -sub syllabus_javascript { +sub courselink_javascript { return <<"END"; function ToSyllabus(cdom,cnum) { @@ -195,8 +196,17 @@ if (cnum == '' || cnum == null) { return; } - document.syllabuslaunch.action = "/public/"+cdom+"/"+cnum+"/syllabus"; - document.syllabuslaunch.submit(); + document.linklaunch.action = "/public/"+cdom+"/"+cnum+"/syllabus"; + document.linklaunch.submit(); +} + +function ToSelfenroll(courseid) { + if (courseid == '') { + return; + } + document.linklaunch.action = "/adm/selfenroll"; + document.linklaunch.courseid.value = courseid; + document.linklaunch.submit(); } END @@ -755,9 +765,10 @@ my %domconfig = &Apache::lonnet::get_dom('configuration',['usercreation'],$domain); $output .= &construct_data_table($knownuser,\%courses,$details,undef,$now,\%domconfig,$trails,$allitems); - $output .= "\n".'
        '. + $output .= "\n".''. ''. - &Apache::lonhtmlcommon::echo_form_input(['catalogfilter']).'
        '; + ''. + &Apache::lonhtmlcommon::echo_form_input(['catalogfilter','courseid']).''; return $output; } @@ -1084,7 +1095,7 @@ if (($info->{'selfenroll_start'} > 0) && ($info->{'selfenroll_start'} > $now)) { $output .= ''.&mt('Starts: [_1]',''.$showstart.'').'
        '.&mt('Ends: [_1]',''.$showend.'').''; } else { - $output .= ''.&mt('Enroll in course').''; + $output .= ''.&mt('Enroll in course').''; } $selfenroll = 1; } From lon-capa-cvs-allow@mail.lon-capa.org Thu Jul 17 13:01:49 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (raeburn) Date: Thu, 17 Jul 2008 12:01:49 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /interface lonsyllabus.pm Message-ID: raeburn Thu Jul 17 08:01:49 2008 EDT Modified files: /loncom/interface lonsyllabus.pm Log: - 'courseid' added as another element to exclude from echo of form input in backtocat form. Index: loncom/interface/lonsyllabus.pm diff -u loncom/interface/lonsyllabus.pm:1.65 loncom/interface/lonsyllabus.pm:1.66 --- loncom/interface/lonsyllabus.pm:1.65 Tue Jul 15 15:50:39 2008 +++ loncom/interface/lonsyllabus.pm Thu Jul 17 08:01:46 2008 @@ -1,7 +1,7 @@ # The LearningOnline Network # Syllabus # -# $Id: lonsyllabus.pm,v 1.65 2008/07/15 19:50:39 raeburn Exp $ +# $Id: lonsyllabus.pm,v 1.66 2008/07/17 12:01:46 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -393,7 +393,7 @@ if ($target ne 'tex') { if ($env{'form.backto'} eq 'coursecatalog') { $r->print('
        '. - &Apache::lonhtmlcommon::echo_form_input(['backto']). + &Apache::lonhtmlcommon::echo_form_input(['backto','courseid']). '
        '); } $r->print(&Apache::loncommon::end_page()); From lon-capa-cvs-allow@mail.lon-capa.org Thu Jul 17 13:10:09 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (raeburn) Date: Thu, 17 Jul 2008 12:10:09 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /interface createaccount.pm Message-ID: This is a MIME encoded message --raeburn1216296609 Content-Type: text/plain raeburn Thu Jul 17 08:10:09 2008 EDT Modified files: /loncom/interface createaccount.pm Log: - Breadcrumbs added to facilitate retreat to earlier pages during account creation process. - &catreturn_js() added to provide javascript functions used in breadcrumb trail to jump back to course catalog or first self-enrollment screen, when account creation occuring in context of self-rnrollment - &print_footer() added to provide backupcrumbs form where coursecatalog search terms are stored so breadcrumb links can jump back to entry point from course catalog in self-enroll context. - &selfenroll_crumbs() added to provide additional breadcrumbs in selfe-ennroll context. - &login_failure_msg() added to put messages displayed when authentication fails in one place, with a link back to try again. - form element cid renamed courseid (and $cid renamed $courseid) to avoid confusing this with the cid form element used for entering a studentID in loncreateuser:personal_data_display(). --raeburn1216296609 Content-Type: text/plain Content-Disposition: attachment; filename="raeburn-20080717081009.txt" Index: loncom/interface/createaccount.pm diff -u loncom/interface/createaccount.pm:1.21 loncom/interface/createaccount.pm:1.22 --- loncom/interface/createaccount.pm:1.21 Mon Jul 14 06:17:42 2008 +++ loncom/interface/createaccount.pm Thu Jul 17 08:10:05 2008 @@ -3,7 +3,7 @@ # institutional log-in ID (institutional authentication required - localauth # or kerberos) or an e-mail address. # -# $Id: createaccount.pm,v 1.21 2008/07/14 10:17:42 raeburn Exp $ +# $Id: createaccount.pm,v 1.22 2008/07/17 12:10:05 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -52,7 +52,7 @@ if ($r->header_only) { return OK; } - + my $domain; my $sso_username = $r->subprocess_env->get('REDIRECT_SSOUserUnknown'); @@ -90,35 +90,41 @@ return OK; } - my $courseid; + my ($js,$courseid,$title); if (defined($env{'form.courseid'})) { $courseid = &validate_course($env{'form.courseid'}); } + if ($courseid ne '') { + $js = &catreturn_js(); + $title = 'Self-enroll in a LON-CAPA course'; + } else { + $title = 'Create a user account in LON-CAPA'; + } if ($env{'form.phase'} eq 'selfenroll_login') { + $title = 'Self-enroll in a LON-CAPA course'; if ($env{'form.udom'} ne '') { $domain = $env{'form.udom'}; } my ($result,$output) = &username_validation($r,$env{'form.uname'},$domain,$domdesc, - $contact_name,$contact_email,$courseid, $lonhost); if ($result eq 'existingaccount') { $r->print($output); - $r->print(&Apache::loncommon::end_page()); + &print_footer($r); return OK; } else { $start_page = - &Apache::loncommon::start_page('Self-enroll in a LON-CAPA course','', + &Apache::loncommon::start_page($title,$js, {'no_inline_link' => 1,}); - &print_header($r,$start_page); - $r->print($output.&Apache::loncommon::end_page()); + &print_header($r,$start_page,$courseid); + $r->print($output); + &print_footer($r); return OK; } } - $start_page = - &Apache::loncommon::start_page('Create a user account in LON-CAPA','', + &Apache::loncommon::start_page($title,$js, {'no_inline_link' => 1,}); my @cancreate; my %domconfig = &Apache::lonnet::get_dom('configuration',['usercreation'],$domain); @@ -134,17 +140,17 @@ } if (@cancreate == 0) { - &print_header($r,$start_page); + &print_header($r,$start_page,$courseid); my $output = '

        '.&mt('Account creation unavailable').'

        '. ''. &mt('Creation of a new user account using an e-mail address or an institutional log-in ID as username is not permitted at this institution ([_1]).',$domdesc).'

        '; $r->print($output); - $r->print(&Apache::loncommon::end_page()); + &print_footer($r); return OK; } if ($sso_username ne '') { - &print_header($r,$start_page); + &print_header($r,$start_page,$courseid); my ($msg,$sso_logout); $sso_logout = &sso_logout_frag($r,$domain); if (grep(/^sso$/,@cancreate)) { @@ -159,7 +165,7 @@ $sso_logout; } $r->print($msg); - $r->print(&Apache::loncommon::end_page()); + &print_footer($r); return OK; } @@ -174,13 +180,13 @@ return OK; } else { $r->print($output); - $r->print(&Apache::loncommon::end_page()); + &print_footer($r); return OK; } } else { - &print_header($r,$start_page); + &print_header($r,$start_page,$courseid); $r->print($output); - $r->print(&Apache::loncommon::end_page()); + &print_footer($r); return OK; } } @@ -194,9 +200,9 @@ return OK; } } - &print_header($r,$start_page); + &print_header($r,$start_page,$courseid); $r->print($output); - $r->print(&Apache::loncommon::end_page()); + &print_footer($r); return OK; } elsif ($env{'form.phase'} eq 'username_validation') { (my $result,$output) = @@ -205,19 +211,19 @@ $lonhost); if ($result eq 'existingaccount') { $r->print($output); - $r->print(&Apache::loncommon::end_page()); + &print_footer($r); return OK; } else { - &print_header($r,$start_page); + &print_header($r,$start_page,$courseid); } } elsif ($env{'form.create_with_email'}) { - &print_header($r,$start_page); + &print_header($r,$start_page,$courseid); $output = &process_email_request($env{'form.useremail'},$domain,$domdesc, $contact_name,$contact_email,\@cancreate, $lonhost,$domconfig{'usercreation'}, $courseid); } elsif (!$token) { - &print_header($r,$start_page); + &print_header($r,$start_page,$courseid); my $now=time; if (grep(/^login$/,@cancreate)) { my $jsh=Apache::File->new($include."/londes.js"); @@ -228,17 +234,21 @@ $r->print(&javascript_validmail()); } $output = &print_username_form($domain,$domdesc,\@cancreate,$now,$lonhost, - $courseid); + $courseid); } $r->print($output); - $r->print(&Apache::loncommon::end_page()); + &print_footer($r); return OK; } sub print_header { - my ($r,$start_page) = @_; + my ($r,$start_page,$courseid) = @_; $r->print($start_page); &Apache::lonhtmlcommon::clear_breadcrumbs(); + if ($courseid ne '') { + my %coursehash = &Apache::lonnet::coursedescription($courseid); + &selfenroll_crumbs($r,$courseid,$coursehash{'description'}); + } &Apache::lonhtmlcommon::add_breadcrumb ({href=>"/adm/createuser", text=>"New username"}); @@ -246,6 +256,42 @@ return; } +sub print_footer { + my ($r) = @_; + if ($env{'form.courseid'} ne '') { + $r->print('
        '. + &Apache::lonhtmlcommon::echo_form_input(['backto','logtoken', + 'token','serverid','uname','upass','phase','create_with_email', + 'code','useremail','crypt','cfirstname','clastname', + 'cmiddlename','cgeneration','cpermanentemail','cid]). + '
        '); + } + $r->print(&Apache::loncommon::end_page()); +} + +sub selfenroll_crumbs { + my ($r,$courseid,$desc) = @_; + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>"javascript:ToCatalog('backupcrumbs','')", + text=>"Course Catalog"}); + if ($env{'form.coursenum'} ne '') { + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>"javascript:ToCatalog('backupcrumbs','details')", + text=>"Course details"}); + } + my $last_crumb; + if ($desc ne '') { + $last_crumb = &mt('Self-enroll in [_1]',''.$desc.''); + } else { + $last_crumb = &mt('Self-enroll'); + } + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>"javascript:ToSelfenroll('backupcrumbs')", + text=>$last_crumb, + no_mt=>"1"}); + return; +} + sub validate_course { my ($courseid) = @_; my ($cdom,$cnum) = ($courseid =~ /^($match_domain)_($match_courseid)$/); @@ -346,7 +392,7 @@ my $submit_text = &mt('Create LON-CAPA account'); $output .= &mt('If you already have a log-in ID at this institution,[_1] you may be able to use it for LON-CAPA.','
        ').'

        '.&mt('Type in your log-in ID and password to find out.').'

        '; $output .= &login_box($now,$lonhost,$courseid,$submit_text, - $domain,'createaccount'); + $domain,'createaccount').''; } } if (grep(/^email$/,@{$cancreate})) { @@ -374,8 +420,11 @@ $output .= ''. &Apache::lonhtmlcommon::row_closure(1). - &Apache::lonhtmlcommon::end_pick_box().'

        '. - ''; + &Apache::lonhtmlcommon::end_pick_box().'

        '; + if ($courseid ne '') { + $output .= &Apache::lonhtmlcommon::echo_form_input(['courseid']); + } + $output .= ''; } } if ($output eq '') { @@ -424,7 +473,7 @@ &Apache::lonhtmlcommon::end_pick_box().'

        '."\n". ''."\n". ''."\n". - ''; + ''; return $output; } @@ -608,7 +657,7 @@ $courseid = &validate_course($courseid); if ($courseid ne '') { $form{'courseid'} = $courseid; - $firsturl = '/adm/selfenroll?cid='.$courseid; + $firsturl = '/adm/selfenroll?courseid='.$courseid; } } if ($r->dir_config('lonBalancer') eq 'yes') { @@ -730,7 +779,7 @@ &mt('Return to previous page').''. &Apache::loncommon::end_page(); if ($retrieved eq 'ok') { - if ($env{'form.cid'} ne '') { + if ($env{'form.courseid'} ne '') { my ($result,$userchkmsg) = &check_id($username,$domain,$domdesc); if ($result eq 'fail') { $output = $error.&mt('Invalid ID format').$end. @@ -775,10 +824,7 @@ $output = '

        '.&mt('A LON-CAPA account already exists for username [_1] at this institution ([_2]).',''.$username.'',$domdesc).'
        '.&mt('The password entered was also correct so you have been logged in.'); return ('existingaccount',$output); } else { - $output = '
        '. - &mt('Username and/or password could not be authenticated.'). - '
        '. - &mt('Please check the username and password.'); + $output = &login_failure_msg($courseid); } } else { my $primlibserv = &Apache::lonnet::domain($domain,'primary'); @@ -795,15 +841,28 @@ $output = &username_check($username,$domain,$domdesc,$courseid,$lonhost, $contact_email,$contact_name); } else { - $output = '
        '. - &mt('Username and/or password could not be authenticated.'). - '
        '. - &mt('Please check the username and password.'); + $output = &login_failure_msg($courseid); } } return ('ok',$output); } +sub login_failure_msg { + my ($courseid) = @_; + my $url; + if ($courseid ne '') { + $url = "/adm/selfenroll?courseid=".$courseid; + } else { + $url = "/adm/createaccount"; + } + my $output = '

        '.&mt('Authentication failed').'

        '. + &mt('Username and/or password could not be authenticated.'). + '
        '. + &mt('Please check the username and password.').'

        '; + ''.&mt('Try again').''; + return $output; +} + sub username_check { my ($username,$domain,$domdesc,$courseid,$lonhost,$contact_email,$contact_name, $sso_logout) = @_; @@ -877,12 +936,21 @@ &mt('Create LON-CAPA account').'" />'; if ($rowcount) { if ($editable) { - $msg = &mt('To create one, use the table below to provide information about yourself, then click the [_1]Create LON-CAPA account[_2] button.','','').'
        '; + if ($courseid ne '') { + $msg = '

        '.&mt('User information').'

        '; + } + $msg .= &mt('To create one, use the table below to provide information about yourself, then click the [_1]Create LON-CAPA account[_2] button.','','').'
        '; } else { - $msg = &mt('A user account will be created with information displayed in the table below, when you click the [_1]Create LON-CAPA account[_2] button.','','').'
        '; + if ($courseid ne '') { + $msg = '

        '.&mt('Review user information').'

        '; + } + $msg .= &mt('A user account will be created with information displayed in the table below, when you click the [_1]Create LON-CAPA account[_2] button.','','').'
        '; } } else { - $msg = '
        '.&mt('Confirm that you wish to create an account.'); + if ($courseid ne '') { + $msg = '

        '.&mt('Confirmation').'

        '; + } + $msg .= &mt('Confirm that you wish to create an account.'); } $msg .= $output; } @@ -922,7 +990,7 @@ if ((($domdefaults{'auth_def'} =~/^krb(4|5)$/) && ($domdefaults{'auth_arg_def'} ne '')) || ($domdefaults{'auth_def'} eq 'localauth')) { - if ($env{'form.cid'} ne '') { + if ($env{'form.courseid'} ne '') { my ($result,$userchkmsg) = &check_id($username,$domain,$domdesc); if ($result eq 'fail') { $output = $error.&mt('Invalid ID format').$end. @@ -932,7 +1000,7 @@ } # Call modifyuser my $result = - &Apache::lonnet::modifyuser($domain,$username,$env{'form.cid'}, + &Apache::lonnet::modifyuser($domain,$username,$env{'form.courseid'}, $domdefaults{'auth_def'}, $domdefaults{'auth_arg_def'},$env{'form.cfirstname'}, $env{'form.cmiddlename'},$env{'form.clastname'}, @@ -1056,11 +1124,15 @@ sub serverform { my ($logtoken,$lonhost,$mailtoken,$courseid,$context) = @_; - my $phase = 'username_validation"'; + my $phase = 'username_validation'; + my $catalog_elements; if ($context eq 'selfenroll') { $phase = 'selfenroll_login'; } - my $output .= < @@ -1069,6 +1141,7 @@ + $catalog_elements ENDSERVERFORM return $output; @@ -1153,4 +1226,61 @@ return $endsessionmsg; } +sub catreturn_js { + return <<"ENDSCRIPT"; + +ENDSCRIPT + +} + 1; --raeburn1216296609-- From lon-capa-cvs-allow@mail.lon-capa.org Thu Jul 17 13:22:28 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (raeburn) Date: Thu, 17 Jul 2008 12:22:28 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /interface selfenroll.pm Message-ID: This is a MIME encoded message --raeburn1216297348 Content-Type: text/plain raeburn Thu Jul 17 08:22:28 2008 EDT Modified files: /loncom/interface selfenroll.pm Log: - Breadcrumbs added to facilitate retreat to course catalog or initial self-enrollment page. - &page_footer() added to provide backupcrumba form used to store catalog filters used originally. - &Apache::createaccount::catreturn_js() used to generate getFormByName() and getIndexByName() javascript. - &Apache::createaccount::selfenroll_crumbs() used to generate breadcrumbs. - setPath() javascript function takes new first argument - formname - now page can have multiple forms. - logmein form now includes echo of catalog search form elements so subsequent screens generated by createaccount.pm can include irteurn to course catalog in breadcrumbs. - form element cid renamed courseid (and $cid renamed $courseid) to avoid confusing this with the cid form element used for entering a studentID in loncreateuser:personal_data_display(). --raeburn1216297348 Content-Type: text/plain Content-Disposition: attachment; filename="raeburn-20080717082228.txt" Index: loncom/interface/selfenroll.pm diff -u loncom/interface/selfenroll.pm:1.11 loncom/interface/selfenroll.pm:1.12 --- loncom/interface/selfenroll.pm:1.11 Mon Jul 14 06:25:25 2008 +++ loncom/interface/selfenroll.pm Thu Jul 17 08:22:28 2008 @@ -1,7 +1,7 @@ # The LearningOnline Network # Allow users to self-enroll in a course # -# $Id: selfenroll.pm,v 1.11 2008/07/14 10:25:25 raeburn Exp $ +# $Id: selfenroll.pm,v 1.12 2008/07/17 12:22:28 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -51,34 +51,35 @@ } &Apache::lonacc::get_posted_cgi($r); &Apache::lonlocal::get_language_handle($r); - &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['cid']); - my ($coursechk,$cid) = &validate_course_id($env{'form.cid'}); + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['courseid']); + my $js = &Apache::createaccount::catreturn_js(); + my $desc; + my ($coursechk,$courseid) = &validate_course_id($env{'form.courseid'}); if ($coursechk ne 'ok') { - &page_header($r,$cid); + &page_header($r,$courseid,$js); $r->print('

        '.&mt('Self-enrollment error').'

        '. ''. &mt('Invalid domain or course number').''); - $r->print(&Apache::loncommon::end_page()); + &page_footer($r); return OK; } my $now = time; - my $js; if ($env{'form.phase'} eq 'login') { - $js = &Apache::createaccount::javascript_setforms($now); + $js .= "\n".&Apache::createaccount::javascript_setforms($now); } - &page_header($r,$cid,$js); + my %coursehash = &Apache::lonnet::coursedescription($courseid); + my $cdom = $coursehash{'domain'}; + my $cnum = $coursehash{'num'}; + my $desc = $coursehash{'description'}; + &page_header($r,$courseid,$js,$desc); my $include = $r->dir_config('lonIncludes'); if ($env{'form.phase'} eq 'login') { my $jsh=Apache::File->new($include."/londes.js"); $r->print(<$jsh>); } - my ($cdom,$cnum,$desc,$canenroll,$selfenroll_types,$selfenroll_registered, - @cancreate,$knownuser,$selfenroll_access_start,$selfenroll_access_end, - $selfenroll_section,$selfenroll_future,%curr_role,%coursehash,$cdomdesc); - %coursehash = &Apache::lonnet::coursedescription($cid); - $cdom = $coursehash{'domain'}; - $cnum = $coursehash{'num'}; - $desc = $coursehash{'description'}; + my ($canenroll,$selfenroll_types,$selfenroll_registered,@cancreate, + $knownuser,$selfenroll_access_start,$selfenroll_access_end, + $selfenroll_section,$selfenroll_future,%curr_role,$cdomdesc); $selfenroll_types = $coursehash{'internal.selfenroll_types'}; $selfenroll_registered = $coursehash{'internal.selfenroll_registered'}; $selfenroll_section = $coursehash{'internal.selfenroll_section'}; @@ -167,13 +168,14 @@ if (keys(%curr_role)) { $r->print(&has_role(%curr_role)); } - $r->print(&Apache::loncommon::end_page()); + &page_footer($r); return OK; } @cancreate = &can_create($cdom); - my ($login_path,$firsturl,$create_path,$sso_url,$missing_formitem); + my ($form,$login_path,$firsturl,$create_path,$sso_url,$missing_formitem); + $form = 'logmein'; $login_path = '/adm/login'; - $firsturl= '/adm/selfenroll?cid='.$cid; + $firsturl= '/adm/selfenroll?courseid='.$courseid; $create_path = '/adm/createaccount'; $sso_url = $r->dir_config('lonSSOReloginServer'); if ($sso_url eq '') { @@ -184,7 +186,7 @@ if (keys(%curr_role)) { $r->print('

        '.&mt('Self-enrollment unavailable').'

        '. ''.&has_role(%curr_role).''); - $r->print(&Apache::loncommon::end_page()); + &page_footer($r); return OK; } &process_self_enroll($r,$cdom,$cnum,$selfenroll_types,$selfenroll_registered, @@ -194,41 +196,36 @@ my $submit_text = &mt('Log in'); $r->print('

        '.&mt('Log-in to LON-CAPA').'

        '); my $udom = &Apache::lonnet::default_login_domain(); - $r->print(&Apache::createaccount::login_box($now,$lonhost,$cid, + $r->print(&Apache::createaccount::login_box($now,$lonhost,$courseid, $submit_text,$udom,'selfenroll')); - $r->print(&mt('You will be able to self-enroll in the course you selected ([_1]) after you have successfully logged in.',''.$desc.''). - &Apache::loncommon::end_page()); + $r->print(&mt('You will be able to self-enroll in the course you selected ([_1]) after you have successfully logged in.',''.$desc.'')); + &page_footer($r); return OK; } elsif (@cancreate > 0) { $r->print(< -function setPath(formaction,item,arg) { - if (formaction != '') { - document.forms.logmein.action = formaction; - } - var itemid = getIndexByName("setting"); - if (itemid > -1) { - document.logmein.elements[itemid].name = item; - document.logmein.elements[itemid].value = arg; - document.logmein.submit(); - } else { - alert("$missing_formitem"); +function setPath(formname,formaction,item,arg) { + var formidx = getFormByName(formname); + if (formidx > -1) { + if (formaction != '') { + document.forms[formidx].action = formaction; + } + var itemid = getIndexByName(formidx,'setting'); + if (itemid > -1) { + document.forms[formidx].elements[itemid].name = item; + document.forms[formidx].elements[itemid].value = arg; + document.forms[formidx].submit(); + } else { + alert("$missing_formitem"); + } } return; } -function getIndexByName(item) { - for (var i=0;i END $r->print('

        '.&mt('LON-CAPA account required').'

        '. - &mt('You need to be logged into LON-CAPA to self-enroll in a course.').'
        • '.&mt('If you have an account in LON-CAPA, [_1]log-in[_2].','','').'
        • '); + &mt('You need to be logged into LON-CAPA to self-enroll in a course.').'
          • '.&mt('If you have an account in LON-CAPA, [_1]log-in[_2].','','').'
          • '); if (@cancreate > 1) { $r->print('
          • '.&mt('Otherwise:').'
            '); my $count = 0; @@ -238,11 +235,11 @@ } if (grep(/^$type$/,@cancreate)) { if ($type eq 'sso') { - $r->print('  '.&mt("if you have an institutional log-in, use your institution's [_1]single sign on page[_2] to log-in, then create an account",'','')); + $r->print('  '.&mt("if you have an institutional log-in, use your institution's [_1]single sign on page[_2] to log-in, then create an account",'','')); } elsif ($type eq 'login') { - $r->print('  '.&mt('if you have an institutional login, [_1]create an account[_2]','','')); + $r->print('  '.&mt('if you have an institutional login, [_1]create an account[_2]','','')); } elsif ($type eq 'email') { - $r->print('  '.&mt('you can use an e-mail address to [_1]create an account[_2]','','')); + $r->print('  '.&mt('you can use an e-mail address to [_1]create an account[_2]','','')); } $count ++; } @@ -250,11 +247,11 @@ $r->print('.
            '); } else { if ($cancreate[0] eq 'login') { - $r->print('
          • '.&mt('Otherwise, if you have an institutional login, [_1]create an account[_2].','','')); + $r->print('
          • '.&mt('Otherwise, if you have an institutional login, [_1]create an account[_2].','','')); } elsif ($cancreate[0] eq 'email') { - $r->print('
          • '.&mt('Otherwise, you will use an e-mail address to [_1]create an account[_2].','','')); + $r->print('
          • '.&mt('Otherwise, you will use an e-mail address to [_1]create an account[_2].','','')); } elsif ($cancreate[0] eq 'sso') { - $r->print('
          • '.&mt("Otherwise, use your institution's [_1]single sign on page[_2] to log-in, then create an account.",'','')); + $r->print('
          • '.&mt("Otherwise, use your institution's [_1]single sign on page[_2] to log-in, then create an account.",'','')); } } if ($selfenroll_types eq '*') { @@ -277,34 +274,41 @@ my $displayurl = &escape($firsturl); $r->print(&mt('Submit a request to the LON-CAPA [_1]helpdesk[_2] for [_3] if you require assistance.','','',$cdomdesc)); } - $r->print('
            '."\n". - ''."\n". + $r->print("\n".''."\n". + ''."\n". ''."\n". - '
            '."\n". - &Apache::loncommon::end_page()); + &Apache::lonhtmlcommon::echo_form_input(['backto','courseid','context','phase'])."\n". + ''."\n"); + &page_footer($r); return OK; } sub page_header { - my ($r,$cid,$js) = @_; + my ($r,$courseid,$js,$desc) = @_; my $start_page = &Apache::loncommon::start_page('Self-enroll in a LON-CAPA course',$js, {'no_inline_link' => 1,}); $r->print($start_page); &Apache::lonhtmlcommon::clear_breadcrumbs(); - &Apache::lonhtmlcommon::add_breadcrumb - ({href=>"/adm/selfenroll?cid=$cid", - text=>"Self-enroll"}); + &Apache::createaccount::selfenroll_crumbs($r,$courseid,$desc); $r->print(&Apache::lonhtmlcommon::breadcrumbs('Self-enroll in course')); return; } +sub page_footer { + my ($r) = @_; + $r->print('
            '."\n". + &Apache::lonhtmlcommon::echo_form_input(['backto','courseid','phase','context']). + '
            '.&Apache::loncommon::end_page()); + return; +} + sub validate_course_id { - my ($cid) = @_; - my ($cdom,$cnum) = ($env{'form.cid'} =~ /^($match_domain)_($match_courseid)$/); + my ($courseid) = @_; + my ($cdom,$cnum) = ($env{'form.courseid'} =~ /^($match_domain)_($match_courseid)$/); if ($cdom ne '' && $cnum ne '') { if (&Apache::lonnet::is_course($cdom,$cnum)) { - return ('ok',$cid); + return ('ok',$courseid); } } return; @@ -552,14 +556,14 @@ $output = &mt('Self-enrollment is not currently available for this course for users affiliated with [_1].',$domdesc); } } elsif (keys(%{$longtypes}) > 0) { - $output = &mt('Self-enrollment in this course is only available to users affiliated with the following institutions, and who have the required status:').'
              '; + $output = &mt('Self-enrollment in this course is only available to users affiliated with the following institutions, and who have the required status:').'
                '."\n"; foreach my $selfdom (sort(keys(%{$longtypes}))) { my $selfdomdesc = &Apache::lonnet::domain($selfdom,'description'); if (ref($longtypes->{$selfdom}) eq 'ARRAY') { - $output .= '
              • '.$selfdomdesc.': '.join(', ',@{$longtypes->{$selfdom}}).'
              • '; + $output .= '
              • '.$selfdomdesc.': '.join(', ',@{$longtypes->{$selfdom}}).'
              • '."\n"; } } - $output .= '
              '; + $output .= '
            '."\n"; } else { $output = &mt('Self-enrollment is not currently available for this course.'); } --raeburn1216297348-- From lon-capa-cvs-allow@mail.lon-capa.org Thu Jul 17 15:27:16 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (raeburn) Date: Thu, 17 Jul 2008 14:27:16 -0000 Subject: [LON-CAPA-cvs] cvs: loncom / development_dns_domain.tab Message-ID: raeburn Thu Jul 17 10:27:16 2008 EDT Modified files: /loncom development_dns_domain.tab Log: - Primary library server for sfud needs to be consistent with development_dns_hosts.tab. Index: loncom/development_dns_domain.tab diff -u loncom/development_dns_domain.tab:1.9 loncom/development_dns_domain.tab:1.10 --- loncom/development_dns_domain.tab:1.9 Tue May 6 16:55:57 2008 +++ loncom/development_dns_domain.tab Thu Jul 17 10:27:14 2008 @@ -21,6 +21,6 @@ conference:2006 Conference:krb4:MSU.EDU:en-US:East Lansing, MI:-84.483:42.737:conferencel1 bridge:Bridge Tasks Test:krb4:MSU.EDU:en-US:East Lansing, MI:-84.483:42.737:btl1 vlernen:Vernetztes Lernen:::de:Hagen -sfud:Simon Fraser University Development:::en-US:Vancouver, BC:-123.078:49.316:sfud1 +sfud:Simon Fraser University Development:::en-US:Vancouver, BC:-123.078:49.316:sfudl1 banghart:Development domain::banghartl1:::::banghartl1 hope:Hope College Chemistry Development Server::tea01:::::tea01 From lon-capa-cvs-allow@mail.lon-capa.org Thu Jul 17 21:05:16 2008 From: lon-capa-cvs-allow@mail.lon-capa.org (raeburn) Date: Thu, 17 Jul 2008 20:05:16 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /interface loncreateuser.pm Message-ID: raeburn Thu Jul 17 16:05:16 2008 EDT Modified files: /loncom/interface loncreateuser.pm Log: - Moving evaluation of modifiable user information fields in selfcreate context to &selfcreate_canmodify(). - Escaping institutional status types in form elements included in self-enrollment configuration screen. Index: loncom/interface/loncreateuser.pm diff -u loncom/interface/loncreateuser.pm:1.256 loncom/interface/loncreateuser.pm:1.257 --- loncom/interface/loncreateuser.pm:1.256 Wed Jul 16 08:06:28 2008 +++ loncom/interface/loncreateuser.pm Thu Jul 17 16:05:14 2008 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.256 2008/07/16 12:06:28 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.257 2008/07/17 20:05:14 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1397,30 +1397,24 @@ sub personal_data_display { my ($ccuname,$ccdomain,$newuser,$context,$inst_results,$rolesarray) = @_; - my ($output,$showforceid,%userenv,%canmodify,@inststatuses); + my ($output,$showforceid,%userenv,%canmodify); my @userinfo = ('firstname','middlename','lastname','generation', 'permanentemail','id'); my $rowcount = 0; my $editable = 0; - if ($context eq 'selfcreate') { - if (ref($inst_results) eq 'HASH') { - @inststatuses = &get_inststatuses($inst_results); - if (@inststatuses == 0) { - @inststatuses = ('default'); - } - $rolesarray = \@inststatuses; - } - } if (!$newuser) { # Get the users information %userenv = &Apache::lonnet::get('environment', ['firstname','middlename','lastname','generation', 'permanentemail','id'],$ccdomain,$ccuname); } - if ((!$newuser) || ($context eq 'selfcreate')) { + if (!$newuser) { %canmodify = &Apache::lonuserutils::can_modify_userinfo($context,$ccdomain, \@userinfo,$rolesarray); + } elsif ($context eq 'selfcreate') { + %canmodify = &selfcreate_canmodify($context,$ccdomain,\@userinfo, + $inst_results,$rolesarray); } my %lt=&Apache::lonlocal::texthash( 'pd' => "Personal Data", @@ -1506,6 +1500,21 @@ } } +sub selfcreate_canmodify { + my ($context,$dom,$userinfo,$inst_results,$rolesarray) = @_; + if (ref($inst_results) eq 'HASH') { + my @inststatuses = &get_inststatuses($inst_results); + if (@inststatuses == 0) { + @inststatuses = ('default'); + } + $rolesarray = \@inststatuses; + } + my %canmodify = + &Apache::lonuserutils::can_modify_userinfo($context,$dom,$userinfo, + $rolesarray); + return %canmodify; +} + sub get_inststatuses { my ($insthashref) = @_; my @inststatuses = (); @@ -3738,13 +3747,14 @@ $output .= ''; } if (defined($usertypes->{$type})) { + my $esc_type = &escape($type); $output .= '