Diff for /loncom/interface/loncommon.pm between versions 1.925.2.20 and 1.925.2.21

version 1.925.2.20, 2010/12/02 16:42:08 version 1.925.2.21, 2010/12/05 16:38:37
Line 1980  sub select_dom_form { Line 1980  sub select_dom_form {
             if ($dom ne '') {              if ($dom ne '') {
                 my $domdesc;                  my $domdesc;
                 if ($name eq 'srchdomain') {                  if ($name eq 'srchdomain') {
                     if ($dom eq 'gci') {                      if ($dom =~ /^\w+ci$/) {
                         $domdesc = 'Faculty';                          $domdesc = 'Faculty';
                     } else {                      } else {
                         $domdesc = 'Students';                          $domdesc = 'Students';
Line 4569  sub bodytag { Line 4569  sub bodytag {
         my $role_selector;          my $role_selector;
         if (($custommenu) && !($env{'form.context'} eq 'requestcrs') &&           if (($custommenu) && !($env{'form.context'} eq 'requestcrs') && 
             ($env{'request.course.id'}) &&               ($env{'request.course.id'}) && 
             ($env{'course.'.$env{'request.course.id'}.'.domain'} eq 'gcitest')) {              ($env{'course.'.$env{'request.course.id'}.'.domain'} =~ /^\w+citest$/)) {
             $role_selector = &Apache::lonmenu::roles_selector(              $role_selector = &Apache::lonmenu::roles_selector(
                         $env{'course.' . $env{'request.course.id'} . '.domain'},                          $env{'course.' . $env{'request.course.id'} . '.domain'},
                         $env{'course.' . $env{'request.course.id'} . '.num'}  );                          $env{'course.' . $env{'request.course.id'} . '.num'}  );
Line 4578  sub bodytag { Line 4578  sub bodytag {
             }              }
         }          }
         my $cid = $env{'request.course.id'};          my $cid = $env{'request.course.id'};
         my %gcicourses = (          my %cicourses;
                            gci_9615072b469884921gcil1 => 'review',          my $udom = $env{'user.domain'};
                            gci_1H96711d710194bfegcil1 => 'submit',          my %allnums = &get_faculty_cnums();
                            gci_5422913620b814c90gcil1 => 'tutorial',          if ($udom ne '' && ref($allnums{$udom} eq 'HASH') {
                          );               foreach my $key (%{$allnums{$udom}}) {
         if (($custommenu && $cid && !$gcicourses{$cid}) &&                    $cicourses{$udom.'_'.$key} = $allnums{$udom}->{$key};
                }
           }
           if (($custommenu && $cid && !$cicourses{$cid}) && 
              !($env{'form.context'} eq 'requestcrs') ||               !($env{'form.context'} eq 'requestcrs') ||
              ($env{'user.domain'} eq 'gcitest')) {               ($env{'user.domain'} =~ /^\w+citest$/)) {
             my $role = 'st';              my $role = 'st';
             if ($custommenu) {              if ($custommenu) {
                 $role = 'cc';                  $role = 'cc';
Line 4607  sub bodytag { Line 4610  sub bodytag {
                     $current = $role.'./'.$env{'course.'.$cid.'.domain'}.                      $current = $role.'./'.$env{'course.'.$cid.'.domain'}.
                                '/'.$env{'course.'.$cid.'.num'};                                 '/'.$env{'course.'.$cid.'.num'};
                 }                  }
                 $switcher_js = &Apache::loncommon::gcitest_switcher_js($current,$numcourses,$formname);                  $switcher_js = &gcitest_switcher_js($current,$numcourses,$formname);
                 if ($switcher_js) {                    if ($switcher_js) {  
                     $switcher_js= <<"ENDSCRIPT";                      $switcher_js= <<"ENDSCRIPT";
 <script type="text/javascript">  <script type="text/javascript">
Line 4643  ENDSCRIPT Line 4646  ENDSCRIPT
             return $bodytag;              return $bodytag;
         }          }
   
         if ($cid && $gcicourses{$cid} eq 'tutorial') {          if ($cid && $cicourses{$cid} eq 'tutorial') {
             $bodytag .= '<div class="LC_page_header">';              $bodytag .= '<div class="LC_page_header">';
         }          }
     
Line 4658  ENDSCRIPT Line 4661  ENDSCRIPT
             $dc_info = &dc_courseid_toggle($dc_info);              $dc_info = &dc_courseid_toggle($dc_info);
         }          }
         $bodytag .= qq|<div id="LC_realm">$realm $dc_info</div>|;          $bodytag .= qq|<div id="LC_realm">$realm $dc_info</div>|;
         if ($cid && $gcicourses{$cid} eq 'tutorial') {          if ($cid && $cicourses{$cid} eq 'tutorial') {
             $bodytag .= '</div>';              $bodytag .= '</div>';
         }          }
   
         #don't show menus for public users          #don't show menus for public users
         if(!$public){          if(!$public){
             if (($custommenu) &&               if (($custommenu) && 
                 ($env{'request.role'} !~ m{^st\./gcitest/$match_courseid})) {                  ($env{'request.role'} !~ m{^st\./(\w+)citest/$match_courseid})) {
                 $bodytag .= &Apache::lonmenu::gci_secondary_menu();                  $bodytag .= &Apache::lonmenu::gci_secondary_menu();
             } elsif ($env{'request.role'} ne 'cm' || &check_for_gci_dc()) {                  } elsif ($env{'request.role'} ne 'cm' || &check_for_gci_dc()) {    
                 $bodytag .= Apache::lonmenu::secondary_menu();                  $bodytag .= Apache::lonmenu::secondary_menu();
Line 11010  sub clean_symb { Line 11013  sub clean_symb {
 sub needs_gci_custom {  sub needs_gci_custom {
     my $custommenu;      my $custommenu;
     my $numdc = &check_for_gci_dc();      my $numdc = &check_for_gci_dc();
       my $udom = $env{'user.domain'};
       return if ($udom eq '');
     unless ($numdc) {      unless ($numdc) {
         my $then=$env{'user.login.time'};          my $then=$env{'user.login.time'};
         my $now = time;          my $now = time;
         my %cnums = (          my %allnums = &get_faculty_cnums();
                         review => '9615072b469884921gcil1',          my $cnums = $allnums{$udom};
                         submit => '1H96711d710194bfegcil1',          return unless (ref($cnums) eq 'HASH');
                     );          if ($env{'user.role.st./\Q$udom\E/'.$cnums->{'review'}}) {
         if ($env{'user.role.st./gci/'.$cnums{'review'}}) {  
             my ($start,$end) =              my ($start,$end) =
                 split('.',$env{'user.role.st./gci/'.$cnums{'review'}});                  split('.',$env{'user.role.st./\Q$udom\E/'.$cnums->{'review'}});
             if (((!$start) || ($start && $start <= $now)) &&              if (((!$start) || ($start && $start <= $now)) &&
                 ((!$end) || ($end > $now))) {                  ((!$end) || ($end > $now))) {
                 $custommenu = 1;                  $custommenu = 1;
                 if ($env{'user.role.cc./gci/'.$cnums{'review'}}) {                  if ($env{'user.role.cc./\Q$udom\E/'.$cnums->{'review'}}) {
                     my ($ccstart,$ccend) =                      my ($ccstart,$ccend) =
                         split('.',$env{'user.role.cc./gci/'.$cnums{'review'}});                          split('.',$env{'user.role.cc./\Q$udom\E/'.$cnums->{'review'}});
                     if (((!$start) || ($start && $start <= $now)) &&                      if (((!$start) || ($start && $start <= $now)) &&
                             ((!$end) || ($end > $now))) {                              ((!$end) || ($end > $now))) {
                         $custommenu = '';                          $custommenu = '';
Line 11040  sub needs_gci_custom { Line 11044  sub needs_gci_custom {
 sub check_for_gci_dc {  sub check_for_gci_dc {
     my $then=$env{'user.login.time'};      my $then=$env{'user.login.time'};
     my $numdc = 0;      my $numdc = 0;
     foreach my $dom ('gci','gcitest') {      my @doms = &Apache::lonnet::current_machine_domains();
       foreach my $dom (@doms) {
         if ($env{'user.role.dc./'.$dom.'/'}) {          if ($env{'user.role.dc./'.$dom.'/'}) {
             my $livedc = 1;              my $livedc = 1;
             my ($tstart,$tend)=split(/\./,$env{'user.role.dc./'.$dom.'/'});              my ($tstart,$tend)=split(/\./,$env{'user.role.dc./'.$dom.'/'});
Line 11054  sub check_for_gci_dc { Line 11059  sub check_for_gci_dc {
     return $numdc;      return $numdc;
 }  }
   
   sub get_faculty_cnums {
       my %cnums = (
            gci => { 
                       review => '9615072b469884921gcil1',
                       submit => '1H96711d710194bfegcil1',
                       tutorial' => '5422913620b814c90gcil1',
                   },
            slci => {
                       review => '',
                       submit => '',
                       tutorial' => '',
                    }
       );
       return %cnums;
   }
   
 sub existing_gcitest_courses {  sub existing_gcitest_courses {
     my ($role) = @_;      my ($role) = @_;
     my %courses;      my %courses;
     my $cdom = 'gcitest';      my $cdom = $env{'user.domain'}.'test';
     my $now = time;      my $now = time;
     foreach my $envkey (keys(%env)) {      foreach my $envkey (keys(%env)) {
         my $cnum;          my $cnum;
Line 11150  ENDJS Line 11171  ENDJS
     return $output;      return $output;
 }  }
   
   sub get_citest_map {
       my ($cdom) = @_;
       my %questionnaires = (
                              gcitest  => 'default_1261144274.sequence',
                              slcitest => 'default_1261144274.sequence',
                            );
       return $questionnaires{$cdom};
   }
   
 =pod  =pod
   

Removed from v.1.925.2.20  
changed lines
  Added in v.1.925.2.21


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