Diff for /loncom/interface/lonfeedback.pm between versions 1.182 and 1.188

version 1.182, 2006/03/04 00:59:53 version 1.188, 2006/03/23 22:39:51
Line 1253  END Line 1253  END
         }          }
     }      }
     if ($type eq 'allversions') {      if ($type eq 'allversions') {
         $discussion.=('</ul></body></html>');          $discussion.='</ul>';
         return $discussion;          return $discussion;
     } else {      } else {
         return;          return;
Line 1303  sub mail_screen { Line 1303  sub mail_screen {
   if (exists($env{'form.origpage'})) {    if (exists($env{'form.origpage'})) {
       &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','currnewattach','addnewattach','deloldattach','delnewattach','timestamp','idx','anondiscuss','discuss','blog']);        &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','currnewattach','addnewattach','deloldattach','delnewattach','timestamp','idx','anondiscuss','discuss','blog']);
   }    }
   my $bodytag=&Apache::loncommon::bodytag('Resource Feedback and Discussion',  
                                           '','onLoad="window.focus();setposttype();"');  
   my $title=&Apache::lonnet::gettitle($feedurl);    my $title=&Apache::lonnet::gettitle($feedurl);
   if (!$title) { $title = $feedurl; }    if (!$title) { $title = $feedurl; }
   my $quote='';    my $quote='';
Line 1442  END Line 1441  END
       &process_attachments(\@currnewattach,\@currdelold,\@keepold);        &process_attachments(\@currnewattach,\@currdelold,\@keepold);
   }    }
   my $latexHelp=&Apache::loncommon::helpLatexCheatsheet();    my $latexHelp=&Apache::loncommon::helpLatexCheatsheet();
   my $htmlheader=&Apache::lonhtmlcommon::htmlareaheaders();  
   my $send=&mt('Send');    my $send=&mt('Send');
   my $html=&Apache::lonxml::xmlbegin();    my $js= <<END;
   $r->print(<<END);  
 $html  
 <head>  
 <title>The LearningOnline Network with CAPA</title>  
 <meta http-equiv="pragma" content="no-cache"></meta>  
 $htmlheader  
 <script type="text/javascript">  <script type="text/javascript">
 //<!--  //<!--
     function gosubmit() {      function gosubmit() {
Line 1504  $htmlheader Line 1496  $htmlheader
     $anonscript      $anonscript
 //-->  //-->
 </script>  </script>
 </head>  END
 $bodytag  
     my $onload = 'onLoad="window.focus();setposttype();"';
     my $start_page=
         &Apache::loncommon::start_page('Resource Feedback and Discussion',$js,
        {'add_entries' => $onload});
   
     $r->print(<<END);
   $start_page
 <h2><tt>$title</tt></h2>  <h2><tt>$title</tt></h2>
 <form action="/adm/feedback" method="post" name="mailform"  <form action="/adm/feedback" method="post" name="mailform"
 enctype="multipart/form-data">  enctype="multipart/form-data">
Line 1602  END Line 1601  END
     }      }
     $r->print(&generate_preview_button().      $r->print(&generate_preview_button().
               &Apache::lonhtmlcommon::htmlareaselectactive('comment').                &Apache::lonhtmlcommon::htmlareaselectactive('comment').
               '</body></html>');        &Apache::loncommon::end_page());
   
 }  }
   
 sub print_display_options {  sub print_display_options {
Line 1613  sub print_display_options { Line 1613  sub print_display_options {
     my $function = &Apache::loncommon::get_users_function();      my $function = &Apache::loncommon::get_users_function();
     my $tabcolor = &Apache::loncommon::designparm($function.'.tabbg',      my $tabcolor = &Apache::loncommon::designparm($function.'.tabbg',
                                                     $env{'user.domain'});                                                      $env{'user.domain'});
     my $bodytag=&Apache::loncommon::bodytag('Discussion options',  
                                           '','');  
   
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
         'dido' => 'Discussion display options',  
         'pref' => 'Display Preference',          'pref' => 'Display Preference',
         'curr' => 'Current setting ',          'curr' => 'Current setting ',
         'actn' => 'Action',          'actn' => 'Action',
Line 1675  sub print_display_options { Line 1672  sub print_display_options {
         $currtogg = $lt{'toggon'};          $currtogg = $lt{'toggon'};
         $disctogg = 'toggon';          $disctogg = 'toggon';
     }      }
     my $html=&Apache::lonxml::xmlbegin();  
     $r->print(<<END);      my $js = <<END;
 $html  <script type="text/javascript">
 <head>  
 <title>$lt{'dido'}</title>  
 <meta http-equiv="pragma" content="no-cache" />  
 <script>  
 function discdispChk(caller) {  function discdispChk(caller) {
     var disctogg = '$toggchg'      var disctogg = '$toggchg'
     if (caller == 0) {      if (caller == 0) {
Line 1748  function setDisp() { Line 1741  function setDisp() {
     }      }
 }  }
 </script>  </script>
 </head>  END
 $bodytag  
 <form name="modifydisp" method="post" action="/adm/feedback">  
       my $start_page =
    &Apache::loncommon::start_page('Discussion display options',$js);
       my $end_page =
    &Apache::loncommon::end_page();
       $r->print(<<END);
   <form name="modifydisp" method="POSTx" action="/adm/feedback">
 $lt{'sdpf'}<br/> $lt{'prca'}  <ol><li>$lt{'whpo'}</li><li>$lt{'unwh'}</li><li>$lt{'wipa'}</li></ol>  $lt{'sdpf'}<br/> $lt{'prca'}  <ol><li>$lt{'whpo'}</li><li>$lt{'unwh'}</li><li>$lt{'wipa'}</li></ol>
 <br />  <br />
 <table border="0" cellpadding="0" cellspacing="0">  <table border="0" cellpadding="0" cellspacing="0">
Line 1800  $lt{'sdpf'}<br/> $lt{'prca'}  <ol><li>$l Line 1799  $lt{'sdpf'}<br/> $lt{'prca'}  <ol><li>$l
 <br />  <br />
 <br />  <br />
 </form>  </form>
 </body>  $end_page
 </html>  
 END  END
     return;      return;
 }  }
Line 1838  sub print_sortfilter_options { Line 1836  sub print_sortfilter_options {
     my $function = &Apache::loncommon::get_users_function();      my $function = &Apache::loncommon::get_users_function();
     my $tabcolor = &Apache::loncommon::designparm($function.'.tabbg',      my $tabcolor = &Apache::loncommon::designparm($function.'.tabbg',
                                                     $env{'user.domain'});                                                      $env{'user.domain'});
     my $bodytag=&Apache::loncommon::bodytag('Discussion options',  
                                           '','');  
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
         'diso' => 'Discussion sorting and filtering options',  
         'diop' => 'Display Options',          'diop' => 'Display Options',
         'curr' => 'Current setting ',          'curr' => 'Current setting ',
         'actn' => 'Action',          'actn' => 'Action',
Line 1858  sub print_sortfilter_options { Line 1853  sub print_sortfilter_options {
     my %role_types = ();      my %role_types = ();
     my %status_types = ();      my %status_types = ();
     &sort_filter_names(\%sort_types,\%role_types,\%status_types);      &sort_filter_names(\%sort_types,\%role_types,\%status_types);
     my $html=&Apache::lonxml::xmlbegin();  
     $r->print(<<END);      my $js = <<END;
 $html  
 <head>  
 <title>$lt{'diso'}</title>  
 <meta http-equiv="pragma" content="no-cache" />  
 <script type="text/javascript">  <script type="text/javascript">
 function verifyFilter() {  function verifyFilter() {
     var rolenum = 0      var rolenum = 0
Line 1888  function verifyFilter() { Line 1879  function verifyFilter() {
     document.modifyshown.submit();      document.modifyshown.submit();
 }  }
 </script>  </script>
 </head>  END
 $bodytag  
 <form name="modifyshown" method="post" action="/adm/feedback">      my $start_page=
    &Apache::loncommon::start_page('Discussion options',$js);
       my $end_page=
    &Apache::loncommon::end_page();
   
       $r->print(<<END);
   $start_page
   <form name="modifyshown" method="POST" action="/adm/feedback">
 <b>$lt{'diso'}</b><br/> $lt{'prca'}  <b>$lt{'diso'}</b><br/> $lt{'prca'}
 <br /><br />  <br /><br />
 <table border="0">  <table border="0">
Line 1955  $bodytag Line 1953  $bodytag
 <br />  <br />
 <br />  <br />
 </form>  </form>
 </body>  $end_page
 </html>  
 END  END
 }  }
   
Line 1978  sub print_showposters { Line 1975  sub print_showposters {
                           $env{'course.'.$env{'request.course.id'}.'.num'});                            $env{'course.'.$env{'request.course.id'}.'.num'});
     my %namesort = ();      my %namesort = ();
     my %postcounts = ();      my %postcounts = ();
     my %lt=&Apache::lonlocal::texthash(  
                      'diso' => 'Discussion filtering options',  
     );  
     my $bodytag=&Apache::loncommon::bodytag('Discussion options',  
                                           '','');  
     if ($contrib{'version'}) {      if ($contrib{'version'}) {
         for (my $idx=1;$idx<=$contrib{'version'};$idx++) {          for (my $idx=1;$idx<=$contrib{'version'};$idx++) {
             my $hidden=($contrib{'hidden'}=~/\.$idx\./);              my $hidden=($contrib{'hidden'}=~/\.$idx\./);
Line 2014  sub print_showposters { Line 2007  sub print_showposters {
             }              }
         }          }
     }      }
     my $html=&Apache::lonxml::xmlbegin();  
       my $start_page = &Apache::loncommon::start_page('Discussion options');
   
     $r->print(<<END);      $r->print(<<END);
 $html  $start_page
 <head>  
 <title>$lt{'diso'}</title>  
 <meta http-equiv="pragma" content="no-cache" />  
 </head>  
 $bodytag  
  <form name="pickpostersform" method="post">   <form name="pickpostersform" method="post">
   <table border="0">    <table border="0">
    <tr>     <tr>
Line 2048  END Line 2038  END
             }              }
         }          }
     }      }
   
       my $end_page   = &Apache::loncommon::end_page();
     $r->print(<<END);      $r->print(<<END);
      </table>       </table>
     </td>      </td>
Line 2058  END Line 2050  END
 <input type="hidden" name="userpick" value="$symb" />  <input type="hidden" name="userpick" value="$symb" />
 <input type="button" name="store" value="Display posts" onClick="javascript:document.pickpostersform.submit()" />  <input type="button" name="store" value="Display posts" onClick="javascript:document.pickpostersform.submit()" />
 </form>  </form>
 </body>  $end_page
 </html>  
 END  END
 }  }
   
