Diff for /loncom/interface/loncoursegroups.pm between versions 1.79 and 1.100

version 1.79, 2008/10/21 14:29:39 version 1.100, 2009/05/11 16:10:33
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 => 'Group Portfolio',
                       roster => 'Membership roster',                        roster => 'Membership Roster',
                       homepage => $ucgpterm.' home page',                        homepage => $ucgpterm.' home page',
                     );                      );
   
Line 141  function openGroupRoster(group,status) { Line 141  function openGroupRoster(group,status) {
     rosterbrowser = open(url,title,options,'1');      rosterbrowser = open(url,title,options,'1');
     rosterbrowser.focus();      rosterbrowser.focus();
 }\n|;  }\n|;
     $r->print(&header('Groups',$jscript,$action,$state));      $r->print(&header('My Space',$jscript,$action,$state));
     if ($env{'form.refpage'} eq 'cusr') {      if ($env{'form.refpage'} eq 'cusr') {
         &Apache::lonhtmlcommon::add_breadcrumb          &Apache::lonhtmlcommon::add_breadcrumb
             ({href=>"/adm/createuser",              ({href=>"/adm/createuser",
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 785  sub group_administration { Line 785  sub group_administration {
     }      }
     var maxposs = '.sprintf("%.2f",$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 group portfolio quota you entered for this group ("+newquota+" Mb) exceeds the maximum possible ("+maxposs+" Mb). Please enter a smaller number.");
         return;          return;
     }      }
     var re_quota = '.$float_check.';      var re_quota = '.$float_check.';
Line 804  sub group_administration { Line 804  sub group_administration {
             }              }
         }          }
         if (warn_zero == 1) {          if (warn_zero == 1) {
             alert("You have indicated that the file repository should be enabled, but you have set the respository quota to 0 Mb.\nThis will prevent any upload of files.\nPlease set a value or disable the repository feature.");              alert("You have indicated that the group portfolio should be enabled, but you have set the respository quota to 0 Mb.\nThis will prevent any upload of files.\nPlease set a value or disable the repository feature.");
             return;              return;
         }          }
     }       } 
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 1553  sub open_list_window { Line 1559  sub open_list_window {
     my ($group,$status,$count,$text) = @_;      my ($group,$status,$count,$text) = @_;
     my $entry;      my $entry;
     if ($count > 0) {      if ($count > 0) {
         $entry = '<nobr><a href="javascript:openGroupRoster('.          $entry = '<span class="LC_nobreak"><a href="javascript:openGroupRoster('.
                  "'$group','$status'".')">'.$text.'</a>&nbsp;-&nbsp;'.$count.                   "'$group','$status'".')">'.$text.'</a>&nbsp;-&nbsp;'.$count.
                  '</nobr><br />';                   '</span><br />';
     } else {      } else {
         $entry = '<nobr>'.$text.'&nbsp;-&nbsp;'.$count.'</nobr><br />';          $entry = '<span class="LC_nobreak">'.$text.'&nbsp;-&nbsp;'.$count.'</span><br />';
     }      }
     return $entry;      return $entry;
 }  }
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 1606  sub groupsettings_options { Line 1612  sub groupsettings_options {
         'lett' => 'Letters, numbers and underscore only',          'lett' => 'Letters, numbers and underscore only',
         'doyo' => 'Different subsets of the chosen collaborative tools '.          'doyo' => 'Different subsets of the chosen collaborative tools '.
                   'for different group members?',                    'for different group members?',
           'gran' => 'Granularity',
           'dquo' => 'Disk quota',
     );      );
     my ($crsquota,$freespace,$maxposs) = &get_quota_constraints($action,$stored);      my ($crsquota,$freespace,$maxposs) = &get_quota_constraints($action,$stored);
     $r->print(&Apache::lonhtmlcommon::topic_bar($image,$lt{'gnde'}).'      $r->print(&Apache::lonhtmlcommon::topic_bar($image,$lt{'gnde'}));
      <table class="LC_descriptive_input">  
       <tr>      # Group Name
        <td class="LC_description">'.$lt{'gnam'}.':</td>      $r->print(&Apache::lonhtmlcommon::start_pick_box()
        <td colspan="5">               .&Apache::lonhtmlcommon::row_title($lt{'gnam'})
 ');      );
     if ($action eq 'create') {      if ($action eq 'create') {
         $r->print('<input type="text" name="groupname" size="25" />&nbsp;('.          $r->print('<input type="text" name="groupname" size="25" />'
                   $lt{'lett'}.')');                   .' <span class="LC_nobreak">('
                    .$lt{'lett'}.')</span>'
           );
     } 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'});
     }      }
     $r->print(<<"END");      $r->print(&Apache::lonhtmlcommon::row_closure());
        </td>  
       <tr>      # Group Title
       <tr>      $r->print(&Apache::lonhtmlcommon::row_title($lt{'desc'})
        <td class="LC_description">$lt{'desc'}:</td>               .'<input type="text" name="description" size="40" value="" />'
        <td colspan="5"><input type="text" name="description" size="40"               .&Apache::lonhtmlcommon::row_closure()
                                                     value="" />      );
        </td>  
       <tr>      # Collaborative Tools
       <tr>  
        <td class="LC_description">$lt{'func'}:</td>  
 END  
     my $numitems = keys(%{$functions});      my $numitems = keys(%{$functions});
     my $halfnum = int($numitems/2);      my $halfnum = int($numitems/2);
     my $remnum = $numitems%2;      my $remnum = $numitems%2;
Line 1640  END Line 1647  END
         $halfnum ++;          $halfnum ++;
     }      }
     my @allfunctions = sort(keys (%{$functions}));      my @allfunctions = sort(keys (%{$functions}));
     for (my $i=0; $i<$halfnum; $i++) {  
         $r->print('<td><label><input type="checkbox" name="tool" value="'.      $r->print(&Apache::lonhtmlcommon::row_title($lt{'func'})
                   $allfunctions[$i].'" />&nbsp;'.               .'<div>'
                    $$functions{$allfunctions[$i]}.'</label></td>               .'<input type="button" value="'.&mt('check all').'"'
                    <td>&nbsp;</td><td>&nbsp;</td>');               .' onclick="javascript:checkAll(document.'.$formname.'.tool)" />'
     }               .'&nbsp;<input type="button" value="'.&mt('uncheck all').'"'
     $r->print('<td><input type="button" value="check all" '.               .' onclick="javascript:uncheckAll(document.'.$formname.'.tool)" />'
               'onclick="javascript:checkAll(document.'.$formname.'.tool)" />'.               .'</div>'
               '</td></tr><tr><td>&nbsp;</td>');               .'<table cellpadding="5px"><tr>' # FIXME Get rid of inflexible table (-> float)
     for (my $j=$halfnum; $j<@allfunctions; $j++) {      );
         $r->print('<td><label><input type="checkbox" name="tool" value="'.      for (my $i=0; $i<@allfunctions; $i++) {
                   $allfunctions[$j].'" />&nbsp;'.          $r->print('<td><label><span class="LC_nobreak">'
                   $$functions{$allfunctions[$j]}.'</label></td>                   .'<input type="checkbox" name="tool" value="'
                   <td>&nbsp;</td><td>&nbsp;</td>');                   .$allfunctions[$i].'" /> '
     }                   .&mt($$functions{$allfunctions[$i]})
     if ($remnum) {                   .'</span></label></td>'
         $r->print('<td>&nbsp;</td>');          );
           if ($i == $halfnum - 1) {
               $r->print('</tr><tr>');
           }
     }      }
     $r->print('      $r->print('</tr></table>'
        <td>               .&Apache::lonhtmlcommon::row_closure()
         <input type="button" value="uncheck all"      );
           onclick="javascript:uncheckAll(document.'.$formname.'.tool)" />  
        </td>      # Granularity
       </tr>      $r->print(&Apache::lonhtmlcommon::row_title($lt{'gran'})
       <tr>               .$lt{'doyo'}.'<br />'
        <td class="LC_description">'.&mt('Granularity:').'</td>               .'<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>');               .'<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(' <span class="LC_nobreak">('
                                       $$stored{'granularity'}).')');                   .&mt('Currently set to [_1].'
                        ,'"'.&mt($$stored{'granularity'}).'"')
                    .')</span>'
           );
     }      }
     $r->print('      $r->print(&Apache::lonhtmlcommon::row_closure());
        </td>  
       </tr>      # Disk Quota
       <tr>      $r->print(&Apache::lonhtmlcommon::row_title($lt{'dquo'}));
        <td class="LC_description">'.&mt('Disk quota: ').'</td><td colspan="10">');  
     if ($action eq 'create') {      if ($action eq 'create') {
         $r->print(&mt('If you enable the file repository for the '.$gpterm.', allocate a disk quota.'));          $r->print('<span class="LC_info">'
                    .&mt('If you enable the group portfolio for the '.$gpterm
                        .', allocate a disk quota.')
                    .'</span>'
           );
     } else {      } else {
         $r->print(&mt('Quota allocated to file repository:'));          $r->print(&mt('Quota allocated to group portfolio:'));
     }       } 
     $r->print('&nbsp;'.&mt('[_1] Mb','<input type="text" name="quota" size="4" />'));      $r->print(' '.&mt('[_1] Mb','<input type="text" name="quota" size="4" />'));
     if ($action eq 'create') {      if ($action eq 'create') {
         $r->print('<br />'          $r->print('<br />'
                  .&mt('A total of [_1] Mb can be divided amongst all '.$gpterm.'s in the '                   .&mt('A total of [_1] Mb can be divided amongst all '.$gpterm.'s in the '
Line 1697  END Line 1717  END
                  .'by adding all unallocated space for '.$gpterm.'s in the '.lc($crstype).'.'                   .'by adding all unallocated space for '.$gpterm.'s in the '.lc($crstype).'.'
                   ,sprintf("%.2f",$maxposs)));                    ,sprintf("%.2f",$maxposs)));
     }      }
     $r->print('      $r->print(&Apache::lonhtmlcommon::row_closure(1));
        </td>  
       </tr>      $r->print(&Apache::lonhtmlcommon::end_pick_box());
      </table>  
 ');  
     return;      return;
 }  }
   
