Diff for /loncom/interface/loncoursegroups.pm between versions 1.93 and 1.103

version 1.93, 2009/02/13 20:20:29 version 1.103, 2009/09/09 04:31:53
Line 77  sub handler { Line 77  sub handler {
     my %functions = (      my %functions = (
                       email => 'Send Messages',                         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 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 1440  sub header { Line 1440  sub header {
        {'add_entries' => $loaditems,});         {'add_entries' => $loaditems,});
     my $output = <<"END";      my $output = <<"END";
 $start_page  $start_page
 <form method="POST" name="$state">  <form method="post" name="$state">
   
 END  END
     if ($action eq 'create' || $action eq 'modify') {      if ($action eq 'create' || $action eq 'modify') {
Line 1612  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 1646  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>'
                    &mt($$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="'.&mt('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">'
                   &mt($$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="'.&mt('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">('
                                       ,'"'.&mt($$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 1703  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 1875  sub choose_members_form { Line 1888  sub choose_members_form {
         }          }
     }      }
     &privilege_specificity($r,$action,$specimg,$tools,$stored,$toolprivs,      &privilege_specificity($r,$action,$specimg,$tools,$stored,$toolprivs,
                           $fixedprivs,\@available,$formname,$gpterm,$ucgpterm);                            $fixedprivs,\@available,$formname,$gpterm,$ucgpterm,
                             $functions);
     my $newusers = &pick_new_members($r,$action,$formname,\@available,$idx,      my $newusers = &pick_new_members($r,$action,$formname,\@available,$idx,
      $stored,$memimg,$users,$userdata,       $stored,$memimg,$users,$userdata,
      $granularity,\%origmembers,$gpterm,       $granularity,\%origmembers,$gpterm,
Line 1972  sub print_current_settings { Line 1986  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('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('<td>&nbsp;</td><td>&nbsp;</td>');  
         }          }
         $r->print('</tr></table>');          $r->print('</ul>');
     }      }
   
     my $quota_text=&mt('[_1] Mb',$quota);      my $quota_text=&mt('[_1] Mb',$quota);
     my $granu_text=&mt($granularity);      my $granu_text=&mt($granularity);
     $r->print(<<"END");      $r->print(<<"END");
Line 2070  sub pick_new_members { Line 2067  sub pick_new_members {
         &check_uncheck_buttons($r,$formname,'member',$lt{'addm'});          &check_uncheck_buttons($r,$formname,'member',$lt{'addm'});
         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>'.$lt{'setf'}.'</legend>
       <span class="LC_nobreak">        <span class="LC_nobreak">
       <input type="button" value="'.&mt('check all').'"        <input type="button" value="'.&mt('check all').'"
         onclick="javascript:checkAllTools(document.'.$formname.')" />          onclick="javascript:checkAllTools(document.'.$formname.')" />
Line 2302  sub default_privileges { Line 2299  sub default_privileges {
       'LC_groups_functionality'));        'LC_groups_functionality'));
     my @tableHeader;      my @tableHeader;
     foreach my $key (sort(keys(%{$functions}))){      foreach my $key (sort(keys(%{$functions}))){
         push (@tableHeader,&mt(${$functions}{$key}));          push (@tableHeader,&mt($functions->{$key}));
     }         }   
  $r->print(join('</td><td class="LC_groups_functionality">', @tableHeader));   $r->print(join('</td><td class="LC_groups_functionality">', @tableHeader));
     $r->print(&Apache::lonhtmlcommon::row_closure(1));      $r->print(&Apache::lonhtmlcommon::row_closure(1));
Line 2520  sub current_membership { Line 2517  sub current_membership {
                 $r->print('                  $r->print('
      <td>       <td>
       <span class="LC_nobreak">        <span class="LC_nobreak">
        <fieldset><legend><b>'.$lt{'curf'}.'</b></legend>         <fieldset><legend>'.$lt{'curf'}.'</legend>
        <input type="button" value="'.&mt('check all').'"         <input type="button" value="'.&mt('check all').'"
        onclick="javascript:checkAllTools(document.'.$formname.')" />         onclick="javascript:checkAllTools(document.'.$formname.')" />
        &nbsp;&nbsp;         &nbsp;&nbsp;
Line 2678  sub check_uncheck_buttons { Line 2675  sub check_uncheck_buttons {
     $r->print('      $r->print('
      <td '.$colspan.'>       <td '.$colspan.'>
        <fieldset>         <fieldset>
        <legend><b>'.$title.'</b></legend>         <legend>'.$title.'</legend>
       <span class="LC_nobreak">        <span class="LC_nobreak">
        <input type="button" value="'.&mt('check all').'"         <input type="button" value="'.&mt('check all').'"
        onclick="javascript:checkAll(document.'.$formname.'.'.$field.')" />         onclick="javascript:checkAll(document.'.$formname.'.'.$field.')" />
Line 2962  sub member_privileges_form { Line 2959  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>');
                                       &mt($tool).'</th></tr><tr>');  
                             my $privcount = 0;                              my $privcount = 0;
                             foreach my $priv (@{$showboxes{$tool}}) {                              foreach my $priv (@{$showboxes{$tool}}) {
                                 $privcount ++;                                  $privcount ++;
Line 2979  sub member_privileges_form { Line 2975  sub member_privileges_form {
                                     $r->print('<td>');                                      $r->print('<td>');
                                 }                                  }
                                 $r->print(                                  $r->print(
  '<fieldset><legend><b>'.&mt($$toolprivs{$tool}{$priv}).'</b></legend>'   '<fieldset><legend>'.&mt($$toolprivs{$tool}{$priv}).'</legend>'
 .'<span class="LC_nobreak">'  .'<span class="LC_nobreak">'
 .' <input type="button" value="'.&mt('check all').'"'  .' <input type="button" value="'.&mt('check all').'"'
 .' onclick="javascript:checkAll(document.'.$formname.'.userpriv_'.$priv.')" />'  .' onclick="javascript:checkAll(document.'.$formname.'.userpriv_'.$priv.')" />'
Line 2999  sub member_privileges_form { Line 2995  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 3132  sub write_group_data { Line 3128  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 3140  sub write_group_data { Line 3136  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 3763  sub date_setting_table { Line 3759  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>'
  '<span class="LC_nobreak"><label><input type="checkbox" name="no_end_date" />'.                     .'<input type="checkbox" name="no_end_date" />'
  &mt('None').'</label></span>';                     .&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;
 }  }
   

Removed from v.1.93  
changed lines
  Added in v.1.103


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