Diff for /loncom/interface/loncoursegroups.pm between versions 1.80.2.2 and 1.94

version 1.80.2.2, 2008/12/16 23:19:19 version 1.94, 2009/02/25 16:39:54
Line 75  sub handler { Line 75  sub handler {
     my $crstype = &Apache::loncommon::course_type();      my $crstype = &Apache::loncommon::course_type();
   
     my %functions = (      my %functions = (
                       email => 'E-mail',                        email => 'Send Messages', 
                       discussion => 'Discussion boards',                        discussion => 'Discussion Boards',
                       chat => 'Chat',                        chat => 'Chat Room',
                       files => 'File repository',                        files => 'File Repository',
                       roster => 'Membership roster',                        roster => 'Membership Roster',
                       homepage => $ucgpterm.' home page',                        homepage => $ucgpterm.' home page',
                     );                      );
   
Line 349  END Line 349  END
       '<td align="right">'.$quota.'</td>'.        '<td align="right">'.$quota.'</td>'.
       '<td align="right">'.$totalmembers.'</td>'.        '<td align="right">'.$totalmembers.'</td>'.
       '<td align="right">'.        '<td align="right">'.
                                   '<div class="LC_nobreak">'.&mt('Files: [_1]',$totalfiles).'</div>'.                                    '<span class="LC_nobreak">'.&mt('Files: [_1]',$totalfiles).'</span><br />'.
                                   '<div class="LC_nobreak">'.&mt('Folders: [_1]',$totaldirs).'</div>'.                                    '<span class="LC_nobreak">'.&mt('Folders: [_1]',$totaldirs).'</span>'.
                                   '</td>'.                                    '</td>'.
       '<td align="right">'.$boards.'</td>'.        '<td align="right">'.$boards.'</td>'.
       '<td align="right">'.$diskuse.'</td>'.        '<td align="right">'.$diskuse.'</td>'.
Line 915  function changeSort(caller) { Line 915  function changeSort(caller) {
                             result => 'Re-enabled'                              result => 'Re-enabled'
                           );                            );
     my %navbuttons = &Apache::lonlocal::texthash(      my %navbuttons = &Apache::lonlocal::texthash(
                              gtns => 'Go to next step',                               gtns => 'Next',#'Go to next step',
                              gtps => 'Go to previous step',                               gtps => 'Back',#'Go to previous step',
                              crgr => 'Create '.$gpterm,                               crgr => 'Create '.$gpterm,
                              mose => 'Modify settings',                               mose => 'Save',#'Modify settings',
                              gtpp => 'Go to previous page',                               gtpp => 'Back',#'Go to previous page',
                              adme => 'Add members',                               adme => 'Add members',
     );      );
     if ((($action eq 'create') || ($action eq 'modify') || ($action eq 'delete') || ($action eq 'reenable')) &&      if ((($action eq 'create') || ($action eq 'modify') || ($action eq 'delete') || ($action eq 'reenable')) &&
Line 1259  sub reenable_folder { Line 1259  sub reenable_folder {
   
 sub modify_folders {  sub modify_folders {
     my ($cdom,$cnum,$groupname) = @_;      my ($cdom,$cnum,$groupname) = @_;
     my $outcome;      my ($outcome,$groupmap,$groupmapres,$map,$id,$src);
     my $navmap = Apache::lonnavmaps::navmap->new();      my $navmap = Apache::lonnavmaps::navmap->new();
     my $groupmap = '/uploaded/'.$cdom.'/'.$cnum.'/'.'group_folder_'.      if (!defined($navmap)) {
           $outcome = '<div class="LC_error">'.
                      &mt('Error reading course contents.').' '.
                      &mt('You need to re-initialize the course.').
                      '</div>';
           return $outcome;
       }
       $groupmap = '/uploaded/'.$cdom.'/'.$cnum.'/'.'group_folder_'.
                    $groupname.'.sequence';                     $groupname.'.sequence';
     my $groupmapres = $navmap->getResourceByUrl($groupmap);      $groupmapres = $navmap->getResourceByUrl($groupmap);
     my ($map,$id,$src);  
     if ($groupmapres) {      if ($groupmapres) {
         ($map,$id,$src)=&Apache::lonnet::decode_symb($groupmapres->symb());          ($map,$id,$src)=&Apache::lonnet::decode_symb($groupmapres->symb());
     }      }
Line 1582  sub general_settings_form { Line 1588  sub general_settings_form {
         @{$tools} = sort(keys(%{$functions}));          @{$tools} = sort(keys(%{$functions}));
         &privilege_specificity($r,$action,3,$tools,$stored,$toolprivs,          &privilege_specificity($r,$action,3,$tools,$stored,$toolprivs,
        $fixedprivs,\@available,$formname,         $fixedprivs,\@available,$formname,
        $gpterm,$ucgpterm);         $gpterm,$ucgpterm,$functions);
         &mapping_options($r,$action,$formname,$page,$sectioncount,          &mapping_options($r,$action,$formname,$page,$sectioncount,
                          $states,$stored,$navbuttons,4,5,                           $states,$stored,$navbuttons,4,5,
  $gpterm,$ucgpterm,$crstype,$cdom,$cnum);   $gpterm,$ucgpterm,$crstype,$cdom,$cnum);
Line 1643  END Line 1649  END
     for (my $i=0; $i<$halfnum; $i++) {      for (my $i=0; $i<$halfnum; $i++) {
         $r->print('<td><label><input type="checkbox" name="tool" value="'.          $r->print('<td><label><input type="checkbox" name="tool" value="'.
                   $allfunctions[$i].'" />&nbsp;'.                    $allfunctions[$i].'" />&nbsp;'.
                    $$functions{$allfunctions[$i]}.'</label></td>                     &mt($$functions{$allfunctions[$i]}).'</label></td>
                    <td>&nbsp;</td><td>&nbsp;</td>');                     <td>&nbsp;</td><td>&nbsp;</td>');
     }      }
     $r->print('<td><input type="button" value="'.&mt('check all').'" '.      $r->print('<td><input type="button" value="'.&mt('check all').'" '.
Line 1652  END Line 1658  END
     for (my $j=$halfnum; $j<@allfunctions; $j++) {      for (my $j=$halfnum; $j<@allfunctions; $j++) {
         $r->print('<td><label><input type="checkbox" name="tool" value="'.          $r->print('<td><label><input type="checkbox" name="tool" value="'.
                   $allfunctions[$j].'" />&nbsp;'.                    $allfunctions[$j].'" />&nbsp;'.
                   $$functions{$allfunctions[$j]}.'</label></td>                    &mt($$functions{$allfunctions[$j]}).'</label></td>
                   <td>&nbsp;</td><td>&nbsp;</td>');                    <td>&nbsp;</td><td>&nbsp;</td>');
     }      }
     if ($remnum) {      if ($remnum) {
Line 1668  END Line 1674  END
        <td class="LC_description">'.&mt('Granularity:').'</td>         <td class="LC_description">'.&mt('Granularity:').'</td>
        <td colspan="10">'.$lt{'doyo'}.'&nbsp;<label><input type="radio" name="granularity" value="Yes" />'.&mt('Yes').'</label>&nbsp;<label><input type="radio" name="granularity" value="No" checked="checked" />'.&mt('No').'</label>');         <td colspan="10">'.$lt{'doyo'}.'&nbsp;<label><input type="radio" name="granularity" value="Yes" />'.&mt('Yes').'</label>&nbsp;<label><input type="radio" name="granularity" value="No" checked="checked" />'.&mt('No').'</label>');
     if ($action eq 'modify') {      if ($action eq 'modify') {
         $r->print('&nbsp;&nbsp;('.&mt('Currently set to "[_1]"',          $r->print('&nbsp;&nbsp;('.&mt('Currently set to [_1].'
                                       &mt($$stored{'granularity'})).')');                                        ,'"'.&mt($$stored{'granularity'}).'"').')');
     }      }
     $r->print('      $r->print('
        </td>         </td>
Line 1798  sub sections_selection { Line 1804  sub sections_selection {
         }          }
     }      }
     my $output = '      my $output = '
         <select name="'.$elementname.'" multiple="true" size="'.$numvisible.'">          <select name="'.$elementname.'" multiple="multiple" size="'.$numvisible.'">
           '.$section_sel.'            '.$section_sel.'
         </select>';          </select>';
     return $output;      return $output;
Line 2163  sub pick_new_members { Line 2169  sub pick_new_members {
   
 sub privilege_specificity {  sub privilege_specificity {
     my ($r,$action,$img,$tools,$stored,$toolprivs,$fixedprivs,$available,      my ($r,$action,$img,$tools,$stored,$toolprivs,$fixedprivs,$available,
  $formname,$gpterm,$ucgpterm) = @_;   $formname,$gpterm,$ucgpterm,$functions) = @_;
     my %lt = &Apache::lonlocal::texthash (      my %lt = &Apache::lonlocal::texthash (
       'uprv' => 'User privileges for collaborative tools',        'uprv' => 'User privileges for collaborative tools',
       'frty' => 'For each collaborative tool you have chosen to include, '.        'frty' => 'For each collaborative tool you have chosen to include, '.
Line 2260  sub privilege_specificity { Line 2266  sub privilege_specificity {
             $r->print($lt{'algm'}.'<br /><br />');              $r->print($lt{'algm'}.'<br /><br />');
         }          }
         &default_privileges($r,$action,$tools,$toolprivs,$fixedprivs,          &default_privileges($r,$action,$tools,$toolprivs,$fixedprivs,
     $available);      $available,$functions);
     } else {      } else {
         if ($action eq 'create') {          if ($action eq 'create') {
             $r->print($lt{'asyo'});              $r->print($lt{'asyo'});
Line 2284  sub privilege_specificity { Line 2290  sub privilege_specificity {
 }  }
   
 sub default_privileges {  sub default_privileges {
     my ($r,$action,$tools,$toolprivs,$fixedprivs,$available) = @_;      my ($r,$action,$tools,$toolprivs,$fixedprivs,$available,$functions) = @_;
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
                                 'addp' => 'Additional privileges',                                  'addp' => 'Additional privileges',
                                 'fixp' => 'Fixed privileges',                                  'fixp' => 'Fixed privileges',
Line 2293  sub default_privileges { Line 2299  sub default_privileges {
     );      );
     $r->print(&Apache::lonhtmlcommon::start_pick_box('LC_group_priv_box').      $r->print(&Apache::lonhtmlcommon::start_pick_box('LC_group_priv_box').
       &Apache::lonhtmlcommon::row_title($lt{'func'},undef,        &Apache::lonhtmlcommon::row_title($lt{'func'},undef,
  'LC_groups_functionality'));        'LC_groups_functionality'));
     $r->print(join('</td><td class="LC_groups_functionality">',@{$tools}));      my @tableHeader;
       foreach my $key (sort(keys(%{$functions}))){
           push (@tableHeader,&mt(${$functions}{$key}));
       }   
    $r->print(join('</td><td class="LC_groups_functionality">', @tableHeader));
     $r->print(&Apache::lonhtmlcommon::row_closure(1));      $r->print(&Apache::lonhtmlcommon::row_closure(1));
     my $fixed = '';      my $fixed = '';
     my $dynamic = '';      my $dynamic = '';
Line 2310  sub default_privileges { Line 2320  sub default_privileges {
     $fixed .= '</td><td class="LC_groups_fixed">';      $fixed .= '</td><td class="LC_groups_fixed">';
  }   }
                 $fixed .= '<input type="hidden" name="defpriv" value="'.$priv.'" />'                  $fixed .= '<input type="hidden" name="defpriv" value="'.$priv.'" />'
                          .'<span class="LC_nobreak">'.$$toolprivs{$tool}{$priv}.'&nbsp;';                           .'<span class="LC_nobreak">'.&mt($$toolprivs{$tool}{$priv}).'&nbsp;';
                 if ($action eq 'modify') {                  if ($action eq 'modify') {
                     if (grep(/^$tool$/,@{$available})) {                      if (grep(/^$tool$/,@{$available})) {
                         $fixed .= '<small>'.&mt('(on)').'<small>&nbsp;';                          $fixed .= '<small>'.&mt('(on)').'<small>&nbsp;';
Line 2325  sub default_privileges { Line 2335  sub default_privileges {
                     $dynamic .= '</tr>                      $dynamic .= '</tr>
                                  <tr>'."\n";                                   <tr>'."\n";
                 }                  }
                 $dynamic .= '<td><span class="LC_nobreak"><label><input type="checkbox" name="defpriv" value="'.$priv.'" />'.$$toolprivs{$tool}{$priv}.'</label></span></td>'."\n";                  $dynamic .= '<td><span class="LC_nobreak"><label><input type="checkbox" name="defpriv" value="'.$priv.'" />'.&mt($$toolprivs{$tool}{$priv}).'</label></span></td>'."\n";
             }              }
         }          }
         if ($privcount == 0) {          if ($privcount == 0) {
Line 3222  sub write_group_data { Line 3232  sub write_group_data {
                 my $crspath = '/uploaded/'.$cdom.'/'.$cnum.'/';                  my $crspath = '/uploaded/'.$cdom.'/'.$cnum.'/';
                 my $boardsmap = $crspath.'group_boards_'.$groupname.'.sequence';                  my $boardsmap = $crspath.'group_boards_'.$groupname.'.sequence';
                 my $navmap = Apache::lonnavmaps::navmap->new();                  my $navmap = Apache::lonnavmaps::navmap->new();
                 my $bbmapres = $navmap->getResourceByUrl($boardsmap);                  my ($bbmapres,$error);
                 undef($navmap);                  if (defined($navmap)) {
                 if (!$bbmapres) {                      $bbmapres = $navmap->getResourceByUrl($boardsmap);
                     my $grpmap = $crspath.'group_folder_'.$groupname.'.sequence';                      undef($navmap);
                     my $disctitle = &mt('Discussion Boards');                      if (!$bbmapres) {
                     my $outcome = &map_updater($cdom,$cnum,'group_boards_'.                          my $grpmap = $crspath.'group_folder_'.$groupname.'.sequence';
                                                $groupname.'.sequence','bbseq',                          my $disctitle = &mt('Discussion Boards');
                                                $disctitle,$grpmap);                          my $outcome = &map_updater($cdom,$cnum,'group_boards_'.
                     my ($furl,$ferr) =                                                      $groupname.'.sequence','bbseq',
                         &Apache::lonuserstate::readmap($cdom.'/'.$cnum);                                                     $disctitle,$grpmap);
                     $navmap = Apache::lonnavmaps::navmap->new();                          my ($furl,$ferr) = 
                     # modify parameter                              &Apache::lonuserstate::readmap($cdom.'/'.$cnum);
                     if ($outcome eq 'ok') {                          # modify parameter
                         my $parm_result = &parm_setter($navmap,$cdom,$boardsmap,                          if ($outcome eq 'ok') {
                                                        $groupname);                              $navmap = Apache::lonnavmaps::navmap->new();
                         if ($parm_result) {                              if (defined($navmap)) {
                             $r->print('<div class="LC_error">'                                  my $parm_result = &parm_setter($navmap,$cdom,$boardsmap,
                                      .&mt('An error occurred while setting parameters '                                                                 $groupname);
                                          .'for Discussion Boards folder: '                                  if ($parm_result) {
                                          .'[_1]',$parm_result)                                      $error = &mt('An error occurred while setting parameters '
                                      .'</div>');                                               .'for Discussion Boards folder: '
                                                .'[_1]',$parm_result);
                                   } else {
                                       $r->print('<div class="LC_success">'.
                                                 &mt('Discussion Boards Folder created.')
                                                 .'</div>');
                                   }
                                   undef($navmap);
                               } else {
                                   $error = &mt('An error occurred while setting parameters '.
                                                'for Discussion Boards folder: '.
                                                'Could not retrieve course information' );
                               }
                         } else {                          } else {
                             $r->print('<div class="LC_success">'                              $r->print($outcome);
                                      .&mt('Discussion Boards Folder created.')  
                                      .'</div>');  
                         }                          }
                     } else {  
                         $r->print($outcome);  
                     }                      }
                     undef($navmap);                  } else {
                       $error = &mt("An error occurred while retrieving the contents of the group's folder.").'<br />'.
                                &mt('You need to re-initialize the course.');
                   }
                   if ($error ne '') {
                       $r->print('<div class="LC_error">'.$error.'</div>');
                 }                  }
             }              }
             $r->print('<div class="LC_success">'              $r->print('<div class="LC_success">'
Line 3509  sub mapping_options { Line 3532  sub mapping_options {
         'adds'  => "If automatic $gpterm enrollment is enabled, when a user is newly assigned a ".lc($crstype)."-wide or section-specific role, he/she will automatically be added as a member of the $gpterm, with start and end access dates defined by the default dates set for the $gpterm, unless he/she is already a $gpterm member, with access dates that permit either current or future $gpterm access.",          'adds'  => "If automatic $gpterm enrollment is enabled, when a user is newly assigned a ".lc($crstype)."-wide or section-specific role, he/she will automatically be added as a member of the $gpterm, with start and end access dates defined by the default dates set for the $gpterm, unless he/she is already a $gpterm member, with access dates that permit either current or future $gpterm access.",
         'drops'  => "If automatic $gpterm disenrollment is enabled, when a user's role is expired, access to the $gpterm will be terminated unless the user continues to have other ".lc($crstype)."-wide or section-specific active or future roles which receive automatic membership in the $gpterm.",          'drops'  => "If automatic $gpterm disenrollment is enabled, when a user's role is expired, access to the $gpterm will be terminated unless the user continues to have other ".lc($crstype)."-wide or section-specific active or future roles which receive automatic membership in the $gpterm.",
         'pirs' => "Pick roles and sections for automatic $gpterm enrollment",          'pirs' => "Pick roles and sections for automatic $gpterm enrollment",
         'curr' => 'Currently set to',  
         'on' => 'on',          'on' => 'on',
         'off' => 'off',          'off' => 'off',
         'auad' => "Automatically enable $gpterm membership when roles are added?",          'auad' => "Automatically enable $gpterm membership when roles are added?",
Line 3537  sub automapping { Line 3559  sub automapping {
    <span class="LC_nobreak">'.$$lt{'auad'}.':&nbsp;     <span class="LC_nobreak">'.$$lt{'auad'}.':&nbsp;
     <label><input type="radio" name="autoadd" value="on" />'.&mt('on').'&nbsp;&nbsp;</label><label><input type="radio" name="autoadd" value="off" checked="checked" />'.&mt('off').'</label>');      <label><input type="radio" name="autoadd" value="on" />'.&mt('on').'&nbsp;&nbsp;</label><label><input type="radio" name="autoadd" value="off" checked="checked" />'.&mt('off').'</label>');
     if ($action eq 'modify') {      if ($action eq 'modify') {
         $r->print('&nbsp;&nbsp;&nbsp;&nbsp;('.$$lt{'curr'}.' <b>'.$$lt{$add}.'</b>)');          $r->print('&nbsp;&nbsp;&nbsp;&nbsp;('.&mt('Currently set to [_1].','<b>'.$$lt{$add}.'</b>').')');
     }      }
     $r->print('      $r->print('
     </span><br />      </span><br />
     <span class="LC_nobreak">'.$$lt{'auex'}.':&nbsp;      <span class="LC_nobreak">'.$$lt{'auex'}.':&nbsp;
     <label><input type="radio" name="autodrop" value="on" />'.&mt('on').'&nbsp;&nbsp;</label><label><input type="radio" name="autodrop" value="off" checked="checked" />'.&mt('off').'</label>');      <label><input type="radio" name="autodrop" value="on" />'.&mt('on').'&nbsp;&nbsp;</label><label><input type="radio" name="autodrop" value="off" checked="checked" />'.&mt('off').'</label>');
     if ($action eq 'modify') {      if ($action eq 'modify') {
         $r->print('&nbsp;&nbsp;&nbsp;&nbsp;('.$$lt{'curr'}.' <b>'.$$lt{$drop}.'</b>)');          $r->print('&nbsp;&nbsp;&nbsp;&nbsp;('.&mt('Currently set to [_1].','<b>'.$$lt{$drop}.'</b>').')');
     }      }
     $r->print('</span><br /><br />'.$$lt{'mapr'});      $r->print('</span><br /><br />'.$$lt{'mapr'});
 }  }
Line 3828  sub add_group_folder { Line 3850  sub add_group_folder {
     }      }
     my ($furl,$ferr)= &Apache::lonuserstate::readmap($cdom.'/'.$cnum);      my ($furl,$ferr)= &Apache::lonuserstate::readmap($cdom.'/'.$cnum);
     my $navmap = Apache::lonnavmaps::navmap->new();      my $navmap = Apache::lonnavmaps::navmap->new();
       if (!defined($navmap)) {
           return $warning.'<span class="LC_error">'.&mt('Error retrieving course contents').
                  ' '.&mt('You need to re-initialize the course.').'</span>';
       }
     # modify parameters      # modify parameters
     my $parm_result;      my $parm_result;
     if ($action eq 'create') {      if ($action eq 'create') {
Line 3933  sub new_map { Line 3959  sub new_map {
 sub parm_setter {  sub parm_setter {
     my ($navmap,$cdom,$url,$groupname) = @_;      my ($navmap,$cdom,$url,$groupname) = @_;
     my $allresults;      my $allresults;
       if (!defined($navmap)) {
           $allresults = '<div class="LC_warning">'.
                         &mt('Parameters not set for [_1] because the contents of the course could not be retrieved.',$url).' '.
                         &mt('You need to reinitialize the course.').
                         '</div>';
           return $allresults;
       }
     my %hide_settings = (      my %hide_settings = (
                            'course' =>  {                             'course' =>  {
                                           'num' => 13,                                            'num' => 13,

Removed from v.1.80.2.2  
changed lines
  Added in v.1.94


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