| … | |
… | |
| 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 | |
| 9 | use Apache::Request; |
9 | use strict; |
| 10 | use Apache::Constants qw(:common); |
10 | use warnings; |
| 11 | use WeBWorK::ContentGenerator; |
11 | use base 'WeBWorK::ContentGenerator'; |
|
|
12 | use CGI qw(); |
| 12 | use WeBWorK::Utils qw(hash2string); |
13 | use WeBWorK::Utils qw(ref2string); |
| 13 | |
14 | use WeBWorK::Form; |
| 14 | #use CGI::Carp qw(fatalsToBrowser); |
|
|
| 15 | |
|
|
| 16 | our @ISA = qw(WeBWorK::ContentGenerator); |
|
|
| 17 | |
15 | |
| 18 | sub title { |
16 | sub title { |
| 19 | return "Welcome to Hell."; |
17 | return "Welcome to Hell"; |
| 20 | } |
18 | } |
| 21 | |
19 | |
| 22 | sub body() { |
20 | sub 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 | |
| 58 | 1; |
29 | 1; |