[LON-CAPA-cvs] cvs: loncom /interface lonfeedback.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Wed, 29 Nov 2006 03:23:05 -0000
This is a MIME encoded message
--raeburn1164770585
Content-Type: text/plain
raeburn Tue Nov 28 22:23:05 2006 EDT
Modified files:
/loncom/interface lonfeedback.pm
Log:
Internationalization
--raeburn1164770585
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20061128222305.txt"
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.219 loncom/interface/lonfeedback.pm:1.220
--- loncom/interface/lonfeedback.pm:1.219 Tue Nov 28 17:27:56 2006
+++ loncom/interface/lonfeedback.pm Tue Nov 28 22:23:02 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.219 2006/11/28 22:27:56 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.220 2006/11/29 03:23:02 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -291,6 +291,13 @@
'disp' => 'Display',
'nolo' => 'Not new',
'togg' => 'Toggle read/unread',
+ 'aner' => 'An error occurred opening the manifest file.',
+ 'difo' => 'Discussion for',
+ 'aerr' => 'An error occurred opening the export file for posting',
+ 'aysu' => 'Are you sure you want to delete this post?',
+ 'dpwn' => 'Deleted posts will no longer be visible to you and other students',
+ 'bwco' => 'but will continue to be visible to your instructor',
+ 'depo' => 'Deleted posts will no longer be visible to you or anyone else.',
);
my $currdisp = $lt{'allposts'};
@@ -385,9 +392,9 @@
imscp_v1p1.xsd http://www.imsglobal.org/xsd/imsmd_v1p2 imsmd_v1p2p2.xsd">
<organizations default="$ressymb">
<organization identifier="$ressymb">
- <title>Discussion for $ressymb</title>\n|;
+ <title>$lt{'difo'} $ressymb</title>\n|;
} else {
- $discussion .= 'An error occurred opening the manifest file.<br />';
+ $discussion .= $lt{'aner'}.'<br />';
}
} else {
my $colspan=$maxdepth+1;
@@ -400,12 +407,12 @@
prevparm = "&previous="+previous
}
if (caller == 'studentdelete') {
- if (confirm("Are you sure you want to delete this post?\\nDeleted posts will no longer be visible to you and other students,\\nbut will continue to be visible to your instructor")) {
+ if (confirm("$lt{'aysu'}\\n$lt{'dpwn'},\\n$lt{'bwco'}")) {
document.location.href = "/adm/feedback?hide="+symbparm+prevparm+groupparm
}
} else {
if (caller == 'seeiddelete') {
- if (confirm("Are you sure you want to delete this post?\\nDeleted posts will no longer be visible to you or anyone else")) {
+ if (confirm("$lt{'aysu'}\\n$lt{'depo'}")) {
document.location.href = "/adm/feedback?deldisc="+symbparm+prevparm+groupparm
}
}
@@ -463,7 +470,7 @@
}
$discussion .= '</tr></table></td></tr>';
- my $numhidden = keys %notshown;
+ my $numhidden = keys(%notshown);
if ($numhidden > 0) {
my $colspan = $maxdepth+1;
$discussion.="\n".'<tr><td bgcolor="#CCCCCC" colspan="'.$colspan.'">'.
@@ -567,7 +574,7 @@
$imsitems{$alldiscussion{$_}}{'attach'}.'</body></html>'."\n";
close($postingfile);
} else {
- $discussion .= 'An error occurred opening the export file for posting '.$alldiscussion{$_}.'<br />';
+ $discussion .= $lt{'aerr'}.' '.$alldiscussion{$_}.'<br />';
}
$copyresult.=&replicate_attachments($imsitems{$alldiscussion{$_}}{'allattachments'},$tempexport);
} else {
@@ -627,7 +634,6 @@
$discussion .= &mt('Posts by').':';
if ($totposters > 0) {
foreach my $poster (@posters) {
- $poster =~ s/:/\@/;
$discussion .= ' '.$poster.',';
}
$discussion =~ s/,$//;
@@ -708,13 +714,13 @@
open(OUTPUT, "zip -r $imszip * 2> /dev/null |");
close(OUTPUT);
chdir $cwd;
- $discussion .= 'Download the zip file from <a href="'.$imszipfile.'">Discussion Posting Archive</a><br />';
+ $discussion .= &mt('Download the zip file from [_1]Discussion Posting Archive','<a href="'.$imszipfile.'">').'</a><br />';
if ($copyresult) {
- $discussion .= 'The following errors occurred during export - <br />'.$copyresult;
+ $discussion .= &mt('The following errors occurred during export').' - <br />'.$copyresult;
}
}
} else {
- $discussion .= '<br />Unfortunately you will not be able to retrieve an archive of the discussion posts at this time, because there was a problem creating a manifest file.<br />';
+ $discussion .= '<br />'.&mt('Unfortunately you will not be able to retrieve an archive of the discussion posts at this time, because there was a problem creating a manifest file.').'<br />';
}
return $discussion;
}
@@ -777,15 +783,21 @@
my ($mode,$ressymb,$now,$subject,$comment,$outputtarget,$attachnum,
$currnewattach,$currdelold,$group) = @_;
my $newattachmsg;
+ my %lt = &Apache::lonlocal::texthash(
+ 'note' => 'Note: in anonymous discussion, your name is visible only to course faculty',
+ 'title' => 'Title',
+ 'podi' => 'Post Discussion',
+ 'poan' => 'Post Anonymous Discussion',
+ 'newa' => 'New attachments',
+ );
my $postingform = (<<ENDDISCUSS);
-<form action="/adm/feedback" method="post" name="mailform" enctype="multipart/form-data"> <input type="submit" name="discuss" value="Post Discussion" />
-<input type="submit" name="anondiscuss" value="Post Anonymous Discussion" /> <input type="hidden" name="symb" value="$ressymb" />
+<form action="/adm/feedback" method="post" name="mailform" enctype="multipart/form-data"> <input type="submit" name="discuss" value="$lt{'podi'}" />
+<input type="submit" name="anondiscuss" value="$lt{'poan'}" /> <input type="hidden" name="symb" value="$ressymb" />
<input type="hidden" name="sendit" value="true" />
<input type="hidden" name="timestamp" value="$now" />
<br /><a name="newpost"></a>
-<font size="1">Note: in anonymous discussion, your name is visible only
-to course faculty</font><br />
-<b>Title:</b> <input type="text" name="subject" value="$subject" size="30" /><br /><br />
+<font size="1">$lt{'note'}</font><br />
+<b>$lt{'title'}:</b> <input type="text" name="subject" value="$subject" size="30" /><br /><br />
<textarea name="comment" cols="80" rows="14" wrap="hard">$comment</textarea>
ENDDISCUSS
if ($env{'form.origpage'}) {
@@ -809,7 +821,7 @@
$now,$currnewattach,
$currdelold,'',$mode);
if ((ref($currnewattach) eq 'ARRAY') && (@{$currnewattach} > 0)) {
- $newattachmsg = '<br /><b>New attachments</b><br />';
+ $newattachmsg = '<br /><b>'.$lt{'newa'}.'</b><br />';
if (@{$currnewattach} > 1) {
$newattachmsg .= '<ol>';
foreach my $item (@{$currnewattach}) {
@@ -1335,7 +1347,7 @@
if ($type eq 'export') {
$$imsfiles{$idx}{$i} = '';
if ($attachmsg) {
- $$attachtxt{$i} = '<br />Attachments:<br />';
+ $$attachtxt{$i} = '<br />'.&mt('Attachments').':<br />';
foreach (sort keys %currattach) {
if ($$allattachments{$_}{'filename'} =~ m-^/uploaded/([^/]+/[^/]+)(/feedback)?(/?\d*)/([^/]+)$-) {
my $fname = $1.$3.'/'.$4;
@@ -1346,7 +1358,7 @@
}
} else {
if ($attachmsg) {
- $$attachtxt{$i} = '<br />Attachments:'.$attachmsg.'<br />';
+ $$attachtxt{$i} = '<br />'.&mt('Attachments').':'.$attachmsg.'<br />';
} else {
$$attachtxt{$i} = '';
}
@@ -1393,11 +1405,11 @@
print $attachcopy $content;
close($attachcopy);
} else {
- $response .= 'Error copying file attachment - '.$5.' to IMS package: '.$!.'<br />'."\n";
+ $response .= &mt('Error copying file attachment - [_1] to IMS package',$5).': '.$!.'<br />'."\n";
}
} else {
&Apache::lonnet::logthis("Replication of attachment failed when building IMS export of discussion posts - domain: $1, course: $2, file: $$attachrefs{$id}{'filename'} -error: $rtncode");
- $response .= 'Error copying file attachment - '.$5.' to IMS package: '.$rtncode.'<br />'."\n";
+ $response .= &mt('Error copying file attachment - [_1] to IMS package: ',$5).$rtncode.'<br />'."\n";
}
}
}
@@ -1411,6 +1423,13 @@
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','currnewattach','addnewattach','deloldattach','delnewattach','timestamp','idx','anondiscuss','discuss','blog','group','ref']);
}
+ my %lt = &Apache::lonlocal::texthash(
+ 'plch' => 'Please check at least one of the following feedback types:',
+ 'myqu' => 'My question/comment/feedback:',
+ 'title' => 'Title',
+ 'reta' => 'Retained attachments',
+ 'atta' => 'Attachment (128 KB max size)',
+ );
my $title=&Apache::lonnet::gettitle($feedurl);
if (!$title) { $title = $feedurl; }
my $quote='';
@@ -1501,7 +1520,7 @@
if ($idx > 0) {
my %subversions = ();
&get_post_versions(\%subversions,$contrib{$idx.':subject'},1,$numoldver);
- $subject = 'Re: '.$subversions{$numoldver};
+ $subject = &mt('Re: ')..$subversions{$numoldver};
}
$subject = &HTML::Entities::encode($subject,'<>&"');
} else {
@@ -1548,6 +1567,7 @@
}
my $latexHelp=&Apache::loncommon::helpLatexCheatsheet();
my $send=&mt('Send');
+ my $alert = &mt('Please select a feedback type.');
my $js= <<END;
<script type="text/javascript">
//<!--
@@ -1578,7 +1598,7 @@
}
document.mailform.submit();
} else {
- alert('Please select a feedback type.');
+ alert('$alert');
}
}
$anonchk
@@ -1616,13 +1636,13 @@
END
}
$r->print(<<END);
-Please check at least one of the following feedback types:
+$lt{'plch'}
$options<hr />
$quote
-<p>My question/comment/feedback:</p>
+<p>$lt{'myqu'}</p>
<p>
$latexHelp
-Title: <input type="text" name="subject" size="30" value="$subject" /></p>
+$lt{'title'}: <input type="text" name="subject" size="30" value="$subject" /></p>
<p>
<textarea name="comment" id="comment" cols="60" rows="10" wrap="hard">$comment
</textarea></p>
@@ -1648,7 +1668,7 @@
}
} else {
$r->print(<<END);
-Attachment (128 KB max size): <input type="file" name="attachment" />
+$lt{'atta'}: <input type="file" name="attachment" />
</p>
END
}
@@ -1678,7 +1698,7 @@
$r->print(&generate_attachments_button($postidx,$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,$numoldver));
if ($attachnum > 0) {
if (@currnewattach > 0) {
- $newattachmsg .= '<br /><b>New attachments</b><br />';
+ $newattachmsg .= '<br /><b>'.&mt('New attachments').'</b><br />';
if (@currnewattach > 1) {
$newattachmsg .= '<ol>';
foreach my $item (@currnewattach) {
@@ -1692,7 +1712,7 @@
}
}
if ($attachmsg) {
- $r->print("<br /><b>Retained attachments</b>:$attachmsg<br />\n");
+ $r->print("<br /><b>$lt{'reta'}</b>:$attachmsg<br />\n");
}
if ($newattachmsg) {
$r->print("$newattachmsg<br />");
@@ -1983,7 +2003,8 @@
'spse' => 'Specific sections',
'spgr' => 'Specific groups',
'psub' => 'Pick specific users (by name)',
- 'shal' => 'Show a list of current posters'
+ 'shal' => 'Show a list of current posters',
+ 'stor' => 'Store changes',
);
my %sort_types = ();
@@ -2105,7 +2126,7 @@
<br />
<input type="hidden" name="previous" value="$previous" />
<input type="hidden" name="applysort" value="$symb" />
-<input type="button" name="sub" value="Store Changes" onClick="verifyFilter()" />
+<input type="button" name="sub" value="$lt{'stor'}" onClick="verifyFilter()" />
END
if (exists($env{'form.group'})) {
$r->print('<input type="hidden" name="group" value="'.$env{'form.group'}.'" />');
@@ -2154,7 +2175,7 @@
my %lt = &Apache::lonlocal::texthash(
sele => 'Select',
full => 'Fullname',
- usdo => 'Username/domain',
+ usdo => 'Username:domain',
post => 'Posts',
);
if ($contrib{'version'}) {
@@ -2215,7 +2236,7 @@
$r->print(&Apache::loncommon::start_data_table_row().
'<td align="right">'.$count.'</td>
<td align="center"><label><input name="stuinfo" type="checkbox" value="'.$_.'" /></td>
- <td>'.$last.', '.$first.' ('.$uname.','.$udom.')</label></td>
+ <td>'.$last.', '.$first.' ('.$uname.':'.$udom.')</label></td>
<td>'.$postcounts{$_}.'</td>'.
&Apache::loncommon::end_data_table_row());
}
@@ -2299,13 +2320,16 @@
sub fail_redirect {
my ($r,$feedurl) = @_;
if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' };
+ my %lt = &Apache::lonlocal::texthash(
+ 'sorr' => 'Sorry, no recipients ...',
+ );
my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');
$r->print(&Apache::loncommon::start_page('Feedback not sent',undef,
{'redirect' => [2,$feedurl],
'only_body' => 1,}));
$r->print(<<ENDFAILREDIR);
<img align="right" src="$logo" />
-<b>Sorry, no recipients ...</b>
+<b>$lt{'sorr'}</b>
ENDFAILREDIR
$r->print(&Apache::loncommon::end_page());
}
@@ -2564,16 +2588,21 @@
sub assemble_email {
my ($feedurl,$message,$prevattempts,$usersaw,$useranswer)=@_;
+ my %lt = &Apache::lonlocal::texthash(
+ 'prev' => 'Previous attempts of student (if applicable)',
+ 'orig' => 'Original screen output (if applicable)',
+ 'corr' => 'Correct Answer(s) (if applicable)',
+ );
my $email=<<"ENDEMAIL";
$message
ENDEMAIL
my $citations=<<"ENDCITE";
-<h2>Previous attempts of student (if applicable)</h2>
+<h2>$lt{'prev'}</h2>
$prevattempts
<br /><hr />
-<h2>Original screen output (if applicable)</h2>
+<h2>$lt{'orig'}</h2>
$usersaw
-<h2>Correct Answer(s) (if applicable)</h2>
+<h2>$lt{'corr'}</h2>
$useranswer
ENDCITE
return ($email,$citations);
@@ -2837,7 +2866,7 @@
my $end_page = &Apache::loncommon::end_page();
$r->print($start_page.'<table border="2"><tr><td>'.
- '<b>Subject:</b> '.$subject.'<br /><br />'.
+ '<b>'.&mt('Subject').':</b> '.$subject.'<br /><br />'.
$message.'</td></tr></table>'.$end_page);
}
@@ -2882,6 +2911,14 @@
sub modify_attachments {
my ($r,$currnewattach,$currdelold,$symb,$idx,$attachmenturls)=@_;
+ my %lt = &Apache::lonlocal::texthash(
+ 'subj' => 'Subject',
+ 'thfo' => 'The following attachments were part of the most recent saved version of this posting.',
+ 'chth' => 'Check the checkboxes for any you wish to remove.',
+ 'thef' => 'The following attachments have been uploaded for inclusion with this posting.',
+ 'adda' => 'Add a new attachment to this post.',
+ 'stch' => 'Store Changes',
+ );
my $js = <<END;
<script type="text/javascript">
function setAction () {
@@ -2924,7 +2961,7 @@
if ($attachmenturls) {
my @currold = keys %currattach;
if (@currold > 0) {
- $r->print("The following attachments were part of the most recent saved version of this posting.<br />Check the checkboxes for any you wish to remove<br />\n");
+ $r->print($lt{'thfo'}.'<br />'.$lt{'chth'}.'<br />'."\n");
foreach my $id (@currold) {
my $attachurl = &HTML::Entities::decode($attachments{$id}{'filename'});
$attachurl =~ m#/([^/]+)$#;
@@ -2935,7 +2972,7 @@
}
}
if ((ref($currnewattach) eq 'ARRAY') && (@{$currnewattach} > 0)) {
- $r->print("The following attachments have been uploaded for inclusion with this posting.<br />Check the checkboxes for any you wish to remove<br />\n");
+ $r->print($lt{'thef'}.'<br />'.$lt{'chth'}.'<br />'."\n");
foreach (@{$currnewattach}) {
$_ =~ m#/([^/]+)$#;
$r->print('<label><input type="checkbox" name="delnewattach" value="'.$_.'" /> '.$1.'</label><br />'."\n");
@@ -2943,7 +2980,7 @@
$r->print("<br />");
}
$r->print(<<END);
- Add a new attachment to this post. <input type="file" name="addnewattach" /><input type="button" name="upload" value="Upload" onClick="this.form.submit()" />
+ $lt{'adda'} <input type="file" name="addnewattach" /><input type="button" name="upload" value="Upload" onClick="this.form.submit()" />
</td>
</tr>
</table>
@@ -2956,14 +2993,14 @@
<input type="hidden" name="blog" value="$env{'form.blog'}" />
<input type="hidden" name="discuss" value="$env{'form.discuss'}" />
END
- foreach (@{$currnewattach}) {
- $r->print('<input type="hidden" name="currnewattach" value="'.$_.'" />'."\n");
+ foreach my $item (@{$currnewattach}) {
+ $r->print('<input type="hidden" name="currnewattach" value="'.$item.'" />'."\n");
}
- foreach (@{$currdelold}) {
- $r->print('<input type="hidden" name="deloldattach" value="'.$_.'" />'."\n");
+ foreach my $item (@{$currdelold}) {
+ $r->print('<input type="hidden" name="deloldattach" value="'.$item.'" />'."\n");
}
$r->print(<<END);
- <input type="button" name="rtntoedit" value="Store Changes" onClick="setAction()"/>
+ <input type="button" name="rtntoedit" value="$lt{'stch'}" onClick="setAction()"/>
</form>
$end_page
END
@@ -3002,10 +3039,13 @@
my ($idx,$attachnum,$ressymb,$now,$currnewattach,$deloldattach,$numoldver,$mode) = @_;
my $origpage = $ENV{'REQUEST_URI'};
my $att=$attachnum.' '.&mt("attachments");
+ my %lt = &Apache::lonlocal::texthash(
+ 'clic' => 'Click to add/remove attachments',
+ );
my $response = (<<END);
<br />
<form name="attachment" action="/adm/feedback?attach=$ressymb" method="post">
-Click to add/remove attachments: <input type="button" value="$att"
+$lt{'clic'}: <input type="button" value="$att"
onClick="if (typeof(document.mailform.onsubmit)=='function') {document.mailform.onsubmit();};this.form.comment.value=escape(document.mailform.comment.value);this.form.subject.value=escape(document.mailform.subject.value);
END
unless ($mode eq 'board') {
--raeburn1164770585--