--- loncom/interface/lonmsgdisplay.pm 2006/12/06 23:44:33 1.46 +++ loncom/interface/lonmsgdisplay.pm 2006/12/08 14:43:38 1.50 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging display # -# $Id: lonmsgdisplay.pm,v 1.46 2006/12/06 23:44:33 raeburn Exp $ +# $Id: lonmsgdisplay.pm,v 1.50 2006/12/08 14:43:38 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -74,8 +74,8 @@ email program, so they have full access interface, or other features they may wish to use in response to the student's query. -=item * B: LON-CAPA can block display of e-mails that are -sent to a student during an online exam. A course coordinator or +=item * B: LON-CAPA can block selected communication +features for students during an online exam. A course coordinator or instructor can set an open and close date/time for scheduled online exams in a course. If a user uses the LON-CAPA internal messaging system to display e-mails during the scheduled blocking event, @@ -143,6 +143,14 @@ sub folderlist { fold => 'Folder', show => 'Show', go => 'Go', + nnff => 'New Name for Folder', + newn => 'New Name', + thfm => 'The folder may not be renamed', + fmnb => 'folder may not be renamed as it is a folder provided by the system.', + asth => 'as this name is already in use for a system-provided or user-defined folder.', + the => 'The', + tnfm => 'The new folder may not be named', + ); my %actions = &Apache::lonlocal::texthash( @@ -182,16 +190,16 @@ function folder_choice(targetform,caller if (targetform.folderaction.options[targetform.folderaction.selectedIndex].value == 'rename') { for (var i=0; i '.$lt{'fold'}.'
'."\n". - &Apache::loncommon::select_form($folder,'folder',%formhash).' + &Apache::loncommon::select_form($folder,'folder',%formhash).' '.$lt{'show'}.'
+ join("\n",map { '' + } + (10,20,50,100,200)).' '.$lt{'actn'}.'
'. - &Apache::loncommon::select_form('view','folderaction',%actions).' + &Apache::loncommon::select_form('view','folderaction',%actions).'
'. ' @@ -244,7 +253,7 @@ function folder_choice(targetform,caller '. - '

'.&mt('New Folder').'
'. + '
'.&mt('New Folder').'
'. '
@@ -252,18 +261,18 @@ function folder_choice(targetform,caller '."\n". ''. ''. - ($folder=~/^(new|critical)/?'':''); + ($folder=~/^(new|critical)/?'':''); return $output; } sub get_permanent_folders { - my %permfolders = &Apache::lonlocal::texthash ( - '' => 'INBOX', - 'trash' => 'TRASH', - 'new' => 'New Messages Only', - 'critical' => 'Critical', - 'sent' => 'Sent Messages', - ); + my %permfolders = + &Apache::lonlocal::texthash('' => 'INBOX', + 'trash' => 'TRASH', + 'new' => 'New Messages Only', + 'critical' => 'Critical', + 'sent' => 'Sent Messages', + ); return %permfolders; } @@ -323,19 +332,18 @@ sub makefolder { while (defined($userfolders{$folder_id})) { $folder_id ++; } - my %folderinfo = ( - id => $folder_id, - created => time, - ); + my %folderinfo = ( id => $folder_id, + created => time, ); $outcome = - &Apache::lonnet::put('email_folders',{$newfolder => \%folderinfo, - "\0".'idcount' => $folder_id}); + &Apache::lonnet::put('email_folders',{$newfolder => \%folderinfo, + "\0".'idcount' => $folder_id}); my $releaseresult = &release_msgfolder_lock(); if ($releaseresult ne 'ok') { $warning = $releaseresult; } } else { - $outcome = 'Error - could not obtain lock on email folders record.'; + $outcome = + &mt('Error - could not obtain lock on email folders record.'); } return ($outcome,$warning); } @@ -386,10 +394,8 @@ sub renamefolder { if (ref($userfolders{$folder}) eq 'HASH') { %folderinfo = %{$userfolders{$folder}}; } else { - %folderinfo = ( - id => $folder, - created => $userfolders{$folder}, - ); + %folderinfo = ( id => $folder, + created => $userfolders{$folder},); } my $outcome = &Apache::lonnet::put('email_folders',{$newname => \%folderinfo}); @@ -401,14 +407,12 @@ sub renamefolder { sub get_msgfolder_lock { # get lock for mail folder counter. - my $lockhash = { - "\0".'lock_counter' => time, - }; + my $lockhash = { "\0".'lock_counter' => time, }; my $tries = 0; my $gotlock = &Apache::lonnet::newput('email_folders',$lockhash); while (($gotlock ne 'ok') && $tries <3) { $tries ++; - sleep 1; + sleep(1); $gotlock = &Apache::lonnet::newput('email_folders',$lockhash); } return $gotlock; @@ -573,10 +577,10 @@ sub disgroup { $result.=''. '
'.$lt{$status}. ''. - ''. '  '. - ''. '

'. &Apache::loncommon::start_data_table(). @@ -847,7 +851,7 @@ sub get_course_desc { if (defined($env{'course.'.$fromcid.'.description'})) { $description = $env{'course.'.$fromcid.'.description'}; } else { - my %courseinfo=&Apache::lonnet::coursedescription($fromcid); $description = $courseinfo{'description'}; + my %courseinfo=&Apache::lonnet::coursedescription($fromcid); $description = $courseinfo{'description'}; } $$descriptions{$fromcid} = $description; @@ -893,14 +897,14 @@ sub disnew { $blocked{$id} = 'ON'; $numblocked ++; } else { - push @newmsgs, { + push(@newmsgs, { msgid => $msgid, sendtime => $sendtime, shortsub => $shortsubj, from => $fromname, fromdom => $fromdom, - course => $description - } + course => $description, + }); } } } @@ -908,18 +912,18 @@ sub disnew { if ($#newmsgs >= 0) { $r->print(<$lt{'nm'} - +
 
TABLEHEAD foreach my $msg (@newmsgs) { $r->print(<<"ENDLINK"); - + ENDLINK foreach my $item ('sendtime','from','fromdom','shortsub','course') { $r->print(""); } - $r->print(""); + $r->print(""); } $r->print('
  $lt{'da'}$lt{'us'}$lt{'do'}$lt{'su'}$lt{'co'}
$lt{'op'}$lt{'op'}$msg->{$item}
'); } elsif ($numblocked == 0) { @@ -997,7 +1001,7 @@ ENDDISHEADER if ($lastdis>$#temp) { $lastdis=$#temp; } $r->print(&scrollbuttons($startdis,$number,$firstdis,$lastdis,$totalnumber)); $r->print('
'. - '
 '); + ''); } else { @@ -1151,13 +1155,17 @@ sub compout { my $dismsg=''; my $disbase=''; my $func=&mt('Send New'); - my %lt=&Apache::lonlocal::texthash('us' => 'Username', - 'do' => 'Domain', - 'ad' => 'Additional Recipients', - 'sb' => 'Subject', - 'ca' => 'Cancel', - 'ma' => 'Mail'); - + my %lt=&Apache::lonlocal::texthash('us' => 'Username', + 'do' => 'Domain', + 'ad' => 'Additional Recipients', + 'sb' => 'Subject', + 'ca' => 'Cancel', + 'ma' => 'Mail', + 'gen' => 'Generate messages from a file', + 'gmt' => 'General message text', + 'tff' => 'The file format for the uploaded portion of the message is', + 'uas' => 'Upload and Send', + ); if (&Apache::lonnet::allowed('srm',$env{'request.course.id'}) || &Apache::lonnet::allowed('srm',$env{'request.course.id'}. '/'.$env{'request.course.sec'})) { @@ -1256,7 +1264,7 @@ sub compout { my $latexHelp = Apache::loncommon::helpLatexCheatsheet(); if ($broadcast ne 'upload') { $r->print(<<"ENDCOMP"); -
 '); if ($env{'form.sortedby'} eq "revdate") { $r->print(''.&mt('Date').'
$lt{'ad'}
username:domain,username:domain, ... +
$lt{'ad'}:
username:domain,username:domain, ...
$lt{'sb'}: @@ -1281,31 +1289,34 @@ ENDCOMP $env{'form.group'}.'" />'); } } else { # $broadcast is 'upload' - $r->print(<print(< -

Generate messages from a file

+

$lt{'gen'}

Subject:

-

General message text
+

$lt{'gmt'}:

-The file format for the uploaded portion of the message is: -

-username1:domain1: text
-username2:domain2: text
-username3:domain1: text
-
+$lt{'tff'}: +ENDBLOCK + $r->print(' +
'."\n".
+&mt('username1:domain1: text')."\n".
+&mt('username2:domain2: text')."\n".
+&mt('username3:domain1: text')."\n".
+'

-The messages will be assembled from all lines with the respective -username:domain, and appended to the general message text.

+'.&mt('The messages will be assembled from all lines with the respective'."\n".'username:domain, and appended to the general message text.')); + $r->print(<

$dispcrit -

+

ENDUPLOAD } if ($broadcast eq 'group') { @@ -1342,8 +1353,8 @@ sub retrieve_instructor_comments { my ($user,$domain)=@_; my $target=$env{'form.grade_target'}; if (! $env{'request.course.id'}) { return; } - if (! &Apache::lonnet::allowed('srm',$env{'request.course.id'}) - && ! &Apache::lonnet::allowed('srm',$env{'request.course.id'}. + if (! &Apache::lonnet::allowed('dff',$env{'request.course.id'}) + && ! &Apache::lonnet::allowed('dff',$env{'request.course.id'}. '/'.$env{'request.course.sec'})) { return; } @@ -1369,10 +1380,10 @@ sub disfacetoface { my ($r,$user,$domain)=@_; my $target=$env{'form.grade_target'}; unless ($env{'request.course.id'}) { return; } - if (!&Apache::lonnet::allowed('srm',$env{'request.course.id'}) - && ! &Apache::lonnet::allowed('srm',$env{'request.course.id'}. + if (!&Apache::lonnet::allowed('dff',$env{'request.course.id'}) + && ! &Apache::lonnet::allowed('dff',$env{'request.course.id'}. '/'.$env{'request.course.sec'})) { - $r->print('Not allowed'); + $r->print(&mt('Not allowed')); return; } my %records=&Apache::lonnet::dump('nohist_email', @@ -1451,10 +1462,10 @@ sub general_message { sub facetoface { my ($r,$stage)=@_; - if (!&Apache::lonnet::allowed('srm',$env{'request.course.id'}) - && ! &Apache::lonnet::allowed('srm',$env{'request.course.id'}. + if (!&Apache::lonnet::allowed('dff',$env{'request.course.id'}) + && ! &Apache::lonnet::allowed('dff',$env{'request.course.id'}. '/'.$env{'request.course.sec'})) { - $r->print('Not allowed'); + $r->print(&mt('Not allowed')); return; } my $crstype = &Apache::loncommon::course_type(); @@ -1541,7 +1552,8 @@ sub examblock { 'cbds' => 'Communication blocking during scheduled exams', 'desc' => "You can use communication blocking to prevent $usertype enrolled in this course from displaying LON-CAPA messages sent by other $usertype during an online exam. As blocking of communication could potentially interrupt legitimate communication between $usertype who are also both enrolled in a different LON-CAPA course, please be careful that you select the correct start and end times for your scheduled exam when setting or modifying these parameters.", 'mecb' => 'Modify existing communication blocking periods', - 'ncbc' => 'No communication blocks currently stored' + 'ncbc' => 'No communication blocks currently stored', + 'stor' => 'Store', ); my %ltext = &Apache::lonlocal::texthash( @@ -1580,7 +1592,7 @@ sub examblock { $r->print(<<"END");
- + $end_page END @@ -1591,10 +1603,6 @@ sub blockstore { my $r = shift; my %lt=&Apache::lonlocal::texthash( 'tfcm' => 'The following changes were made', - 'cbps' => 'communication blocking period(s)', - 'werm' => 'was/were removed', - 'wemo' => 'was/were modified', - 'wead' => 'was/were added', 'ncwm' => 'No changes were made.' ); my %adds = (); @@ -1651,13 +1659,13 @@ sub blockstore { if ($chgestotal > 0) { $r->print($lt{'tfcm'}.'
    '); if ($canceltotal > 0) { - $r->print('
  • '.$canceltotal.' '.$lt{'cbps'},' '.$lt{'werm'}.'
  • '); + $r->print('
  • '.&mt('[quant,_1,communication blocking period was,communication blocking periods were] removed.',$canceltotal).'
  • '); } if ($modtotal > 0) { - $r->print('
  • '.$modtotal.' '.$lt{'cbps'},' '.$lt{'wemo'}.'
  • '); + $r->print('
  • '.&mt('[quant,_1,communication blocking period was,communication blocking periods were] modified.',$modtotal).'
  • '); } if ($addtotal > 0) { - $r->print('
  • '.$addtotal.' '.$lt{'cbps'},' '.$lt{'wead'}.'
  • '); + $r->print('
  • '.&mt('[quant,_1,communication blocking period was,communication blocking periods were] added.',$addtotal).'
  • '); } $r->print('
'); } else { @@ -2282,7 +2290,7 @@ sub handler { unless ($dismode) { $dismode=''; } else { - $sqs.='&dismode='.&escape($dismode); + $sqs.='&dismode='.&escape($dismode); } # --------------------------------------------------------------------- Display