Diff for /loncom/interface/lonfeedback.pm between versions 1.122 and 1.126

version 1.122, 2004/08/31 22:27:10 version 1.126, 2004/09/15 06:17:11
Line 165  sub list_discussion { Line 165  sub list_discussion {
     }      }
   
 # Get discussion display default settings for user  # Get discussion display default settings for user
     my %userenv = &Apache::lonnet::get('environment',['discdisplay','discmarkread'],$ENV{'user.domain'},$ENV{'user.name'});      if ($ENV{'environment.discdisplay'} eq 'unread') {
     my $discdisplay=$userenv{'discdisplay'};  
     if ($discdisplay eq 'unread') {  
         $showonlyunread = 1;          $showonlyunread = 1;
     }      }
     my $discmarkread=$userenv{'discmarkread'};      if ($ENV{'environment.discmarkread'} eq 'ondisp') {
     if ($discmarkread eq 'ondisp') {  
         $markondisp = 1;          $markondisp = 1;
     }      }
   
 # Override user's default if user specified display setting for this discussion  # Override user's default if user specified display setting for this discussion
     if (defined($dischash{$ondispkey})) {      if (defined($dischash{$ondispkey})) {
         $markondisp = $dischash{$ondispkey};          unless ($dischash{$ondispkey} eq '') {
               $markondisp = $dischash{$ondispkey};
           }
     }      }
     if ($markondisp) {      if ($markondisp) {
         $discinfo{$lastkey} = time;          $discinfo{$lastkey} = time;
     }      }
   
     if (defined($dischash{$showkey})) {      if (defined($dischash{$showkey})) {
         $showonlyunread = $dischash{$showkey};          unless ($dischash{$showkey} eq '') {
               $showonlyunread = $dischash{$showkey};
           }
     }      }
   
     if (defined($dischash{$markkey})) {      if (defined($dischash{$markkey})) {
         $showunmark = $dischash{$markkey};          unless ($dischash{$markkey} eq '') {
               $showunmark = $dischash{$markkey};
           }
     }      }
   
     if (defined($dischash{$visitkey})) {      if (defined($dischash{$visitkey})) {
         $visit = $dischash{$visitkey};          unless ($dischash{$visitkey} eq '') {
               $visit = $dischash{$visitkey};
           }
     }      }
     $visit ++;      $visit ++;
   
