Diff for /loncom/interface/lonevaluate.pm between versions 1.20 and 1.30

version 1.20, 2006/12/05 02:55:52 version 1.30, 2014/01/17 17:10:12
Line 26 Line 26
 # http://www.lon-capa.org/  # http://www.lon-capa.org/
 #  #
   
   
   
 package Apache::lonevaluate;  package Apache::lonevaluate;
   
 use strict;  use strict;
Line 33  use Apache::lonnet; Line 35  use Apache::lonnet;
 use Apache::Constants qw(:common);  use Apache::Constants qw(:common);
 use Apache::loncommon();  use Apache::loncommon();
 use Apache::lonenc();  use Apache::lonenc();
   use Apache::lonlocal;
 use LONCAPA();  use LONCAPA();
   
 sub handler {  sub handler {
Line 45  sub handler { Line 48  sub handler {
   
     &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/^https?\:\/\///;
     $feedurl=~s/^$ENV{'SERVER_NAME'}//;      $feedurl=~s/^$ENV{'SERVER_NAME'}//;
     $feedurl=~s/^$ENV{'HTTP_HOST'}//;      $feedurl=~s/^$ENV{'HTTP_HOST'}//;
   
Line 85  sub handler { Line 88  sub handler {
         }          }
         if ($complete) {          if ($complete) {
     my $showurl=&Apache::lonenc::check_encrypt(&Apache::lonnet::clutter($feedurl));      my $showurl=&Apache::lonenc::check_encrypt(&Apache::lonnet::clutter($feedurl));
     my $js =<<ENDJS;              my $js = &Apache::lonhtmlcommon::scripttag(<<ENDJS);
 <script type="text/javascript">  
     function goback() {      function goback() {
  if ((window.name=='loncapaclient')) {          if ((window.name=='loncapaclient')) {
             window.location='$showurl';              window.location='$showurl';
         } else {          } else {
             self.close();              self.close();
         }          }
     }      }
 </script>  
 ENDJS  ENDJS
   
             my $start_page =               # Breadcrumbs
         &Apache::loncommon::start_page('Evaluate Resource',$js);              my $brcrum = [{'href' => '/adm/evaluate',
     $r->print(<<ENDHEADER);                             'text' => 'Evaluate Resource'},
 $start_page                            {'href' => '',
 <h1>Thank you for your input!</h1>                             'text' => 'Done'}];
 ENDHEADER  
        $r->print('Storing feedback: '.              my $start_page = &Apache::loncommon::start_page('Evaluate Resource',
            &Apache::lonnet::put('nohist_resevaldata',\%currenteval,$rdomain,$rauth));                                                              $js,
                                                               {'bread_crumbs' => $brcrum,});
   
               $r->print($start_page
                        .'<p class="LC_success">'
                        .&mt('Saving feedback: [_1]'
                             ,&Apache::lonnet::put(
                                  'nohist_resevaldata',\%currenteval,$rdomain,$rauth))
                        .'</p>'
               );
            unless ($already) {             unless ($already) {
        $r->print('<br />Logging first evaluation');                 $r->print('<p>'.&mt('Logging first evaluation').'</p>');
            }             }
            $r->print(             $r->print('<p><b>'.&mt('Thank you for your input!').'</b></p>'
             '<script type="text/javascript">setTimeout("goback()",2000);</script>'.&Apache::loncommon::end_page());                      .&Apache::lonhtmlcommon::scripttag(
                           'setTimeout("goback()",2000);')
                       .&Apache::loncommon::end_page()
              );
            return OK;             return OK;
         } else {          } else {
     $warning='Please fill out all fields below';              $warning=&mt('Please fill out all required fields below!');
         }          }
         
     }      }
Line 134  ENDHEADER Line 147  ENDHEADER
        }                }       
     }      }
 # ------------------------------------------------------- Print out eval screen  # ------------------------------------------------------- Print out eval screen
     my $standardoptions=(<<ENDOPTIONS);      my %lt=&Apache::lonlocal::texthash('a' => 'Strongly Disagree',
          'b' => 'Disagree',
          'c' => 'Neutral',
          'd' => 'Agree',
          'e' => 'Strongly Agree',);
       my $standardoptions='';
       $standardoptions = (<<ENDOPTIONS);
 <option value="0">-</option>  <option value="0">-</option>
 <option value="1">Strongly Disagree</option>  <option value="1">$lt{'a'}</option>
 <option value="2">Disagree</option>  <option value="2">$lt{'b'}</option>
 <option value="3">Neutral</option>  <option value="3">$lt{'c'}</option>
 <option value="4">Agree</option>  <option value="4">$lt{'d'}</option>
 <option value="5">Strongly Agree</option>  <option value="5">$lt{'e'}</option>
 ENDOPTIONS  ENDOPTIONS
       
     my $start_page = &Apache::loncommon::start_page('Evaluate Resource');      # Breadcrumbs
       my $brcrum = [{'href' => '/adm/evaluate',
                      'text' => 'Evaluate Resource'}];
   
       my $start_page = &Apache::loncommon::start_page('Evaluate Resource',
                                                       undef,
                                                       {'bread_crumbs' => $brcrum,});
     my $end_page   = &Apache::loncommon::end_page();      my $end_page   = &Apache::loncommon::end_page();
     $r->print(<<ENDDOCUMENT);  
 $start_page      %lt=&Apache::lonlocal::texthash(
 <tt>$title</tt><br /><br />         'pleaserank' => 'Please rank the following criteria:',
 <h3><font color="red">$warning</font></h3>         'required'   => '(All fields marked with * are required.)',
 Please rank the following criteria:         'correct'    => 'The material appears to be correct',
 <form method="post" name="evaluation" action="/adm/evaluate">         'helpful'    => 'The material is helpful',
 <input type="hidden" name="submiteval" value="true" />         'depth'      => 'The material is covered with sufficient depth',
 <input type="hidden" name="postdata" value="$showurl" />         'clear'      => 'The material is presented in a clear way',
 The material appears to be correct         'technical'  => 'The resource is technically correct (loads fast enough, does not produce errors, links work, etc)',
 <br /><select name="correct">         'comments'   => 'Comments',
 $standardoptions         'submit'     => 'Submit Evaluation',
 </select>      );
 <hr />      $r->print(
 The material is helpful          $start_page
 <br /><select name="helpful">         .'<h2>'.$title.'</h2>');
 $standardoptions  
 </select>      if ($warning) {
 <hr />          $r->print(
 The material is covered with sufficient depth              &Apache::loncommon::confirmwrapper(
 <br /><select name="depth">                  &Apache::lonhtmlcommon::confirm_success(
 $standardoptions              $warning,1)));
 </select>      }
 <hr />      $r->print(
 The material is presented in a clear way          '<form method="post" name="evaluation" action="/adm/evaluate">'
 <br /><select name="clear">         .'<input type="hidden" name="submiteval" value="true" />'
 $standardoptions         .'<input type="hidden" name="postdata" value="'.$showurl.'" />'
 </select>      );
 <hr />      $r->print(
 The resource is technically correct           &Apache::lonhtmlcommon::start_pick_box()
 (loads fast enough, does not produce errors, links work, etc)          .&Apache::lonhtmlcommon::row_headline()
 <br /><select name="technical">         .$lt{'pleaserank'}.'<br />'
 $standardoptions         .'<span class="LC_info">'.$lt{'required'}.'</span>'
 </select>         .&Apache::lonhtmlcommon::row_closure()
 <hr />      );
 Any comments?  
 <br /><textarea name="comments" cols="40" rows="5">$oldcomments</textarea>      foreach my $key ('correct', 'helpful', 'depth', 'clear', 'technical') {
 <script type="text/javascript">$dialold</script>          $r->print(
 <br /><input type="submit" value="Submit Evaluation" />              &Apache::lonhtmlcommon::row_title(
 </form>                  '<span title="'.&mt('required').'">'.$lt{$key}
 $end_page                 .' <span class="LC_info">*</span></span>')
 ENDDOCUMENT             .'<select name="'.$key.'">'
              .$standardoptions
              .'</select>'
              .&Apache::lonhtmlcommon::row_closure()
           );
       }
   
       $r->print(
           &Apache::lonhtmlcommon::row_title($lt{'comments'})
          .'<textarea name="comments" cols="40" rows="5">'
          .$oldcomments
          .'</textarea>'
          .&Apache::lonhtmlcommon::row_closure(1)
          .&Apache::lonhtmlcommon::end_pick_box()
          .'<p>'
          .'<input type="submit" value="'.$lt{'submit'}.'" />'
          .'</p>'
       );
   
       $r->print(
           &Apache::lonhtmlcommon::scripttag($dialold)
          .'</form>'
          .$end_page
       );
   
     return OK;      return OK;
 }   } 
   
 1;  1;
 __END__  __END__
   
   =pod
   
   =head1 NAME
   
   Apache::lonevaluate.pm
   
   =head1 SYNOPSIS
   
   Handles evaluation.
   
   This is part of the LearningOnline Network with CAPA project
   described at http://www.lon-capa.org.
   
   =head1 OVERVIEW
   
   None
   
   =cut

Removed from v.1.20  
changed lines
  Added in v.1.30


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