Diff for /loncom/interface/lonviewcoauthors.pm between versions 1.1 and 1.2

version 1.1, 2023/11/03 01:12:15 version 1.2, 2023/11/04 01:33:47
Line 306  sub edit_settings { Line 306  sub edit_settings {
         }          }
         my $forceedit;          my $forceedit;
         if ($env{'form.forceedit'}) {          if ($env{'form.forceedit'}) {
             $forceedit = 1;               $forceedit = 1;
         }          }
         my $hiddenaction;          my $hiddenaction;
         if ($caller eq '/adm/createuser') {          if ($caller eq '/adm/createuser') {
Line 317  sub edit_settings { Line 317  sub edit_settings {
                   '<input type="hidden" name="caller" value="'.$caller.'" />'."\n".                    '<input type="hidden" name="caller" value="'.$caller.'" />'."\n".
                   '<input type="hidden" name="state" value="setconfig" />'."\n".                    '<input type="hidden" name="state" value="setconfig" />'."\n".
                   '<input type="hidden" name="forceedit" value="'.$forceedit.'" />'."\n".                    '<input type="hidden" name="forceedit" value="'.$forceedit.'" />'."\n".
                   $hiddenaction.                     $hiddenaction.
                   &Apache::loncommon::start_data_table().                    &Apache::loncommon::start_data_table().
                   &Apache::loncommon::start_data_table_header_row().                    &Apache::loncommon::start_data_table_header_row().
                   '<th>'.$lt{'set'}.'</th><th>'.$lt{'val'}.'</th>'.                    '<th>'.$lt{'set'}.'</th><th>'.$lt{'val'}.'</th>'.
Line 351  sub edit_settings { Line 351  sub edit_settings {
 sub print_coauthors {  sub print_coauthors {
     my ($r,$auname,$audom,$role,$caller,$settingsref) = @_;      my ($r,$auname,$audom,$role,$caller,$settingsref) = @_;
     my %viewsettings;      my %viewsettings;
     if (ref($settingsref) eq 'HASH') {       if (ref($settingsref) eq 'HASH') {
         %viewsettings = %{$settingsref};          %viewsettings = %{$settingsref};
     } else {      } else {
         %viewsettings =          %viewsettings =
Line 364  sub print_coauthors { Line 364  sub print_coauthors {
                  rol => 'Role(s)',                   rol => 'Role(s)',
                  and => 'and',                   and => 'and',
                  utd => 'Unable to determine Authoring Space context',                   utd => 'Unable to determine Authoring Space context',
              );                 );
     if (($auname ne '') && ($audom ne '')) {      if (($auname ne '') && ($audom ne '')) {
         my (%shownstatus,%coauthors);          my (%shownstatus,%coauthors);
         $r->print("<h3>$lt{'cvl'}</h3>");          $r->print("<h3>$lt{'cvl'}</h3>");
Line 383  sub print_coauthors { Line 383  sub print_coauthors {
         my ($output,$roletype);          my ($output,$roletype);
         my @showroles;          my @showroles;
         if ($env{'request.role'} eq "au./$env{'user.domain'}/") {          if ($env{'request.role'} eq "au./$env{'user.domain'}/") {
             @showroles = ('ca','aa');               @showroles = ('ca','aa');
         } elsif ($viewsettings{'show'} eq 'role') {          } elsif ($viewsettings{'show'} eq 'role') {
             ($roletype) = ($env{'request.role'} =~ m{^(ca|aa)\./$audom/$auname$});              ($roletype) = ($env{'request.role'} =~ m{^(ca|aa)\./$audom/$auname$});
             if ($roletype ne '') {              if ($roletype ne '') {
Line 408  sub print_coauthors { Line 408  sub print_coauthors {
                     $userinfo{$username.':'.$domain}{roles} = [$userrole];                      $userinfo{$username.':'.$domain}{roles} = [$userrole];
                 }                  }
             } else {              } else {
                 $userinfo{$username.':'.$domain}{fullname} =                   $userinfo{$username.':'.$domain}{fullname} =
                     &Apache::loncommon::plainname($username,$domain,'lastname');                      &Apache::loncommon::plainname($username,$domain,'lastname');
                 $userinfo{$username.':'.$domain}{roles} = [$userrole];                  $userinfo{$username.':'.$domain}{roles} = [$userrole];
             }              }
Line 436  sub print_coauthors { Line 436  sub print_coauthors {
                                           &Apache::lonnet::plaintext($roletype));                                            &Apache::lonnet::plaintext($roletype));
                         } else {                          } else {
                             $output = &mt('The one user with a [_1] or [_2] role has opted not to be listed.',                              $output = &mt('The one user with a [_1] or [_2] role has opted not to be listed.',
                                           $rolenames[0],$rolenames[1]);                                              $rolenames[0],$rolenames[1]);
                         }                          }
                     } else {                      } else {
                         if ($roletype) {                          if ($roletype) {
Line 455  sub print_coauthors { Line 455  sub print_coauthors {
                                       $fullcount,&Apache::lonnet::plaintext($roletype));                                        $fullcount,&Apache::lonnet::plaintext($roletype));
                     } else {                      } else {
                         $output = &mt('All [_1] users with a [_2] or [_3] role have opted to be listed.',                          $output = &mt('All [_1] users with a [_2] or [_3] role have opted to be listed.',
                                       $fullcount,$rolenames[0],$rolenames[1]);                                         $fullcount,$rolenames[0],$rolenames[1]);
                     }                      }
                 } elsif ($fullcount == 1) {                  } elsif ($fullcount == 1) {
                     if ($roletype) {                      if ($roletype) {
Line 520  sub print_coauthors { Line 520  sub print_coauthors {
             } (keys(%showuser));              } (keys(%showuser));
             foreach my $user (@sorted) {              foreach my $user (@sorted) {
                 my ($username,$domain) = split(/:/,$user);                  my ($username,$domain) = split(/:/,$user);
                 $count ++;                   $count ++;
                 $table .= &Apache::loncommon::start_data_table_row()."\n".                  $table .= &Apache::loncommon::start_data_table_row()."\n".
                           '<td>'.$count.'</td>'.                            '<td>'.$count.'</td>'.
                           '<td>'.&Apache::loncommon::aboutmewrapper($showuser{$user}{fullname},                            '<td>'.&Apache::loncommon::aboutmewrapper($showuser{$user}{fullname},
Line 532  sub print_coauthors { Line 532  sub print_coauthors {
                           '</td>';                            '</td>';
                 unless ($roletype) {                  unless ($roletype) {
                     $table .= '<td>'.                      $table .= '<td>'.
                               join(" $lt{'and'} ", map { &Apache::lonnet::plaintext($_); }                                 join(" $lt{'and'} ", map { &Apache::lonnet::plaintext($_); }
                                    @{$showuser{$user}{roles}}).                                     @{$showuser{$user}{roles}}).
                               '</td>';                                '</td>';
                 }                  }

Removed from v.1.1  
changed lines
  Added in v.1.2


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