Line 324  sub list_discussion { Line 329  sub list_discussion {
 # open manifest file  # open manifest file
             my $manifest = '/imsmanifest.xml';              my $manifest = '/imsmanifest.xml';
             my $manifestfilename = $tempexport.$manifest;              my $manifestfilename = $tempexport.$manifest;
             print STDERR "manifestfilename is $manifestfilename\n";  
             if ($manifestfile = Apache::File->new('>'.$manifestfilename)) {              if ($manifestfile = Apache::File->new('>'.$manifestfilename)) {
                 $manifestok=1;                  $manifestok=1;
                 print $manifestfile qq|                  print $manifestfile qq|
Line 474  imscp_v1p1.xsd http://www.imsglobal.org/ Line 478  imscp_v1p1.xsd http://www.imsglobal.org/
                     my $postfilename = $alldiscussion{$_}.'-'.$imsitems{$alldiscussion{$_}}{'timestamp'}.'.html';                      my $postfilename = $alldiscussion{$_}.'-'.$imsitems{$alldiscussion{$_}}{'timestamp'}.'.html';
                     if ($manifestok) {                      if ($manifestok) {
                         if (($depth[$alldiscussion{$_}] <= $currdepth) && ($alldiscussion{$_} != $firstidx)) {                          if (($depth[$alldiscussion{$_}] <= $currdepth) && ($alldiscussion{$_} != $firstidx)) {
                             print STDERR "depth is $depth[$alldiscussion{$_}], currdepth is $currdepth, idx is $alldiscussion{$_}, firstidx is $firstidx\n";  
                             print $manifestfile '  </item>'."\n";                              print $manifestfile '  </item>'."\n";
                         }                          }
                         $currdepth = $depth[$alldiscussion{$_}];                          $currdepth = $depth[$alldiscussion{$_}];
Line 600  END Line 603  END
                 undef(%oldENV);                  undef(%oldENV);
                 $discussion .= 'Download the zip file from <a href="'.$imszipfile.'">Discussion Posting Archive</a><br />';                  $discussion .= 'Download the zip file from <a href="'.$imszipfile.'">Discussion Posting Archive</a><br />';
                 if ($copyresult) {                  if ($copyresult) {
                     $discussion .= 'The following errors occurred during export - '.$copyresult;                      $discussion .= 'The following errors occurred during export - <br />'.$copyresult;
                 }                  }
             } else {              } 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 />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 />';
Line 618  END Line 621  END
         my $subject = '';          my $subject = '';
         if ($ENV{'form.origpage'}) {          if ($ENV{'form.origpage'}) {
             &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['addnewattach','deloldattach','delnewattach','timestamp','idx','subject','comment']);              &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['addnewattach','deloldattach','delnewattach','timestamp','idx','subject','comment']);
             $subject = &HTML::Entities::encode($ENV{'form.subject'},'<>&"');              $subject = &Apache::lonnet::unescape($ENV{'form.subject'});
             $comment = &HTML::Entities::encode($ENV{'form.comment'},'<>&"');              $comment = &Apache::lonnet::unescape($ENV{'form.comment'});
             my @keepold = ();              my @keepold = ();
             &process_attachments(\@currnewattach,\@currdelold,\@keepold);              &process_attachments(\@currnewattach,\@currdelold,\@keepold);
             if (@currnewattach > 0) {              if (@currnewattach > 0) {
Line 1048  sub get_post_contents { Line 1051  sub get_post_contents {
            return $discussion;             return $discussion;
        }          } 
     }      }
     $$screenname=&Apache::loncommon::screenname(  #    $$screenname=&Apache::loncommon::screenname(
                                         $$contrib{$idx.':sendername'},  #                                        $$contrib{$idx.':sendername'},
                                         $$contrib{$idx.':senderdomain'});  #                                        $$contrib{$idx.':senderdomain'});
     $$plainname=&Apache::loncommon::nickname(  #    $$plainname=&Apache::loncommon::nickname(
                                         $$contrib{$idx.':sendername'},  #                                        $$contrib{$idx.':sendername'},
                                         $$contrib{$idx.':senderdomain'});  #                                        $$contrib{$idx.':senderdomain'});
       ($$screenname,$$plainname)=($$contrib{$idx.':screenname'},
    $$contrib{$idx.':plainname'});
     my $sender=&Apache::loncommon::aboutmewrapper(      my $sender=&Apache::loncommon::aboutmewrapper(
                                  $$plainname,                                   $$plainname,
                                  $$contrib{$idx.':sendername'},                                   $$contrib{$idx.':sendername'},
Line 1151  sub replicate_attachments { Line 1156  sub replicate_attachments {
                     $i ++;                      $i ++;
                 }                  }
                 my ($content,$rtncode);                  my ($content,$rtncode);
                 print STDERR "File to replicate is $$attachrefs{$id}{'filename'} in $1,$2\n";  
                 my $uploadreply = &Apache::lonnet::getuploaded('GET',$$attachrefs{$id}{'filename'},$1,$2,$content,$rtncode);                  my $uploadreply = &Apache::lonnet::getuploaded('GET',$$attachrefs{$id}{'filename'},$1,$2,$content,$rtncode);
                 if ($uploadreply eq 'ok') {                  if ($uploadreply eq 'ok') {
                      my $attachcopy;                      my $attachcopy;
                      if ($attachcopy = Apache::File->new('>'.$destination)) {                      if ($attachcopy = Apache::File->new('>'.$destination)) {
                          print $attachcopy $content;                          print $attachcopy $content;
                          close($attachcopy);                          close($attachcopy);
                      } else {                      } else {
                          $response .= 'Error copying a file attachment to IMS package: '.$!.'<br />'."\n";                          $response .= 'Error copying file attachment - '.$5.' to IMS package: '.$!.'<br />'."\n";
                      }                      }
                 } else {                  } else {
                     print STDERR "return code from lonnet was $rtncode\n";                      &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";
                 }                  }
             }              }
         }          }
     }      }
       return $response;
 }  }
   
 sub mail_screen {  sub mail_screen {
Line 1308  END Line 1314  END
   }    }
   
   if ($ENV{'form.origpage'}) {    if ($ENV{'form.origpage'}) {
       $subject = $ENV{'form.subject'};        $subject = &Apache::lonnet::unescape($ENV{'form.subject'});
       $comment = $ENV{'form.comment'};        $comment = &Apache::lonnet::unescape($ENV{'form.comment'});
       &process_attachments(\@currnewattach,\@currdelold,\@keepold);        &process_attachments(\@currnewattach,\@currdelold,\@keepold);
   }    }
   my $latexHelp=&Apache::loncommon::helpLatexCheatsheet();    my $latexHelp=&Apache::loncommon::helpLatexCheatsheet();
Line 2433  ENDPREVIEW Line 2439  ENDPREVIEW
   
 sub modify_attachments {  sub modify_attachments {
     my ($r,$currnewattach,$currdelold,$symb,$idx,$attachmenturls)=@_;      my ($r,$currnewattach,$currdelold,$symb,$idx,$attachmenturls)=@_;
     my $subject=&clear_out_html($ENV{'form.subject'});      my $orig_subject = &Apache::lonnet::unescape($ENV{'form.subject'});
       my $subject=&clear_out_html($orig_subject);
     $subject=~s/\n/\<br \/\>/g;      $subject=~s/\n/\<br \/\>/g;
     $subject=&Apache::lontexconvert::msgtexconverted($subject);      $subject=&Apache::lontexconvert::msgtexconverted($subject);
     my $timestamp=$ENV{'form.timestamp'};      my $timestamp=$ENV{'form.timestamp'};
Line 2462  $bodytag Line 2469  $bodytag
  <table border="2">   <table border="2">
   <tr>    <tr>
    <td>     <td>
     <b>Subject:</b>$subject</b><br /><br />      <b>Subject:</b> $subject</b><br /><br />
 END  END
     if ($idx) {      if ($idx) {
         if ($attachmenturls) {          if ($attachmenturls) {
Line 2569  sub generate_attachments_button { Line 2576  sub generate_attachments_button {
     my $response = (<<END);      my $response = (<<END);
 <form name="attachment" action="/adm/feedback?attach=$ressymb" method="post">  <form name="attachment" action="/adm/feedback?attach=$ressymb" method="post">
 Click to add/remove attachments:&nbsp;<input type="button" value="$att"  Click to add/remove attachments:&nbsp;<input type="button" value="$att"
 onClick="if (typeof(document.mailform.onsubmit)=='function') {document.mailform.onsubmit();};this.form.comment.value=document.mailform.comment.value;this.form.subject.value=document.mailform.subject.value;  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  END
     unless ($mode eq 'board') {      unless ($mode eq 'board') {
         $response .= 'javascript:anonchk();';          $response .= 'javascript:anonchk();';

Removed from v.1.122  
changed lines
  Added in v.1.126


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