Diff for /loncom/interface/lonmsg.pm between versions 1.87 and 1.90

version 1.87, 2004/03/01 01:19:51 version 1.90, 2004/03/01 18:30:50
Line 802  ENDDISHEADER Line 802  ENDDISHEADER
   
 sub compout {  sub compout {
     my ($r,$forwarding,$broadcast)=@_;      my ($r,$forwarding,$broadcast)=@_;
       my $dispcrit='';      &printheader($r,'/adm/email?compose=upload',
        'Distribute from uploaded file');
       my $dispcrit='';
     my $dissub='';      my $dissub='';
     my $dismsg='';      my $dismsg='';
     my $func=&mt('Send New');      my $func=&mt('Send New');
Line 949  sub facetoface { Line 951  sub facetoface {
     unless (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) {      unless (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) {
  return;   return;
     }      }
       &printheader($r,
    '/adm/email?recordftf=query',
    "User Notes, Face-to-Face, Critical Messages");
 # from query string  # from query string
   
     if ($ENV{'form.recname'}) { $ENV{'form.recuname'}=$ENV{'form.recname'}; }      if ($ENV{'form.recname'}) { $ENV{'form.recuname'}=$ENV{'form.recname'}; }
     if ($ENV{'form.recdom'}) { $ENV{'form.recdomain'}=$ENV{'form.recdom'}; }      if ($ENV{'form.recdom'}) { $ENV{'form.recdomain'}=$ENV{'form.recdom'}; }
   
Line 960  sub facetoface { Line 966  sub facetoface {
     my $domform = &Apache::loncommon::select_dom_form($defdom,'recdomain');      my $domform = &Apache::loncommon::select_dom_form($defdom,'recdomain');
     my $stdbrws = &Apache::loncommon::selectstudent_link      my $stdbrws = &Apache::loncommon::selectstudent_link
  ('stdselect','recuname','recdomain');   ('stdselect','recuname','recdomain');
       my %lt=&Apache::lonlocal::texthash('user' => 'Username',
          'dom' => 'Domain',
          'head' => 'User Notes, Records of Face-To-Face Discussions, and Critical Messages in Course',
          'subm' => 'Retrieve discussion and message records',
          'newr' => 'New Record (record is visible to course faculty and staff)',
          'post' => 'Post this Record');
     $r->print(<<"ENDTREC");      $r->print(<<"ENDTREC");
 <h3>User Notes, Records of Face-To-Face Discussions, and Critical Messages in Course</h3>  <h3>$lt{'head'}</h3>
 <form method="post" action="/adm/email" name="stdselect">  <form method="post" action="/adm/email" name="stdselect">
 <input type="hidden" name="recordftf" value="retrieve" />  <input type="hidden" name="recordftf" value="retrieve" />
 <table>  <table>
 <tr><td>Username:</td><td><input type=text size=12 name=recuname value="$ENV{'form.recuname'}"></td>  <tr><td>$lt{'user'}:</td><td><input type="text" size="12" name="recuname" value="$ENV{'form.recuname'}" /></td>
 <td rowspan="2">  <td rowspan="2">
 $stdbrws  $stdbrws
 <input type="submit" value="Retrieve discussion and message records"></td>  <input type="submit" value="$lt{'subm'}" /></td>
 </tr>  </tr>
 <tr><td>Domain:</td>  <tr><td>$lt{'dom'}:</td>
 <td>$domform</td></tr>  <td>$domform</td></tr>
 </table>  </table>
 </form>  </form>
Line 982  ENDTREC Line 994  ENDTREC
            &user_normal_msg_raw(             &user_normal_msg_raw(
             $ENV{'course.'.$ENV{'request.course.id'}.'.num'},              $ENV{'course.'.$ENV{'request.course.id'}.'.num'},
             $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},              $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
             'Record ['.$ENV{'form.recuname'}.':'.$ENV{'form.recdomain'}.']',              &mt('Record').
        ' ['.$ENV{'form.recuname'}.':'.$ENV{'form.recdomain'}.']',
     $ENV{'form.newrecord'});      $ENV{'form.newrecord'});
         }          }
         $r->print('<h3>'.&Apache::loncommon::plainname($ENV{'form.recuname'},          $r->print('<h3>'.&Apache::loncommon::plainname($ENV{'form.recuname'},
Line 994  ENDTREC Line 1007  ENDTREC
 <input name="recuname" value="$ENV{'form.recuname'}" type="hidden" />  <input name="recuname" value="$ENV{'form.recuname'}" type="hidden" />
 ENDRHEAD  ENDRHEAD
         $r->print(<<ENDBFORM);          $r->print(<<ENDBFORM);
 <hr />New Record (record is visible to course faculty and staff)<br />  <hr />$lt{'newr'}<br />
 <textarea name="newrecord" cols="80" rows="10" wrap="hard"></textarea>  <textarea name="newrecord" cols="80" rows="10" wrap="hard"></textarea>
 <br />  <br />
 <input type="hidden" name="recordftf" value="post" />  <input type="hidden" name="recordftf" value="post" />
 <input type="submit" value="Post this record" />  <input type="submit" value="$lt{'post'}" />
 </form>  </form>
 ENDBFORM  ENDBFORM
     }      }
 }  }
   # ----------------------------------------------------------- Display a message
   
   sub displaymessage {
       my ($r,$msgid)=@_;
       &statuschange($msgid,'read');
       my %message=&Apache::lonnet::get('nohist_email',[$msgid]);
       my %content=&unpackagemsg($message{$msgid});
   # info to generate "next" and "previous" buttons
       my @messages=&sortedmessages();
       my $counter=0;
       $r->print('<pre>');
       my $escmsgid=&Apache::lonnet::escape($msgid);
       foreach (@messages) {
    if ($_->[5] eq $escmsgid){
       last;
    }
    $counter++;
       }
       $r->print('</pre>');
       my $number_of_messages = scalar(@messages); #subtract 1 for last index
   # start output
       &printheader($r,'/adm/email?display='.$msgid,'Display a Message','',$content{'baseurl'});
       my %courseinfo=&Apache::lonnet::coursedescription($content{'courseid'});
   # Functions
       $r->print('<table border="2" width="100%"><tr bgcolor="#FFFFAA"><td>'.&mt('Functions').':</td>'.
         '<td><a href="/adm/email?replyto='.&Apache::lonnet::escape($msgid).$sqs.
         '"><b>'.&mt('Reply').'</b></a></td>'.
         '<td><a href="/adm/email?forward='.&Apache::lonnet::escape($msgid).$sqs.
         '"><b>'.&mt('Forward').'</b></a></td>'.
         '<td><a href="/adm/email?markunread='.&Apache::lonnet::escape($msgid).$sqs.
         '"><b>'.&mt('Mark Unread').'</b></a></td>'.
         '<td><a href="/adm/email?markdel='.&Apache::lonnet::escape($msgid).$sqs.
         '"><b>Delete</b></a></td>'.
         '<td><a href="/adm/email?sortedby='.$ENV{'form.sortedby'}.
         '"><b>'.&mt('Display all Messages').'</b></a></td>');
       if ($counter > 0){
    $r->print('<td><a href="/adm/email?display='.$messages[$counter-1]->[5].$sqs.
     '"><b>'.&mt('Previous').'</b></a></td>');
       }
       if ($counter < $number_of_messages - 1){
    $r->print('<td><a href="/adm/email?display='.$messages[$counter+1]->[5].$sqs.
     '"><b>'.&mt('Next').'</b></a></td>');
       }
       $r->print('</tr></table>');
       $r->print('<br /><b>'.&mt('Subject').':</b> '.$content{'subject'}.
         '<br /><b>'.&mt('From').':</b> '.
         &Apache::loncommon::aboutmewrapper(
    &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),
    $content{'sendername'},$content{'senderdomain'}).' ('.
         $content{'sendername'}.' at '.
         $content{'senderdomain'}.') '.
         ($content{'courseid'}?'<br /><b>'.&mt('Course').':</b> '.$courseinfo{'description'}.
          ($content{'coursesec'}?' ('.&mt('Group/Section').': '.$content{'coursesec'}.')':''):'').
         '<br /><b>'.&mt('Time').':</b> '.$content{'time'}.
         '<p><pre>'.
         &Apache::lontexconvert::msgtexconverted($content{'message'},1).
         '</pre><hr />'.$content{'citation'}.'</p>');
       return;   
   }
   
   # ================================================================== The Header
   
   sub header {
       my ($r,$title,$baseurl)=@_;
       $r->print('<html><head><title>Communication and Messages</title>');
       if ($baseurl) {
    $r->print("<base href=\"http://$ENV{'SERVER_NAME'}/$baseurl\" />");
       }
       $r->print(&Apache::loncommon::studentbrowser_javascript().'</head>'.
         &Apache::loncommon::bodytag('Communication and Messages'));
           $r->print(&Apache::lonhtmlcommon::breadcrumbs
                     (undef,($title?$title:'Communication and Messages')));
   
   }
   
   # ---------------------------------------------------------------- Print header
   
   sub printheader {
       my ($r,$url,$desc,$title,$baseurl)=@_;
       &Apache::lonhtmlcommon::add_breadcrumb
    ({href=>$url,
     text=>$desc});
       &header($r,$title,$baseurl);
   }
   
   
 # ===================================================================== Handler  # ===================================================================== Handler
   
Line 1024  sub handler { Line 1122  sub handler {
     $sqs='&sortedby='.$ENV{'form.sortedby'};      $sqs='&sortedby='.$ENV{'form.sortedby'};
 # ------------------------------------------------------ They checked for email  # ------------------------------------------------------ They checked for email
     &Apache::lonnet::put('email_status',{'recnewemail'=>0});      &Apache::lonnet::put('email_status',{'recnewemail'=>0});
   
   # ----------------------------------------------------------------- Breadcrumbs
   
       &Apache::lonhtmlcommon::clear_breadcrumbs();
       &Apache::lonhtmlcommon::add_breadcrumb
           ({href=>"/adm/communicate",
             text=>"Communication/Messages",
             faq=>12,bug=>'Communication Tools',});
   
 # --------------------------------------------------------------- Render Output  # --------------------------------------------------------------- Render Output
     if (!$ENV{'form.display'}) {  
  $r->print('<html><head><title>EMail and Messaging</title>'.  
   &Apache::loncommon::studentbrowser_javascript().'</head>'.  
   &Apache::loncommon::bodytag('EMail and Messages').  
   &Apache::loncommon::help_open_faq(12).  
   &Apache::loncommon::help_open_bug('Communication Tools'));  
     }  
     if ($ENV{'form.display'}) {      if ($ENV{'form.display'}) {
  my $msgid=$ENV{'form.display'};   &displaymessage($r,$ENV{'form.display'});
  &statuschange($msgid,'read');  
  my %message=&Apache::lonnet::get('nohist_email',[$msgid]);  
  my %content=&unpackagemsg($message{$msgid});  
 # info to generate "next" and "previous" buttons  
  my @messages=&sortedmessages();  
  my $counter=0;  
  $r->print('<pre>');  
  my $escmsgid=&Apache::lonnet::escape($msgid);  
  foreach (@messages) {  
     if ($_->[5] eq $escmsgid){  
  last;  
     }  
     $counter++;  
  }  
  $r->print('</pre>');  
  my $number_of_messages = scalar(@messages); #subtract 1 for last index  
 # start output  
  $r->print('<html><head><title>EMail and Messaging</title>');  
  if (defined($content{'baseurl'})) {  
     $r->print("<base href=\"http://$ENV{'SERVER_NAME'}/$content{'baseurl'}\" />");  
  }  
  $r->print(&Apache::loncommon::studentbrowser_javascript().  
   '</head>'.  
   &Apache::loncommon::bodytag('EMail and Messages').  
   &Apache::loncommon::help_open_faq(12).  
   &Apache::loncommon::help_open_bug('Communication Tools'));  
  my %courseinfo=&Apache::lonnet::coursedescription($content{'courseid'});  
   
  $r->print('<br /><b>'.&mt('Subject').':</b> '.$content{'subject'}.  
   '<br /><b>'.&mt('From').':</b> '.  
   &Apache::loncommon::aboutmewrapper(  
      &Apache::loncommon::plainname($content{'sendername'},$content{'senderdomain'}),  
      $content{'sendername'},$content{'senderdomain'}).' ('.  
   $content{'sendername'}.' at '.  
   $content{'senderdomain'}.') '.  
   ($content{'courseid'}?'<br /><b>'.&mt('Course').':</b> '.$courseinfo{'description'}.  
    ($content{'coursesec'}?' ('.&mt('Group/Section').': '.$content{'coursesec'}.')':''):'').  
   '<br /><b>'.&mt('Time').':</b> '.$content{'time'}.'<p>'.  
   '<table border=2><tr bgcolor="#FFFFAA"><td>'.&mt('Functions').':</td>'.  
   '<td><a href="/adm/email?replyto='.&Apache::lonnet::escape($msgid).$sqs.  
   '"><b>'.&mt('Reply').'</b></a></td>'.  
   '<td><a href="/adm/email?forward='.&Apache::lonnet::escape($msgid).$sqs.  
   '"><b>'.&mt('Forward').'</b></a></td>'.  
   '<td><a href="/adm/email?markunread='.&Apache::lonnet::escape($msgid).$sqs.  
   '"><b>'.&mt('Mark Unread').'</b></a></td>'.  
   '<td><a href="/adm/email?markdel='.&Apache::lonnet::escape($msgid).$sqs.  
   '"><b>Delete</b></a></td>'.  
   '<td><a href="/adm/email?sortedby='.$ENV{'form.sortedby'}.  
   '"><b>'.&mt('Display all Messages').'</b></a></td>');  
  if ($counter > 0){  
     $r->print('<td><a href="/adm/email?display='.$messages[$counter-1]->[5].$sqs.  
       '"><b>'.&mt('Previous').'</b></a></td>');  
  }  
  if ($counter < $number_of_messages - 1){  
     $r->print('<td><a href="/adm/email?display='.$messages[$counter+1]->[5].$sqs.  
       '"><b>'.&mt('Next').'</b></a></td>');  
  }  
  $r->print('</tr></table><p><pre>'.  
   &Apache::lontexconvert::msgtexconverted($content{'message'},1).  
   '</pre><hr>'.$content{'citation'});  
     } elsif ($ENV{'form.replyto'}) {      } elsif ($ENV{'form.replyto'}) {
  &comprep($r,$ENV{'form.replyto'});   &comprep($r,$ENV{'form.replyto'});
     } elsif ($ENV{'form.sendreply'}) {      } elsif ($ENV{'form.sendreply'}) {

Removed from v.1.87  
changed lines
  Added in v.1.90


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>