~mortenoh/+junk/dhis2-detailed-import-export

« back to all changes in this revision

Viewing changes to dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/FCK/_samples/perl/sampleposteddata.cgi

  • Committer: larshelge at gmail
  • Date: 2009-03-03 16:46:36 UTC
  • Revision ID: larshelge@gmail.com-20090303164636-2sjlrquo7ib1gf7r
Initial check-in

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env perl
 
2
 
 
3
#####
 
4
#  FCKeditor - The text editor for Internet - http://www.fckeditor.net
 
5
#  Copyright (C) 2003-2007 Frederico Caldeira Knabben
 
6
#
 
7
#  == BEGIN LICENSE ==
 
8
#
 
9
#  Licensed under the terms of any of the following licenses at your
 
10
#  choice:
 
11
#
 
12
#   - GNU General Public License Version 2 or later (the "GPL")
 
13
#     http://www.gnu.org/licenses/gpl.html
 
14
#
 
15
#   - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
 
16
#     http://www.gnu.org/licenses/lgpl.html
 
17
#
 
18
#   - Mozilla Public License Version 1.1 or later (the "MPL")
 
19
#     http://www.mozilla.org/MPL/MPL-1.1.html
 
20
#
 
21
#  == END LICENSE ==
 
22
#
 
23
#  This page lists the data posted by a form.
 
24
#####
 
25
 
 
26
## START: Hack for Windows (Not important to understand the editor code... Perl specific).
 
27
if(Windows_check()) {
 
28
        chdir(GetScriptPath($0));
 
29
}
 
30
 
 
31
sub Windows_check
 
32
{
 
33
        # IIS,PWS(NT/95)
 
34
        $www_server_os = $^O;
 
35
        # Win98 & NT(SP4)
 
36
        if($www_server_os eq "") { $www_server_os= $ENV{'OS'}; }
 
37
        # AnHTTPd/Omni/IIS
 
38
        if($ENV{'SERVER_SOFTWARE'} =~ /AnWeb|Omni|IIS\//i) { $www_server_os= 'win'; }
 
39
        # Win Apache
 
40
        if($ENV{'WINDIR'} ne "") { $www_server_os= 'win'; }
 
41
        if($www_server_os=~ /win/i) { return(1); }
 
42
        return(0);
 
43
}
 
44
 
 
45
sub GetScriptPath {
 
46
        local($path) = @_;
 
47
        if($path =~ /[\:\/\\]/) { $path =~ s/(.*?)[\/\\][^\/\\]+$/$1/; } else { $path = '.'; }
 
48
        $path;
 
49
}
 
50
## END: Hack for IIS
 
51
 
 
52
require '../../fckeditor.pl';
 
53
 
 
54
        if($ENV{'REQUEST_METHOD'} eq "POST") {
 
55
                read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
 
56
        } else {
 
57
                $buffer = $ENV{'QUERY_STRING'};
 
58
        }
 
59
        @pairs = split(/&/,$buffer);
 
60
        foreach $pair (@pairs) {
 
61
                ($name,$value) = split(/=/,$pair);
 
62
                $value =~ tr/+/ /;
 
63
                $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
 
64
                $value =~ s/\t//g;
 
65
                $value =~ s/\r\n/\n/g;
 
66
                $FORM{$name} .= "\0"                    if(defined($FORM{$name}));
 
67
                $FORM{$name} .= $value;
 
68
        }
 
69
 
 
70
        print "Content-type: text/html\n\n";
 
71
        print <<"_HTML_TAG_";
 
72
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 
73
 
 
74
<html>
 
75
        <head>
 
76
                <title>FCKeditor - Samples - Posted Data</title>
 
77
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 
78
                <meta name="robots" content="noindex, nofollow">
 
79
                <link href="../sample.css" rel="stylesheet" type="text/css" />
 
80
        </head>
 
81
        <body>
 
82
                <h1>FCKeditor - Samples - Posted Data</h1>
 
83
                This page lists all data posted by the form.
 
84
                <hr>
 
85
                <table width="100%" border="1" cellspacing="0" bordercolor="#999999">
 
86
                        <tr style="FONT-WEIGHT: bold; COLOR: #dddddd; BACKGROUND-COLOR: #999999">
 
87
                                <td nowrap>Field Name&nbsp;&nbsp;</td>
 
88
                                <td>Value</td>
 
89
                        </tr>
 
90
_HTML_TAG_
 
91
 
 
92
        foreach $key (keys %FORM) {
 
93
                $postedValue = &specialchar_cnv($FORM{$key});
 
94
                print <<"_HTML_TAG_";
 
95
                        <tr>
 
96
                                <td valign="top" nowrap><b>$key</b></td>
 
97
                                <td width="100%">$postedValue</td>
 
98
                        </tr>
 
99
_HTML_TAG_
 
100
        }
 
101
                print <<"_HTML_TAG_";
 
102
                </table>
 
103
        </body>
 
104
</html>
 
105
_HTML_TAG_