Line 1798  sub sections_selection { Line 1817  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 1806  sub sections_selection { Line 1825  sub sections_selection {
   
 sub access_date_settings {  sub access_date_settings {
     my ($r,$action,$formname,$stored,$image,$gpterm,$ucgpterm) = @_;      my ($r,$action,$formname,$stored,$image,$gpterm,$ucgpterm) = @_;
     my %lt = &Apache::lonlocal::texthash(      my $sten = &mt("Default start and end dates for $gpterm access");
                 'sten' => "Default start and end dates for $gpterm access",  
              );  
     my $starttime = time;      my $starttime = time;
     my $endtime = time+(6*30*24*60*60); # 6 months from now, approx      my $endtime = time+(6*30*24*60*60); # 6 months from now, approx
     if ($action eq 'modify') {      if ($action eq 'modify') {
Line 1818  sub access_date_settings { Line 1835  sub access_date_settings {
         }          }
     }      }
     my ($table) = &date_setting_table($starttime,$endtime,$formname);      my ($table) = &date_setting_table($starttime,$endtime,$formname);
     $r->print(&Apache::lonhtmlcommon::topic_bar($image,$lt{'sten'}).'      $r->print(&Apache::lonhtmlcommon::topic_bar($image,$sten).'
     '.$table.'      '.$table.'
     ');      ');
     return;      return;
Line 1935  sub print_current_settings { Line 1952  sub print_current_settings {
         ygrs => "Your group selections - ",          ygrs => "Your group selections - ",
         tfwa => "The following settings will apply to the group:",          tfwa => "The following settings will apply to the group:",
         difn => 'Different collaborative tools<br />for different members:',          difn => 'Different collaborative tools<br />for different members:',
         stda => 'Start date',          stda => 'Start date:',
         enda => 'End date:',          enda => 'End date:',
     );      );
     my $showstart = &Apache::lonlocal::locallocaltime($startdate);      my $showstart = &Apache::lonlocal::locallocaltime($startdate);
Line 1968  sub print_current_settings { Line 1985  sub print_current_settings {
   <td valign="top">'.$description.'</td>    <td valign="top">'.$description.'</td>
   <td>    <td>
 ');  ');
   
     if (@{$available} > 0) {      if (@{$available} > 0) {
         $r->print('<b>'.&mt('Available for assignment to members:').'</b>'.          $r->print('<b>'.&mt('Available for assignment to members:').'</b>');
                     '<table class="LC_group_priv"><tr>');          $r->print('<ul>');
         my $rowcell = int(@{$available}/2) + @{$available}%2;  
         for (my $i=0; $i<@{$available}; $i++) {          for (my $i=0; $i<@{$available}; $i++) {
             if (@{$available} > 3) {              $r->print('<li>'.&mt($$functions{$$available[$i]}).'</li>');
                 if ($i==$rowcell) {  
                     $r->print('</tr><tr>');  
                 }  
             }  
             $r->print('<td>'.$$functions{$$available[$i]}.  
       '</td><td>&nbsp;</td>');  
         }          }
         if ((@{$available} > 3) && (@{$available}%2)) {          $r->print('</ul>');
             $r->print('<td>&nbsp;</td><td>&nbsp;</td>');  
         }  
         $r->print('</tr></table><br />');  
     }      }
   
     if (@{$unavailable} > 0) {      if (@{$unavailable} > 0) {
         $r->print('<b>'.&mt('<b>Unavailable for assignment:').'</b>'.          $r->print('<b>'.&mt('Unavailable for assignment:').'</b>');
                     '<table class="LC_group_priv"><tr>');          $r->print('<ul>');
         my $rowcell = int(@{$unavailable}/2) + @{$unavailable}%2;          for (my $i=0; $i<@{$unavailable}; $i++) {
         for (my $j=0; $j<@{$unavailable}; $j++) {              $r->print('<li>'.&mt($$functions{$$unavailable[$i]}).'</li>');
             if (@{$unavailable} > 3) {  
                 if ($j==$rowcell) {  
                     $r->print('</tr><tr>');  
                 }  
             }  
             $r->print('<td>'.$$functions{$$unavailable[$j]}.  
       '</td><td>&nbsp;</td>');  
         }          }
         if ((@{$unavailable} > 3) && (@{$unavailable}%2)) {          $r->print('</ul>');
             $r->print('<td>&nbsp;</td><td>&nbsp;</td>');  
         }  
         $r->print('</tr></table>');  
     }      }
   
     my $quota_text=&mt('[_1] Mb',$quota);      my $quota_text=&mt('[_1] Mb',$quota);
       my $granu_text=&mt($granularity);
     $r->print(<<"END");      $r->print(<<"END");
   </td>    </td>
   <td valign="top"><b>$lt{'difn'}</b> $granularity</td>    <td valign="top"><b>$lt{'difn'}</b> $granu_text</td>
   <td valign="top">$quota_text</td>     <td valign="top">$quota_text</td> 
   <td valign="top"><b>$lt{'stda'}</b> $showstart<br />    <td valign="top"><b>$lt{'stda'}</b> $showstart<br />
       <b>$lt{'enda'}</b> $showend        <b>$lt{'enda'}</b> $showend
Line 2066  sub pick_new_members { Line 2067  sub pick_new_members {
         if (@{$available} > 0 && $granularity eq 'Yes') {          if (@{$available} > 0 && $granularity eq 'Yes') {
             $r->print('<td>              $r->print('<td>
      <fieldset><legend><b>'.$lt{'setf'}.'</b></legend>       <fieldset><legend><b>'.$lt{'setf'}.'</b></legend>
       <nobr>        <span class="LC_nobreak">
       <input type="button" value="check all"        <input type="button" value="'.&mt('check all').'"
         onclick="javascript:checkAllTools(document.'.$formname.')" />          onclick="javascript:checkAllTools(document.'.$formname.')" />
         &nbsp;&nbsp;          &nbsp;&nbsp;
       <input type="button" value="uncheck all"        <input type="button" value="'.&mt('uncheck all').'"
         onclick="javascript:uncheckAllTools(document.'.$formname.')" />          onclick="javascript:uncheckAllTools(document.'.$formname.')" />
       </nobr>        </span>
      </fieldset></td>');       </fieldset></td>');
         }          }
         $r->print('</tr></table>          $r->print('</tr></table>
Line 2095  sub pick_new_members { Line 2096  sub pick_new_members {
             if ($granularity eq 'Yes') {              if ($granularity eq 'Yes') {
                 $r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense LC_data_table_highlight').'                  $r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense LC_data_table_highlight').'
  <td colspan="6">&nbsp;</td>   <td colspan="6">&nbsp;</td>
  <td align="center"><nobr><b>'.&mt('All:').'</b>&nbsp;');   <td align="center"><span class="LC_nobreak"><b>'.&mt('All:').'</b>&nbsp;');
                 foreach my $tool (@{$available}) {                  foreach my $tool (@{$available}) {
                     $r->print('<label><input type="checkbox" name="togglefunc" '.                      $r->print('<label><input type="checkbox" name="togglefunc" '.
    'onclick="javascript:toggleTools(document.'.$formname.'.user_'.$tool.',this);"'.     'onclick="javascript:toggleTools(document.'.$formname.'.user_'.$tool.',this);"'.
    ' value="'.$tool.'">'.'<b>'.$tool.'</b></label>&nbsp;&nbsp;&nbsp;');     ' value="'.$tool.'">'.'<b>'.$tool.'</b></label>&nbsp;&nbsp;&nbsp;');
                 }                  }
                 $r->print('</nobr></td></tr>');                  $r->print('</span></td></tr>');
             }              }
         }          }
         my %Sortby = ();          my %Sortby = ();
Line 2135  sub pick_new_members { Line 2136  sub pick_new_members {
   '<td>'.$id.'</td>'.    '<td>'.$id.'</td>'.
   '<td>'.$section.'</td>');    '<td>'.$section.'</td>');
                 if (@{$available} > 0) {                  if (@{$available} > 0) {
                     $r->print('<td align="center"><nobr>'.                      $r->print('<td align="center"><span class="LC_nobreak">'.
                               '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');                                '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
                     foreach my $tool (@{$available}) {                      foreach my $tool (@{$available}) {
                         if ($granularity eq 'Yes') {                          if ($granularity eq 'Yes') {
Line 2146  sub pick_new_members { Line 2147  sub pick_new_members {
                           $tool.'" value="'.$user.'" />'.$tool.'&nbsp;&nbsp;&nbsp;');                            $tool.'" value="'.$user.'" />'.$tool.'&nbsp;&nbsp;&nbsp;');
                         }                          }
                     }                      }
                     $r->print('</nobr></td>');                      $r->print('</span></td>');
                 }                  }
                 $r->print(&Apache::loncommon::end_data_table_row()."\n");                  $r->print(&Apache::loncommon::end_data_table_row()."\n");
             }              }
Line 2164  sub pick_new_members { Line 2165  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 2233  sub privilege_specificity { Line 2234  sub privilege_specificity {
         if ($totaloptionalprivs) {          if ($totaloptionalprivs) {
             $r->print('              $r->print('
 <br />  <br />
 <label><nobr><input type="radio" name="specificity" value="No" '.$specific{'No'}.' />&nbsp;'.$lt{'algm'}.'</nobr></label><br />  <label><span class="LC_nobreak"><input type="radio" name="specificity" value="No" '.$specific{'No'}.' />&nbsp;'.$lt{'algm'}.'</span></label><br />
 <label><nobr><input type="radio" name="specificity" value="Yes" '.$specific{'Yes'}.' />&nbsp;'.$lt{'smgp'}.'</nobr></label><br /><br />');  <label><span class="LC_nobreak"><input type="radio" name="specificity" value="Yes" '.$specific{'Yes'}.' />&nbsp;'.$lt{'smgp'}.'</span></label><br /><br />');
         } else {          } else {
             $r->print('<input type="hidden" name="specificity" value="No" />');              $r->print('<input type="hidden" name="specificity" value="No" />');
         }          }
Line 2261  sub privilege_specificity { Line 2262  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 2285  sub privilege_specificity { Line 2286  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 2294  sub default_privileges { Line 2295  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 2311  sub default_privileges { Line 2316  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 2326  sub default_privileges { Line 2331  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 2510  sub current_membership { Line 2515  sub current_membership {
                 $r->print(&check_uncheck_tools($r,$available));                  $r->print(&check_uncheck_tools($r,$available));
                 $r->print('                  $r->print('
      <td>       <td>
       <nobr>        <span class="LC_nobreak">
        <fieldset><legend><b>'.$lt{'curf'}.'</b></legend>         <fieldset><legend><b>'.$lt{'curf'}.'</b></legend>
        <input type="button" value="check all"         <input type="button" value="'.&mt('check all').'"
        onclick="javascript:checkAllTools(document.'.$formname.')" />         onclick="javascript:checkAllTools(document.'.$formname.')" />
        &nbsp;&nbsp;         &nbsp;&nbsp;
        <input type="button" value="uncheck all"         <input type="button" value="'.&mt('uncheck all').'"
         onclick="javascript:uncheckAllTools(document.'.$formname.')" />          onclick="javascript:uncheckAllTools(document.'.$formname.')" />
       </fieldset>        </fieldset>
      </nobr>       </span>
     </td>      </td>
 ');  ');
             }              }
Line 2553  END Line 2558  END
             if ($granularity eq 'Yes') {              if ($granularity eq 'Yes') {
                 $r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense LC_data_table_highlight').'                  $r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense LC_data_table_highlight').'
  <td colspan="7">&nbsp;</td>   <td colspan="7">&nbsp;</td>
  <td colspan="'.$colspan.'" align="center"><nobr><b>'.&mt('All:').   <td colspan="'.$colspan.'" align="center"><span class="LC_nobreak"><b>'.&mt('All:').
   '</b>&nbsp;');    '</b>&nbsp;');
                 foreach my $tool (@{$available}) {                  foreach my $tool (@{$available}) {
                     $r->print('<label><input type="checkbox" name="togglefunc"'.                      $r->print('<label><input type="checkbox" name="togglefunc"'.
    ' onclick="javascript:toggleTools(document.'.$formname.'.user_'.$tool.',this);"'.     ' onclick="javascript:toggleTools(document.'.$formname.'.user_'.$tool.',this);"'.
    ' value="'.$tool.'" />'.'<b>'.$tool.'</b></label>&nbsp;&nbsp;&nbsp;');     ' value="'.$tool.'" />'.'<b>'.$tool.'</b></label>&nbsp;&nbsp;&nbsp;');
                 }                  }
                 $r->print('</nobr></td></tr>');                  $r->print('</span></td></tr>');
             }              }
         }          }
         my %Sortby = ();          my %Sortby = ();
Line 2588  END Line 2593  END
                 $r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense').'                  $r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense').'
                             <td>');                              <td>');
                 if ($$current{$user}{changestate} eq 'reenable') {                  if ($$current{$user}{changestate} eq 'reenable') {
                     $r->print('<nobr><label>'.                       $r->print('<span class="LC_nobreak"><label>'. 
    '<input type="checkbox" name="reenable" value="'.$user.'" />'.     '<input type="checkbox" name="reenable" value="'.$user.'" />'.
    $lt{'reen'}.'</label></nobr><br />');     $lt{'reen'}.'</label></span><br />');
                 } elsif ($$current{$user}{changestate} eq 'expire') {                  } elsif ($$current{$user}{changestate} eq 'expire') {
                     $r->print('<nobr><label>'.                      $r->print('<span class="LC_nobreak"><label>'.
    '<input type="checkbox" name="expire" value="'.$user.'" />'.     '<input type="checkbox" name="expire" value="'.$user.'" />'.
    $lt{'expi'}.'</label></nobr><br />');     $lt{'expi'}.'</label></span><br />');
                 } elsif ($$current{$user}{changestate} eq 'activate') {                  } elsif ($$current{$user}{changestate} eq 'activate') {
                     $r->print('<nobr><label>'.                      $r->print('<span class="LC_nobreak"><label>'.
    '<input type="checkbox" name="activate" value="'.$user.'" />'.     '<input type="checkbox" name="activate" value="'.$user.'" />'.
    $lt{'acti'}.'</label></nobr><br />');     $lt{'acti'}.'</label></span><br />');
                 }                  }
                 $r->print('<nobr><label>'.                  $r->print('<span class="LC_nobreak"><label>'.
    '<input type="checkbox" name="deletion" value="'.$user.'" />'.     '<input type="checkbox" name="deletion" value="'.$user.'" />'.
    $lt{'dele'}.'</label></nobr>');     $lt{'dele'}.'</label></span>');
                 if ($specificity eq 'Yes') {                  if ($specificity eq 'Yes') {
                     $r->print('<br /><nobr><label>'.                      $r->print('<br /><span class="LC_nobreak"><label>'.
    '<input type="checkbox" name="changepriv" value="'.$user.'" />'.$lt{'chpr'}.     '<input type="checkbox" name="changepriv" value="'.$user.'" />'.$lt{'chpr'}.
    '</label></nobr>');     '</label></span>');
                 }                  }
                 $r->print('                  $r->print('
    </td>'.     </td>'.
Line 2617  END Line 2622  END
    '<td>'.$start.'</td>'.     '<td>'.$start.'</td>'.
    '<td>'.$end.'</td>');     '<td>'.$end.'</td>');
                 if ($hastools) {                  if ($hastools) {
                     $r->print('<td align="left"><nobr>'.                      $r->print('<td align="left"><span class="LC_nobreak">'.
                                   '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');                                    '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
                     foreach my $tool (@{$$current{$user}{currtools}}) {                      foreach my $tool (@{$$current{$user}{currtools}}) {
                         if ($granularity eq 'Yes') {                          if ($granularity eq 'Yes') {
Line 2633  END Line 2638  END
                          }                           }
                          $r->print('&nbsp;&nbsp;&nbsp;');                           $r->print('&nbsp;&nbsp;&nbsp;');
                     }                      }
                     $r->print('</nobr></td>');                      $r->print('</span></td>');
                 }                  }
                 if ($addtools) {                  if ($addtools) {
                     $r->print('<td align="left">');                      $r->print('<td align="left">');
                     if ($granularity eq 'Yes') {                      if ($granularity eq 'Yes') {
                         foreach my $tool (@{$$current{$user}{newtools}}) {                          foreach my $tool (@{$$current{$user}{newtools}}) {
                             $r->print('<nobr><label><input type="checkbox"                              $r->print('<span class="LC_nobreak"><label><input type="checkbox"
                                           name="user_'.$tool.'" value="'.                                            name="user_'.$tool.'" value="'.
                                           $user.'" />'.$tool.                                            $user.'" />'.$tool.
                                           '</label></nobr>&nbsp;&nbsp;&nbsp;');                                            '</label></span>&nbsp;&nbsp;&nbsp;');
                         }                          }
                     } else {                      } else {
                         foreach my $tool (@{$$current{$user}{newtools}}) {                          foreach my $tool (@{$$current{$user}{newtools}}) {
                             $r->print('<nobr><input type="hidden"                               $r->print('<span class="LC_nobreak"><input type="hidden" 
                                           name="user_'. $tool.'" value="'.                                            name="user_'. $tool.'" value="'.
                                           $user.'" />'.$tool.                                            $user.'" />'.$tool.
                                           '</nobr>&nbsp;&nbsp;&nbsp;');                                            '</span>&nbsp;&nbsp;&nbsp;');
                         }                          }
                     }                      }
                     $r->print('</td>');                      $r->print('</td>');
Line 2670  sub check_uncheck_buttons { Line 2675  sub check_uncheck_buttons {
      <td '.$colspan.'>       <td '.$colspan.'>
        <fieldset>         <fieldset>
        <legend><b>'.$title.'</b></legend>         <legend><b>'.$title.'</b></legend>
       <nobr>        <span class="LC_nobreak">
        <input type="button" value="check all"         <input type="button" value="'.&mt('check all').'"
        onclick="javascript:checkAll(document.'.$formname.'.'.$field.')" />         onclick="javascript:checkAll(document.'.$formname.'.'.$field.')" />
        &nbsp;&nbsp;         &nbsp;&nbsp;
        <input type="button" value="uncheck all"         <input type="button" value="'.&mt('uncheck all').'"
        onclick="javascript:uncheckAll(document.'.$formname.'.'.$field.')" />         onclick="javascript:uncheckAll(document.'.$formname.'.'.$field.')" />
       </nobr>        </span>
        </fieldset>         </fieldset>
      </td>       </td>
 ');  ');
Line 2876  sub member_privileges_form { Line 2881  sub member_privileges_form {
                       'members being added or modified, '.                         'members being added or modified, '. 
                       'there are no optional privileges to set '.                        'there are no optional privileges to set '.
                       'for specific members.',                        'for specific members.',
             'algr' => 'All new group members will receive the same privileges.',            'ifex' => 'If previously expired members are being re-enabled, or '.              'algr' => 'All new group members will receive the same privileges.',
               'ifex' => 'If previously expired members are being re-enabled, or '.
                       'if access for future members is being activated now, '.                        'if access for future members is being activated now, '.
                       'previously set privileges will be preserved.',                        'previously set privileges will be preserved.',
             'asno' => 'As no group members are being added, '.              'asno' => 'As no group members are being added, '.
Line 2952  sub member_privileges_form { Line 2958  sub member_privileges_form {
                     foreach my $tool (@{$tools}) {                      foreach my $tool (@{$tools}) {
                         if (@{$showboxes{$tool}} > 0) {                          if (@{$showboxes{$tool}} > 0) {
                             $r->print('<td valign="top">');                              $r->print('<td valign="top">');
                             $r->print('<table class="thinborder"><tr>'.                              $r->print('<fieldset><legend>'.&mt($tool).'</legend>');
       '<th colspan="'.$colspan.'">'.                              $r->print('<table><tr>');
                                       $tool.'</th></tr><tr>');  
                             my $privcount = 0;                              my $privcount = 0;
                             foreach my $priv (@{$showboxes{$tool}}) {                              foreach my $priv (@{$showboxes{$tool}}) {
                                 $privcount ++;                                  $privcount ++;
Line 2968  sub member_privileges_form { Line 2973  sub member_privileges_form {
                                 } else {                                  } else {
                                     $r->print('<td>');                                      $r->print('<td>');
                                 }                                  }
                                 $r->print(qq|                                  $r->print(
        <fieldset><legend><b>$$toolprivs{$tool}{$priv}</b></legend>   '<fieldset><legend><b>'.&mt($$toolprivs{$tool}{$priv}).'</b></legend>'
        <nobr>  .'<span class="LC_nobreak">'
        <input type="button" value="check all"  .' <input type="button" value="'.&mt('check all').'"'
          onclick="javascript:checkAll(document.$formname.userpriv_$priv)" />  .' onclick="javascript:checkAll(document.'.$formname.'.userpriv_'.$priv.')" />'
        &nbsp;  .'&nbsp;'
        <input type="button" value="uncheck all"  .'<input type="button" value="'.&mt('uncheck all').'"'
         onclick="javascript:uncheckAll(document.$formname.userpriv_$priv)" />  .' onclick="javascript:uncheckAll(document.'.$formname.'.userpriv_'.$priv.')" />'
       </nobr></fieldset><br />|);  .'</span></fieldset><br />'
                                   );
                                 $r->print('</td>');                                  $r->print('</td>');
                                 if ($privcount < @{$showboxes{$tool}}) {                                  if ($privcount < @{$showboxes{$tool}}) {
                                     if (@{$showboxes{$tool}} > 2) {                                      if (@{$showboxes{$tool}} > 2) {
Line 2988  sub member_privileges_form { Line 2994  sub member_privileges_form {
                                     }                                      }
                                 }                                  }
                             }                              }
                             $r->print('</tr></table></td><td>&nbsp;</td>');                              $r->print('</tr></table></fieldset></td><td>&nbsp;</td>');
                         }                          }
                     }                      }
                     $r->print('</tr></table>');                      $r->print('</tr></table>');
Line 3121  sub write_group_data { Line 3127  sub write_group_data {
     if ($quota !~ /^\d*\.?\d*$/) {      if ($quota !~ /^\d*\.?\d*$/) {
         $quota = 0;          $quota = 0;
         $r->print('<div class="LC_warning">'          $r->print('<div class="LC_warning">'
                  .&mt('The value you entered for the quota for the file repository in this '.$gpterm                   .&mt('The value you entered for the quota for the group portfolio in this '.$gpterm
                  .' contained invalid characters, so it has been set to 0 Mb. You can change this by'                   .' contained invalid characters, so it has been set to 0 Mb. You can change this by'
                  .' modifying the '.$gpterm.' settings.')                   .' modifying the '.$gpterm.' settings.')
                  .'</div>');                   .'</div>');
Line 3129  sub write_group_data { Line 3135  sub write_group_data {
     if ($quota > $maxposs) {      if ($quota > $maxposs) {
         $quota = $maxposs;          $quota = $maxposs;
         $r->print('<div class="LC_warning">'          $r->print('<div class="LC_warning">'
                  .&mt('The value you entered for the quota for the file repository in this '.$gpterm                   .&mt('The value you entered for the quota for the group portfolio in this '.$gpterm
                  .' exceeded the maximum possible value, so it has been set to [_1] Mb '                   .' exceeded the maximum possible value, so it has been set to [_1] Mb '
                  .'(the maximum possible value).',sprintf("%.2f",$maxposs))                   .'(the maximum possible value).',sprintf("%.2f",$maxposs))
                  .'</div>');                   .'</div>');
Line 3221  sub write_group_data { Line 3227  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 3471  sub process_membership { Line 3490  sub process_membership {
         $r->print('<br />');          $r->print('<br />');
     }      }
     if (@unchanged > 0) {      if (@unchanged > 0) {
         $r->print(&mt('No change occurred for the following users:<br />'));          $r->print(&mt('No change occurred for the following users:').'<br />');
         foreach my $user (sort(@unchanged)) {          foreach my $user (sort(@unchanged)) {
             $r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.'<br />');              $r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.'<br />');
         }          }
         $r->print('<br />');          $r->print('<br />');
     }      }
     if ($roster_result eq 'ok') {      if ($roster_result eq 'ok') {
         $r->print('<br />'.&mt('[_1] membership list updated.',$ucgpterm));          $r->print('<div class="LC_success">'
  $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>');                   .&mt($ucgpterm.' membership list updated.')
                    .'</div>');
    $r->print('<p class="LC_info">'
                    .&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.'
                        ,'<i>'.$groupname.'</i>')
                    .'</p>'
           );
     } else {      } else {
         $r->print('<br />'.&mt('An error occurred while updating the [_1] membership list -',$gpterm).$roster_result.'<br />');          $r->print('<div class="LC_error">'
                    .&mt("An error occurred while updating the $gpterm membership list:")
                    .'<br />'.$roster_result
                    .'</div>');
     }      }
     return;      return;
 }  }
Line 3497  sub mapping_options { Line 3527  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 3522  sub automapping { Line 3551  sub automapping {
     }      }
     $r->print(&Apache::lonhtmlcommon::topic_bar($image,$$lt{'endi'}).'      $r->print(&Apache::lonhtmlcommon::topic_bar($image,$$lt{'endi'}).'
     <b>'.$$lt{'gmma'}.':</b><br />'.$$lt{'adds'}.'<br />'.$$lt{'drops'}.'<br /><br />      <b>'.$$lt{'gmma'}.':</b><br />'.$$lt{'adds'}.'<br />'.$$lt{'drops'}.'<br /><br />
    <nobr>'.$$lt{'auad'}.':&nbsp;     <span class="LC_nobreak">'.$$lt{'auad'}.':&nbsp;
     <label><input type="radio" name="autoadd" value="on" />on&nbsp;&nbsp;</label><label><input type="radio" name="autoadd" value="off" checked="checked" />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('
     </nobr><br />      </span><br />
     <nobr>'.$$lt{'auex'}.':&nbsp;      <span class="LC_nobreak">'.$$lt{'auex'}.':&nbsp;
     <label><input type="radio" name="autodrop" value="on" />on&nbsp;&nbsp;</label><label><input type="radio" name="autodrop" value="off" checked="checked" />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('</nobr><br /><br />'.$$lt{'mapr'});      $r->print('</span><br /><br />'.$$lt{'mapr'});
 }  }
   
 sub mapping_settings {  sub mapping_settings {
Line 3694  sub member_privs_entries { Line 3723  sub member_privs_entries {
                         if ($privcount == 3) {                          if ($privcount == 3) {
                             $dynamic .= '</tr><tr>';                              $dynamic .= '</tr><tr>';
                         }                          }
                         $dynamic .='<td><nobr><label><input type="checkbox" '.                          $dynamic .='<td><span class="LC_nobreak"><label><input type="checkbox" '.
                                'name="userpriv_'.$priv.'" value="'.$user.'"';                                 'name="userpriv_'.$priv.'" value="'.$user.'"';
                         if (grep/^\Q$priv\E$/,@{$defprivs}) {                          if (grep/^\Q$priv\E$/,@{$defprivs}) {
                             $dynamic .= ' checked="checked" ';                              $dynamic .= ' checked="checked" ';
                         }                          }
                         $dynamic .= ' />'.$$toolprivs{$tool}{$priv}.                          $dynamic .= ' />'.$$toolprivs{$tool}{$priv}.
                                     '</label></nobr></td>';                                      '</label></span></td>';
                     }                      }
                 }                  }
                 $r->print('<tr><td colspan="2"><nobr>'.$fixed.'</nobr></td></tr><tr>'.$dynamic.'</tr></table></td>');                  $r->print('<tr><td colspan="2"><span class="LC_nobreak">'.$fixed.'</span></td></tr><tr>'.$dynamic.'</tr></table></td>');
             } else {              } else {
                 $r->print('<td valign="top"><table width="100%"><tr><th colspan="2">'.$tool.'</th></tr><tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr></table></td>');                  $r->print('<td valign="top"><table width="100%"><tr><th colspan="2">'.$tool.'</th></tr><tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr></table></td>');
             }              }
Line 3729  sub date_setting_table { Line 3758  sub date_setting_table {
                                                       'startdate',$starttime);                                                        'startdate',$starttime);
     my $endform = &Apache::lonhtmlcommon::date_setter($formname,      my $endform = &Apache::lonhtmlcommon::date_setter($formname,
                                                       'enddate',$endtime);                                                        'enddate',$endtime);
     my $perpetual =       my $perpetual = ' <span class="LC_nobreak"><label>'
  '<nobr><label><input type="checkbox" name="no_end_date" />'.                     .'<input type="checkbox" name="no_end_date" />'
  &mt('None').'</label></nobr>';                     .&mt('No end date')
     my $table = "<table class=\"LC_descriptive_input\">\n".                     .'</label></span>';
  '<tr><td class="LC_description">'.&mt('Start:').'</td>'.      my $table = &Apache::lonhtmlcommon::start_pick_box()
         '<td>'.$startform.'</td>'.                 .&Apache::lonhtmlcommon::row_title(&mt('Start Date'))
         '<td>&nbsp;</td>'."</tr>\n".                 .$startform
  '<tr><td class="LC_description">'.&mt('End:').'</td>'.                 .&Apache::lonhtmlcommon::row_closure()
         '<td>'.$endform.'</td>'.                 .&Apache::lonhtmlcommon::row_title(&mt('End Date'))
         '<td>'.$perpetual.'</td>'."</tr>\n".                 .$endform
  "</table>\n";                 .$perpetual
                  .&Apache::lonhtmlcommon::row_closure(1)
                  .&Apache::lonhtmlcommon::end_pick_box();
     return $table;      return $table;
 }  }
   
Line 3747  sub add_group_folder { Line 3778  sub add_group_folder {
     my ($cdom,$cnum,$now,$groupname,$action,$description,$tools,$groupinfo,      my ($cdom,$cnum,$now,$groupname,$action,$description,$tools,$groupinfo,
         $gpterm,$ucgpterm,$crstype) = @_;          $gpterm,$ucgpterm,$crstype) = @_;
     if ($cdom eq '' || $cnum eq '') {      if ($cdom eq '' || $cnum eq '') {
         return &mt('Error: invalid course domain or number - group folder creation failed');            return '<span class="LC_error">'
                 .&mt('Error: invalid course domain or number - group folder creation failed.')
                 .'</span>';
     }      }
     my ($outcome,$allgrpsmap,$grpmap,$boardsmap,$grppage,$warning);      my ($outcome,$allgrpsmap,$grpmap,$boardsmap,$grppage,$warning);
     my $crspath = '/uploaded/'.$cdom.'/'.$cnum.'/';      my $crspath = '/uploaded/'.$cdom.'/'.$cnum.'/';
Line 3757  sub add_group_folder { Line 3790  sub add_group_folder {
             # check if group_allfolders.sequence exists.              # check if group_allfolders.sequence exists.
             my $mapcontents = &Apache::lonnet::getfile($allgrpsmap);              my $mapcontents = &Apache::lonnet::getfile($allgrpsmap);
             if ($mapcontents eq '-1') { #file does not exist;              if ($mapcontents eq '-1') { #file does not exist;
                 my $grpstitle = &mt('[_1] [_2]s',$crstype,$ucgpterm);                  my $grpstitle = &mt("$crstype $ucgpterm".'s');
                 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|) {
                     $outcome = &map_updater($cdom,$cnum,'group_allfolders.sequence',                      $outcome = &map_updater($cdom,$cnum,'group_allfolders.sequence',
                                             'toplevelgroup',$grpstitle,$topmap_url);                                              'toplevelgroup',$grpstitle,$topmap_url);
                 } else {                  } else {
                     $outcome = &mt('Non-standard course - folder for all groups not added.');                      $outcome = '<span class="LC_warning">'
                                 .&mt('Non-standard course - folder for all groups not added.')
                                 .'</span>';
                 }                  }
                 if ($outcome ne 'ok') {                  if ($outcome ne 'ok') {
                     my $delresult = &release_folder_lock($cdom,$cnum,'group_allfolders');                      my $delresult = &release_folder_lock($cdom,$cnum,'group_allfolders');
                     if ($delresult ne 'ok') {                      if ($delresult ne 'ok') {
                         $warning = $delresult;                          $warning = $delresult;
                     }                      }
                     return $outcome;                      return $outcome.$warning;
                 }                  }
             }              }
             my $delresult = &release_folder_lock($cdom,$cnum,'group_allfolders');              my $delresult = &release_folder_lock($cdom,$cnum,'group_allfolders');
Line 3779  sub add_group_folder { Line 3814  sub add_group_folder {
                 $warning = $delresult ;                  $warning = $delresult ;
             }              }
         } else {          } else {
             $outcome = &mt('Could not obtain exclusive lock to check status of the folder for all groups. No group folder added.');              $outcome = '<span class="LC_error">'
                         .&mt('Could not obtain exclusive lock to check status of the folder for all groups. No group folder added.')
                         .'</span>';
             return $outcome;              return $outcome;
         }          }
         my $grpfolder = &mt($ucgpterm.' Folder - [_1]',$description);          my $grpfolder = &mt($ucgpterm.' Folder - [_1]',$description);
Line 3810  sub add_group_folder { Line 3847  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 3855  sub release_folder_lock { Line 3896  sub release_folder_lock {
     my @del_lock = ($folder_name."\0".'locked_folder');      my @del_lock = ($folder_name."\0".'locked_folder');
     my $dellockoutcome=&Apache::lonnet::del('coursegroups',\@del_lock,$cdom,$cnum);      my $dellockoutcome=&Apache::lonnet::del('coursegroups',\@del_lock,$cdom,$cnum);
     if ($dellockoutcome ne 'ok') {      if ($dellockoutcome ne 'ok') {
         return ('<br />'.&mt('Warning: failed to release lock for folder: [_1].',$folder_name).'<br />');           return ('<div class="LC_error">'
                  .&mt('Warning: failed to release lock for folder: [_1].','<tt>'.$folder_name.'</tt>')
                  .'</div>'
                  );
     } else {      } else {
         return 'ok';          return 'ok';
     }      }
Line 3870  sub map_updater { Line 3914  sub map_updater {
     my $newmapurl=&Apache::lonnet::finishuserfileupload($cnum,$cdom,$itemname,      my $newmapurl=&Apache::lonnet::finishuserfileupload($cnum,$cdom,$itemname,
                                                         $newfile);                                                          $newfile);
     if ($newmapurl !~ m|^/uploaded|) {      if ($newmapurl !~ m|^/uploaded|) {
         $outcome = &mt('Error uploading new folder.')." ($newfile): $newmapurl".'<br />';          $outcome = '<div class="LC_error">'
                     .&mt('Error uploading new folder.')." ($newfile): $newmapurl"
                     .'</div>';
         return $outcome;          return $outcome;
     }      }
     my ($errtext,$fatal)=&LONCAPA::map::mapread($parentmap);      my ($errtext,$fatal)=&LONCAPA::map::mapread($parentmap);
     if ($fatal) {      if ($fatal) {
         $outcome = &mt('Error reading contents of parent folder')." ($parentmap): $errtext".'<br />';          $outcome = '<div class="LC_error">'
                     .&mt('Error reading contents of parent folder.')." ($parentmap): $errtext"
                     .'</div>';
         return $outcome;          return $outcome;
     } else {      } else {
         my $newidx=&LONCAPA::map::getresidx($newmapurl);          my $newidx=&LONCAPA::map::getresidx($newmapurl);
Line 3884  sub map_updater { Line 3932  sub map_updater {
         $LONCAPA::map::order[1+$#LONCAPA::map::order]=$newidx;          $LONCAPA::map::order[1+$#LONCAPA::map::order]=$newidx;
         my ($outtext,$errtext) = &LONCAPA::map::storemap($parentmap,1);          my ($outtext,$errtext) = &LONCAPA::map::storemap($parentmap,1);
         if ($errtext) {          if ($errtext) {
             $outcome = &mt('Error saving updated parent folder')." ($parentmap):  $errtext".'<br />';              $outcome = '<div class="LC_error">'
                         .&mt('Error saving updated parent folder.')." ($parentmap):  $errtext"
                         .'</div>';
             return $outcome;              return $outcome;
         }          }
     }      }
Line 3906  sub new_map { Line 3956  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,
Line 3934  sub parm_setter { Line 3991  sub parm_setter {
             }              }
         }          }
     } else {      } else {
         $allresults = &mt('Parameters not set for [_1] because the resource was not recognized as part of the course',$url).'<br />';          $allresults = '<div class="LC_warning">' 
                        .&mt('Parameters not set for [_1] because the resource was not recognized'
                            .' as part of the course.','<tt>'.$url.'</tt>')
                        .'</div>';
     }      }
     return $allresults;      return $allresults;
 }  }

Removed from v.1.79  
changed lines
  Added in v.1.100


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