Diff for /loncom/interface/loncoursegroups.pm between versions 1.51 and 1.54

version 1.51, 2006/07/08 01:16:30 version 1.54, 2006/07/20 03:11:52
Line 63  sub handler { Line 63  sub handler {
     my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};      my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
   
     my $view_permission =      my $view_permission =
           &Apache::lonnet::allowed('vcg',$env{'request.course.id'});            &Apache::lonnet::allowed('vcg',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
     my $manage_permission =      my $manage_permission =
           &Apache::lonnet::allowed('mdg',$env{'request.course.id'});            &Apache::lonnet::allowed('mdg',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
     &Apache::lonhtmlcommon::clear_breadcrumbs();      &Apache::lonhtmlcommon::clear_breadcrumbs();
   
     my $gpterm = &Apache::loncommon::group_term();      my $gpterm = &Apache::loncommon::group_term();
Line 91  sub handler { Line 91  sub handler {
   
     my $action = $env{'form.action'};      my $action = $env{'form.action'};
     my $state = $env{'form.state'};      my $state = $env{'form.state'};
     if ((!defined($action)) || ($action eq 'view')) {      if ((!defined($action)) || ($action eq 'view') || ($action eq 'modify')) {
         if (!defined($state)) {          if (!defined($state)) {
             $state = 'view';              $state = 'view';
         }          }
     }      }
     if ($action eq 'create' || $action eq 'modify' || $action eq 'view') {       if ($action eq 'create' || $action eq 'modify' || $action eq 'view') { 
         if ($view_permission || $manage_permission) {          if ($view_permission || $manage_permission) {
             &group_administration($r,$action,$state,$cdom,$cnum,              if ($state eq 'view') {
                                   \%functions,\%idx,$view_permission,                  &print_main_menu($r,$cdom,$cnum,\%functions,\%idx,
                                   $manage_permission,$gpterm,$ucgpterm,                                   $view_permission,$manage_permission,
   $crstype);                                   $action,$state,$gpterm,$ucgpterm,$crstype);
               } else {
                   &group_administration($r,$action,$state,$cdom,$cnum,
                                         \%functions,\%idx,$view_permission,
                                         $manage_permission,$gpterm,$ucgpterm,
           $crstype);
               }
         } else {          } else {
             $r->print(&mt('You do not have [_1] administration '.              $r->print(&mt('You do not have [_1] administration '.
                           'privileges in this [_2]',$gpterm,lc($crstype)));                            'privileges in this [_2]',$gpterm,lc($crstype)));
Line 117  sub handler { Line 123  sub handler {
 sub print_main_menu {  sub print_main_menu {
     my ($r,$cdom,$cnum,$functions,$idx,$view_permission,$manage_permission,      my ($r,$cdom,$cnum,$functions,$idx,$view_permission,$manage_permission,
  $action,$state,$gpterm,$ucgpterm,$crstype) = @_;   $action,$state,$gpterm,$ucgpterm,$crstype) = @_;
     my $pagename = "$crstype $ucgpterm".'s';  
     my $jscript = qq|      my $jscript = qq|
 function changeSort(caller) {  function changeSort(caller) {
     document.$state.sortby.value = caller;      document.$state.sortby.value = caller;
     document.$state.submit();      document.$state.submit();
 }\n|;  }\n|;
     $r->print(&header($pagename,$jscript,$action,$state));      $r->print(&header('Groups',$jscript,$action,$state));
       if ($env{'form.refpage'} eq 'enrl') {
           &Apache::lonhtmlcommon::add_breadcrumb
               ({href=>"/adm/dropadd",
                 text=>"Enrollment Manager"});
       }
     &Apache::lonhtmlcommon::add_breadcrumb      &Apache::lonhtmlcommon::add_breadcrumb
         ({href=>"/adm/coursegroups",          ({href=>"/adm/coursegroups",
           text=>"$pagename"});            text=>"Groups"});
     $r->print(&Apache::lonhtmlcommon::breadcrumbs($pagename));      $r->print(&Apache::lonhtmlcommon::breadcrumbs('Groups'));
     &display_groups($r,$cdom,$cnum,$functions,$idx,$view_permission,      &display_groups($r,$cdom,$cnum,$functions,$idx,$view_permission,
     $manage_permission,$action,$state,$gpterm,$ucgpterm,      $manage_permission,$action,$state,$gpterm,$ucgpterm,
     $crstype);      $crstype);
Line 142  sub display_groups { Line 152  sub display_groups {
     my %grp_info = ();      my %grp_info = ();
     my %actionlinks = (      my %actionlinks = (
       modify => '<a href="/adm/coursegroups?action=modify&refpage='.        modify => '<a href="/adm/coursegroups?action=modify&refpage='.
                          $env{'form.refpage'}.'&groupname=',                           $env{'form.refpage'}.'&state=pick_task&groupname=',
       view => '<a href="/adm/'.$cdom.'/'.$cnum.'/',        view => '<a href="/adm/'.$cdom.'/'.$cnum.'/',
       delete => '<a href="/adm/coursegroups?action=delete&refpage='.        delete => '<a href="/adm/coursegroups?action=delete&refpage='.
                          $env{'form.refpage'}.'&groupname=',                           $env{'form.refpage'}.'&groupname=',
Line 152  sub display_groups { Line 162  sub display_groups {
                           view   => 'View',                            view   => 'View',
                           delete => 'Delete',                            delete => 'Delete',
                           act    => 'Action',                            act    => 'Action',
                           gname  => "$ucgpterm Name",                            gname  => 'Group Name',
                           desc   => 'Description',                            desc   => 'Group Title',
                           crea   => 'Creator',                            crea   => 'Creator',
                           crtd   => 'Created',                            crtd   => 'Created',
                           last   => 'Last Modified',                            last   => 'Last Modified',
                           func   => 'Functionality',                            func   => 'Collaborative Tools',
                           quot   => 'Quota (Mb)',                            quot   => 'Quota (Mb)',
                           memb   => 'Members',                            memb   => 'Members',
                           file   => 'Files',                            file   => 'Files',
                           dibd   => 'Discussion Boards',                            dibd   => 'Discussion Boards',
                           dius   => 'Disk Use (%)',                            dius   => 'Disk Use (%)',
                           nogr   => 'No '.$gpterm.'s exist.',                            nogr   => 'No groups exist.',
                           crng   => 'Create a new '.$gpterm,                            crng   => 'Create a new group',
                           alth   => 'Although your current role has privileges'.                            alth   => 'Although your current role has privileges'.
                                     ' to view any existing '.$gpterm.'s in this'.                                      ' to view any existing groups in this'.
                                     lc($crstype).', you do not have privileges'.                                      lc($crstype).', you do not have privileges'.
                                     'to create new '.$gpterm.'s.',                                      'to create new groups.',
                      );                       );
     if ($view_permission) {      if ($view_permission) {
         if (!defined($action)) {          if (!defined($action)) {
Line 177  sub display_groups { Line 187  sub display_groups {
         my %curr_groups = &Apache::longroup::coursegroups($cdom,$cnum);          my %curr_groups = &Apache::longroup::coursegroups($cdom,$cnum);
         if (%curr_groups) {          if (%curr_groups) {
             if ($manage_permission) {              if ($manage_permission) {
                 $r->print('<br /><a href="/adm/coursegroups?action=create&refpage='.$env{'form.refpage'}.'">'.$lt{'crng'}.'</a>');                  if (!exists($env{'form.refpage'})) { 
                       $r->print('<br /><a href="/adm/coursegroups?action=create">'.$lt{'crng'}.'</a>');
                   }
             }              }
             $r->print('<br /><br />');              $r->print('<br /><br />');
     $r->print(&Apache::loncommon::start_data_table().      $r->print(&Apache::loncommon::start_data_table().
Line 274  END Line 286  END
                         $link .= $group;                          $link .= $group;
                     } else {                      } else {
                         $link .= $group.'/smppg?ref=grouplist';                          $link .= $group.'/smppg?ref=grouplist';
                           if (exists($env{'form.refpage'})) {
                               $link .= '&amp;refpage='.$env{'form.refpage'};
                           }
                     }                      }
                     $link .= '">'.$lt{$action}.'</a>';                      $link .= '">'.$lt{$action}.'</a>';
                     if ($action eq 'view') {                       if ($action eq 'view') { 
Line 312  END Line 327  END
         } else {          } else {
             $r->print($lt{'nogr'});              $r->print($lt{'nogr'});
             if ($manage_permission) {              if ($manage_permission) {
                 $r->print('<br /><br /><a href="/adm/coursegroups?action=create&refpage='.$env{'form.refpage'}.'">'.$lt{'crng'}.'</a>');                  if (!exists($env{'form.refpage'})) {
                       $r->print('<br /><br /><a href="/adm/coursegroups?action=create">'.$lt{'crng'}.'</a>');
                   }
             } else {              } else {
                 $r->print('<br /><br />'.$lt{'alth'});                  $r->print('<br /><br />'.$lt{'alth'});
   
Line 329  END Line 346  END
                                         $curr_groups{$group});                                          $curr_groups{$group});
                     my $description = &unescape(                      my $description = &unescape(
                                         $group_info{description});                                          $group_info{description});
                     my ($uname,$udom) = split(/:/,$group_info{creator});                      $r->print('<font size="+1"><a href="/adm/'.$cdom.'/'.$cnum.'/'.$group.'/smppg?ref=grouplist">'.$group,'</a><font><br /><small>'.$description.'</small><br /><br />');
                     $r->print('<font size="+1"><a href="/adm/'.$udom.'/'.$uname.'/'.$group.'/smppg?ref=grouplist">'.$group,'</a><font><br /><small>'.$description.'</small><br /><br />');  
                 }                  }
             }              }
         } else {          } else {
Line 350  sub group_administration { Line 366  sub group_administration {
     my @types = ();      my @types = ();
     my @roles = ();      my @roles = ();
     my @sections = ();      my @sections = ();
       my @buildsections = ();
     my %users = ();      my %users = ();
     my %userdata = ();      my %userdata = ();
     my @members = ();      my @members = ();
Line 401  sub group_administration { Line 418  sub group_administration {
         if ($state eq '') {          if ($state eq '') {
             if (defined($env{'form.groupname'})) {              if (defined($env{'form.groupname'})) {
                 $state = 'pick_task';                  $state = 'pick_task';
             } else {  
                 $state = 'pick_group';  
             }              }
         } else {          } else {
             %stored = &retrieve_settings($cdom,$cnum,$groupname);              %stored = &retrieve_settings($cdom,$cnum,$groupname);
Line 496  sub group_administration { Line 511  sub group_administration {
        (($action eq 'modify') && (($state eq 'change_settings') ||         (($action eq 'modify') && (($state eq 'change_settings') ||
                                   ($state eq 'add_members')))) {                                    ($state eq 'add_members')))) {
         %sectioncount = &Apache::loncommon::get_sections($cdom,$cnum);          %sectioncount = &Apache::loncommon::get_sections($cdom,$cnum);
         if (%sectioncount) {          $elements{'create'}{'pick_name'}{'sectionpick'} = 'selectbox';
             $elements{'create'}{'pick_name'}{'sectionpick'} = 'selectbox';          $elements{'modify'}{'change_mapping'}{'sectionpick'} = 'selectbox';
             $elements{'modify'}{'change_mapping'}{'sectionpick'} = 'selectbox';          $elements{'modify'}{'add_members'}{'sectionpick'} = 'selectbox';
             $elements{'modify'}{'add_members'}{'sectionpick'} = 'selectbox';  
         }  
     }      }
   
     if (($action eq 'create') ||       if (($action eq 'create') || 
Line 514  sub group_administration { Line 527  sub group_administration {
         if (defined($env{'form.sectionpick'})) {          if (defined($env{'form.sectionpick'})) {
             @sections=&Apache::loncommon::get_env_multiple('form.sectionpick');              @sections=&Apache::loncommon::get_env_multiple('form.sectionpick');
             if (grep/^all$/,@sections) {              if (grep/^all$/,@sections) {
                 @sections = sort {$a cmp $b} keys(%sectioncount);                  @buildsections = sort {$a cmp $b} keys(%sectioncount);
               } else {
                   @buildsections = @sections;
             }              }
         }          }
     }      }
   
     if (($state eq 'pick_members') || ($state eq 'pick_privs') || ($state eq 'change_privs')) {      if (($state eq 'pick_members') || ($state eq 'pick_privs') || ($state eq 'change_privs')) {
         &build_members_list($cdom,$cnum,\@types,\@roles,\@sections,\%users,          &build_members_list($cdom,$cnum,\@types,\@roles,\@buildsections,\%users,
                             \%userdata);                              \%userdata);
     }      }
     if ($state eq 'pick_members') {      if ($state eq 'pick_members') {
Line 556  sub group_administration { Line 571  sub group_administration {
                         $num_reenable ++;                          $num_reenable ++;
                         next;                          next;
                     } elsif (($start > $now)) {                      } elsif (($start > $now)) {
                         $num_activate = 1;                          $num_activate ++;
                         next;                          next;
                     } else {                      } else {
                         $num_expire ++;                          $num_expire ++;
Line 725  sub group_administration { Line 740  sub group_administration {
         my $space_trim = '/^\s*|\s*\$/g,""';          my $space_trim = '/^\s*|\s*\$/g,""';
         my $float_check = '/^([0-9]*\.?[0-9]*)$/';          my $float_check = '/^([0-9]*\.?[0-9]*)$/';
         $validate_script = '          $validate_script = '
     var newquota = document.'.$state.'.quota.value;      var newquota = new String(document.'.$state.'.quota.value);
     newquota.replace('.$space_trim.');      newquota.replace('.$space_trim.');
     if (newquota == "" ) {      if (newquota == "" ) {
         document.'.$state.'.quota.value = 0;          document.'.$state.'.quota.value = 0;
         newquota = 0;                 newquota = "0";
     }      }
     var maxposs = '.$maxposs.';      var maxposs = '.sprintf("%.2f",$maxposs).';
     if (newquota > maxposs) {      if (newquota > maxposs) {
         alert("The file repository quota you entered for this group ("+newquota+" Mb) exceeds the maximum possible ("+maxposs+" Mb). Please enter a smaller number.");          alert("The file repository quota you entered for this group ("+newquota+" Mb) exceeds the maximum possible ("+maxposs+" Mb). Please enter a smaller number.");
         return;          return;
Line 782  function changeSort(caller) { Line 797  function changeSort(caller) {
     my %states = ();      my %states = ();
     my %branchstates = ();      my %branchstates = ();
     @{$states{'create'}} = ('pick_name','pick_members','pick_privs','result');      @{$states{'create'}} = ('pick_name','pick_members','pick_privs','result');
     @{$states{'modify'}} = ('pick_group','pick_task');      @{$states{'modify'}} = ('pick_task');
     @{$branchstates{'noprivs'}} = ('result');      @{$branchstates{'noprivs'}} = ('result');
     @{$branchstates{'settings'}} = ('change_settings','chgresult');      @{$branchstates{'settings'}} = ('change_settings','chgresult');
     @{$branchstates{'members'}} = ('change_members','change_privs','memresult');      @{$branchstates{'members'}} = ('change_members','change_privs','memresult');
Line 806  function changeSort(caller) { Line 821  function changeSort(caller) {
     }      }
   
     my $loaditems =  &onload_action($action,$state);      my $loaditems =  &onload_action($action,$state);
     my $crumbtitle = "$crstype $ucgpterm".'s';       $r->print(&header("Groups Manager",
     $r->print(&header("$crumbtitle Manager",  
       $jscript,$action,$state,$page,$loaditems));        $jscript,$action,$state,$page,$loaditems));
   
     if ($env{'form.refpage'} eq 'enrl') {      if ($env{'form.refpage'} eq 'enrl') {
Line 815  function changeSort(caller) { Line 829  function changeSort(caller) {
         ({href=>"/adm/dropadd",          ({href=>"/adm/dropadd",
           text=>"Enrollment Manager",            text=>"Enrollment Manager",
           faq=>9,bug=>'Instructor Interface',});            faq=>9,bug=>'Instructor Interface',});
     } else {          if ($action eq 'modify') {
               &Apache::lonhtmlcommon::add_breadcrumb
               ({href=>"/adm/coursegroups?refpage=enrl&action=modify",
                 text=>"Groups",
                 faq=>9,bug=>'Instructor Interface',});
           }
       } else { 
         &Apache::lonhtmlcommon::add_breadcrumb          &Apache::lonhtmlcommon::add_breadcrumb
        ({href=>"/adm/coursegroups",            ({href=>"/adm/coursegroups",
           text=>"$crumbtitle",              text=>"Groups",
           faq=>9,bug=>'Instructor Interface',});              faq=>9,bug=>'Instructor Interface',});
           if ($env{'form.refpage'} eq 'grouplist') {
               &Apache::lonhtmlcommon::add_breadcrumb
                ({href=>"/adm/$cdom/$cnum/$env{'form.groupname'}/smppg?ref=grouplist",
                  text=>"Group: $description",});
           }
     }      }
   
     my %trail = ();      my %trail = ();
Line 830  function changeSort(caller) { Line 855  function changeSort(caller) {
                             result => 'Creation Complete',                              result => 'Creation Complete',
                           );                            );
     %{$trail{'modify'}} = &Apache::lonlocal::texthash(      %{$trail{'modify'}} = &Apache::lonlocal::texthash(
                             pick_group => $ucgpterm.'s',  
                             pick_task => 'Choose Task',                              pick_task => 'Choose Task',
                             change_settings => "$ucgpterm Settings",                              change_settings => "$ucgpterm Settings",
                             change_members => 'Modify/Delete Members',                              change_members => 'Modify/Delete Members',
Line 858  function changeSort(caller) { Line 882  function changeSort(caller) {
                 &Apache::lonhtmlcommon::add_breadcrumb(                  &Apache::lonhtmlcommon::add_breadcrumb(
                    {text=>"$trail{$action}{$state}"});                     {text=>"$trail{$action}{$state}"});
                 $r->print(&Apache::lonhtmlcommon::breadcrumbs                  $r->print(&Apache::lonhtmlcommon::breadcrumbs
   ("$crumbtitle Manager"));    ("Groups Manager"));
                 &display_control($r,$cdom,$cnum,$action,$state,$page,                  &display_control($r,$cdom,$cnum,$action,$state,$page,
                        \%sectioncount,$groupname,$description,$functions,                         \%sectioncount,$groupname,$description,$functions,
                        \@tools,$toolprivs,$fixedprivs,$startdate,$enddate,                         \@tools,$toolprivs,$fixedprivs,$startdate,$enddate,
Line 883  function changeSort(caller) { Line 907  function changeSort(caller) {
     } elsif (($action eq 'view') && ($view_permission)) {      } elsif (($action eq 'view') && ($view_permission)) {
                         &Apache::lonhtmlcommon::add_breadcrumb(                          &Apache::lonhtmlcommon::add_breadcrumb(
                    {text=>"View $gpterm".'s'});                     {text=>"View $gpterm".'s'});
         my $crumbtitle = "$crstype $ucgpterm".'s Manager';  
         $r->print(&Apache::lonhtmlcommon::breadcrumbs          $r->print(&Apache::lonhtmlcommon::breadcrumbs
   (&mt($crumbtitle)));    ('Groups Manager'));
         &display_groups($r,$cdom,$cnum,$functions,$idx,$view_permission,          &display_groups($r,$cdom,$cnum,$functions,$idx,$view_permission,
  $manage_permission,$action,$state,$gpterm,$ucgpterm,   $manage_permission,$action,$state,$gpterm,$ucgpterm,
  $crstype);   $crstype);
Line 989  sub display_control { Line 1012  sub display_control {
         }          }
     } elsif ($action eq 'modify') {      } elsif ($action eq 'modify') {
         my $groupname = $env{'form.groupname'};          my $groupname = $env{'form.groupname'};
         if ($state eq 'pick_group') {          if ($state eq 'pick_task') {
             &display_groups($r,$cdom,$cnum,$functions,$idx,$view_permission,  
     $manage_permission,$action,$state,$gpterm,  
     $ucgpterm,$crstype);  
         } elsif ($state eq 'pick_task') {  
             &modify_menu($r,$groupname,$page,$gpterm);              &modify_menu($r,$groupname,$page,$gpterm);
         } elsif ($state eq 'change_settings') {          } elsif ($state eq 'change_settings') {
             &general_settings_form($r,$cdom,$cnum,$action,$state,$page,              &general_settings_form($r,$cdom,$cnum,$action,$state,$page,
Line 1078  sub onload_action { Line 1097  sub onload_action {
     }      }
     if (($action eq 'modify') &&      if (($action eq 'modify') &&
                 ($state eq 'change_settings' || $state eq 'change_members' ||                  ($state eq 'change_settings' || $state eq 'change_members' ||
                  $state eq 'change_privs' || $state eq 'add_members' ||                   $state eq 'change_privs' || $state eq 'add_members')) {
                  $state eq 'pick_members')) {  
  $loaditems{'onload'} =    $loaditems{'onload'} = 
     'javascript:setFormElements(document.'.$state.')';      'javascript:setFormElements(document.'.$state.')';
     }      }
Line 1201  sub groupsettings_options { Line 1219  sub groupsettings_options {
     my ($r,$functions,$action,$formname,$stored,$image,$gpterm,      my ($r,$functions,$action,$formname,$stored,$image,$gpterm,
         $ucgpterm,$crstype) = @_;          $ucgpterm,$crstype) = @_;
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
         'gdat' => "$ucgpterm open and close dates",          'gdat' => "Group access start and end dates",
         'sten' => "Set a start date/time and end date/time for the $gpterm",          'gnde' => "Group name, title and available collaborative tools",
         'gfun' => "$ucgpterm functionality",          'desc' => 'Group Title',
         'gnde' => "$ucgpterm name, description and available functionality",          'func' => 'Collaborative Tools',
         'desc' => 'Description',          'gnam' => 'Group Name',
         'func' => 'Functionality',          'lett' => 'Letters, numbers and underscore only',
         'gnam' => "$ucgpterm Name",          'doyo' => 'Different subsets of the chosen collaborative tools '.
         'doyo' => "Do you want to assign different functionality ".                    'for different group members?',
                   "to different $gpterm members?",  
     );      );
     my ($crsquota,$freespace,$maxposs) = &get_quota_constraints($action,$stored);      my ($crsquota,$freespace,$maxposs) = &get_quota_constraints($action,$stored);
     &topic_bar($r,$image,$lt{'gnde'});      &topic_bar($r,$image,$lt{'gnde'});
Line 1220  sub groupsettings_options { Line 1237  sub groupsettings_options {
        <td colspan="5">         <td colspan="5">
 ');  ');
     if ($action eq 'create') {      if ($action eq 'create') {
         $r->print('<input type="text" name="groupname" size="25" />');          $r->print('<input type="text" name="groupname" size="25" />&nbsp;('.
                     $lt{'lett'}.')');
     } else {      } else {
         $r->print('<input type="hidden" name="groupname" value="'.          $r->print('<input type="hidden" name="groupname" value="'.
                          $env{'form.groupname'}.'" />'.$env{'form.groupname'});                           $env{'form.groupname'}.'" />'.$env{'form.groupname'});
Line 1290  END Line 1308  END
         $r->print('<br />'.          $r->print('<br />'.
                   &mt('A total of [_1] Mb can be divided amongst all [_2]s in the '.                    &mt('A total of [_1] Mb can be divided amongst all [_2]s in the '.
                   '[_3], and [_4] Mb are currently unallocated.',$crsquota,                    '[_3], and [_4] Mb are currently unallocated.',$crsquota,
                   $gpterm,lc($crstype),$freespace));                    $gpterm,lc($crstype),sprintf("%.2f",$freespace)));
     } else {      } else {
         $r->print('&nbsp;&nbsp;('.&mt('The quota is currently [_1] Mb',          $r->print('&nbsp;&nbsp;('.&mt('The quota is currently [_1] Mb',
                                       $$stored{'quota'}).').');                                        $$stored{'quota'}).').');
   
         $r->print('<br />'.&mt('The quota can be increased to [_1] Mb, '.          $r->print('<br />'.&mt('The quota can be increased to [_1] Mb, '.
                   'by adding all unallocated space for [_2]s in the [_3].',                    'by adding all unallocated space for [_2]s in the [_3].',
                   $maxposs,$gpterm,lc($crstype)));                    sprintf("%.2f",$maxposs),$gpterm,lc($crstype)));
     }      }
     $r->print('      $r->print('
        </td>         </td>
Line 1327  sub membership_options { Line 1345  sub membership_options {
     my ($r,$action,$state,$sectioncount,$image,$gpterm,$ucgpterm) = @_;      my ($r,$action,$state,$sectioncount,$image,$gpterm,$ucgpterm) = @_;
     my $crstype = &Apache::loncommon::course_type();      my $crstype = &Apache::loncommon::course_type();
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
                 'pipa' => 'Pick parameters to generate membership list',                  'pipa' => 'Build a list of users for selection of group members',
                 'gmem' => "$ucgpterm membership options",                  'gmem' => "Group membership selection list criteria:",
                 'picr' => 'Pick the criteria to use to build a list of '.                  'picr' => 'Pick the criteria to use to build a list of '.
                           lc($crstype).' users from which you will select ',                            lc($crstype).' users from which you will select ',
                 'meof' => "members of the new $gpterm.",                  'meof' => "members of the new group.",
                 'admg' => "additional members of the $gpterm.",                  'admg' => "additional members of the group.",
                 'ifno' => "If you do not wish to add members when you first ".                  'ifno' => "If you do not wish to add members when you first ".
                           "create the $gpterm, do not make any selections.",                            "create the group, there is no need to pick any criteria.",
                 'asub' => "A subsequent step will also allow you to specify automatic adding/dropping of $gpterm members triggered by specified role and section changes.",                  'asub' => "A subsequent step will also allow you to specify automatic adding/dropping of group members triggered by specified user role and section <i>changes</i> in the course.",
                 'acty' => 'Access types',                  'acty' => 'Access types',
                 'coro' => $crstype.' roles',                  'coro' => $crstype.' roles',
                 'cose' => $crstype.' sections',                  'cose' => $crstype.' sections',
Line 1365  sub membership_options { Line 1383  sub membership_options {
      <table class="LC_status_selector">       <table class="LC_status_selector">
       <tr>        <tr>
        <th>'.$lt{'acty'}.'</th>         <th>'.$lt{'acty'}.'</th>
        <th>'.$lt{'coro'}.'</th>');         <th>'.$lt{'coro'}.'</th>
     if (@sections >0) {         <th>'.$lt{'cose'}.'</th>
         $r->print('        </tr><tr><td>');
        <th>'.$lt{'cose'}.'</th>');  
     }  
     $r->print('</tr><tr><td>');  
     $r->print(&Apache::lonhtmlcommon::status_select_row(\%status_types));      $r->print(&Apache::lonhtmlcommon::status_select_row(\%status_types));
     $r->print('</td><td>');      $r->print('</td><td>');
     $r->print(&Apache::lonhtmlcommon::role_select_row(\@roles));      $r->print(&Apache::lonhtmlcommon::role_select_row(\@roles));
Line 1378  sub membership_options { Line 1393  sub membership_options {
         @sections = sort {$a cmp $b} @sections;          @sections = sort {$a cmp $b} @sections;
         unshift(@sections,'none'); # Put 'no sections' next          unshift(@sections,'none'); # Put 'no sections' next
         unshift(@sections,'all'); # Put 'all' at the front of the list          unshift(@sections,'all'); # Put 'all' at the front of the list
         $r->print('</td><td>'.      } else {
         &sections_selection(\@sections,'sectionpick').'</td>');          @sections = ('all','none');
     }      }
     $r->print('      $r->print('</td><td>'.
                 &sections_selection(\@sections,'sectionpick').'</td>
       </tr>        </tr>
      </table>');       </table>');
     return;      return;
Line 1396  sub sections_selection { Line 1412  sub sections_selection {
     }      }
     foreach my $sec (@{$sections}) {      foreach my $sec (@{$sections}) {
         if ($sec eq 'all') {          if ($sec eq 'all') {
             $section_sel .= '  <option value="'.$sec.'" selected="selected">'.&mt('all sections').'</option>'."\n";              $section_sel .= '  <option value="'.$sec.'">'.&mt('all sections').'</option>'."\n";
         } elsif ($sec eq 'none') {          } elsif ($sec eq 'none') {
             $section_sel .= '  <option value="'.$sec.'">'.&mt('no section').'</option>'."\n";               $section_sel .= '  <option value="'.$sec.'">'.&mt('no section').'</option>'."\n"; 
         } else {          } else {
Line 1528  sub print_current_settings { Line 1544  sub print_current_settings {
  $granularity,$quota,$available,$unavailable,$gpterm,$ucgpterm) = @_;   $granularity,$quota,$available,$unavailable,$gpterm,$ucgpterm) = @_;
   
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
         grna => "$ucgpterm Name",          grna => 'Group Name',
         desc => 'Description',          desc => 'Group Title',
         grfn => "$ucgpterm Functions",          grfn => "Collaborative Tools",
         gran => 'Granularity',          gran => 'Granularity',
         quot => 'File quota',          quot => 'File quota',
         dfac => 'Default access dates',          dfac => 'Default access dates',
         ygrs => "Your $gpterm selections",          ygrs => "Your group selections - ",
         tfwa => "The following settings will apply to the $gpterm:",          tfwa => "The following settings will apply to the group:",
         difn => 'Different functionality<br />for different members:',          difn => 'Different collaborative tools<br />for different members:',
         stda => 'Start date',          stda => 'Start date',
         enda => 'End date:',          enda => 'End date:',
     );      );
Line 1571  sub print_current_settings { Line 1587  sub print_current_settings {
   <td>    <td>
 ');  ');
     if (@{$available} > 0) {      if (@{$available} > 0) {
         $r->print('<b>Available:</b>          $r->print(&mt('<b>Available for assignment to members:</b>').
                     <table class="LC_group_priv"><tr>');                      '<table class="LC_group_priv"><tr>');
         my $rowcell = int(@{$available}/2) + @{$available}%2;          my $rowcell = int(@{$available}/2) + @{$available}%2;
         for (my $i=0; $i<@{$available}; $i++) {          for (my $i=0; $i<@{$available}; $i++) {
             if (@{$available} > 3) {              if (@{$available} > 3) {
Line 1589  sub print_current_settings { Line 1605  sub print_current_settings {
         $r->print('</tr></table><br />');          $r->print('</tr></table><br />');
     }      }
     if (@{$unavailable} > 0) {      if (@{$unavailable} > 0) {
         $r->print('<b>Unavailable:</b>          $r->print(&mt('<b>Unavailable for assignment:</b>').
                     <table class="LC_group_priv"><tr>');                      '<table class="LC_group_priv"><tr>');
         my $rowcell = int(@{$unavailable}/2) + @{$unavailable}%2;          my $rowcell = int(@{$unavailable}/2) + @{$unavailable}%2;
         for (my $j=0; $j<@{$unavailable}; $j++) {          for (my $j=0; $j<@{$unavailable}; $j++) {
             if (@{$unavailable} > 3) {              if (@{$unavailable} > 3) {
Line 1623  sub pick_new_members { Line 1639  sub pick_new_members {
     my ($r,$action,$formname,$available,$idx,$stored,$img,$users,$userdata,      my ($r,$action,$formname,$available,$idx,$stored,$img,$users,$userdata,
  $granularity,$origmembers,$gpterm,$ucgpterm) = @_;   $granularity,$origmembers,$gpterm,$ucgpterm) = @_;
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
           'gpme' => "$ucgpterm membership",            'gpme' => "Group membership",
           'addm' => 'Add members',            'addm' => 'Add members',
           'setf' => 'Set functionality',            'setf' => 'Assign collaborative tools', 
           'func' => 'Functionality',            'func' => 'Tools',
           'nome' => 'No members to add at this time.',            'nome' => 'No members to add at this time, as there are no users '.
                        'matching the specified type(s), role(s) and section(s).',
           'nnew' => "There are no users to add as new members, as all users".            'nnew' => "There are no users to add as new members, as all users".
                     " matching the specified type(s), role(s), and/or ".                      " matching the specified type(s), role(s), and ".
                     "section(s) are already affiliated with this $gpterm.",                      "section(s) are already affiliated with this group.",
           'yoma' =>  'You may need to use the '."'".'modify existing, past or '.            'yoma' =>  'You may need to use the '."'".'modify existing, past or '.
                      'future members'."'".' page if you need to re-enable '.                       'future members'."'".' page if you need to re-enable '.
                      'or activate access for previous or future members.',                       'or activate access for previous or future members.',
Line 1766  sub privilege_specificity { Line 1783  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) = @_;
     my %lt = &Apache::lonlocal::texthash (      my %lt = &Apache::lonlocal::texthash (
       'uprv' => 'User privileges',        'uprv' => 'User privileges for collaborative tools',
       'frty' => 'For each type of functionality you have chosen to include, '.        'frty' => 'For each collaborative tool you have chosen to include, '.
                 'there is a set of standard privileges which apply to all '.                  'there is a set of core privileges which all group members '.
                 'of those for whom the functionality is enabled.',                  'assigned use of the tool will receive.',
       'thar' => 'There are also additional privileges which can be set for '.        'thar' => 'For some tools there are also additional optional '.
                 'some, or all, members. Please choose one of the following:',                   'privileges which can be set.',
       'fort' => 'For the types of functionality you have chosen to include '.        'plch' => 'Choose one of the following:',
                 'there are no additional privileges which can be set for some '.        'fort' => 'For the collaborative tools you have chosen to include '.
                 'or all members.',                  'only core privileges are available, '.
       'eaty' => 'Each of the types of functionality includes standard '.                  'so there are no optional privileges to assign.',
                 'privileges which apply to members with access to that '.        'eaty' => 'Each collaborative tool includes core '.
                 'functionality, and may also include additional privileges '.                  'privileges assigned to all members with access to the '.
                   'tool. Some tools may also feature additional privileges '.
                 'which can be set for specific members.',                  'which can be set for specific members.',
       'cutg' => "Currently the $gpterm is configured ",        'cutg' => 'Currently the group is configured ',
       'sdif' => "so different $gpterm members can receive different privileges.",        'sdif' => 'so different members can receive different optional privileges for a particular tool.',
       'sall' => "so all $gpterm members will receive the same privileges.",        'sall' => 'so all members will receive the same optional privileges for a particular tool.',
       'algm' => "All $gpterm members will receive the same privileges.",        'algm' => 'All group members will receive the same privileges for any tool assigned to them, including the default set of optional privileges.',
       'smgp' => "Some $gpterm members will receive different privileges from ".        'smgp' => 'Different group members may receive different privileges from '.
                 "others.",                  'others for the tools they have been assigned.',
       'thwi' => "These will be the privileges all $gpterm members receive, ".         'thwi' => 'These will be the privileges all group members receive for a particular assigned tool, '. 
                 "if you selected the first option above.",                  'if you selected the first option above.',
       'thes' => "These will be the privileges given to members assigned ".           'thes' => "These will be the privileges given to members assigned ".   
                 "in the future, including via automatic $gpterm assignment ".                  "in the future via automatic group assignment ".
                 "for specific sections/roles ",                  "for users who receive specific sections/roles in the course ",
       'asyo' => "As you have chosen not to include any functionality in the ".        'asyo' => "As you have chosen not to include any collaborative tools ".
                 "$gpterm, no default user privileges settings need to be set.",                  "in the group, no default optional privileges need to be set.",
       'plin' => 'Please indicate which <b>optional</b> privileges members '.        'plin' => 'Indicate which <b>optional</b> privileges members '.
                 'will receive by default.',                  'will receive by default for a specific tool.',
       'oppr' => 'Optional privileges',        'oppr' => 'Optional privileges',
       'defp' => 'The default privileges new members will receive are:',         'defp' => 'The default privileges new members will receive are:', 
     );      );
Line 1815  sub privilege_specificity { Line 1833  sub privilege_specificity {
         if ($action eq 'create') {          if ($action eq 'create') {
             $r->print($lt{'frty'}.'<br />');              $r->print($lt{'frty'}.'<br />');
             if ($totaloptionalprivs) {              if ($totaloptionalprivs) {
                 $r->print($lt{'thar'});                  $r->print($lt{'thar'}.'<br /><br />'.$lt{'plch'});
             } else {              } else {
                 $r->print($lt{'fort'});                  $r->print($lt{'fort'});
             }              }
Line 1831  sub privilege_specificity { Line 1849  sub privilege_specificity {
         }          }
         if ($totaloptionalprivs) {          if ($totaloptionalprivs) {
             $r->print('              $r->print('
 <br /><br />  <br />
 <label><nobr><input type="radio" name="specificity" value="No" '.$specific{'No'}.' />&nbsp;'.$lt{'algm'}.'</nobr></label><br />  <label><nobr><input type="radio" name="specificity" value="No" '.$specific{'No'}.' />&nbsp;'.$lt{'algm'}.'</nobr></label><br />
 <label><nobr><input type="radio" name="specificity" value="Yes" '.$specific{'Yes'}.' />&nbsp;'.$lt{'smgp'}.'</nobr></label>');  <label><nobr><input type="radio" name="specificity" value="Yes" '.$specific{'Yes'}.' />&nbsp;'.$lt{'smgp'}.'</nobr></label><br /><br />');
         } else {          } else {
             $r->print('<input type="hidden" name="specificity" value="No" />');              $r->print('<input type="hidden" name="specificity" value="No" />');
         }          }
         if ($totaloptionalprivs) {          if ($totaloptionalprivs) {
             $r->print($lt{'plin'});              $r->print($lt{'plin'});
             if ($action eq 'create') {              if ($action eq 'create') {
                 $r->print(' '.$lt{'thwi'});                  $r->print('<br />'.$lt{'thwi'});
             }              }
             $r->print('<br />'.$lt{'thes'});              $r->print('<br />'.$lt{'thes'});
             if ($action eq 'create') {              if ($action eq 'create') {
Line 1888  sub default_privileges { Line 1906  sub default_privileges {
                                 'addp' => 'Additional privileges',                                  'addp' => 'Additional privileges',
                                 'fixp' => 'Fixed privileges',                                  'fixp' => 'Fixed privileges',
                                 'oppr' => 'Optional privileges',                                  'oppr' => 'Optional privileges',
                                 'func' => 'Function',                                  'func' => 'Collaborative Tool',
     );      );
     $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,
Line 1908  sub default_privileges { Line 1926  sub default_privileges {
  if ($fixed ne '') {   if ($fixed ne '') {
     $fixed .= '</td><td class="LC_groups_fixed">';      $fixed .= '</td><td class="LC_groups_fixed">';
  }   }
                 $fixed .= '<input type="hidden" name="defpriv" value="'.$priv.'" />'.$$toolprivs{$tool}{$priv}.'&nbsp;';                  $fixed .= '<input type="hidden" name="defpriv" value="'.$priv.'" /><nobr>'.$$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 1916  sub default_privileges { Line 1934  sub default_privileges {
                         $fixed .= '<small>'.&mt('(off)').'<small>&nbsp;';                          $fixed .= '<small>'.&mt('(off)').'<small>&nbsp;';
                     }                      }
                 }                  }
                   $fixed .= '</nobr>';
             } else {              } else {
                 $privcount++;                  $privcount++;
                 if ($privcount == 3) {                  if ($privcount == 3) {
                     $dynamic .= '</tr>                      $dynamic .= '</tr>
                                  <tr>'."\n";                                   <tr>'."\n";
                 }                  }
                 $dynamic .= '<td><label><input type="checkbox" name="defpriv" value="'.$priv.'" />'.$$toolprivs{$tool}{$priv}.'</label></td>'."\n";                  $dynamic .= '<td><nobr><label><input type="checkbox" name="defpriv" value="'.$priv.'" />'.$$toolprivs{$tool}{$priv}.'</label></nobr></td>'."\n";
             }              }
         }          }
         if ($privcount == 0) {          if ($privcount == 0) {
             $dynamic .= '<td>None</td>'."\n";              $dynamic .= '<td>None</td>'."\n";
         }          }
         if ($privcount < 3) {          if ($privcount < 3) {
             $dynamic .= '</td>              $dynamic .= '<td>&nbsp;</td>'."\n";
                          <td>&nbsp;</td>'."\n";  
         } elsif ($privcount%2) {          } elsif ($privcount%2) {
             $dynamic = '<td>&nbsp;</td>'."\n";              $dynamic = '<td>&nbsp;</td>'."\n";
         }          }
Line 1957  sub display_defprivs { Line 1975  sub display_defprivs {
     my $rowColor2 = "#eeeeee";      my $rowColor2 = "#eeeeee";
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
                                 'priv' => 'Privileges',                                  'priv' => 'Privileges',
                                 'func' => 'Function',                                  'func' => 'Collaborative Tool',
     );      );
     $r->print(&Apache::lonhtmlcommon::start_pick_box());      $r->print(&Apache::lonhtmlcommon::start_pick_box());
     $r->print('<tr>');      $r->print('<tr>');
Line 2050  sub change_members_form { Line 2068  sub change_members_form {
     $groupname,$description,$granularity,$quota,      $groupname,$description,$granularity,$quota,
     \@available,\@unavailable,$gpterm,$ucgpterm);      \@available,\@unavailable,$gpterm,$ucgpterm);
     &topic_bar($r,2,$lt{'mogm'});      &topic_bar($r,2,$lt{'mogm'});
     &current_membership($r,$cdom,$cnum,$formname,$groupname,\@available,      my $numcurrent = &current_membership($r,$cdom,$cnum,$formname,$groupname,
  \@unavailable,$fixedprivs,$granularity,$specificity);                                           \@available,\@unavailable,$fixedprivs,
     &display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext,                   $granularity,$specificity);
                         $$states{$action}[$page+1],$nexttext);      if ($numcurrent > 0) {
           &display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext,
                               $$states{$action}[$page+1],$nexttext);
       } else {
           &display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext);
       }
     return;      return;
 }  }
   
Line 2073  sub current_membership { Line 2096  sub current_membership {
                                           'reen' => 'Re-enable',                                            'reen' => 'Re-enable',
                                           'acti' => 'Activate',                                            'acti' => 'Activate',
                                           'dele' => 'Delete',                                            'dele' => 'Delete',
                                           'curf' => 'Current Functionality',                                            'curf' => 'Current Tool Set',
                                           'chpr' => 'Change Privileges'                                             'chpr' => 'Change Privileges' 
                                         );                                          );
     my ($current,$hastools,$addtools,$num_reenable,$num_activate,$num_expire) =      my ($current,$num_items,$hastools,$addtools) =
         &Apache::longroup::group_memberlist($cdom,$cnum,$groupname,$fixedprivs,          &Apache::longroup::group_memberlist($cdom,$cnum,$groupname,$fixedprivs,
                                             $available);                                              $available);
     if (keys(%{$current}) > 0) {      my $numcurrent = scalar(keys(%{$current}));
       if ($numcurrent > 0) {
         $r->print('          $r->print('
    <table>     <table>
     <tr>');      <tr>');
         if ($num_expire) {          if ($num_items->{'active'}) {
             &check_uncheck_buttons($r,$formname,'expire',$lt{'expi'});              &check_uncheck_buttons($r,$formname,'expire',$lt{'expi'});
         }          }
         if ($num_reenable) {          if ($num_items->{'previous'}) {
             &check_uncheck_buttons($r,$formname,'reenable',$lt{'reen'});              &check_uncheck_buttons($r,$formname,'reenable',$lt{'reen'});
         }          }
         if ($num_activate) {          if ($num_items->{'future'}) {
             &check_uncheck_buttons($r,$formname,'activate',$lt{'acti'});              &check_uncheck_buttons($r,$formname,'activate',$lt{'acti'});
         }          }
         &check_uncheck_buttons($r,$formname,'deletion',$lt{'dele'});          &check_uncheck_buttons($r,$formname,'deletion',$lt{'dele'});
Line 2136  END Line 2160  END
             $colspan++;                $colspan++;  
         }          }
         if ($addtools) {          if ($addtools) {
             $r->print('<th>'.&mt('Additional Functionality').'</th>');              $r->print('<th>'.&mt('Additional Tools').'</th>');
             $colspan++;              $colspan++;
         }          }
         $r->print(&Apache::loncommon::end_data_table_header_row());          $r->print(&Apache::loncommon::end_data_table_header_row());
Line 2249  END Line 2273  END
             }              }
         }          }
         $r->print(&Apache::loncommon::end_data_table());          $r->print(&Apache::loncommon::end_data_table());
       } else {
           $r->print(&mt('There are no active, future or previous group members to modify.'));
     }      }
     return;      return $numcurrent;
 }  }
   
 sub check_uncheck_buttons {  sub check_uncheck_buttons {
Line 2319  sub change_privs_form { Line 2345  sub change_privs_form {
         $r->print($lt{'nome'}.'<br />');          $r->print($lt{'nome'}.'<br />');
     }      }
           
     &topic_bar($r,4,&mt('[_1] member privileges',$ucgpterm));      &topic_bar($r,4,&mt('Setting optional privileges for specific group members'));
   
     my $numchgs = &member_privileges_form($r,$action,$formname,$tools,      my $numchgs = &member_privileges_form($r,$action,$formname,$tools,
                                           $toolprivs,$fixedprivs,$userdata,                                            $toolprivs,$fixedprivs,$userdata,
Line 2375  sub choose_privs_form { Line 2401  sub choose_privs_form {
         $nexttext = $$navbuttons{'adme'};          $nexttext = $$navbuttons{'adme'};
     }      }
   
     &topic_bar($r,6,&mt('[_1] member privileges',$ucgpterm));      &topic_bar($r,6,&mt('Setting optional privileges for specific group members'));
   
     &member_privileges_form($r,$action,$formname,$tools,$toolprivs,      &member_privileges_form($r,$action,$formname,$tools,$toolprivs,
                             $fixedprivs,$userdata,$usertools,$idx,undef,                              $fixedprivs,$userdata,$usertools,$idx,undef,
                             $states,$stored,$gpterm);                              $states,$stored,$gpterm);
   
     if ($action eq 'create') {      if ($action eq 'create') {
         if (keys(%{$sectioncount}) > 0) {          my $img1 = 7;
             my $img1 = 7;          my $img2 = 8;
             my $img2 = 8;          &mapping_options($r,$action,$formname,$page,$sectioncount,
             &mapping_options($r,$action,$formname,$page,$sectioncount,                           $states,$stored,$navbuttons,$img1,$img2,
                              $states,$stored,$navbuttons,$img1,$img2,                           $gpterm,$ucgpterm,$crstype);
                              $gpterm,$ucgpterm,$crstype);  
         }  
     }      }
     my $prevtext = $$navbuttons{'gtps'};      my $prevtext = $$navbuttons{'gtps'};
     &display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext,      &display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext,
Line 2459  sub member_privileges_form { Line 2483  sub member_privileges_form {
         $usertools,$idx,$memchg,$states,$stored,$gpterm) = @_;          $usertools,$idx,$memchg,$states,$stored,$gpterm) = @_;
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
             'addp' => 'Additional privileges',              'addp' => 'Additional privileges',
             'fixp' => 'Fixed privileges',              'fixp' => 'Core privileges',
             'oppr' => 'Optional privileges',              'oppr' => 'Optional privileges',
             'func' => 'Function',              'func' => 'Tool',
             'forf' => 'For the functionality you have chosen to include '.              'forf' => 'For the collaborative tools included for group '.
                       'there are no optional privileges to set besides '.                        'members being added or modified, '. 
                       'the standard privileges.',                        'there are no optional privileges to set '.
             'algr' => "All $gpterm members will receive the same privileges.",                        'for specific members.',
             'asno' => "As no $gpterm members are being added, ".              'algr' => 'All new group members will receive the same privileges.',            'ifex' => 'If previously expired members are being re-enabled, or '.
                       "there are no specific user privileges to set.",                        'if access for future members is being activated now, '.
             'asng' => "As no $gpterm tools will be made available to users, ".                        'previously set privileges will be preserved.',
                       "there are no specific user privileges to set.",              'asno' => 'As no group members are being added, '.
             'nogm' => "No $gpterm member privileges to display or set, ".                        'there are no specific user privileges to set.',
                       "as you have not indicated that you will be activating,".              'asng' => 'As no group tools will be made available to users, '.
                       " re-enabling, changing privileges, or adding/removing ".                        'there are no specific user privileges to set.',
                       "functionality for any current members ",              'nogm' => 'No group member privileges to display or set, '.
                         'as you have not indicated that you will be activating,'.
                         ' re-enabling, changing privileges, or adding/removing '.
                         'tools for any current members.',
             'full' => 'Fullname',              'full' => 'Fullname',
             'user' => 'Username',              'user' => 'Username',
             'doma' => 'Domain',              'doma' => 'Domain',
Line 2599  END Line 2626  END
             }              }
         } else {          } else {
             if (keys(%{$usertools}) > 0) {              if (keys(%{$usertools}) > 0) {
                 $r->print($lt{'algr'}.'<br /><br />');                  $r->print($lt{'algr'}.'<br />'.$lt{'ifex'}.'<br /><br />');
                 &display_defprivs($r,$tools,$toolprivs,\@defprivs);                  &display_defprivs($r,$tools,$toolprivs,\@defprivs);
             } else {              } else {
                 $r->print($lt{'asno'}.'<br />');                  $r->print($lt{'asno'}.'<br />');
Line 2711  sub write_group_data { Line 2738  sub write_group_data {
     }      }
     if ($quota > $maxposs) {      if ($quota > $maxposs) {
         $quota = $maxposs;          $quota = $maxposs;
         $r->print(&mt('The value you entered for the quota for the file repository in this [_1] exceeded the maximum possible value, so it has been set to [_2] Mb (the maximum possible value).<br />',$gpterm,$maxposs));          $r->print(&mt('The value you entered for the quota for the file repository in this [_1] exceeded the maximum possible value, so it has been set to [_2] Mb (the maximum possible value).<br />',$gpterm,sprintf("%.2f",$maxposs)));
     }      }
     my %groupinfo = (      my %groupinfo = (
                      description => $esc_description,                       description => $esc_description,
Line 3000  sub process_membership { Line 3027  sub process_membership {
     }      }
     if ($roster_result eq 'ok') {      if ($roster_result eq 'ok') {
         $r->print('<br />'.&mt('[_1] membership list updated.',$ucgpterm));          $r->print('<br />'.&mt('[_1] membership list updated.',$ucgpterm));
  $r->print('<p>'.&mt("For full access to all of [_1]'s privileges, users will need to log out and log back in.",$groupname).'</p>');   $r->print('<p>'.&mt("Any currently logged in course users affected by the changes you made to group membership or privileges for the [_1] group will need to log out and log back in for their LON-CAPA sessions to reflect these changes.",$groupname).'</p>');
     } else {      } else {
         $r->print('<br />'.&mt('An error occurred while updating the [_1] membership list -',$gpterm).$roster_result.'<br />');          $r->print('<br />'.&mt('An error occurred while updating the [_1] membership list -',$gpterm).$roster_result.'<br />');
     }      }
Line 3015  sub mapping_options { Line 3042  sub mapping_options {
         'gmma' => "$ucgpterm membership mapping to specific sections/roles",          'gmma' => "$ucgpterm membership mapping to specific sections/roles",
         'endi' => "Enable/disable automatic $gpterm enrollment for ".          'endi' => "Enable/disable automatic $gpterm enrollment for ".
                           "users in specified roles and sections",                            "users in specified roles and sections",
         'adds'  => "If automatic $gpterm enrollment is enabled, when a user is 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',          'curr' => 'Currently set to',
Line 3065  sub mapping_settings { Line 3092  sub mapping_settings {
         @sections = sort {$a cmp $b} @sections;          @sections = sort {$a cmp $b} @sections;
         unshift(@sections,'none'); # Put 'no sections' next          unshift(@sections,'none'); # Put 'no sections' next
         unshift(@sections,'all'); # Put 'all' at the front of the list          unshift(@sections,'all'); # Put 'all' at the front of the list
       } else {
           @sections = ('all','none');
     }      }
     &topic_bar($r,$image,$$lt{'pirs'});      &topic_bar($r,$image,$$lt{'pirs'});
     my @roles = &standard_roles();      my @roles = &standard_roles();
Line 3106  sub mapping_settings { Line 3135  sub mapping_settings {
         }          }
         $r->print(&Apache::loncommon::start_data_table_row().          $r->print(&Apache::loncommon::start_data_table_row().
   '<td><input type="checkbox" '.    '<td><input type="checkbox" '.
                   'value="'.$role.'" /></td><td>'.$role.'</td>'.                    'value="'.$role.'" /></td><td>'.&mt('Custom role: ').
                   $sections_sel.                    '<i>'.$role.'</i></td>'.$sections_sel.
   &Apache::loncommon::end_data_table_row());    &Apache::loncommon::end_data_table_row());
     }      }
     $r->print(&Apache::loncommon::end_data_table());      $r->print(&Apache::loncommon::end_data_table());
Line 3182  sub member_privs_entries { Line 3211  sub member_privs_entries {
                 <td>'.$$userdata{$user}[$$idx{fullname}].'</td>                  <td>'.$$userdata{$user}[$$idx{fullname}].'</td>
                 <td>'.$uname.'</td>                  <td>'.$uname.'</td>
                 <td>'.$udom.'</td>                  <td>'.$udom.'</td>
                 <td valign="top"><table><tr><td><b>Function</b></td></tr><tr><td><b>Fixed</b></td></tr><tr><td><b>Optional</b></td></tr></table></td>');                  <td valign="top">
                     <table>
                      <tr>
                       <td><b>'.
                       &mt('Collaborative Tool').'</b></td>
                      </tr>
                      <tr>
                       <td><b>'.&mt('Fixed').'</b></td>
                      </tr>
                      <tr>
                       <td><b>'.&mt('Optional').'</b></td>
                      </tr>
                     </table>
                    </td>');
         foreach my $tool (@{$showtools}) {          foreach my $tool (@{$showtools}) {
             if (exists($$usertools{$user}{$tool})) {              if (exists($$usertools{$user}{$tool})) {
                 $r->print('<td valign="top"><table><tr><th colspan="2">'.$tool.'</th></tr>');                  $r->print('<td valign="top"><table><tr><th colspan="2">'.$tool.'</th></tr>');
Line 3261  sub add_group_folder { Line 3303  sub add_group_folder {
     if ($action eq 'create') {      if ($action eq 'create') {
     # check if group_allfolders.sequence exists.      # check if group_allfolders.sequence exists.
         if (!$topmap) {          if (!$topmap) {
             my $grpstitle = &mt('[_1] [_2]',$crstype,$ucgpterm);              my $grpstitle = &mt('[_1] [_2]s',$crstype,$ucgpterm);
             my $topmap_url = '/'.$env{'course.'.$env{'request.course.id'}.'.url'};              my $topmap_url = '/'.$env{'course.'.$env{'request.course.id'}.'.url'};
             $topmap_url =~ s|/+|/|g;              $topmap_url =~ s|/+|/|g;
             if ($topmap_url =~ m|^/uploaded|) {              if ($topmap_url =~ m|^/uploaded|) {

Removed from v.1.51  
changed lines
  Added in v.1.54


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