[system] / trunk / webwork-modperl / lib / WeBWorK / ContentGenerator / Test.pm Repository:
ViewVC logotype

Diff of /trunk/webwork-modperl/lib/WeBWorK/ContentGenerator/Test.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 423 Revision 439
4# have been written. However, there's always reason to keep it around, as 4# have been written. However, there's always reason to keep it around, as
5# it showcases many things that new content generators will want to do, 5# it showcases many things that new content generators will want to do,
6# since it's generally where I dump new functionality before I put it in any 6# since it's generally where I dump new functionality before I put it in any
7# end-user modules. 7# end-user modules.
8 8
9use Apache::Request; 9use strict;
10use Apache::Constants qw(:common); 10use warnings;
11use WeBWorK::ContentGenerator; 11use base 'WeBWorK::ContentGenerator';
12use CGI qw();
12use WeBWorK::Utils qw(hash2string); 13use WeBWorK::Utils qw(ref2string);
13 14use WeBWorK::Form;
14#use CGI::Carp qw(fatalsToBrowser);
15
16our @ISA = qw(WeBWorK::ContentGenerator);
17 15
18sub title { 16sub title {
19 return "Welcome to Hell."; 17 return "Welcome to Hell";
20} 18}
21 19
22sub body() { 20sub body {
23 my $self = shift; 21 my $self = shift;
24 my $r = $self->{r}; 22 my $formFields = WeBWorK::Form->new_from_paramable($self->{r});
25 my $course_env = $self->{courseEnvironment}; 23 my $courseEnvironment = $self->{courseEnvironment};
26 # get some stuff together 24 return
27 my $user = $r->param("user"); 25 CGI->h2("Form Fields"), ref2string($formFields),
28 my $key = $r->param("key"); 26 CGI->h2("Course Environment"), ref2string($courseEnvironment);
29 my $uri = $r->uri;
30
31 print "<h1>There you go.</h1>","<p>You're now accessing $uri.</p>";
32
33 print $self->print_form_data(""," = ","<br>\n");
34
35 print '<br><form method="POST" action="',$r->uri,'">';
36 print $self->print_form_data('<input type="hidden" name="','" value = "',"\">\n");
37 print '<input type="file" name="filefield">';
38 print '<input type="submit" value="file upload test"></form>';
39
40 print '<br><form method="POST" action="',$r->uri,'">';
41 print $self->print_form_data('<input type="hidden" name="','" value = "',"\">\n");
42 print '<input type="submit" value="repost"></form>';
43
44 print '<form method="POST" action="',$r->uri,'">';
45 print $self->print_form_data('<input type="hidden" name="','" value = "',"\">\n",qr/^key$/);
46 print "<input type=\"hidden\" name=\"key\" value=\"invalidkeyhahaha\">";
47 print '<input type="submit" value="invalidate key"></form>';
48
49 print "<hr><pre>";
50
51 print hash2string($course_env);
52
53 print "</pre>";
54
55 "";
56} 27}
57 28
581; 291;

Legend:
Removed from v.423  
changed lines
  Added in v.439

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9