Line 2067  sub get_post_versions { Line 2058  sub get_post_versions {
     my ($versions,$incoming,$htmldecode,$numver) = @_;      my ($versions,$incoming,$htmldecode,$numver) = @_;
     if ($incoming =~ /^<version num="0">/) {      if ($incoming =~ /^<version num="0">/) {
         my $p = HTML::LCParser->new(\$incoming);          my $p = HTML::LCParser->new(\$incoming);
         my $done = 0;                                                                                 my $done = 0; 
   
         while ( (my $token = $p->get_tag("version")) && (!$done)) {          while ( (my $token = $p->get_tag("version")) && (!$done)) {
             my $num = $token->[1]{num};              my $num = $token->[1]{num};
             my $text = $p->get_text("/version");              my $text = $p->get_text("/version");
Line 2128  sub fail_redirect { Line 2120  sub fail_redirect {
   my ($r,$feedurl) = @_;    my ($r,$feedurl) = @_;
   if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' };    if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' };
   my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');    my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');
   my $html=&Apache::lonxml::xmlbegin();    $r->print(&Apache::loncommon::start_page('Feedback not sent',undef,
   $r->print (<<ENDFAILREDIR);     {'redirect'  => [2,$feedurl],
 $html      'only_body' => 1,}));
 <head>    $r->print(<<ENDFAILREDIR);
 <title>Feedback not sent</title>  
 <meta http-equiv="pragma" content="no-cache" />  
 <meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl" />  
 </head>  
 <body bgcolor="#FFFFFF">  
 <img align="right" src="$logo" />  <img align="right" src="$logo" />
 <b>Sorry, no recipients  ...</b>  <b>Sorry, no recipients  ...</b>
 <br /><a href="$feedurl">Continue</a>  
 </body>  
 </html>  
 ENDFAILREDIR  ENDFAILREDIR
     $r->print(&Apache::loncommon::end_page());
 }  }
   
 sub redirect_back {  sub redirect_back {
Line 2216  sub redirect_back { Line 2201  sub redirect_back {
   }    }
   $feedurl=&Apache::lonenc::check_encrypt($feedurl);    $feedurl=&Apache::lonenc::check_encrypt($feedurl);
   my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');    my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');
   my $html=&Apache::lonxml::xmlbegin();    my $onload = 'onLoad=\'if (window.name!="loncapaclient") { this.document.reldt.submit(); self.window.close(); }\'';
   $r->print (<<ENDREDIR);    my $start_page=
 $html        &Apache::loncommon::start_page('New posts marked as read',undef,
 <head>       {'redirect'    => [2,$feedurl],
 <title>Feedback sent</title>        'only_body'   => 1,
 <meta http-equiv="pragma" content="no-cache" />        'add_entries' => $onload});
 <meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl" />    my $end_page = &Apache::loncommon::end_page();
 </head>  
 <body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { this.document.reldt.submit(); self.close(); }'>    $r->print(<<ENDREDIR);
   $start_page
 <img align="right" src="$logo" />  <img align="right" src="$logo" />
 $typestyle  $typestyle
 <b>Sent $sendsomething message(s), and $sendposts post(s).</b>  <b>Sent $sendsomething message(s), and $sendposts post(s).</b>
Line 2238  $roletag Line 2224  $roletag
 $sectag  $sectag
 $userpicktag  $userpicktag
 </form>  </form>
 <br /><a href="$feedurl">Continue</a>  $end_page
 </body>  
 </html>  
 ENDREDIR  ENDREDIR
 }  }
   
 sub no_redirect_back {  sub no_redirect_back {
   my ($r,$feedurl) = @_;    my ($r,$feedurl) = @_;
   my $nofeed=&mt('Sorry, no feedback possible on this resource  ...');    my $nofeed=&mt('Sorry, no feedback possible on this resource  ...');
   my $continue=&mt('Continue');   
   my $html=&Apache::lonxml::xmlbegin();    my %body_options = ('only_body'   => 1,
   $r->print (<<ENDNOREDIR);        'add_entries' =>  'onLoad=\'if (window.name!="loncapaclient") { self.window.close(); }\'');
 $html  
 <head>    if ($feedurl !~ m{^/adm/feedback}) { 
 <title>Feedback not sent</title>        $body_options{'rediect'} = [2,$feedurl];
 <meta http-equiv="pragma" content="no-cache" />  
 ENDNOREDIR  
   
   if ($feedurl!~/^\/adm\/feedback/) {   
       $r->print('<meta HTTP-EQUIV="Refresh" CONTENT="2; url='.  
  &Apache::lonenc::check_encrypt($feedurl).'">');  
   }    }
     my $start_page=
         &Apache::loncommon::start_page('Feedback not sent',undef,
        \%body_options);
         
     my $end_page = &Apache::loncommon::end_page();
   
   $feedurl=&Apache::lonenc::check_encrypt($feedurl);    $feedurl=&Apache::lonenc::check_encrypt($feedurl);
   my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');    my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');
   $r->print (<<ENDNOREDIRTWO);    $r->print (<<ENDNOREDIRTWO);
 </head>  </head>
 <body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { self.close(); }'>  <body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { self.window.close(); }'>
 <img align="right" src="$logo" />  <img align="right" src="$logo" />
 <b>$nofeed</b>  <b>$nofeed</b>
 <br /><a href="$feedurl">$continue</a>  <br />
 </body>  $end_page
 </html>  
 ENDNOREDIRTWO  ENDNOREDIRTWO
 }  }
   
Line 2314  sub screen_header { Line 2297  sub screen_header {
  ' <i>('.&mt('name only visible to course faculty').')</i></label> '.   ' <i>('.&mt('name only visible to course faculty').')</i></label> '.
  '<a href="/adm/preferences?action=changescreenname">'.&mt('Change Screenname').'</a>';   '<a href="/adm/preferences?action=changescreenname">'.&mt('Change Screenname').'</a>';
         }          }
         #$discussoptions.='<br /><label><input type="checkbox" name="blog" /> '.          $discussoptions.='<br /><label><input type="checkbox" name="blog" /> '.
  #    &mt('Add to my public course blog').'</label>';      &mt('Add to my public course blog').'</label>';
     }      }
     if ($msgoptions) { $msgoptions='<h2><img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/feedback.gif').'" />'.&mt('Sending Messages').'</h2>'.$msgoptions; }      if ($msgoptions) { $msgoptions='<h2><img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/feedback.gif').'" />'.&mt('Sending Messages').'</h2>'.$msgoptions; }
     if ($discussoptions) {       if ($discussoptions) { 
Line 2541  sub adddiscuss { Line 2524  sub adddiscuss {
     }      }
     if (($symb) && ($email)) {      if (($symb) && ($email)) {
         if ($env{'form.editdisc'}) {          if ($env{'form.editdisc'}) {
             my %newcontrib = ();  
             $contrib{'ip'}=$ENV{'REMOTE_ADDR'};              $contrib{'ip'}=$ENV{'REMOTE_ADDR'};
             $contrib{'host'}=$Apache::lonnet::perlvar{'lonHostID'};              $contrib{'host'}=$Apache::lonnet::perlvar{'lonHostID'};
             $contrib{'timestamp'} = time;              $contrib{'timestamp'} = time;
Line 2584  sub adddiscuss { Line 2566  sub adddiscuss {
                 }                  }
             }              }
             $contrib{'history'} .= $oldcontrib{$oldidx.':timestamp'};              $contrib{'history'} .= $oldcontrib{$oldidx.':timestamp'};
             foreach (keys %contrib) {  
                 my $key = $oldidx.':'.&Apache::lonnet::escape($oldsymb).':'.$_;                                                                                 
                 $newcontrib{$key} = $contrib{$_};  
             }  
             my $put_reply = &Apache::lonnet::putstore($env{'request.course.id'},              my $put_reply = &Apache::lonnet::putstore($env{'request.course.id'},
                   $oldsymb,$oldidx,\%contrib,                    $oldsymb,$oldidx,\%contrib,
                   $env{'course.'.$env{'request.course.id'}.'.domain'},                    $env{'course.'.$env{'request.course.id'}.'.domain'},
Line 2623  sub adddiscuss { Line 2601  sub adddiscuss {
 # ----------------------------------------------------------- Preview function  # ----------------------------------------------------------- Preview function
   
 sub show_preview {  sub show_preview {
     my $r=shift;      my ($r) = @_;
     &Apache::loncommon::content_type($r,'text/html');      &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;      $r->send_http_header;
     my $message=&clear_out_html($env{'form.comment'});      my $message=&clear_out_html($env{'form.comment'});
Line 2633  sub show_preview { Line 2611  sub show_preview {
     my $subject=&clear_out_html($env{'form.subject'});      my $subject=&clear_out_html($env{'form.subject'});
     $subject=~s/\n/\<br \/\>/g;      $subject=~s/\n/\<br \/\>/g;
     $subject=&Apache::lontexconvert::msgtexconverted($subject);      $subject=&Apache::lontexconvert::msgtexconverted($subject);
     my $html=&Apache::lonxml::xmlbegin();      my $start_page=
     $r->print($html.'<head>'.   &Apache::loncommon::start_page('Preview',undef,
       '</head><body><table border="2"><tr><td>'.         {'only_body'   => 1,});
   
       my $end_page = &Apache::loncommon::end_page();
   
       $r->print($start_page.'<table border="2"><tr><td>'.
       '<b>Subject:</b> '.$subject.'<br /><br />'.        '<b>Subject:</b> '.$subject.'<br /><br />'.
       $message.'</td></tr></table></body></html>');        $message.'</td></tr></table>'.$end_page);
 }  }
   
   
Line 2685  sub modify_attachments { Line 2667  sub modify_attachments {
     $subject=&Apache::lontexconvert::msgtexconverted($subject);      $subject=&Apache::lontexconvert::msgtexconverted($subject);
     my $timestamp=$env{'form.timestamp'};      my $timestamp=$env{'form.timestamp'};
     my $numoldver=$env{'form.numoldver'};      my $numoldver=$env{'form.numoldver'};
     my $bodytag=&Apache::loncommon::bodytag('Discussion Post Attachments',  
                                           '','');  
     my $msg = '';      my $msg = '';
     my %attachments = ();      my %attachments = ();
     my %currattach = ();      my %currattach = ();
Line 2694  sub modify_attachments { Line 2675  sub modify_attachments {
         &extract_attachments($attachmenturls,$idx,$numoldver,\$msg,\%attachments,\%currattach,$currdelold);          &extract_attachments($attachmenturls,$idx,$numoldver,\$msg,\%attachments,\%currattach,$currdelold);
     }      }
     &Apache::lonenc::check_encrypt(\$symb);      &Apache::lonenc::check_encrypt(\$symb);
     my $html=&Apache::lonxml::xmlbegin();      my $js = <<END;
     $r->print(<<END);  <script type="text/javascript">
 $html  
 <head>  
 <title>Managing Attachments</title>  
 <script>  
  function setAction () {   function setAction () {
    document.modattachments.action = document.modattachments.origpage.value;     document.modattachments.action = document.modattachments.origpage.value;
    document.modattachments.submit();     document.modattachments.submit();
  }   }
 </script>   </script> 
 </head>  END
 $bodytag  
       my $start_page = 
    &Apache::loncommon::start_page('Discussion Post Attachments',$js);
       my $end_page = 
    &Apache::loncommon::end_page();
          
       $r->print(<<END);
 <form name="modattachments" method="post" enctype="multipart/form-data" action="/adm/feedback?attach=$symb">  <form name="modattachments" method="post" enctype="multipart/form-data" action="/adm/feedback?attach=$symb">
  <table border="2">   <table border="2">
   <tr>    <tr>
Line 2759  END Line 2742  END
     $r->print(<<END);      $r->print(<<END);
  <input type="button" name="rtntoedit" value="Store Changes" onClick="setAction()"/>   <input type="button" name="rtntoedit" value="Store Changes" onClick="setAction()"/>
 </form>  </form>
 </body>  $end_page
 </html>  
 END  END
     return;      return;
 }  }
Line 3031  sub handler { Line 3013  sub handler {
   }    }
   if ($env{'form.allversions'}) {    if ($env{'form.allversions'}) {
       &Apache::loncommon::content_type($r,'text/html');        &Apache::loncommon::content_type($r,'text/html');
         &Apache::loncommon::no_cache($r);
       $r->send_http_header;        $r->send_http_header;
       my $html=&Apache::lonxml::xmlbegin();  
       my $bodytag=&Apache::loncommon::bodytag('Discussion Post Versions');        $r->print(&Apache::loncommon::start_page('Discussion Post Versions'));
       $r->print(<<END);  
 $html  
 <head>  
 <title>Post Versions</title>  
 <meta http-equiv="pragma" content="no-cache" />  
 </head>  
 $bodytag  
 END  
       my $crs='/'.$env{'request.course.id'};        my $crs='/'.$env{'request.course.id'};
       if ($env{'request.course.sec'}) {        if ($env{'request.course.sec'}) {
           $crs.='_'.$env{'request.course.sec'};            $crs.='_'.$env{'request.course.sec'};
Line 3062  END Line 3038  END
                            $env{'course.'.$env{'request.course.id'}.'.num'});                             $env{'course.'.$env{'request.course.id'}.'.num'});
           $r->print(&get_post_contents(\%contrib,$idx,$seeid,'allversions',\%messages,\%subjects,\%allattachments,\%attachmsgs,\%imsfiles,\$screenname,\$plainname));            $r->print(&get_post_contents(\%contrib,$idx,$seeid,'allversions',\%messages,\%subjects,\%allattachments,\%attachmsgs,\%imsfiles,\$screenname,\$plainname));
       }        }
         $r->print(&Apache::loncommon::end_page());
       return OK;        return OK;
   }    }
   if ($env{'form.posterlist'}) {    if ($env{'form.posterlist'}) {
Line 3130  END Line 3107  END
       &Apache::loncommon::content_type($r,'text/html');        &Apache::loncommon::content_type($r,'text/html');
       $r->send_http_header;        $r->send_http_header;
       my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');        my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');
       my $html=&Apache::lonxml::xmlbegin();        my $onload = 'onLoad=\'if (window.name!="loncapaclient") { this.document.reldt.submit(); self.window.close(); }\'';
         my $start_page=
     &Apache::loncommon::start_page('New posts marked as read',undef,
    {'redirect'    => [2,$feedurl],
     'only_body'   => 1,
     'add_entries' => $onload});
         my $end_page = &Apache::loncommon::end_page();
       $r->print (<<ENDREDIR);        $r->print (<<ENDREDIR);
 $html  $start_page
 <head>  
 <title>New posts marked as read</title>  
 <meta http-equiv="pragma" content="no-cache" />  
 <meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl" />  
 </head>  
 <body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { this.document.reldt.submit(); self.close(); }'>  
 <img align="right" src="$logo" />  <img align="right" src="$logo" />
 $textline  $textline
 <form name="reldt" action="$feedurl" target="loncapaclient">  <form name="reldt" action="$feedurl" target="loncapaclient">
 </form>  </form>
 <br /><a href="$feedurl">Continue</a>  <br />
 </body>  $end_page
 </html>  
 ENDREDIR  ENDREDIR
       return OK;        return OK;
   } elsif ($env{'form.modifydisp'}) {    } elsif ($env{'form.modifydisp'}) {
Line 3304  ENDREDIR Line 3280  ENDREDIR
           $status=$Apache::inputtags::status[-1];            $status=$Apache::inputtags::status[-1];
       }        }
       my $discussion = &list_discussion($mode,$status,$symb);         my $discussion = &list_discussion($mode,$status,$symb); 
       my $bodytag=&Apache::loncommon::bodytag('Resource Feedback and Discussion');        my $start_page = 
       $r->print($bodytag.$discussion);                                         &Apache::loncommon::start_page('Resource Feedback and Discussion');
         my $end_page = 
     &Apache::loncommon::end_page();
         $r->print($start_page.$discussion.$end_page);
       return OK;        return OK;
   } else {    } else {
 # ------------------------------------------------------------- Normal feedback  # ------------------------------------------------------------- Normal feedback
Line 3498  sub editing_allowed { Line 3477  sub editing_allowed {
     my $cid = $env{'request.course.id'};      my $cid = $env{'request.course.id'};
     my $role = (split(/\./,$env{'request.role'}))[0];      my $role = (split(/\./,$env{'request.role'}))[0];
     my $section = $env{'request.course.sec'};      my $section = $env{'request.course.sec'};
     my $allow_editing_config = $env{'course.'.$env{'request.course.id'}.      my $allow_editing_config = 
                                '.allow_discussion_post_editing'};   $env{'course.'.$cid.'.allow_discussion_post_editing'};
     if ($allow_editing_config =~ m/^\s*yes\s*$/i) {      if ($allow_editing_config =~ m/^\s*yes\s*$/i) {
         $can_edit = 1;          $can_edit = 1;
     } else {      } else {
         my @editor_roles = split(/,/,$allow_editing_config);   foreach my $editor (split(/,/,$allow_editing_config)) {
         if (@editor_roles > 0) {      my ($editor_role,$editor_sec) = split(/:/,$editor);
             foreach my $editor (@editor_roles) {      if ($editor_role eq $role
                 my ($editor_role,$editor_sec) = split(/:/,$editor);   && defined($editor_sec)
                 if ($editor_role eq $role) {   && defined($section)
                     if (defined($editor_sec)) {   && $editor_sec eq $section) {
                         if (defined($section)) {   $can_edit = 1;
                             if ($editor_sec eq $section) {   last;
                                 $can_edit = 1;      }
                                 last;      if ($editor_role eq $role
                             }   && !defined($editor_sec)) {
                         }   $can_edit = 1;
                     } else {      }
                         $can_edit = 1;   }
                         last;  
                     }  
                 }  
             }  
         }  
     }      }
     return $can_edit;      return $can_edit;
 }  }

Removed from v.1.182  
changed lines
  Added in v.1.188


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