Diff for /loncom/interface/lonevaluate.pm between versions 1.25 and 1.31

version 1.25, 2008/11/18 19:14:22 version 1.31, 2018/04/14 02:29:44
Line 26 Line 26
 # http://www.lon-capa.org/  # http://www.lon-capa.org/
 #  #
   
 =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  
   
 package Apache::lonevaluate;  package Apache::lonevaluate;
   
Line 65  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 93  sub handler { Line 76  sub handler {
   
     my $warning='';      my $warning='';
   
       my $windowname = 'loncapaclient';
       if ($env{'request.lti.login'}) {
           $windowname .= 'lti';
       }
   
     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 105  sub handler { Line 93  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=='$windowname')) {
             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('                             'text' => 'Evaluate Resource'},
 '.$start_page.'                            {'href' => '',
 <h1>'.&mt('Thank you for your input!').'</h1>                             'text' => 'Done'}];
 ');  
        $r->print(&mt('Saving feedback: [_1]',              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 />'.&mt('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=&mt('Please fill out all fields below');              $warning=&mt('Please fill out all required fields below!');
         }          }
         
     }      }
Line 169  ENDJS Line 167  ENDJS
 <option value="5">$lt{'e'}</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();
   
      %lt=&Apache::lonlocal::texthash(      %lt=&Apache::lonlocal::texthash(
        'pleaserank' => 'Please rank the following criteria:',         'pleaserank' => 'Please rank the following criteria:',
          'required'   => '(All fields marked with * are required.)',
        'correct'    => 'The material appears to be correct',         'correct'    => 'The material appears to be correct',
        'helpful'    => 'The material is helpful',         'helpful'    => 'The material is helpful',
        'depth'      => 'The material is covered with sufficient depth',         'depth'      => 'The material is covered with sufficient depth',
        'clear'      => 'The material is presented in a clear way',         'clear'      => 'The material is presented in a clear way',
        'technical'  => 'The resource is technically correct (loads fast enough, does not produce errors, links work, etc)',         'technical'  => 'The resource is technically correct (loads fast enough, does not produce errors, links work, etc)',
        'comments'   => 'Any comments?',         'comments'   => 'Comments',
        'submit'     => 'Submit Evaluation',         'submit'     => 'Submit Evaluation',
     );      );
     $r->print(<<ENDDOCUMENT);      $r->print(
 $start_page          $start_page
 <h2><tt>$title</tt></h2><br /><br />         .'<h2>'.$title.'</h2>');
 <h3><font color="red">$warning</font></h3>  
 $lt{'pleaserank'}<br />      if ($warning) {
 <form method="post" name="evaluation" action="/adm/evaluate">          $r->print(
 <input type="hidden" name="submiteval" value="true" />              &Apache::loncommon::confirmwrapper(
 <input type="hidden" name="postdata" value="$showurl" />                  &Apache::lonhtmlcommon::confirm_success(
 <hr />              $warning,1)));
 $lt{'correct'}      }
 <br /><select name="correct">      $r->print(
 $standardoptions          '<form method="post" name="evaluation" action="/adm/evaluate">'
 </select>         .'<input type="hidden" name="submiteval" value="true" />'
 <hr />         .'<input type="hidden" name="postdata" value="'.$showurl.'" />'
 $lt{'helpful'}      );
 <br /><select name="helpful">      $r->print(
 $standardoptions          &Apache::lonhtmlcommon::start_pick_box()
 </select>         .&Apache::lonhtmlcommon::row_headline()
 <hr />         .$lt{'pleaserank'}.'<br />'
 $lt{'depth'}         .'<span class="LC_info">'.$lt{'required'}.'</span>'
 <br /><select name="depth">         .&Apache::lonhtmlcommon::row_closure()
 $standardoptions      );
 </select>  
 <hr />      foreach my $key ('correct', 'helpful', 'depth', 'clear', 'technical') {
 $lt{'clear'}          $r->print(
 <br /><select name="clear">              &Apache::lonhtmlcommon::row_title(
 $standardoptions                  '<span title="'.&mt('required').'">'.$lt{$key}
 </select>                 .' <span class="LC_info">*</span></span>')
 <hr />             .'<select name="'.$key.'">'
 $lt{'technical'}             .$standardoptions
 <br /><select name="technical">             .'</select>'
 $standardoptions             .&Apache::lonhtmlcommon::row_closure()
 </select>          );
 <hr />      }
 $lt{'comments'}  
 <br /><textarea name="comments" cols="40" rows="5">$oldcomments</textarea>      $r->print(
 <script type="text/javascript">$dialold</script>          &Apache::lonhtmlcommon::row_title($lt{'comments'})
 <br /><input type="submit" value="$lt{'submit'}" />         .'<textarea name="comments" cols="40" rows="5">'
 </form>         .$oldcomments
 $end_page         .'</textarea>'
 ENDDOCUMENT         .&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.25  
changed lines
  Added in v.1.31


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