[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm lonmsg.pm

www lon-capa-cvs@mail.lon-capa.org
Fri, 10 Sep 2004 08:42:22 -0000


www		Fri Sep 10 04:42:22 2004 EDT

  Modified files:              
    /loncom/interface	loncommon.pm lonmsg.pm 
  Log:
  Saving my work:
  * orange on green did not look great for help link (something still fishy
  with use of &mt there)
  * moving between folders works now, TRASH is still not quite working right
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.210 loncom/interface/loncommon.pm:1.211
--- loncom/interface/loncommon.pm:1.210	Thu Sep  2 09:38:35 2004
+++ loncom/interface/loncommon.pm	Fri Sep 10 04:42:21 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.210 2004/09/02 13:38:35 www Exp $
+# $Id: loncommon.pm,v 1.211 2004/09/10 08:42:21 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -667,8 +667,8 @@
     my $template;
     if ($text ne "") {
 	$template .= 
-  "<table bgcolor='#337733' cellspacing='1' cellpadding='1' border='0'><tr>".
-  "<td bgcolor='#448844'><a href=\"$link\"><font color='#FFFFFF' size='2'>$text</font></a>";
+  "<table bgcolor='#773311' cellspacing='1' cellpadding='1' border='0'><tr>".
+  "<td bgcolor='#886622'><a href=\"$link\"><font color='#FFFFFF' size='2'>$text</font></a>";
     }
     $template .= <<"ENDTEMPLATE";
  <script>
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.106 loncom/interface/lonmsg.pm:1.107
--- loncom/interface/lonmsg.pm:1.106	Fri Sep 10 02:38:24 2004
+++ loncom/interface/lonmsg.pm	Fri Sep 10 04:42:21 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging
 #
-# $Id: lonmsg.pm,v 1.106 2004/09/10 06:38:24 www Exp $
+# $Id: lonmsg.pm,v 1.107 2004/09/10 08:42:21 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -552,17 +552,25 @@
 
 sub movemsg {
     my ($msgid,$srcfolder,$trgfolder)=@_;
+    my $unmsgid=&Apache::lonnet::unescape($msgid);
     my $srcsuffix=&foldersuffix($srcfolder);
     my $trgsuffix=&foldersuffix($trgfolder);
-    my $srcstatus=&Apache::lonnet::get('email_status'.$srcsuffix,[$msgid]);
-    my $trgstatus=$srcstatus;
-    if ($trgstatus eq 'deleted') { $trgstatus='read'; }
-    &Apache::lonnet::put(
-     'nohist_email'.$trgsuffix,{$msgid => 
-     &Apache::lonnet::get('nohist_email'.$srcsuffix,[$msgid])});
-    &statuschange($msgid,$trgstatus,$trgfolder);
+
+# Copy message
+    my %message=&Apache::lonnet::get('nohist_email'.$srcsuffix,[$msgid]);
+    &Apache::lonnet::put('nohist_email'.$trgsuffix,{$msgid => $message{$msgid}});
+
+# Copy status
+    my %status=&Apache::lonnet::get('email_status'.$srcsuffix,[$unmsgid]);
+    &Apache::lonnet::put('email_status'.$trgsuffix,{$unmsgid => $status{$unmsgid}});
+# See if was deleted -> becomes "read" in trash
+    my $currentstatus=(&unpackmsgid($status{$unmsgid}));
+    if ($currentstatus eq 'deleted') {
+	&statuschange($msgid,'read',$trgfolder);
+    }
+# Delete orginals
     &Apache::lonnet::del('nohist_email'.$srcsuffix,[$msgid]);
-    &Apache::lonnet::del('email_status'.$srcsuffix,[$msgid]);
+    &Apache::lonnet::del('email_status'.$srcsuffix,[$unmsgid]);
 }
 
 # ======================================================= Display a course list
@@ -1538,16 +1546,17 @@
     my $numblocked = 0;
 # info to generate "next" and "previous" buttons and check if message is blocked
     &blockcheck(\%setters,\$startblock,\$endblock);
-    my @messages=&sortedmessages(\%blocked,$startblock,$endblock,\$numblocked);
+    my @messages=&sortedmessages(\%blocked,$startblock,$endblock,\$numblocked,$folder);
     if ( $blocked{$msgid} eq 'ON' ) {
         &printheader($r,'/adm/email',&mt('Display a Message'));
         $r->print(&mt('You attempted to display a message that is currently blocked because you are enrolled in one or more courses for which there is an ongoing online exam.'));
         &build_block_table($r,$startblock,$endblock,\%setters);
         return;
     }
-    &statuschange($msgid,'read');
+    &statuschange($msgid,'read',$folder);
     my %message=&Apache::lonnet::get('nohist_email'.$suffix,[$msgid]);
     my %content=&unpackagemsg($message{$msgid});
+
     my $counter=0;
     $r->print('<pre>');
     my $escmsgid=&Apache::lonnet::escape($msgid);
@@ -1573,6 +1582,7 @@
 	      '<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'}.
+	      '&folder='.&Apache::lonnet::escape($folder).
 	      '"><b>'.&mt('Display all Messages').'</b></a></td>');
     if ($counter > 0){
 	$r->print('<td><a href="/adm/email?display='.$messages[$counter-1]->[5].$sqs.