Diff for /loncom/interface/loncreateuser.pm between versions 1.414 and 1.415

version 1.414, 2016/10/04 21:02:16 version 1.415, 2016/10/10 02:53:02
Line 821  sub print_username_entry_form { Line 821  sub print_username_entry_form {
         }          }
         $r->print("<h3>$actiontext</h3>");          $r->print("<h3>$actiontext</h3>");
         if ($env{'form.origform'} ne 'crtusername') {          if ($env{'form.origform'} ne 'crtusername') {
             $r->print("\n".$response);              if ($response) {
                  $r->print("\n<div>$response</div>".
                            '<br clear="all" />');
               }
         }          }
         $r->print(&entry_form($defdom,$srch,$forcenewuser,$context,$response,$crstype));          $r->print(&entry_form($defdom,$srch,$forcenewuser,$context,$response,$crstype));
     }      }
Line 5015  sub handler { Line 5018  sub handler {
                           $cdom,$cnum,$coursedesc));                            $cdom,$cnum,$coursedesc));
         }          }
     } elsif ($env{'form.action'} eq 'changelogs') {      } elsif ($env{'form.action'} eq 'changelogs') {
         my $helpitem;          &print_userchangelogs_display($r,$context,$permission,$brcrum);
         if ($context eq 'course') {  
             $helpitem = 'Course_User_Logs';  
         }  
         push (@{$brcrum},  
                  {href => '/adm/createuser?action=changelogs',  
                   text => 'User Management Logs',  
                   help => $helpitem});  
         $bread_crumbs_component = 'User Changes';  
         $args = { bread_crumbs           => $brcrum,  
                   bread_crumbs_component => $bread_crumbs_component};  
         $r->print(&header(undef,$args));  
         &print_userchangelogs_display($r,$context,$permission);  
     } else {      } else {
         $bread_crumbs_component = 'User Management';          $bread_crumbs_component = 'User Management';
         $args = { bread_crumbs           => $brcrum,          $args = { bread_crumbs           => $brcrum,
Line 5317  sub print_main_menu { Line 5308  sub print_main_menu {
          {categorytitle => 'Administration',           {categorytitle => 'Administration',
          items => [ ]},           items => [ ]},
        );         );
               
     if ($context eq 'domain'){      if ($context eq 'domain'){
                   
         push(@{ $menu[2]->{items} }, #Category: Administration          push(@{ $menu[2]->{items} }, #Category: Administration
Line 6377  sub selfenroll_date_forms { Line 6368  sub selfenroll_date_forms {
 }  }
   
 sub print_userchangelogs_display {  sub print_userchangelogs_display {
     my ($r,$context,$permission) = @_;      my ($r,$context,$permission,$brcrum) = @_;
     my $formname = 'rolelog';      my $formname = 'rolelog';
     my ($username,$domain,$crstype,%roleslog);      my ($username,$domain,$crstype,%roleslog);
     if ($context eq 'domain') {      if ($context eq 'domain') {
Line 6407  sub print_userchangelogs_display { Line 6398  sub print_userchangelogs_display {
     }      }
     if ((keys(%roleslog))[0]=~/^error\:/) { undef(%roleslog); }      if ((keys(%roleslog))[0]=~/^error\:/) { undef(%roleslog); }
   
       my $helpitem;
       if ($context eq 'course') {
           $helpitem = 'Course_User_Logs';
       }
       push (@{$brcrum},
                {href => '/adm/createuser?action=changelogs',
                 text => 'User Management Logs',
                 help => $helpitem});
       my $bread_crumbs_component = 'User Changes';
       my $args = { bread_crumbs           => $brcrum,
                    bread_crumbs_component => $bread_crumbs_component};
   
       # Create navigation javascript
       my $jsnav = &userlogdisplay_js($formname);
   
       my $jscript = (<<ENDSCRIPT);
   <script type="text/javascript">
   // <![CDATA[
   $jsnav
   // ]]>
   </script>
   ENDSCRIPT
   
       # print page header
       $r->print(&header($jscript,$args));
   
     # set defaults      # set defaults
     my $now = time();      my $now = time();
     my $defstart = $now - (7*24*3600); #7 days ago       my $defstart = $now - (7*24*3600); #7 days ago 
Line 6439  sub print_userchangelogs_display { Line 6456  sub print_userchangelogs_display {
     my ($minshown,$maxshown);      my ($minshown,$maxshown);
     $minshown = 1;      $minshown = 1;
     my $count = 0;      my $count = 0;
     if ($curr{'show'} ne &mt('all')) {       if ($curr{'show'} =~ /\D/) {
           $curr{'page'} = 1;
       } else {
         $maxshown = $curr{'page'} * $curr{'show'};          $maxshown = $curr{'page'} * $curr{'show'};
         if ($curr{'page'} > 1) {          if ($curr{'page'} > 1) {
             $minshown = 1 + ($curr{'page'} - 1) * $curr{'show'};              $minshown = 1 + ($curr{'page'} - 1) * $curr{'show'};
Line 6451  sub print_userchangelogs_display { Line 6470  sub print_userchangelogs_display {
               &role_display_filter($context,$formname,$domain,$username,\%curr,                &role_display_filter($context,$formname,$domain,$username,\%curr,
                                    $version,$crstype));                                     $version,$crstype));
   
     # Create navigation  
     my ($nav_script,$nav_links) = &userlogdisplay_nav($formname,\%curr,$more_records);  
     my $showntableheader = 0;      my $showntableheader = 0;
   
     # Table Header      # Table Header
Line 6477  sub print_userchangelogs_display { Line 6494  sub print_userchangelogs_display {
     foreach my $id (sort { $roleslog{$b}{'exe_time'}<=>$roleslog{$a}{'exe_time'} } (keys(%roleslog))) {      foreach my $id (sort { $roleslog{$b}{'exe_time'}<=>$roleslog{$a}{'exe_time'} } (keys(%roleslog))) {
         next if (($roleslog{$id}{'exe_time'} < $curr{'rolelog_start_date'}) ||          next if (($roleslog{$id}{'exe_time'} < $curr{'rolelog_start_date'}) ||
                  ($roleslog{$id}{'exe_time'} > $curr{'rolelog_end_date'}));                   ($roleslog{$id}{'exe_time'} > $curr{'rolelog_end_date'}));
         if ($curr{'show'} ne &mt('all')) {          if ($curr{'show'} !~ /\D/) {
             if ($count >= $curr{'page'} * $curr{'show'}) {              if ($count >= $curr{'page'} * $curr{'show'}) {
                 $more_records = 1;                  $more_records = 1;
                 last;                  last;
Line 6496  sub print_userchangelogs_display { Line 6513  sub print_userchangelogs_display {
         $count ++;          $count ++;
         next if ($count < $minshown);          next if ($count < $minshown);
         unless ($showntableheader) {          unless ($showntableheader) {
             $r->print($nav_script              $r->print(&Apache::loncommon::start_data_table()
                      .$nav_links  
                      .&Apache::loncommon::start_data_table()  
                      .$tableheader);                       .$tableheader);
             $r->rflush();              $r->rflush();
             $showntableheader = 1;              $showntableheader = 1;
Line 6559  sub print_userchangelogs_display { Line 6574  sub print_userchangelogs_display {
     }      }
   
     if ($showntableheader) { # Table footer, if content displayed above      if ($showntableheader) { # Table footer, if content displayed above
         $r->print(&Apache::loncommon::end_data_table()          $r->print(&Apache::loncommon::end_data_table().
                  .$nav_links);                    &userlogdisplay_navlinks(\%curr,$more_records));
     } else { # No content displayed above      } else { # No content displayed above
         $r->print('<p class="LC_info">'          $r->print('<p class="LC_info">'
                  .&mt('There are no records to display.')                   .&mt('There are no records to display.')
Line 6576  sub print_userchangelogs_display { Line 6591  sub print_userchangelogs_display {
     return;      return;
 }  }
   
 sub userlogdisplay_nav {  sub userlogdisplay_js {
     my ($formname,$curr,$more_records) = @_;      my ($formname) = @_;
     my ($nav_script,$nav_links);      return <<"ENDSCRIPT";
     if (ref($curr) eq 'HASH') {  
         # Create Navigation:  
         # Navigation Script  
         $nav_script = <<"ENDSCRIPT";  
 <script type="text/javascript">  
 // <![CDATA[  
 function chgPage(caller) {  function chgPage(caller) {
     if (caller == 'previous') {      if (caller == 'previous') {
         document.$formname.page.value --;          document.$formname.page.value --;
Line 6595  function chgPage(caller) { Line 6605  function chgPage(caller) {
     document.$formname.submit();      document.$formname.submit();
     return;      return;
 }  }
 // ]]>  
 </script>  
 ENDSCRIPT  ENDSCRIPT
         # Navigation Buttons  }
         $nav_links = '<p>';  
         if (($curr->{'page'} > 1) || ($more_records)) {  sub userlogdisplay_navlinks {
             if ($curr->{'page'} > 1) {      my ($curr,$more_records) = @_;
                 $nav_links .= '<input type="button"'      return unless(ref($curr) eq 'HASH');
                              .' onclick="javascript:chgPage('."'previous'".');"'      # Navigation Buttons
                              .' value="'.&mt('Previous [_1] changes',$curr->{'show'})      my $nav_links = '<p>';
                              .'" /> ';      if (($curr->{'page'} > 1) || ($more_records)) {
             }          if (($curr->{'page'} > 1) && ($curr->{'show'} !~ /\D/)) {
             if ($more_records) {              $nav_links .= '<input type="button"'
                 $nav_links .= '<input type="button"'                           .' onclick="javascript:chgPage('."'previous'".');"'
                              .' onclick="javascript:chgPage('."'next'".');"'                           .' value="'.&mt('Previous [_1] changes',$curr->{'show'})
                              .' value="'.&mt('Next [_1] changes',$curr->{'show'})                           .'" /> ';
                              .'" />';          }
             }          if ($more_records) {
               $nav_links .= '<input type="button"'
                            .' onclick="javascript:chgPage('."'next'".');"'
                            .' value="'.&mt('Next [_1] changes',$curr->{'show'})
                            .'" />';
         }          }
         $nav_links .= '</p>';  
     }      }
     return ($nav_script,$nav_links);      $nav_links .= '</p>';
       return $nav_links;
 }  }
   
 sub role_display_filter {  sub role_display_filter {
Line 6806  sub user_search_result { Line 6818  sub user_search_result {
             if ($domd_chk eq 'ok') {              if ($domd_chk eq 'ok') {
                 $response .= &mt('You may want to search in the LON-CAPA domain instead of the institutional directory.');                  $response .= &mt('You may want to search in the LON-CAPA domain instead of the institutional directory.');
             }              }
             $response .= '<br /><br />';              $response .= '<br />';
         }          }
     } else {      } else {
         unless (($context eq 'requestcrs') && ($srch->{'srchtype'} eq 'exact')) {           unless (($context eq 'requestcrs') && ($srch->{'srchtype'} eq 'exact')) { 
Line 6817  sub user_search_result { Line 6829  sub user_search_result {
                 if ($instd_chk eq 'ok') {                  if ($instd_chk eq 'ok') {
                     $response .= &mt('You may want to search in the institutional directory instead of the LON-CAPA domain.');                      $response .= &mt('You may want to search in the institutional directory instead of the LON-CAPA domain.');
                 }                  }
                 $response .= '<br /><br />';                  $response .= '<br />';
             }              }
         }          }
     }      }
Line 6914  sub user_search_result { Line 6926  sub user_search_result {
                     &mt('Institutional directory search is not available in domain: [_1]',$showdom).                      &mt('Institutional directory search is not available in domain: [_1]',$showdom).
                     '</span><br />'.                      '</span><br />'.
                     &mt('You may want to search in the LON-CAPA domain instead of the institutional directory.').                      &mt('You may want to search in the LON-CAPA domain instead of the institutional directory.').
                     '<br /><br />';                       '<br />'; 
             }              }
         }          }
     } else {      } else {
Line 6987  sub user_search_result { Line 6999  sub user_search_result {
                     &mt('Institutional directory search is not available in domain: [_1]',$showdom).                      &mt('Institutional directory search is not available in domain: [_1]',$showdom).
                     '</span><br />'.                      '</span><br />'.
                     &mt('You may want to search in the LON-CAPA domain instead of the institutional directory.').                      &mt('You may want to search in the LON-CAPA domain instead of the institutional directory.').
                     '<br /><br />';                      '<br />';
             }              }
         }          }
     }      }
Line 7215  sub build_search_response { Line 7227  sub build_search_response {
                                  .&mt('Please contact the [_1]helpdesk[_2] if you need to create a new user.'                                   .&mt('Please contact the [_1]helpdesk[_2] if you need to create a new user.'
                                     ,' <a'.$helplink.'>'                                      ,' <a'.$helplink.'>'
                                     ,'</a>')                                      ,'</a>')
                                  .'<br /><br />';                                   .'<br />';
                 }                  }
             }              }
         }          }

Removed from v.1.414  
changed lines
  Added in v.1.415


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