Diff for /loncom/interface/lonevaluate.pm between versions 1.9 and 1.16

version 1.9, 2002/08/09 19:49:30 version 1.16, 2005/02/17 08:50:20
Line 38 Line 38
 package Apache::lonevaluate;  package Apache::lonevaluate;
   
 use strict;  use strict;
 use Apache::lonnet;  use Apache::lonnet();
 use Apache::Constants qw(:common);  use Apache::Constants qw(:common);
   use Apache::loncommon();
   use Apache::lonenc();
   
 sub handler {  sub handler {
     my $r = shift;      my $r = shift;
     $r->content_type('text/html');      &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;      $r->send_http_header;
     return OK if $r->header_only;      return OK if $r->header_only;
   
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['postdata']);      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['postdata']);
   my $feedurl=$ENV{'form.postdata'};      my $feedurl=$ENV{'form.postdata'};
   $feedurl=~s/^http\:\/\///;      $feedurl=~s/^http\:\/\///;
   $feedurl=~s/^$ENV{'SERVER_NAME'}//;      $feedurl=~s/^$ENV{'SERVER_NAME'}//;
   $feedurl=~s/^$ENV{'HTTP_HOST'}//;      $feedurl=~s/^$ENV{'HTTP_HOST'}//;
   
   $feedurl=&Apache::lonnet::declutter($feedurl);      $feedurl=&Apache::lonnet::declutter($feedurl);
   my $symb=&Apache::lonnet::symbread($feedurl);  
       my $title=&Apache::lonnet::gettitle($feedurl);
       my $showurl=&Apache::lonenc::check_encrypt($feedurl);
   
     my ($rdomain,$rauth)=($feedurl=~/^(\w+)\/(\w+)\//);      my ($rdomain,$rauth)=($feedurl=~/^(\w+)\/(\w+)\//);
   
Line 75  sub handler { Line 79  sub handler {
   
     my $warning='';      my $warning='';
   
       my $bodytag=&Apache::loncommon::bodytag('Evaluate Resource');
   
     if ($ENV{'form.submiteval'} eq 'true') {      if ($ENV{'form.submiteval'} eq 'true') {
 # ------------------------------------------------ User is submitting something  # ------------------------------------------------ User is submitting something
         my $complete=1;          my $complete=1;
Line 86  sub handler { Line 92  sub handler {
             }              }
         }          }
         if ($complete) {          if ($complete) {
            $r->print(<<ENDHEADER);      my $showurl=&Apache::lonenc::check_encrypt(&Apache::lonnet::clutter($feedurl));
 <html>      my $html=&Apache::lonxml::xmlbegin();
       $r->print(<<ENDHEADER);
   $html
 <head>  <head>
 <title>Evaluation submitted</title>  <title>Evaluation submitted</title>
 <script>  <script>
     function go() {      function goback() {
  if (window.name!='LONcatInfo') {   if ((window.name=='loncapaclient')) {
             window.location='/res/$feedurl';              window.location='$showurl';
           } else {
               self.close();
         }          }
     }      }
 </script>  </script>
 <meta http-equiv="pragma" content="no-cache"></meta>  <meta http-equiv="pragma" content="no-cache"></meta>
 </head>  </head>
 <body bgcolor="#FFFFFF">  $bodytag
 <h1>Thank you for your input!</h1>  <h1>Thank you for your input!</h1>
 ENDHEADER  ENDHEADER
        $r->print('Storing feedback: '.         $r->print('Storing feedback: '.
Line 108  ENDHEADER Line 118  ENDHEADER
        $r->print('<br>Logging first evaluation');         $r->print('<br>Logging first evaluation');
            }             }
            $r->print(             $r->print(
             '<script>setTimeout("go()",2000);</script></body></html>');              '<script>setTimeout("goback()",2000);</script></body></html>');
            return OK;             return OK;
         } else {          } else {
     $warning='Please fill out all fields below';      $warning='Please fill out all fields below';
Line 122  ENDHEADER Line 132  ENDHEADER
   
     foreach my $item (@items) {      foreach my $item (@items) {
        unless ($item eq 'comments') {         unless ($item eq 'comments') {
            unless ($item eq 'timestamp') {             unless (($item eq 'timestamp') || 
                      (!defined($currenteval{$prefix.$item}))) {
               $dialold.=                $dialold.=
                    'document.evaluation.'.$item.'.selectedIndex='.                     'document.evaluation.'.$item.'.selectedIndex='.
                    $currenteval{$prefix.$item}.";\n";                     $currenteval{$prefix.$item}.";\n";
Line 131  ENDHEADER Line 142  ENDHEADER
            $oldcomments=$currenteval{$prefix.$item};             $oldcomments=$currenteval{$prefix.$item};
        }                }       
     }      }
   
 # ------------------------------------------------------- Print out eval screen  # ------------------------------------------------------- Print out eval screen
     my $standardoptions=(<<ENDOPTIONS);      my $standardoptions=(<<ENDOPTIONS);
 <option value=0>-</option>  <option value=0>-</option>
Line 141  ENDHEADER Line 151  ENDHEADER
 <option value=4>Agree</option>  <option value=4>Agree</option>
 <option value=5>Strongly Agree</option>  <option value=5>Strongly Agree</option>
 ENDOPTIONS  ENDOPTIONS
       
       my $html=&Apache::lonxml::xmlbegin();
     $r->print(<<ENDDOCUMENT);      $r->print(<<ENDDOCUMENT);
 <html>  $html
 <head>  <head>
 <title>The LearningOnline Network with CAPA</title>  <title>The LearningOnline Network with CAPA</title>
 </head>  </head>
 <body bgcolor="#FFFFFF">  $bodytag
 <h1>Evaluate Resource</h1>  <tt>$title</tt><p>
 <tt>$feedurl</tt><p>  
 <h3><font color="red">$warning</font></h3>  <h3><font color="red">$warning</font></h3>
 Please rank the following criteria:  Please rank the following criteria:
 <form method=post name=evaluation>  <form method=post name=evaluation>
 <input type=hidden name=submiteval value=true>  <input type=hidden name=submiteval value=true>
 <input type=hidden name=postdata value="$feedurl">  <input type=hidden name=postdata value="$showurl">
 The material appears to be correct  The material appears to be correct
 <br><select name=correct>  <br><select name=correct>
 $standardoptions  $standardoptions

Removed from v.1.9  
changed lines
  Added in v.1.16


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