source: main/trunk/greenstone2/perllib/talkback.pm@ 23084

Last change on this file since 23084 was 23084, checked in by davidb, 14 years ago

Routines to help CGI scripts that implement DL Talkback

File size: 3.0 KB
Line 
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
26package talkback;
27
28use strict;
29
30sub generate_upload_form
31{
32 my ($rand_string) = @_;
33
34 my $upload_html_form = <<EOF
35
36<html>
37 <head>
38 </head>
39 <body>
40 <form name="defaultForm"
41 action="talkback-progressbar.pl"
42 enctype="multipart/form-data" method="post">
43 <input type="hidden" name="yes_upload" value="1" />
44 <input type="hidden" name="process" value="1" />
45 <input type="hidden" name="rand_string" id="rand_string" value="$rand_string" />
46
47 <p>
48 <input type="file" size="50" name="uploadedfile" />
49 <span style="font-size:20pt; font-weight:bold;">&rarr;</span>
50 <input type="submit" value="Upload File" />
51 </p>
52
53 <script language="Javascript">
54 setInterval("check_status(['check_upload__1', 'rand_string', 'uploadedfile'], ['statusbar']);", '1000');
55 </script>
56
57 </form>
58
59
60 <div id="statusbar"></div>
61 </body>
62</html>
63
64EOF
65 ;
66
67 return $upload_html_form;
68}
69
70sub generate_upload_form_progressbar
71{
72 my ($rand_string) = @_;
73
74 my $upload_html_form = <<EOF
75
76<html>
77 <head>
78 </head>
79 <body>
80
81
82 <form name="talkbackUploadPB"
83 action="talkback-progressbar.pl"
84 enctype="multipart/form-data" method="post">
85 <input type="hidden" name="uploadedfile" value="test-medium.pdf" />
86 <input type="hidden" name="rand_string" id="rand_string" value="$rand_string" />
87 </form>
88
89
90 <script type="text/javascript">
91 setInterval("check_status(['check_upload__1', 'rand_string', 'uploadedfile'], ['statusbar']);", '1000');
92
93 </script>
94
95 <div style="width: 380px;" id="statusbar">status bar:</div>
96 </body>
97</html>
98
99EOF
100 ;
101
102
103 return $upload_html_form;
104}
105
106
107
108
109sub generate_done_html
110{
111 my ($full_filename) = @_;
112
113 my $done_html = <<EOF
114
115<html>
116 <head>
117 </head>
118 <body>
119 <h3>
120 File uploaded.
121 </h3>
122
123 <hr />
124 <p>
125 <i>Server file: $full_filename</i>
126 </p>
127 </body>
128</html>
129
130EOF
131 ;
132
133 return $done_html;
134}
135
1361;
Note: See TracBrowser for help on using the repository browser.