| 1 |
################################################################################### |
| 2 |
# |
| 3 |
# Embperl - Copyright (c) 1997-2008 Gerald Richter / ecos gmbh www.ecos.de |
| 4 |
# Embperl - Copyright (c) 2008-2014 Gerald Richter |
| 5 |
# |
| 6 |
# You may distribute under the terms of either the GNU General Public |
| 7 |
# License or the Artistic License, as specified in the Perl README file. |
| 8 |
# |
| 9 |
# THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR |
| 10 |
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
| 11 |
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
| 12 |
# |
| 13 |
# $Id$ |
| 14 |
# |
| 15 |
################################################################################### |
| 16 |
|
| 17 |
package Embperl::Form::Control::scriptcode ; |
| 18 |
|
| 19 |
use strict ; |
| 20 |
use base 'Embperl::Form::Control' ; |
| 21 |
|
| 22 |
use Embperl::Inline ; |
| 23 |
|
| 24 |
sub noframe { return 1; } |
| 25 |
|
| 26 |
# --------------------------------------------------------------------------- |
| 27 |
# |
| 28 |
# is_hidden - returns true if this is a hidden control |
| 29 |
# |
| 30 |
|
| 31 |
sub is_hidden |
| 32 |
|
| 33 |
{ |
| 34 |
my ($self, $req) = @_ ; |
| 35 |
|
| 36 |
return 1 ; |
| 37 |
} |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
1 ; |
| 42 |
|
| 43 |
__EMBPERL__ |
| 44 |
|
| 45 |
[# --------------------------------------------------------------------------- |
| 46 |
# |
| 47 |
# show_control - output the control |
| 48 |
#] |
| 49 |
|
| 50 |
[$ sub show ($self, $req) |
| 51 |
|
| 52 |
my $name = $self -> {name}; |
| 53 |
my $type = $self -> {scripttype} || 'text/javascript' ; |
| 54 |
|
| 55 |
$] |
| 56 |
<script type="[+ $type +]"> |
| 57 |
//<!-- |
| 58 |
[+ do { local $escmode = 0 ; $self -> {code} } +] |
| 59 |
//--> |
| 60 |
</script> |
| 61 |
[$endsub$] |
| 62 |
|
| 63 |
__END__ |
| 64 |
|
| 65 |
=pod |
| 66 |
|
| 67 |
=head1 NAME |
| 68 |
|
| 69 |
Embperl::Form::Control::scriptcode - A control to add script code to an Embperl Form |
| 70 |
|
| 71 |
|
| 72 |
=head1 SYNOPSIS |
| 73 |
|
| 74 |
{ |
| 75 |
type => 'scriptcode', |
| 76 |
code => 'function onEvent { .... }', |
| 77 |
} |
| 78 |
|
| 79 |
=head1 DESCRIPTION |
| 80 |
|
| 81 |
Used to create a script code blockinside an Embperl Form. |
| 82 |
The code block is added to the end of the form. |
| 83 |
See Embperl::Form on how to specify parameters. |
| 84 |
|
| 85 |
=head2 PARAMETER |
| 86 |
|
| 87 |
=head3 type |
| 88 |
|
| 89 |
Needs to be set to 'scriptcode'. |
| 90 |
|
| 91 |
=head3 name |
| 92 |
|
| 93 |
optional |
| 94 |
|
| 95 |
=head3 scripttype |
| 96 |
|
| 97 |
Type of script code. Default: text/javascript |
| 98 |
|
| 99 |
=head3 code |
| 100 |
|
| 101 |
The actual script code. |
| 102 |
|
| 103 |
|
| 104 |
=head1 Author |
| 105 |
|
| 106 |
G. Richter (richter at embperl dot org), A. Beckert ([email protected]) |
| 107 |
|
| 108 |
=head1 See Also |
| 109 |
|
| 110 |
perl(1), Embperl, Embperl::Form |
| 111 |
|
| 112 |
|