Annotation of loncom/interface/lonevaluate.pm, revision 1.8
1.1 www 1: # The LearningOnline Network
2: # Evaluate
3: #
1.8 ! www 4: # $Id: lonevaluate.pm,v 1.7 2002/03/28 21:38:53 www Exp $
1.2 www 5: #
6: # Copyright Michigan State University Board of Trustees
7: #
8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
9: #
10: # LON-CAPA is free software; you can redistribute it and/or modify
11: # it under the terms of the GNU General Public License as published by
12: # the Free Software Foundation; either version 2 of the License, or
13: # (at your option) any later version.
14: #
15: # LON-CAPA is distributed in the hope that it will be useful,
16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: # GNU General Public License for more details.
19: #
20: # You should have received a copy of the GNU General Public License
21: # along with LON-CAPA; if not, write to the Free Software
22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23: #
24: # /home/httpd/html/adm/gpl.txt
25: #
26: # http://www.lon-capa.org/
27: #
1.1 www 28: # (Internal Server Error Handler
29: #
30: # (Login Screen
31: # 5/21/99,5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14,
32: # 1/14/00,5/29,5/30,6/1,6/29,7/1,11/9 Gerd Kortemeyer)
33: #
34: # 3/1/1 Gerd Kortemeyer)
35: #
1.6 www 36: # 3/1,12/6,12/12,12/21,12/22 Gerd Kortemeyer
1.1 www 37: #
38: package Apache::lonevaluate;
39:
40: use strict;
1.3 www 41: use Apache::lonnet;
1.1 www 42: use Apache::Constants qw(:common);
43:
44: sub handler {
45: my $r = shift;
46: $r->content_type('text/html');
47: $r->send_http_header;
48: return OK if $r->header_only;
49:
1.7 www 50: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['postdata']);
1.3 www 51: my $feedurl=$ENV{'form.postdata'};
52: $feedurl=~s/^http\:\/\///;
53: $feedurl=~s/^$ENV{'SERVER_NAME'}//;
54: $feedurl=~s/^$ENV{'HTTP_HOST'}//;
55:
56: $feedurl=&Apache::lonnet::declutter($feedurl);
57: my $symb=&Apache::lonnet::symbread($feedurl);
58:
59: my ($rdomain,$rauth)=($feedurl=~/^(\w+)\/(\w+)\//);
60:
1.6 www 61: my $prefix=$ENV{'user.name'}.'@'.$ENV{'user.domain'}.'___'.
1.3 www 62: $feedurl.'___';
63:
1.4 www 64: my @items=('correct','helpful','depth','clear','technical','comments',
65: 'timestamp');
1.3 www 66:
67: my @retrieve=map{ $prefix.$_ } @items;
68:
1.4 www 69: my %currenteval=
70: &Apache::lonnet::get('resevaldata',\@retrieve,$rdomain,$rauth);
71:
72: my $already=($currenteval{$prefix.'timestamp'} ne '');
73:
74: $ENV{'form.timestamp'}=time;
75:
76: my $warning='';
77:
1.3 www 78: if ($ENV{'form.submiteval'} eq 'true') {
79: # ------------------------------------------------ User is submitting something
1.4 www 80: my $complete=1;
81: foreach my $item (@items) {
82: if ($ENV{'form.'.$item}) {
83: $currenteval{$prefix.$item}=$ENV{'form.'.$item};
84: } elsif ($item ne 'comments') {
85: $complete=0;
86: }
87: }
88: if ($complete) {
89: $r->print(<<ENDHEADER);
90: <html>
91: <head>
92: <title>Evaluation submitted</title>
1.8 ! www 93: <script>
! 94: function go() {
! 95: if (window.name!='LONcatInfo') {
! 96: window.location='/res/$feedurl';
! 97: }
! 98: }
! 99: </script>
1.4 www 100: <meta http-equiv="pragma" content="no-cache"></meta>
101: </head>
102: <body bgcolor="#FFFFFF">
103: <h1>Thank you for your input!</h1>
104: ENDHEADER
105: $r->print('Storing feedback: '.
106: &Apache::lonnet::put('resevaldata',\%currenteval,$rdomain,$rauth));
107: unless ($already) {
108: $r->print('<br>Logging first evaluation');
109: }
1.8 ! www 110: $r->print(
! 111: '<script>setTimeout("go()",2000);</script></body></html>');
1.4 www 112: return OK;
113: } else {
114: $warning='Please fill out all fields below';
115: }
1.8 ! www 116:
1.3 www 117: }
1.4 www 118:
119: # ---------------------------------------------------------- Dial in old values
120: my $dialold='';
1.5 www 121: my $oldcomments='';
122:
123: foreach my $item (@items) {
124: unless ($item eq 'comments') {
125: unless ($item eq 'timestamp') {
126: $dialold.=
127: 'document.evaluation.'.$item.'.selectedIndex='.
128: $currenteval{$prefix.$item}.";\n";
129: }
130: } else {
131: $oldcomments=$currenteval{$prefix.$item};
132: }
133: }
1.4 www 134:
1.3 www 135: # ------------------------------------------------------- Print out eval screen
1.2 www 136: my $standardoptions=(<<ENDOPTIONS);
137: <option value=0>-</option>
138: <option value=1>Strongly Disagree</option>
139: <option value=2>Disagree</option>
140: <option value=3>Neutral</option>
141: <option value=4>Agree</option>
142: <option value=5>Strongly Agree</option>
143: ENDOPTIONS
144:
1.1 www 145: $r->print(<<ENDDOCUMENT);
146: <html>
147: <head>
148: <title>The LearningOnline Network with CAPA</title>
149: </head>
150: <body bgcolor="#FFFFFF">
1.2 www 151: <h1>Evaluate Resource</h1>
1.3 www 152: <tt>$feedurl</tt><p>
1.4 www 153: <h3><font color="red">$warning</font></h3>
1.2 www 154: Please rank the following criteria:
1.5 www 155: <form method=post name=evaluation>
1.2 www 156: <input type=hidden name=submiteval value=true>
1.3 www 157: <input type=hidden name=postdata value="$feedurl">
1.2 www 158: The material appears to be correct
159: <br><select name=correct>
160: $standardoptions
161: </select>
162: <hr>
163: The material is helpful
164: <br><select name=helpful>
165: $standardoptions
166: </select>
167: <hr>
168: The material is covered with sufficient depth
169: <br><select name=depth>
170: $standardoptions
171: </select>
172: <hr>
173: The material is presented in a clear way
174: <br><select name=clear>
175: $standardoptions
176: </select>
177: <hr>
178: The resource is technically correct
179: (loads fast enough, does not produce errors, links work, etc)
1.3 www 180: <br><select name=technical>
1.2 www 181: $standardoptions
182: </select>
183: <hr>
184: Any comments?
185: <br><textarea name=comments cols=40 rows=5>$oldcomments</textarea>
1.5 www 186: <script>$dialold</script>
1.4 www 187: <br><input type=submit value="Submit Evaluation">
1.2 www 188: </form>
1.1 www 189: </body>
190: </html>
191: ENDDOCUMENT
192: return OK;
193: }
194:
195: 1;
196: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>