--- loncom/interface/loncoursegroups.pm 2008/10/22 17:39:05 1.80
+++ loncom/interface/loncoursegroups.pm 2009/01/30 16:13:04 1.90
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: loncoursegroups.pm,v 1.80 2008/10/22 17:39:05 bisitz Exp $
+# $Id: loncoursegroups.pm,v 1.90 2009/01/30 16:13:04 schafran Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -75,11 +75,11 @@ sub handler {
my $crstype = &Apache::loncommon::course_type();
my %functions = (
- email => 'E-mail',
- discussion => 'Discussion boards',
+ communication => 'Send Messages',
+ discussion => 'Discussion Boards',
chat => 'Chat',
- files => 'File repository',
- roster => 'Membership roster',
+ files => 'File Repository',
+ roster => 'Membership Roster',
homepage => $ucgpterm.' home page',
);
@@ -349,8 +349,8 @@ END
'
'.$quota.' '.
''.$totalmembers.' '.
''.
- ''.&mt('Files: [_1]',$totalfiles).'
'.
- ''.&mt('Folders: [_1]',$totaldirs).'
'.
+ ''.&mt('Files: [_1]',$totalfiles).' '.
+ ''.&mt('Folders: [_1]',$totaldirs).' '.
' '.
''.$boards.' '.
''.$diskuse.' '.
@@ -1259,12 +1259,18 @@ sub reenable_folder {
sub modify_folders {
my ($cdom,$cnum,$groupname) = @_;
- my $outcome;
+ my ($outcome,$groupmap,$groupmapres,$map,$id,$src);
my $navmap = Apache::lonnavmaps::navmap->new();
- my $groupmap = '/uploaded/'.$cdom.'/'.$cnum.'/'.'group_folder_'.
+ if (!defined($navmap)) {
+ $outcome = ''.
+ &mt('Error reading course contents.').' '.
+ &mt('You need to re-initialize the course.').
+ '
';
+ return $outcome;
+ }
+ $groupmap = '/uploaded/'.$cdom.'/'.$cnum.'/'.'group_folder_'.
$groupname.'.sequence';
- my $groupmapres = $navmap->getResourceByUrl($groupmap);
- my ($map,$id,$src);
+ $groupmapres = $navmap->getResourceByUrl($groupmap);
if ($groupmapres) {
($map,$id,$src)=&Apache::lonnet::decode_symb($groupmapres->symb());
}
@@ -1553,11 +1559,11 @@ sub open_list_window {
my ($group,$status,$count,$text) = @_;
my $entry;
if ($count > 0) {
- $entry = ''.$text.' - '.$count.
- ' ';
+ ' ';
} else {
- $entry = ''.$text.' - '.$count.' ';
+ $entry = ''.$text.' - '.$count.' ';
}
return $entry;
}
@@ -1643,7 +1649,7 @@ END
for (my $i=0; $i<$halfnum; $i++) {
$r->print(' '.
- $$functions{$allfunctions[$i]}.'
+ &mt($$functions{$allfunctions[$i]}).'
');
}
$r->print(' print(' '.
- $$functions{$allfunctions[$j]}.'
+ &mt($$functions{$allfunctions[$j]}).'
');
}
if ($remnum) {
@@ -1668,8 +1674,8 @@ END
'.&mt('Granularity:').'
'.$lt{'doyo'}.' '.&mt('Yes').' '.&mt('No').' ');
if ($action eq 'modify') {
- $r->print(' ('.&mt('Currently set to "[_1]"',
- &mt($$stored{'granularity'})).')');
+ $r->print(' ('.&mt('Currently set to [_1].'
+ ,'"'.&mt($$stored{'granularity'}).'"').')');
}
$r->print('
@@ -1798,7 +1804,7 @@ sub sections_selection {
}
}
my $output = '
-
+
'.$section_sel.'
';
return $output;
@@ -2065,13 +2071,13 @@ sub pick_new_members {
if (@{$available} > 0 && $granularity eq 'Yes') {
$r->print('
'.$lt{'setf'}.'
-
+
-
+
');
}
$r->print('
@@ -2094,13 +2100,13 @@ sub pick_new_members {
if ($granularity eq 'Yes') {
$r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense LC_data_table_highlight').'
- '.&mt('All:').' ');
+ '.&mt('All:').' ');
foreach my $tool (@{$available}) {
$r->print(' '.''.$tool.' ');
}
- $r->print(' ');
+ $r->print(' ');
}
}
my %Sortby = ();
@@ -2134,7 +2140,7 @@ sub pick_new_members {
''.$id.' '.
''.$section.' ');
if (@{$available} > 0) {
- $r->print(''.
+ $r->print(''.
' ');
foreach my $tool (@{$available}) {
if ($granularity eq 'Yes') {
@@ -2145,7 +2151,7 @@ sub pick_new_members {
$tool.'" value="'.$user.'" />'.$tool.' ');
}
}
- $r->print(' ');
+ $r->print(' ');
}
$r->print(&Apache::loncommon::end_data_table_row()."\n");
}
@@ -2232,8 +2238,8 @@ sub privilege_specificity {
if ($totaloptionalprivs) {
$r->print('
- '.$lt{'algm'}.'
- '.$lt{'smgp'}.' ');
+ '.$lt{'algm'}.'
+ '.$lt{'smgp'}.' ');
} else {
$r->print(' ');
}
@@ -2293,8 +2299,12 @@ sub default_privileges {
);
$r->print(&Apache::lonhtmlcommon::start_pick_box('LC_group_priv_box').
&Apache::lonhtmlcommon::row_title($lt{'func'},undef,
- 'LC_groups_functionality'));
- $r->print(join('',@{$tools}));
+ 'LC_groups_functionality'));
+ my @printtool = @{$tools};
+ foreach my $printtool (@printtool){
+ $printtool = &mt($printtool);
+ }
+ $r->print(join(' ', @printtool));
$r->print(&Apache::lonhtmlcommon::row_closure(1));
my $fixed = '';
my $dynamic = '';
@@ -2310,7 +2320,7 @@ sub default_privileges {
$fixed .= ' ';
}
$fixed .= ' '
- .''.$$toolprivs{$tool}{$priv}.' ';
+ .''.&mt($$toolprivs{$tool}{$priv}).' ';
if ($action eq 'modify') {
if (grep(/^$tool$/,@{$available})) {
$fixed .= ''.&mt('(on)').' ';
@@ -2325,7 +2335,7 @@ sub default_privileges {
$dynamic .= '
'."\n";
}
- $dynamic .= ' '.$$toolprivs{$tool}{$priv}.' '."\n";
+ $dynamic .= ' '.&mt($$toolprivs{$tool}{$priv}).' '."\n";
}
}
if ($privcount == 0) {
@@ -2509,7 +2519,7 @@ sub current_membership {
$r->print(&check_uncheck_tools($r,$available));
$r->print('
-
+
'.$lt{'curf'}.'
@@ -2517,7 +2527,7 @@ sub current_membership {
-
+
');
}
@@ -2552,14 +2562,14 @@ END
if ($granularity eq 'Yes') {
$r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense LC_data_table_highlight').'
- '.&mt('All:').
+ '.&mt('All:').
' ');
foreach my $tool (@{$available}) {
$r->print(' '.''.$tool.' ');
}
- $r->print(' ');
+ $r->print(' ');
}
}
my %Sortby = ();
@@ -2587,25 +2597,25 @@ END
$r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense').'
');
if ($$current{$user}{changestate} eq 'reenable') {
- $r->print(''.
+ $r->print(''.
' '.
- $lt{'reen'}.' ');
+ $lt{'reen'}.' ');
} elsif ($$current{$user}{changestate} eq 'expire') {
- $r->print(''.
+ $r->print(''.
' '.
- $lt{'expi'}.' ');
+ $lt{'expi'}.' ');
} elsif ($$current{$user}{changestate} eq 'activate') {
- $r->print(''.
+ $r->print(''.
' '.
- $lt{'acti'}.' ');
+ $lt{'acti'}.' ');
}
- $r->print(''.
+ $r->print(''.
' '.
- $lt{'dele'}.' ');
+ $lt{'dele'}.'');
if ($specificity eq 'Yes') {
- $r->print(''.
+ $r->print(''.
' '.$lt{'chpr'}.
- ' ');
+ '');
}
$r->print('
'.
@@ -2616,7 +2626,7 @@ END
''.$start.' '.
''.$end.' ');
if ($hastools) {
- $r->print(''.
+ $r->print(''.
' ');
foreach my $tool (@{$$current{$user}{currtools}}) {
if ($granularity eq 'Yes') {
@@ -2632,23 +2642,23 @@ END
}
$r->print(' ');
}
- $r->print(' ');
+ $r->print(' ');
}
if ($addtools) {
$r->print('');
if ($granularity eq 'Yes') {
foreach my $tool (@{$$current{$user}{newtools}}) {
- $r->print(' print(' '.$tool.
- ' ');
+ ' ');
}
} else {
foreach my $tool (@{$$current{$user}{newtools}}) {
- $r->print(' print(' '.$tool.
- ' ');
+ ' ');
}
}
$r->print(' ');
@@ -2669,13 +2679,13 @@ sub check_uncheck_buttons {
'.$title.'
-
+
-
+
');
@@ -3222,36 +3232,49 @@ sub write_group_data {
my $crspath = '/uploaded/'.$cdom.'/'.$cnum.'/';
my $boardsmap = $crspath.'group_boards_'.$groupname.'.sequence';
my $navmap = Apache::lonnavmaps::navmap->new();
- my $bbmapres = $navmap->getResourceByUrl($boardsmap);
- undef($navmap);
- if (!$bbmapres) {
- my $grpmap = $crspath.'group_folder_'.$groupname.'.sequence';
- my $disctitle = &mt('Discussion Boards');
- my $outcome = &map_updater($cdom,$cnum,'group_boards_'.
- $groupname.'.sequence','bbseq',
- $disctitle,$grpmap);
- my ($furl,$ferr) =
- &Apache::lonuserstate::readmap($cdom.'/'.$cnum);
- $navmap = Apache::lonnavmaps::navmap->new();
- # modify parameter
- if ($outcome eq 'ok') {
- my $parm_result = &parm_setter($navmap,$cdom,$boardsmap,
- $groupname);
- if ($parm_result) {
- $r->print(''
- .&mt('An error occurred while setting parameters '
- .'for Discussion Boards folder: '
- .'[_1]',$parm_result)
- .'
');
+ my ($bbmapres,$error);
+ if (defined($navmap)) {
+ $bbmapres = $navmap->getResourceByUrl($boardsmap);
+ undef($navmap);
+ if (!$bbmapres) {
+ my $grpmap = $crspath.'group_folder_'.$groupname.'.sequence';
+ my $disctitle = &mt('Discussion Boards');
+ my $outcome = &map_updater($cdom,$cnum,'group_boards_'.
+ $groupname.'.sequence','bbseq',
+ $disctitle,$grpmap);
+ my ($furl,$ferr) =
+ &Apache::lonuserstate::readmap($cdom.'/'.$cnum);
+ # modify parameter
+ if ($outcome eq 'ok') {
+ $navmap = Apache::lonnavmaps::navmap->new();
+ if (defined($navmap)) {
+ my $parm_result = &parm_setter($navmap,$cdom,$boardsmap,
+ $groupname);
+ if ($parm_result) {
+ $error = &mt('An error occurred while setting parameters '
+ .'for Discussion Boards folder: '
+ .'[_1]',$parm_result);
+ } else {
+ $r->print(''.
+ &mt('Discussion Boards Folder created.')
+ .'
');
+ }
+ undef($navmap);
+ } else {
+ $error = &mt('An error occurred while setting parameters '.
+ 'for Discussion Boards folder: '.
+ 'Could not retrieve course information' );
+ }
} else {
- $r->print(''
- .&mt('Discussion Boards Folder created.')
- .'
');
+ $r->print($outcome);
}
- } else {
- $r->print($outcome);
}
- undef($navmap);
+ } else {
+ $error = &mt("An error occurred while retrieving the contents of the group's folder.").' '.
+ &mt('You need to re-initialize the course.');
+ }
+ if ($error ne '') {
+ $r->print(''.$error.'
');
}
}
$r->print(''
@@ -3509,7 +3532,6 @@ 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.",
'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",
- 'curr' => 'Currently set to',
'on' => 'on',
'off' => 'off',
'auad' => "Automatically enable $gpterm membership when roles are added?",
@@ -3534,19 +3556,19 @@ sub automapping {
}
$r->print(&Apache::lonhtmlcommon::topic_bar($image,$$lt{'endi'}).'
'.$$lt{'gmma'}.': '.$$lt{'adds'}.'
'.$$lt{'drops'}.'
-
'.$$lt{'auad'}.':
+ '.$$lt{'auad'}.':
'.&mt('on').' '.&mt('off').' ');
if ($action eq 'modify') {
- $r->print(' ('.$$lt{'curr'}.' '.$$lt{$add}.' )');
+ $r->print(' ('.&mt('Currently set to [_1].',''.$$lt{$add}.' ').')');
}
$r->print('
-
-
'.$$lt{'auex'}.':
+
+ '.$$lt{'auex'}.':
'.&mt('on').' '.&mt('off').' ');
if ($action eq 'modify') {
- $r->print(' ('.$$lt{'curr'}.' '.$$lt{$drop}.' )');
+ $r->print(' ('.&mt('Currently set to [_1].',''.$$lt{$drop}.' ').')');
}
- $r->print(' '.$$lt{'mapr'});
+ $r->print('
'.$$lt{'mapr'});
}
sub mapping_settings {
@@ -3706,16 +3728,16 @@ sub member_privs_entries {
if ($privcount == 3) {
$dynamic .= '
';
}
- $dynamic .=' ';
+ '';
}
}
- $r->print(' '.$fixed.' '.$dynamic.' ');
+ $r->print('
'.$fixed.' '.$dynamic.' ');
} else {
$r->print('
');
}
@@ -3742,8 +3764,8 @@ sub date_setting_table {
my $endform = &Apache::lonhtmlcommon::date_setter($formname,
'enddate',$endtime);
my $perpetual =
- '
'.
- &mt('None').'';
+ '
'.
+ &mt('None').'';
my $table = "