--- loncom/interface/loncoursegroups.pm 2008/05/07 00:10:59 1.76 +++ loncom/interface/loncoursegroups.pm 2009/09/09 04:31:53 1.103 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: loncoursegroups.pm,v 1.76 2008/05/07 00:10:59 raeburn Exp $ +# $Id: loncoursegroups.pm,v 1.103 2009/09/09 04:31:53 raeburn 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', - chat => 'Chat', - files => 'File repository', - roster => 'Membership roster', + email => 'Send Messages', + discussion => 'Discussion Boards', + chat => 'Chat Room', + files => 'Group Portfolio', + roster => 'Membership Roster', homepage => $ucgpterm.' home page', ); @@ -111,8 +111,10 @@ sub handler { $crstype); } } else { - $r->print(&mt('You do not have [_1] administration '. - 'privileges in this [_2]',$gpterm,lc($crstype))); + $r->print('
' + .&mt('You do not have '.$gpterm.' administration ' + .'privileges in this '.lc($crstype).'.') + .'
'); } } else { &print_main_menu($r,$cdom,$cnum,\%functions,\%idx,$view_permission, @@ -139,7 +141,7 @@ function openGroupRoster(group,status) { rosterbrowser = open(url,title,options,'1'); rosterbrowser.focus(); }\n|; - $r->print(&header('Groups',$jscript,$action,$state)); + $r->print(&header('My Space',$jscript,$action,$state)); if ($env{'form.refpage'} eq 'cusr') { &Apache::lonhtmlcommon::add_breadcrumb ({href=>"/adm/createuser", @@ -346,7 +348,10 @@ END ''.$functionality.''. ''.$quota.''. ''.$totalmembers.''. - ''.&mt('Files: ').$totalfiles.'
'.&mt('Folders: ').$totaldirs.''. + ''. + ''.&mt('Files: [_1]',$totalfiles).'
'. + ''.&mt('Folders: [_1]',$totaldirs).''. + ''. ''.$boards.''. ''.$diskuse.''. &Apache::loncommon::end_data_table_row()); @@ -390,9 +395,7 @@ END } } } else { - $r->print(&mt('You are not currently a member of any '. - 'active [_1]s in this [_2]',$gpterm, - lc($crstype))); + $r->print(&mt('You are not currently a member of any active '.$gpterm.'s in this '.lc($crstype).'.')); } } return; @@ -406,7 +409,6 @@ sub group_administration { my @types = (); my @roles = (); my @sections = (); - my @buildsections = (); my %users = (); my %userdata = (); my @members = (); @@ -566,16 +568,11 @@ sub group_administration { } if (defined($env{'form.sectionpick'})) { @sections=&Apache::loncommon::get_env_multiple('form.sectionpick'); - if (grep/^all$/,@sections) { - @buildsections = sort {$a cmp $b} keys(%sectioncount); - } else { - @buildsections = @sections; - } } } if (($state eq 'pick_members') || ($state eq 'pick_privs') || ($state eq 'change_privs')) { - &build_members_list($cdom,$cnum,\@types,\@roles,\@buildsections,\%users, + &build_members_list($cdom,$cnum,\@types,\@roles,\@sections,\%users, \%userdata); } if ($state eq 'pick_members') { @@ -788,7 +785,7 @@ sub group_administration { } var maxposs = '.sprintf("%.2f",$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; } var re_quota = '.$float_check.'; @@ -807,7 +804,7 @@ sub group_administration { } } 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; } } @@ -918,11 +915,11 @@ function changeSort(caller) { result => 'Re-enabled' ); my %navbuttons = &Apache::lonlocal::texthash( - gtns => 'Go to next step', - gtps => 'Go to previous step', + gtns => 'Next',#'Go to next step', + gtps => 'Back',#'Go to previous step', crgr => 'Create '.$gpterm, - mose => 'Modify settings', - gtpp => 'Go to previous page', + mose => 'Save',#'Modify settings', + gtpp => 'Back',#'Go to previous page', adme => 'Add members', ); if ((($action eq 'create') || ($action eq 'modify') || ($action eq 'delete') || ($action eq 'reenable')) && @@ -1140,8 +1137,8 @@ sub display_control { sub verify_delete { my ($r,$groupname,$formname,$action,$page,$states,$stored) = @_; $r->print(&Apache::lonhtmlcommon::echo_form_input([])); - $r->print(&mt("You have requested deletion of the following group: ").''. - $stored->{'description'}.''. + $r->print(&mt('You have requested deletion of the group [_1].' + ,''.$stored->{'description'}.''). '

'.&mt('When a group is deleted the following occurs:').''); } + if (@{$unavailable} > 0) { - $r->print(&mt('Unavailable for assignment:'). - ''); - my $rowcell = int(@{$unavailable}/2) + @{$unavailable}%2; - for (my $j=0; $j<@{$unavailable}; $j++) { - if (@{$unavailable} > 3) { - if ($j==$rowcell) { - $r->print(''); - } - } - $r->print(''); + $r->print(''.&mt('Unavailable for assignment:').''); + $r->print(''); - } - $r->print('
'.$$functions{$$unavailable[$j]}. - '   
'); + $r->print(''); } + + my $quota_text=&mt('[_1] Mb',$quota); + my $granu_text=&mt($granularity); $r->print(<<"END"); - $lt{'difn'} $granularity - $quota Mb + $lt{'difn'} $granu_text + $quota_text $lt{'stda'} $showstart
$lt{'enda'} $showend @@ -2001,9 +2033,9 @@ sub pick_new_members { 'nnew' => "There are no users to add as new members, as all users". " matching the specified type(s), role(s), and ". "section(s) are already affiliated with this group.", - 'yoma' => 'You may need to use the '."'".'modify existing, past or '. - 'future members'."'".' page if you need to re-enable '. - 'or activate access for previous or future members.', + 'yoma' => "You may need to use the 'modify existing, past or ". + "future members' page if you need to re-enable ". + "or activate access for previous or future members.", ); my %members; my $totalusers = 0; @@ -2027,7 +2059,7 @@ sub pick_new_members { $r->print(&check_uncheck_tools($r,$available)); } } - &topic_bar($r,$img,$lt{'gpme'}); + $r->print(&Apache::lonhtmlcommon::topic_bar($img,$lt{'gpme'})); if (keys(%members) > 0) { $r->print(' @@ -2035,14 +2067,14 @@ sub pick_new_members { &check_uncheck_buttons($r,$formname,'member',$lt{'addm'}); if (@{$available} > 0 && $granularity eq 'Yes') { $r->print(''); } $r->print('
-
'.$lt{'setf'}.' - - '.$lt{'setf'}.' + +    - - +
@@ -2065,13 +2097,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('   '); } - $r->print(''); + $r->print(''); } } my %Sortby = (); @@ -2105,7 +2137,7 @@ sub pick_new_members { ''.$id.''. ''.$section.''); if (@{$available} > 0) { - $r->print(''. + $r->print(''. '       '); foreach my $tool (@{$available}) { if ($granularity eq 'Yes') { @@ -2116,7 +2148,7 @@ sub pick_new_members { $tool.'" value="'.$user.'" />'.$tool.'   '); } } - $r->print(''); + $r->print(''); } $r->print(&Apache::loncommon::end_data_table_row()."\n"); } @@ -2134,7 +2166,7 @@ sub pick_new_members { sub privilege_specificity { my ($r,$action,$img,$tools,$stored,$toolprivs,$fixedprivs,$available, - $formname,$gpterm,$ucgpterm) = @_; + $formname,$gpterm,$ucgpterm,$functions) = @_; my %lt = &Apache::lonlocal::texthash ( 'uprv' => 'User privileges for collaborative tools', 'frty' => 'For each collaborative tool you have chosen to include, '. @@ -2176,7 +2208,7 @@ sub privilege_specificity { } } } - &topic_bar($r,$img,$lt{'uprv'}); + $r->print(&Apache::lonhtmlcommon::topic_bar($img,$lt{'uprv'})); if ((($action eq 'create') && (@{$available} > 0)) || (($action eq 'modify') && ($formname eq 'change_settings'))) { my %specific = ( @@ -2203,8 +2235,8 @@ sub privilege_specificity { if ($totaloptionalprivs) { $r->print('
-
-

'); +
+

'); } else { $r->print(''); } @@ -2231,7 +2263,7 @@ sub privilege_specificity { $r->print($lt{'algm'}.'

'); } &default_privileges($r,$action,$tools,$toolprivs,$fixedprivs, - $available); + $available,$functions); } else { if ($action eq 'create') { $r->print($lt{'asyo'}); @@ -2255,7 +2287,7 @@ sub privilege_specificity { } sub default_privileges { - my ($r,$action,$tools,$toolprivs,$fixedprivs,$available) = @_; + my ($r,$action,$tools,$toolprivs,$fixedprivs,$available,$functions) = @_; my %lt = &Apache::lonlocal::texthash( 'addp' => 'Additional privileges', 'fixp' => 'Fixed privileges', @@ -2264,8 +2296,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 @tableHeader; + foreach my $key (sort(keys(%{$functions}))){ + push (@tableHeader,&mt($functions->{$key})); + } + $r->print(join('', @tableHeader)); $r->print(&Apache::lonhtmlcommon::row_closure(1)); my $fixed = ''; my $dynamic = ''; @@ -2280,7 +2316,8 @@ sub default_privileges { if ($fixed ne '') { $fixed .= ''; } - $fixed .= ''.$$toolprivs{$tool}{$priv}.' '; + $fixed .= '' + .''.&mt($$toolprivs{$tool}{$priv}).' '; if ($action eq 'modify') { if (grep(/^$tool$/,@{$available})) { $fixed .= ''.&mt('(on)').' '; @@ -2288,18 +2325,18 @@ sub default_privileges { $fixed .= ''.&mt('(off)').' '; } } - $fixed .= ''; + $fixed .= ''; } else { $privcount++; if ($privcount == 3) { $dynamic .= ' '."\n"; } - $dynamic .= ''."\n"; + $dynamic .= ''."\n"; } } if ($privcount == 0) { - $dynamic .= 'None'."\n"; + $dynamic .= ''.&mt('None').''."\n"; } if ($privcount < 3) { $dynamic .= ' '."\n"; @@ -2417,11 +2454,11 @@ sub change_members_form { $r->print('
'); - &topic_bar($r,1,$lt{'grse'}); + $r->print(&Apache::lonhtmlcommon::topic_bar(1,$lt{'grse'})); &print_current_settings($r,$action,$functions,$startdate,$enddate, $groupname,$description,$granularity,$quota, \@available,\@unavailable,$gpterm,$ucgpterm); - &topic_bar($r,2,$lt{'mogm'}); + $r->print(&Apache::lonhtmlcommon::topic_bar(2,$lt{'mogm'})); my $numcurrent = ¤t_membership($r,$cdom,$cnum,$formname,$groupname, \@available,\@unavailable,$fixedprivs, $granularity,$specificity); @@ -2479,15 +2516,15 @@ sub current_membership { $r->print(&check_uncheck_tools($r,$available)); $r->print(' - -
'.$lt{'curf'}.' - +
'.$lt{'curf'}.' +    -
-
+ '); } @@ -2522,14 +2559,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('   '); } - $r->print(''); + $r->print(''); } } my %Sortby = (); @@ -2557,25 +2594,25 @@ END $r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense').' '); if ($$current{$user}{changestate} eq 'reenable') { - $r->print('
'); + $lt{'reen'}.'
'); } elsif ($$current{$user}{changestate} eq 'expire') { - $r->print('
'); + $lt{'expi'}.'
'); } elsif ($$current{$user}{changestate} eq 'activate') { - $r->print('
'); + $lt{'acti'}.'
'); } - $r->print(''); + $lt{'dele'}.''); if ($specificity eq 'Yes') { - $r->print('
'); + ''); } $r->print(' '. @@ -2586,7 +2623,7 @@ END ''.$start.''. ''.$end.''); if ($hastools) { - $r->print(''. + $r->print(''. '      '); foreach my $tool (@{$$current{$user}{currtools}}) { if ($granularity eq 'Yes') { @@ -2602,23 +2639,23 @@ END } $r->print('   '); } - $r->print(''); + $r->print(''); } if ($addtools) { $r->print(''); if ($granularity eq 'Yes') { foreach my $tool (@{$$current{$user}{newtools}}) { - $r->print('   '); + '   '); } } else { foreach my $tool (@{$$current{$user}{newtools}}) { - $r->print('print(''.$tool. - '   '); + '   '); } } $r->print(''); @@ -2638,14 +2675,14 @@ sub check_uncheck_buttons { $r->print('
- '.$title.' - - '.$title.' + +    - - +
'); @@ -2671,7 +2708,7 @@ sub change_privs_form { } else { $nexttext = $$navbuttons{'mose'}; } - &topic_bar($r,3,&mt('Members to delete or expire')); + $r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('Members to delete or expire'))); my $exp_or_del = 0; if (ref($$memchg{'deletion'}) eq 'ARRAY') { if (@{$$memchg{'deletion'}} > 0) { @@ -2699,7 +2736,7 @@ sub change_privs_form { $r->print($lt{'nome'}.'
'); } - &topic_bar($r,4,&mt('Setting optional privileges for specific group members')); + $r->print(&Apache::lonhtmlcommon::topic_bar(4,&mt('Setting optional privileges for specific group members'))); my $numchgs = &member_privileges_form($r,$action,$formname,$tools, $toolprivs,$fixedprivs,$userdata, @@ -2756,7 +2793,7 @@ sub choose_privs_form { $nexttext = $$navbuttons{'adme'}; } - &topic_bar($r,6,&mt('Setting optional privileges for specific group members')); + $r->print(&Apache::lonhtmlcommon::topic_bar(6,&mt('Setting optional privileges for specific group members'))); &member_privileges_form($r,$action,$formname,$tools,$toolprivs, $fixedprivs,$userdata,$usertools,$idx,undef, @@ -2845,7 +2882,8 @@ sub member_privileges_form { 'members being added or modified, '. 'there are no optional privileges to set '. '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, '. 'previously set privileges will be preserved.', 'asno' => 'As no group members are being added, '. @@ -2921,9 +2959,8 @@ sub member_privileges_form { foreach my $tool (@{$tools}) { if (@{$showboxes{$tool}} > 0) { $r->print(''); - $r->print(''. - ''); + $r->print('
'.&mt($tool).''); + $r->print('
'. - $tool.'
'); my $privcount = 0; foreach my $priv (@{$showboxes{$tool}}) { $privcount ++; @@ -2937,15 +2974,16 @@ sub member_privileges_form { } else { $r->print(''); if ($privcount < @{$showboxes{$tool}}) { if (@{$showboxes{$tool}} > 2) { @@ -2957,7 +2995,7 @@ sub member_privileges_form { } } } - $r->print('
'); } - $r->print(qq| -
$$toolprivs{$tool}{$priv} - - -   - -

|); + $r->print( + '
'.&mt($$toolprivs{$tool}{$priv}).'' +.'' +.' ' +.' ' +.'' +.'

' + ); $r->print('
 '); + $r->print('
 '); } } $r->print(''); @@ -3089,11 +3127,19 @@ sub write_group_data { } if ($quota !~ /^\d*\.?\d*$/) { $quota = 0; - $r->print(&mt('The value you entered for the quota for the file repository in this [_1] contained invalid characters, so it has been set to 0 Mb. You can change this by modifying the [_1] settings.
',$gpterm)); + $r->print('
' + .&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' + .' modifying the '.$gpterm.' settings.') + .'
'); } if ($quota > $maxposs) { $quota = $maxposs; - $r->print(&mt('The value you entered for the quota for the file repository in this [_1] exceeded the maximum possible value, so it has been set to [_2] Mb (the maximum possible value).
',$gpterm,sprintf("%.2f",$maxposs))); + $r->print('
' + .&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 ' + .'(the maximum possible value).',sprintf("%.2f",$maxposs)) + .'
'); } my %groupinfo = ( description => $esc_description, @@ -3158,10 +3204,17 @@ sub write_group_data { my $result = &add_group_folder($cdom,$cnum,$now,$groupname,$action, $description,$tools,\%groupinfo, $gpterm,$ucgpterm,$crstype); - if ($result ne 'ok') { - $r->print(&mt('A problem occurred when creating folders for the new [_1].
[_2]
',$gpterm,$result)); + if ($result eq 'ok') { + $r->print('
' + .&mt($ucgpterm.' [_1] was created.',''.$groupname.'') + .'
'); + } else { + $r->print('
' + .&mt('A problem occurred when creating folders for the new '.$gpterm.' [_1]:' + ,''.$groupname.'') + .'
'.$result + .'
'); } - $r->print(&mt('[_1] [_2] was created.
',$ucgpterm,$groupname)); } elsif ($action eq 'modify') { my (@oldtools,@newtools); if (ref($$stored{'tool'}) eq 'ARRAY') { @@ -3175,35 +3228,54 @@ 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('Error 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(&mt('[_1] [_2] was updated.
',$ucgpterm,$groupname)); + $r->print('
' + .&mt($ucgpterm.' [_1] was updated.',''.$groupname.'') + .'
'); } } else { my %actiontype = ( @@ -3213,8 +3285,10 @@ sub write_group_data { &Apache::lonnet::logthis("Failed to store $gpterm $groupname ". 'in '.lc($crstype).': '.$cnum. ' in domain: '.$cdom); - $r->print(&mt('An error occurred when [_1] the [_2]. '. - 'Please try again.',$actiontype{$action},$gpterm)); + $r->print('
' + .&mt('An error occurred when [_1] the '.$gpterm.'. ' + .'Please try again.',$actiontype{$action}) + .'
'); } return $result; } @@ -3233,6 +3307,7 @@ sub process_membership { my %curr_start = (); my %curr_end = (); my %tooltype = (); + my $context = 'processgroupmembership'; foreach my $tool (@{$tools}) { foreach my $priv (sort(keys(%{$$toolprivs{$tool}}))) { @@ -3302,7 +3377,7 @@ sub process_membership { $curr_privs{$user}; if (&Apache::lonnet::modify_group_roles($cdom,$cnum,$groupname, $user,$now,$savestart, - $curr_privs{$user},''',$context) eq 'ok') { + $curr_privs{$user},'',$context) eq 'ok') { push(@{$added{'expired'}},$user); $num_ok ++; } else { @@ -3406,7 +3481,9 @@ sub process_membership { } if ($num_fail) { foreach my $type (sort(keys(%failed))) { - $r->print(&mt('The following users could not be [_1], because an error occurred:
',$type)); + $r->print('
' + .&mt("The following users could not be $type, because an error occurred:") + .'
'); foreach my $user (@{$failed{$type}}) { $r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.'
'); } @@ -3414,17 +3491,28 @@ sub process_membership { $r->print('
'); } if (@unchanged > 0) { - $r->print(&mt('No change occurred for the following users:
')); + $r->print(&mt('No change occurred for the following users:').'
'); foreach my $user (sort(@unchanged)) { $r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.'
'); } $r->print('
'); } if ($roster_result eq 'ok') { - $r->print('
'.&mt('[_1] membership list updated.',$ucgpterm)); - $r->print('

'.&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).'

'); + $r->print('
' + .&mt($ucgpterm.' membership list updated.') + .'
'); + $r->print('

' + .&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.'') + .'

' + ); } else { - $r->print('
'.&mt('An error occurred while updating the [_1] membership list -',$gpterm).$roster_result.'
'); + $r->print('
' + .&mt("An error occurred while updating the $gpterm membership list:") + .'
'.$roster_result + .'
'); } return; } @@ -3440,7 +3528,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?", @@ -3463,22 +3550,21 @@ sub automapping { if (exists($$stored{'autodrop'})) { $drop = $$stored{'autodrop'}; } - &topic_bar($r,$image,$$lt{'endi'}); - $r->print(' + $r->print(&Apache::lonhtmlcommon::topic_bar($image,$$lt{'endi'}).' '.$$lt{'gmma'}.':
'.$$lt{'adds'}.'
'.$$lt{'drops'}.'

- '.$$lt{'auad'}.':  - '); + '.$$lt{'auad'}.':  + '); 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'}.':  + '); 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 { @@ -3491,7 +3577,7 @@ sub mapping_settings { } else { @sections = ('all','none'); } - &topic_bar($r,$image,$$lt{'pirs'}); + $r->print(&Apache::lonhtmlcommon::topic_bar($image,$$lt{'pirs'})); my @roles = &standard_roles(); my %customroles = &Apache::lonhtmlcommon::course_custom_roles($cdom,$cnum); $r->print(&Apache::loncommon::start_data_table(). @@ -3638,16 +3724,16 @@ sub member_privs_entries { if ($privcount == 3) { $dynamic .= ''; } - $dynamic .=''; + ''; } } - $r->print(''.$fixed.''.$dynamic.''); + $r->print(''.$fixed.''.$dynamic.''); } else { $r->print('
'.$tool.'
 
 
'); } @@ -3673,17 +3759,19 @@ sub date_setting_table { 'startdate',$starttime); my $endform = &Apache::lonhtmlcommon::date_setter($formname, 'enddate',$endtime); - my $perpetual = - ''; - my $table = "\n". - ''. - ''. - ''."\n". - ''. - ''. - ''."\n". - "
'.&mt('Start:').''.$startform.' 
'.&mt('End:').''.$endform.''.$perpetual.'
\n"; + my $perpetual = ' '; + my $table = &Apache::lonhtmlcommon::start_pick_box() + .&Apache::lonhtmlcommon::row_title(&mt('Start Date')) + .$startform + .&Apache::lonhtmlcommon::row_closure() + .&Apache::lonhtmlcommon::row_title(&mt('End Date')) + .$endform + .$perpetual + .&Apache::lonhtmlcommon::row_closure(1) + .&Apache::lonhtmlcommon::end_pick_box(); return $table; } @@ -3691,7 +3779,9 @@ sub add_group_folder { my ($cdom,$cnum,$now,$groupname,$action,$description,$tools,$groupinfo, $gpterm,$ucgpterm,$crstype) = @_; if ($cdom eq '' || $cnum eq '') { - return &mt('Error: invalid course domain or number - group folder creation failed'); + return '' + .&mt('Error: invalid course domain or number - group folder creation failed.') + .''; } my ($outcome,$allgrpsmap,$grpmap,$boardsmap,$grppage,$warning); my $crspath = '/uploaded/'.$cdom.'/'.$cnum.'/'; @@ -3701,21 +3791,23 @@ sub add_group_folder { # check if group_allfolders.sequence exists. my $mapcontents = &Apache::lonnet::getfile($allgrpsmap); 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'}; $topmap_url =~ s|/+|/|g; if ($topmap_url =~ m|^/uploaded|) { $outcome = &map_updater($cdom,$cnum,'group_allfolders.sequence', 'toplevelgroup',$grpstitle,$topmap_url); } else { - $outcome = &mt('Non-standard course - folder for all groups not added.'); + $outcome = '' + .&mt('Non-standard course - folder for all groups not added.') + .''; } if ($outcome ne 'ok') { my $delresult = &release_folder_lock($cdom,$cnum,'group_allfolders'); if ($delresult ne 'ok') { $warning = $delresult; } - return $outcome; + return $outcome.$warning; } } my $delresult = &release_folder_lock($cdom,$cnum,'group_allfolders'); @@ -3723,7 +3815,9 @@ sub add_group_folder { $warning = $delresult ; } } else { - $outcome = &mt('Could not obtain exclusive lock to check status of the folder for all groups. No group folder added.'); + $outcome = '' + .&mt('Could not obtain exclusive lock to check status of the folder for all groups. No group folder added.') + .''; return $outcome; } my $grpfolder = &mt($ucgpterm.' Folder - [_1]',$description); @@ -3754,6 +3848,10 @@ sub add_group_folder { } my ($furl,$ferr)= &Apache::lonuserstate::readmap($cdom.'/'.$cnum); my $navmap = Apache::lonnavmaps::navmap->new(); + if (!defined($navmap)) { + return $warning.''.&mt('Error retrieving course contents'). + ' '.&mt('You need to re-initialize the course.').''; + } # modify parameters my $parm_result; if ($action eq 'create') { @@ -3799,7 +3897,10 @@ sub release_folder_lock { my @del_lock = ($folder_name."\0".'locked_folder'); my $dellockoutcome=&Apache::lonnet::del('coursegroups',\@del_lock,$cdom,$cnum); if ($dellockoutcome ne 'ok') { - return ('
'.&mt('Warning: failed to release lock for folder: [_1].',$folder_name).'
'); + return ('
' + .&mt('Warning: failed to release lock for folder: [_1].',''.$folder_name.'') + .'
' + ); } else { return 'ok'; } @@ -3814,12 +3915,16 @@ sub map_updater { my $newmapurl=&Apache::lonnet::finishuserfileupload($cnum,$cdom,$itemname, $newfile); if ($newmapurl !~ m|^/uploaded|) { - $outcome = &mt('Error uploading new folder.')." ($newfile): $newmapurl".'
'; + $outcome = '
' + .&mt('Error uploading new folder.')." ($newfile): $newmapurl" + .'
'; return $outcome; } my ($errtext,$fatal)=&LONCAPA::map::mapread($parentmap); if ($fatal) { - $outcome = &mt('Error reading contents of parent folder')." ($parentmap): $errtext".'
'; + $outcome = '
' + .&mt('Error reading contents of parent folder.')." ($parentmap): $errtext" + .'
'; return $outcome; } else { my $newidx=&LONCAPA::map::getresidx($newmapurl); @@ -3828,7 +3933,9 @@ sub map_updater { $LONCAPA::map::order[1+$#LONCAPA::map::order]=$newidx; my ($outtext,$errtext) = &LONCAPA::map::storemap($parentmap,1); if ($errtext) { - $outcome = &mt('Error saving updated parent folder')." ($parentmap): $errtext".'
'; + $outcome = '
' + .&mt('Error saving updated parent folder.')." ($parentmap): $errtext" + .'
'; return $outcome; } } @@ -3850,6 +3957,13 @@ sub new_map { sub parm_setter { my ($navmap,$cdom,$url,$groupname) = @_; my $allresults; + if (!defined($navmap)) { + $allresults = '
'. + &mt('Parameters not set for [_1] because the contents of the course could not be retrieved.',$url).' '. + &mt('You need to reinitialize the course.'). + '
'; + return $allresults; + } my %hide_settings = ( 'course' => { 'num' => 13, @@ -3878,7 +3992,10 @@ sub parm_setter { } } } else { - $allresults = &mt('Parameters not set for [_1] because the resource was not recognized as part of the course',$url).'
'; + $allresults = '
' + .&mt('Parameters not set for [_1] because the resource was not recognized' + .' as part of the course.',''.$url.'') + .'
'; } return $allresults; } @@ -3992,18 +4109,6 @@ sub validate_groupname { return; } -sub topic_bar { - my ($r,$imgnum,$title) = @_; - $r->print(' -
- '.&mt('Step [_1]',$imgnum).
-	      '  - '.$title.' -
-'); - return; -} - sub check_changes { my ($member_changes,$memchg) = @_; my %exclusions;