version 1.18, 2006/03/02 21:11:00
|
version 1.29, 2009/09/04 16:12:09
|
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(); |
|
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
&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; |
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/^https?\:\/\///; |
$feedurl=~s/^$ENV{'SERVER_NAME'}//; |
$feedurl=~s/^$ENV{'SERVER_NAME'}//; |
$feedurl=~s/^$ENV{'HTTP_HOST'}//; |
$feedurl=~s/^$ENV{'HTTP_HOST'}//; |
|
|
Line 51 sub handler {
|
Line 57 sub handler {
|
my $title=&Apache::lonnet::gettitle($feedurl); |
my $title=&Apache::lonnet::gettitle($feedurl); |
my $showurl=&Apache::lonenc::check_encrypt($feedurl); |
my $showurl=&Apache::lonenc::check_encrypt($feedurl); |
|
|
my ($rdomain,$rauth)=($feedurl=~/^(\w+)\/(\w+)\//); |
my ($rdomain,$rauth)=($feedurl=~/^($LONCAPA::domain_re)\/($LONCAPA::username_re)\//); |
|
|
my $prefix=$env{'user.name'}.'@'.$env{'user.domain'}.'___'. |
my $prefix=$env{'user.name'}.'@'.$env{'user.domain'}.'___'. |
$feedurl.'___'; |
$feedurl.'___'; |
Line 70 sub handler {
|
Line 76 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 84 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 $html=&Apache::lonxml::xmlbegin(); |
my $js = &Apache::lonhtmlcommon::scripttag(<<ENDJS); |
$r->print(<<ENDHEADER); |
|
$html |
|
<head> |
|
<title>Evaluation submitted</title> |
|
<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 |
<meta http-equiv="pragma" content="no-cache"></meta> |
|
</head> |
# Breadcrumbs |
$bodytag |
my $brcrum = [{'href' => '/adm/evaluate', |
<h1>Thank you for your input!</h1> |
'text' => 'Evaluate Resource'}, |
ENDHEADER |
{'href' => '', |
$r->print('Storing feedback: '. |
'text' => 'Done'}]; |
&Apache::lonnet::put('nohist_resevaldata',\%currenteval,$rdomain,$rauth)); |
|
|
my $start_page = &Apache::loncommon::start_page('Evaluate Resource', |
|
$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></body></html>'); |
.&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 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 $html=&Apache::lonxml::xmlbegin(); |
# Breadcrumbs |
$r->print(<<ENDDOCUMENT); |
my $brcrum = [{'href' => '/adm/evaluate', |
$html |
'text' => 'Evaluate Resource'}]; |
<head> |
|
<title>The LearningOnline Network with CAPA</title> |
my $start_page = &Apache::loncommon::start_page('Evaluate Resource', |
</head> |
undef, |
$bodytag |
{'bread_crumbs' => $brcrum,}); |
<tt>$title</tt><br /><br /> |
my $end_page = &Apache::loncommon::end_page(); |
<h3><font color="red">$warning</font></h3> |
|
Please rank the following criteria: |
%lt=&Apache::lonlocal::texthash( |
<form method="post" name="evaluation" action="/adm/evaluate"> |
'pleaserank' => 'Please rank the following criteria:', |
<input type="hidden" name="submiteval" value="true" /> |
'correct' => 'The material appears to be correct', |
<input type="hidden" name="postdata" value="$showurl" /> |
'helpful' => 'The material is helpful', |
The material appears to be correct |
'depth' => 'The material is covered with sufficient depth', |
<br /><select name="correct"> |
'clear' => 'The material is presented in a clear way', |
$standardoptions |
'technical' => 'The resource is technically correct (loads fast enough, does not produce errors, links work, etc)', |
</select> |
'comments' => 'Comments', |
<hr /> |
'submit' => 'Submit Evaluation', |
The material is helpful |
); |
<br /><select name="helpful"> |
$r->print( |
$standardoptions |
$start_page |
</select> |
.'<h2>'.$title.'</h2>' |
<hr /> |
.'<p class="LC_warning">'.$warning.'</p>' |
The material is covered with sufficient depth |
.'<form method="post" name="evaluation" action="/adm/evaluate">' |
<br /><select name="depth"> |
.'<input type="hidden" name="submiteval" value="true" />' |
$standardoptions |
.'<input type="hidden" name="postdata" value="'.$showurl.'" />' |
</select> |
); |
<hr /> |
$r->print( |
The material is presented in a clear way |
&Apache::lonhtmlcommon::start_pick_box() |
<br /><select name="clear"> |
.&Apache::lonhtmlcommon::row_headline() |
$standardoptions |
.$lt{'pleaserank'} |
</select> |
.&Apache::lonhtmlcommon::row_closure() |
<hr /> |
); |
The resource is technically correct |
|
(loads fast enough, does not produce errors, links work, etc) |
foreach my $key ('correct', 'helpful', 'depth', 'clear', 'technical') { |
<br /><select name="technical"> |
$r->print( |
$standardoptions |
&Apache::lonhtmlcommon::row_title($lt{$key}) |
</select> |
.'<select name="'.$key.'">' |
<hr /> |
.$standardoptions |
Any comments? |
.'</select>' |
<br /><textarea name="comments" cols="40" rows="5">$oldcomments</textarea> |
.&Apache::lonhtmlcommon::row_closure() |
<script type="text/javascript">$dialold</script> |
); |
<br /><input type="submit" value="Submit Evaluation" /> |
} |
</form> |
|
</body> |
$r->print( |
</html> |
&Apache::lonhtmlcommon::row_title($lt{'comments'}) |
ENDDOCUMENT |
.'<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 |