File: wizard.epl

package info (click to toggle)
libembperl-perl 2.5.0-17
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 7,632 kB
  • sloc: ansic: 21,387; perl: 14,497; javascript: 4,280; cpp: 467; xml: 49; makefile: 35; sh: 24
file content (119 lines) | stat: -rw-r--r-- 3,191 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119

[!
sub formname { 'myform' }
sub form_enctype {''}
sub on_submit { '' }
!]

[$ sub hidden $]
    [* my $r = shift ; *]
    <input type="hidden" name="-page" value="[+ $r -> {page} +]">
[$ endsub $]

[$ sub abort_button $]
    [* my $r = shift ; *]
    [$if $r -> {aborturl} $]<input type="submit" name="-abort" value="[= ctl:cancel =]" class="cStandardButton">&nbsp;&nbsp;&nbsp;[$endif$]
[$ endsub $]

[$ sub prev_button $]
    [* my $r = shift ; *]
    [$if $r -> {page} > 0 $]<input type="submit" name="-prev" value="&lt;&lt;[= ctl:back =]"  id="prev_button" class="cStandardButton">[$endif$]
[$ endsub $]

[$ sub next_button $]
    [* my $r = shift ; *]
    [$if $r -> {page} + 1 < @{$r -> {pages}} $]<input type="submit" name="-next" value="[= ctl:next =]&gt;&gt;" id="next_button" onClick="doValidate = 1" class="cStandardButton">[$endif$]
[$ endsub $]

[$ sub prevnext $]
    [* my $r = shift ; *]
    <p id="wizardbuttons">
    [- $r -> abort_button -]
    [- $r -> prev_button -]
    [- $r -> next_button -]
    </p>
[$ endsub $]

[$ sub after_form $]
[$ endsub $]


[$ sub display $]
    [* my $r = shift ; *]

    [- $formname = $r->{fields_epf_formname} = $r -> formname -]
    <script LANGUAGE="javascript">
    var doValidate = 0;

    function setfocus_first()
       {
       for (var i = 0; i < document.forms['[+ $formname +]'].elements.length; i++)
            {
            var e = document.forms['[+ $formname +]'].elements[i] ;
            if (e && e.type != 'hidden')
                {
                e.focus() ;
                if (e.type == 'text')
                    e.select() ;
                break ;
                }
            }
        }

    function submit_on_enter (e)
        {
        var next = document.getElementById('next_button') ;
        if (!next)
            return true ;
        
        if (!e)
            e = window.event ;
        c = e.which ;
        if (!c)
            c = e.keyCode ;
        if (c == 13)
            {
            var b = document.getElementById ('wizardbuttons') ;
            if (b)
                {
                next.focus() ;
                b.style.visibility='hidden';
                }
            submitvalue (document.forms['[+ $formname +]'], '-next', '1') ;
            
            return false ;    
            }
        return true ;    
        }

    document.onkeydown=submit_on_enter ;
    window.onload=setfocus_first ;

    </script>
 
    <form method="post" action="[+ $r -> param -> uri +]" name="[+ $formname +]" class="cEmbperlForm" 
	  onSubmit="v=doValidate; doValidate=0; x =((!v) || (epform_validate_[+ $formname +]() && [+ $r -> on_submit || '1' +])) ; return x "
          enctype="[+ $r -> form_enctype +]">

        [- $r -> show  -]
    <center>
        [- $r -> prevnext -]
        [- 
        delete $fdat{-page} ;
        delete $fdat{-prev} ;
        delete $fdat{-next} ;
        -]
        [- 
        $r -> hidden ;
        @ffld = keys %fdat ;
        -]
        [$ hidden $]
    </center>
    </form>

    [- $r -> after_form -]


[$ endsub $]