1 | ###########################################################################
|
---|
2 | #
|
---|
3 | # talkback.pm --
|
---|
4 | # A component of the Greenstone digital library software
|
---|
5 | # from the New Zealand Digital Library Project at the
|
---|
6 | # University of Waikato, New Zealand.
|
---|
7 | #
|
---|
8 | # Copyright (C) 1999 New Zealand Digital Library Project
|
---|
9 | #
|
---|
10 | # This program 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 | # This program 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 this program; if not, write to the Free Software
|
---|
22 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
23 | #
|
---|
24 | ###########################################################################
|
---|
25 |
|
---|
26 | package talkback;
|
---|
27 |
|
---|
28 | use strict;
|
---|
29 |
|
---|
30 |
|
---|
31 | sub generate_upload_form
|
---|
32 | {
|
---|
33 | my ($rand_string) = @_;
|
---|
34 |
|
---|
35 | my $upload_html_form = <<EOF
|
---|
36 |
|
---|
37 | <html>
|
---|
38 | <head>
|
---|
39 | </head>
|
---|
40 | <body>
|
---|
41 | <form name="defaultForm"
|
---|
42 | action="talkback-progressbar.pl"
|
---|
43 | enctype="multipart/form-data" method="post">
|
---|
44 | <input type="hidden" name="yes_upload" value="1" />
|
---|
45 | <input type="hidden" name="process" value="1" />
|
---|
46 | <input type="hidden" name="rand_string" id="rand_string" value="$rand_string" />
|
---|
47 |
|
---|
48 | <p>
|
---|
49 | <input type="file" size="50" name="uploadedfile" />
|
---|
50 | <span style="font-size:20pt; font-weight:bold;">→</span>
|
---|
51 | <input type="submit" value="Upload File" />
|
---|
52 | </p>
|
---|
53 |
|
---|
54 | <script language="Javascript">
|
---|
55 | setInterval("check_status(['check_upload__1', 'rand_string', 'uploadedfile'], ['statusbar']);", '1000');
|
---|
56 | </script>
|
---|
57 |
|
---|
58 | </form>
|
---|
59 |
|
---|
60 |
|
---|
61 | <div id="statusbar"></div>
|
---|
62 | </body>
|
---|
63 | </html>
|
---|
64 |
|
---|
65 | EOF
|
---|
66 | ;
|
---|
67 |
|
---|
68 | return $upload_html_form;
|
---|
69 | }
|
---|
70 |
|
---|
71 | sub generate_upload_form_progressbar
|
---|
72 | {
|
---|
73 | my ($rand_string) = @_;
|
---|
74 |
|
---|
75 | my $upload_html_form = <<EOF
|
---|
76 |
|
---|
77 | <html>
|
---|
78 | <head>
|
---|
79 | </head>
|
---|
80 | <body>
|
---|
81 |
|
---|
82 |
|
---|
83 | <form name="talkbackUploadPB"
|
---|
84 | action="talkback-progressbar.pl"
|
---|
85 | enctype="multipart/form-data" method="post">
|
---|
86 | <input type="hidden" name="uploadedfile" value="test-medium.pdf" />
|
---|
87 | <input type="hidden" name="rand_string" id="rand_string" value="$rand_string" />
|
---|
88 | </form>
|
---|
89 |
|
---|
90 |
|
---|
91 | <script type="text/javascript">
|
---|
92 | setInterval("check_status(['check_upload__1', 'rand_string', 'uploadedfile'], ['statusbar']);", '1000');
|
---|
93 |
|
---|
94 | </script>
|
---|
95 |
|
---|
96 | <div style="width: 380px;" id="statusbar">status bar:</div>
|
---|
97 | </body>
|
---|
98 | </html>
|
---|
99 |
|
---|
100 | EOF
|
---|
101 | ;
|
---|
102 |
|
---|
103 |
|
---|
104 | return $upload_html_form;
|
---|
105 | }
|
---|
106 |
|
---|
107 |
|
---|
108 |
|
---|
109 |
|
---|
110 | sub generate_done_html
|
---|
111 | {
|
---|
112 | my ($full_filename) = @_;
|
---|
113 |
|
---|
114 | my $done_html = <<EOF
|
---|
115 |
|
---|
116 | <html>
|
---|
117 | <head>
|
---|
118 | </head>
|
---|
119 | <body>
|
---|
120 | <h3>
|
---|
121 | File uploaded.
|
---|
122 | </h3>
|
---|
123 |
|
---|
124 | <hr />
|
---|
125 | <p>
|
---|
126 | <i>Server file: $full_filename</i>
|
---|
127 | </p>
|
---|
128 | </body>
|
---|
129 | </html>
|
---|
130 |
|
---|
131 | EOF
|
---|
132 | ;
|
---|
133 |
|
---|
134 | return $done_html;
|
---|
135 | }
|
---|
136 |
|
---|
137 | sub generate_malformed_args_html
|
---|
138 | {
|
---|
139 | my ($full_filename) = @_;
|
---|
140 |
|
---|
141 | my $done_html = <<EOF
|
---|
142 |
|
---|
143 | <html>
|
---|
144 | <head>
|
---|
145 | </head>
|
---|
146 | <body>
|
---|
147 | <h3>
|
---|
148 | Oops!
|
---|
149 | </h3>
|
---|
150 | <hr />
|
---|
151 | <p>
|
---|
152 | Malformed CGI arguments. Need either CGI 'processing' or 'rand_string' set.
|
---|
153 | </p>
|
---|
154 | </body>
|
---|
155 | </html>
|
---|
156 |
|
---|
157 | EOF
|
---|
158 | ;
|
---|
159 |
|
---|
160 | return $done_html;
|
---|
161 | }
|
---|
162 |
|
---|
163 |
|
---|
164 | 1;
|
---|