[LON-CAPA-cvs] cvs: loncom /interface loncoursegroups.pm
bisitz
lon-capa-cvs-allow@mail.lon-capa.org
Wed, 22 Oct 2008 17:39:05 -0000
This is a MIME encoded message
--bisitz1224697145
Content-Type: text/plain
bisitz Wed Oct 22 17:39:05 2008 EDT
Modified files:
/loncom/interface loncoursegroups.pm
Log:
[Part 2 of changes which started with version 1.79]
Optimized localization and usage of standard styles:
- Added missing &mt() calls to "check all" and "uncheck all" buttons texts
- Added other missing &mt() calls
- Optimized &mt() calls, e.g. don't include HTML Tags, use parameters, optimized usage of group and course type variables, etc.
- Added LON-CAPA standard warning and error styles to warning and error messages
Notes:
- Not all cases are tested (restart of web server without problems)
- More improvements are needed, e.g. get rid of some concatenated phrases, add &mt() to javascript alerts, etc.
- Still some missing &mt() calls, e.g. tool names
--bisitz1224697145
Content-Type: text/plain
Content-Disposition: attachment; filename="bisitz-20081022173905.txt"
Index: loncom/interface/loncoursegroups.pm
diff -u loncom/interface/loncoursegroups.pm:1.79 loncom/interface/loncoursegroups.pm:1.80
--- loncom/interface/loncoursegroups.pm:1.79 Tue Oct 21 14:29:39 2008
+++ loncom/interface/loncoursegroups.pm Wed Oct 22 17:39:05 2008
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: loncoursegroups.pm,v 1.79 2008/10/21 14:29:39 bisitz Exp $
+# $Id: loncoursegroups.pm,v 1.80 2008/10/22 17:39:05 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1646,7 +1646,7 @@
$$functions{$allfunctions[$i]}.'</label></td>
<td> </td><td> </td>');
}
- $r->print('<td><input type="button" value="check all" '.
+ $r->print('<td><input type="button" value="'.&mt('check all').'" '.
'onclick="javascript:checkAll(document.'.$formname.'.tool)" />'.
'</td></tr><tr><td> </td>');
for (my $j=$halfnum; $j<@allfunctions; $j++) {
@@ -1660,7 +1660,7 @@
}
$r->print('
<td>
- <input type="button" value="uncheck all"
+ <input type="button" value="'.&mt('uncheck all').'"
onclick="javascript:uncheckAll(document.'.$formname.'.tool)" />
</td>
</tr>
@@ -1669,7 +1669,7 @@
<td colspan="10">'.$lt{'doyo'}.' <label><input type="radio" name="granularity" value="Yes" />'.&mt('Yes').'</label> <label><input type="radio" name="granularity" value="No" checked="checked" />'.&mt('No').'</label>');
if ($action eq 'modify') {
$r->print(' ('.&mt('Currently set to "[_1]"',
- $$stored{'granularity'}).')');
+ &mt($$stored{'granularity'})).')');
}
$r->print('
</td>
@@ -1806,9 +1806,7 @@
sub access_date_settings {
my ($r,$action,$formname,$stored,$image,$gpterm,$ucgpterm) = @_;
- my %lt = &Apache::lonlocal::texthash(
- 'sten' => "Default start and end dates for $gpterm access",
- );
+ my $sten = &mt("Default start and end dates for $gpterm access");
my $starttime = time;
my $endtime = time+(6*30*24*60*60); # 6 months from now, approx
if ($action eq 'modify') {
@@ -1818,7 +1816,7 @@
}
}
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.'
');
return;
@@ -1935,7 +1933,7 @@
ygrs => "Your group selections - ",
tfwa => "The following settings will apply to the group:",
difn => 'Different collaborative tools<br />for different members:',
- stda => 'Start date',
+ stda => 'Start date:',
enda => 'End date:',
);
my $showstart = &Apache::lonlocal::locallocaltime($startdate);
@@ -1987,7 +1985,7 @@
$r->print('</tr></table><br />');
}
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>');
my $rowcell = int(@{$unavailable}/2) + @{$unavailable}%2;
for (my $j=0; $j<@{$unavailable}; $j++) {
@@ -2005,9 +2003,10 @@
$r->print('</tr></table>');
}
my $quota_text=&mt('[_1] Mb',$quota);
+ my $granu_text=&mt($granularity);
$r->print(<<"END");
</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"><b>$lt{'stda'}</b> $showstart<br />
<b>$lt{'enda'}</b> $showend
@@ -2067,10 +2066,10 @@
$r->print('<td>
<fieldset><legend><b>'.$lt{'setf'}.'</b></legend>
<nobr>
- <input type="button" value="check all"
+ <input type="button" value="'.&mt('check all').'"
onclick="javascript:checkAllTools(document.'.$formname.')" />
- <input type="button" value="uncheck all"
+ <input type="button" value="'.&mt('uncheck all').'"
onclick="javascript:uncheckAllTools(document.'.$formname.')" />
</nobr>
</fieldset></td>');
@@ -2512,10 +2511,10 @@
<td>
<nobr>
<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.')" />
- <input type="button" value="uncheck all"
+ <input type="button" value="'.&mt('uncheck all').'"
onclick="javascript:uncheckAllTools(document.'.$formname.')" />
</fieldset>
</nobr>
@@ -2671,10 +2670,10 @@
<fieldset>
<legend><b>'.$title.'</b></legend>
<nobr>
- <input type="button" value="check all"
+ <input type="button" value="'.&mt('check all').'"
onclick="javascript:checkAll(document.'.$formname.'.'.$field.')" />
- <input type="button" value="uncheck all"
+ <input type="button" value="'.&mt('uncheck all').'"
onclick="javascript:uncheckAll(document.'.$formname.'.'.$field.')" />
</nobr>
</fieldset>
@@ -2876,7 +2875,8 @@
'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, '.
@@ -2954,7 +2954,7 @@
$r->print('<td valign="top">');
$r->print('<table class="thinborder"><tr>'.
'<th colspan="'.$colspan.'">'.
- $tool.'</th></tr><tr>');
+ &mt($tool).'</th></tr><tr>');
my $privcount = 0;
foreach my $priv (@{$showboxes{$tool}}) {
$privcount ++;
@@ -2968,15 +2968,16 @@
} else {
$r->print('<td>');
}
- $r->print(qq|
- <fieldset><legend><b>$$toolprivs{$tool}{$priv}</b></legend>
- <nobr>
- <input type="button" value="check all"
- onclick="javascript:checkAll(document.$formname.userpriv_$priv)" />
-
- <input type="button" value="uncheck all"
- onclick="javascript:uncheckAll(document.$formname.userpriv_$priv)" />
- </nobr></fieldset><br />|);
+ $r->print(
+ '<fieldset><legend><b>'.&mt($$toolprivs{$tool}{$priv}).'</b></legend>'
+.'<span class="LC_nobreak">'
+.' <input type="button" value="'.&mt('check all').'"'
+.' onclick="javascript:checkAll(document.'.$formname.'.userpriv_'.$priv.')" />'
+.' '
+.'<input type="button" value="'.&mt('uncheck all').'"'
+.' onclick="javascript:uncheckAll(document.'.$formname.'.userpriv_'.$priv.')" />'
+.'</span></fieldset><br />'
+ );
$r->print('</td>');
if ($privcount < @{$showboxes{$tool}}) {
if (@{$showboxes{$tool}} > 2) {
@@ -3471,17 +3472,28 @@
$r->print('<br />');
}
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)) {
$r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.'<br />');
}
$r->print('<br />');
}
if ($roster_result eq 'ok') {
- $r->print('<br />'.&mt('[_1] membership list updated.',$ucgpterm));
- $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>');
+ $r->print('<div class="LC_success">'
+ .&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 {
- $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;
}
@@ -3523,14 +3535,14 @@
$r->print(&Apache::lonhtmlcommon::topic_bar($image,$$lt{'endi'}).'
<b>'.$$lt{'gmma'}.':</b><br />'.$$lt{'adds'}.'<br />'.$$lt{'drops'}.'<br /><br />
<nobr>'.$$lt{'auad'}.':
- <label><input type="radio" name="autoadd" value="on" />on </label><label><input type="radio" name="autoadd" value="off" checked="checked" />off</label>');
+ <label><input type="radio" name="autoadd" value="on" />'.&mt('on').' </label><label><input type="radio" name="autoadd" value="off" checked="checked" />'.&mt('off').'</label>');
if ($action eq 'modify') {
$r->print(' ('.$$lt{'curr'}.' <b>'.$$lt{$add}.'</b>)');
}
$r->print('
</nobr><br />
<nobr>'.$$lt{'auex'}.':
- <label><input type="radio" name="autodrop" value="on" />on </label><label><input type="radio" name="autodrop" value="off" checked="checked" />off</label>');
+ <label><input type="radio" name="autodrop" value="on" />'.&mt('on').' </label><label><input type="radio" name="autodrop" value="off" checked="checked" />'.&mt('off').'</label>');
if ($action eq 'modify') {
$r->print(' ('.$$lt{'curr'}.' <b>'.$$lt{$drop}.'</b>)');
}
@@ -3747,7 +3759,9 @@
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 '<span class="LC_error">'
+ .&mt('Error: invalid course domain or number - group folder creation failed.')
+ .'</span>';
}
my ($outcome,$allgrpsmap,$grpmap,$boardsmap,$grppage,$warning);
my $crspath = '/uploaded/'.$cdom.'/'.$cnum.'/';
@@ -3757,14 +3771,16 @@
# 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 = '<span class="LC_warning">'
+ .&mt('Non-standard course - folder for all groups not added.')
+ .'</span>';
}
if ($outcome ne 'ok') {
my $delresult = &release_folder_lock($cdom,$cnum,'group_allfolders');
@@ -3779,7 +3795,9 @@
$warning = $delresult ;
}
} 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.')
+ .'</div>';
return $outcome;
}
my $grpfolder = &mt($ucgpterm.' Folder - [_1]',$description);
@@ -3855,7 +3873,10 @@
my @del_lock = ($folder_name."\0".'locked_folder');
my $dellockoutcome=&Apache::lonnet::del('coursegroups',\@del_lock,$cdom,$cnum);
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 {
return 'ok';
}
@@ -3870,12 +3891,16 @@
my $newmapurl=&Apache::lonnet::finishuserfileupload($cnum,$cdom,$itemname,
$newfile);
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;
}
my ($errtext,$fatal)=&LONCAPA::map::mapread($parentmap);
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;
} else {
my $newidx=&LONCAPA::map::getresidx($newmapurl);
@@ -3884,7 +3909,9 @@
$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".'<br />';
+ $outcome = '<div class="LC_error">'
+ .&mt('Error saving updated parent folder.')." ($parentmap): $errtext"
+ .'</div>';
return $outcome;
}
}
@@ -3934,7 +3961,10 @@
}
}
} 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;
}
--bisitz1224697145--