| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  |  | 
| 2 |  |  |  |  |  |  | ################################################################################### | 
| 3 |  |  |  |  |  |  | # | 
| 4 |  |  |  |  |  |  | #   Embperl - Copyright (c) 1997-2008 Gerald Richter / ecos gmbh  www.ecos.de | 
| 5 |  |  |  |  |  |  | #   Embperl - Copyright (c) 2008-2014 Gerald Richter | 
| 6 |  |  |  |  |  |  | # | 
| 7 |  |  |  |  |  |  | #   You may distribute under the terms of either the GNU General Public | 
| 8 |  |  |  |  |  |  | #   License or the Artistic License, as specified in the Perl README file. | 
| 9 |  |  |  |  |  |  | # | 
| 10 |  |  |  |  |  |  | #   THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR | 
| 11 |  |  |  |  |  |  | #   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | 
| 12 |  |  |  |  |  |  | #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 
| 13 |  |  |  |  |  |  | # | 
| 14 |  |  |  |  |  |  | #   $Id: EmbperlHTML.pm 1578075 2014-03-16 14:01:14Z richter $ | 
| 15 |  |  |  |  |  |  | # | 
| 16 |  |  |  |  |  |  | ################################################################################### | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | package Embperl::Syntax::EmbperlHTML ; | 
| 21 |  |  |  |  |  |  |  | 
| 22 | 1 |  |  | 1 |  | 19 | use Embperl::Syntax qw{:types} ; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 179 |  | 
| 23 | 1 |  |  | 1 |  | 1892 | use Embperl::Syntax::HTML ; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 43 |  | 
| 24 |  |  |  |  |  |  |  | 
| 25 | 1 |  |  | 1 |  | 6 | use strict ; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 25 |  | 
| 26 | 1 |  |  | 1 |  | 4 | use vars qw{@ISA} ; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 422 |  | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | @ISA = qw(Embperl::Syntax::HTML) ; | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | ################################################################################### | 
| 32 |  |  |  |  |  |  | # | 
| 33 |  |  |  |  |  |  | #   Methods | 
| 34 |  |  |  |  |  |  | # | 
| 35 |  |  |  |  |  |  | ################################################################################### | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | # --------------------------------------------------------------------------------- | 
| 38 |  |  |  |  |  |  | # | 
| 39 |  |  |  |  |  |  | #   Create new Syntax Object | 
| 40 |  |  |  |  |  |  | # | 
| 41 |  |  |  |  |  |  | # --------------------------------------------------------------------------------- | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | sub new | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | { | 
| 46 | 2 |  |  | 2 | 1 | 5 | my $class = shift ; | 
| 47 |  |  |  |  |  |  |  | 
| 48 | 2 |  |  |  |  | 10 | my $self = Embperl::Syntax::HTML::new ($class) ; | 
| 49 |  |  |  |  |  |  |  | 
| 50 | 2 |  |  |  |  | 11 | Init ($self) ; | 
| 51 |  |  |  |  |  |  |  | 
| 52 | 2 |  |  |  |  | 10 | return $self ; | 
| 53 |  |  |  |  |  |  | } | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | ################################################################################### | 
| 58 |  |  |  |  |  |  | # | 
| 59 |  |  |  |  |  |  | #   Definitions for Embperl HTML tags | 
| 60 |  |  |  |  |  |  | # | 
| 61 |  |  |  |  |  |  | ################################################################################### | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | sub Init | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | { | 
| 66 | 2 |  |  | 2 | 0 | 4 | my ($self) = @_ ; | 
| 67 |  |  |  |  |  |  |  | 
| 68 | 2 |  |  |  |  | 15 | $self -> AddInitCode ('use vars qw{$_ep_selectname};') ; | 
| 69 |  |  |  |  |  |  |  | 
| 70 | 2 |  |  |  |  | 28 | $self -> AddTag ('input', ['type', 'name', 'value'], ['src'], ['checked'], | 
| 71 |  |  |  |  |  |  | { | 
| 72 |  |  |  |  |  |  | perlcode => | 
| 73 |  |  |  |  |  |  | [ | 
| 74 |  |  |  |  |  |  | 'Embperl::Cmd::InputCheck (%$n%, %&*\'name%, %&*\'value%, %&\'checked%) ;  %&=-type:radio|checkbox% ', | 
| 75 |  |  |  |  |  |  | '$idat{%&*\'name%}=$fdat{%&*\'name%} ; _ep_sa(%$n%, \'value\', exists ($fdat{%&*\'name%})?$fdat{%&*\'name%}:\'\') ;   %&!-value%', | 
| 76 |  |  |  |  |  |  | '$idat{%&*\'name%}=%&*\'value% ; ', | 
| 77 |  |  |  |  |  |  | ] | 
| 78 |  |  |  |  |  |  | }) ; | 
| 79 | 2 |  |  |  |  | 28 | $self -> AddTagBlock ('textarea', ['name'], undef, undef, | 
| 80 |  |  |  |  |  |  | { | 
| 81 |  |  |  |  |  |  | perlcode => | 
| 82 |  |  |  |  |  |  | [ | 
| 83 |  |  |  |  |  |  | '$idat{%&*\'name%}=$fdat{%&*\'name%};_ep_ac(%$n%, Embperl::Syntax::ntypText + 0x20, $fdat{%&*\'name%}) ;   %#!-0%', | 
| 84 |  |  |  |  |  |  | '$idat{%&*\'name%}=%#*\'0% ; ', | 
| 85 |  |  |  |  |  |  | ] | 
| 86 |  |  |  |  |  |  | }) ; | 
| 87 |  |  |  |  |  |  |  | 
| 88 | 2 |  |  |  |  | 18 | $self -> AddTagBlock ('tr', undef, undef, undef, | 
| 89 |  |  |  |  |  |  | { | 
| 90 |  |  |  |  |  |  | perlcode    => 'l%$p%: for (my $col = 0; $col < $maxcol; $col++) {' , | 
| 91 |  |  |  |  |  |  | perlcodeend => '} %?*-htmlrow%' , | 
| 92 |  |  |  |  |  |  | perlcoderemove => 1, | 
| 93 |  |  |  |  |  |  | stackname   => 'htmlrow', | 
| 94 |  |  |  |  |  |  | 'push'        => '%$p%', | 
| 95 |  |  |  |  |  |  | mayjump     => 1, | 
| 96 |  |  |  |  |  |  | }) ; | 
| 97 |  |  |  |  |  |  |  | 
| 98 | 2 |  |  |  |  | 12 | my %ProcInfoTable = ( | 
| 99 |  |  |  |  |  |  | perlcode    => 'l%$p%: for (my $row = 0; $row < $maxrow; $row++) {' , | 
| 100 |  |  |  |  |  |  | perlcodeend =>  '} %?*-htmltable%' , | 
| 101 |  |  |  |  |  |  | perlcoderemove => 1, | 
| 102 |  |  |  |  |  |  | stackname   => 'htmltable', | 
| 103 |  |  |  |  |  |  | 'push'        => '%$p%', | 
| 104 |  |  |  |  |  |  | mayjump     => 1, | 
| 105 |  |  |  |  |  |  | ) ; | 
| 106 |  |  |  |  |  |  |  | 
| 107 | 2 |  |  |  |  | 8 | $self -> AddTagBlock ('table',  undef, undef, undef, \%ProcInfoTable) ; | 
| 108 | 2 |  |  |  |  | 8 | $self -> AddTagBlock ('ol',     undef, undef, undef, \%ProcInfoTable) ; | 
| 109 | 2 |  |  |  |  | 10 | $self -> AddTagBlock ('ul',     undef, undef, undef, \%ProcInfoTable) ; | 
| 110 | 2 |  |  |  |  | 7 | $self -> AddTagBlock ('dl',     undef, undef, undef, \%ProcInfoTable) ; | 
| 111 | 2 |  |  |  |  | 10 | $self -> AddTagBlock ('menu',   undef, undef, undef, \%ProcInfoTable) ; | 
| 112 | 2 |  |  |  |  | 9 | $self -> AddTagBlock ('dir',    undef, undef, undef, \%ProcInfoTable) ; | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  |  | 
| 115 | 2 |  |  |  |  | 30 | $self -> AddTagBlock ('select', ['name'], undef, undef, | 
| 116 |  |  |  |  |  |  | { | 
| 117 |  |  |  |  |  |  | stackname2   => 'htmlselect', | 
| 118 |  |  |  |  |  |  | push2        => '%&*\'name%', | 
| 119 |  |  |  |  |  |  |  | 
| 120 |  |  |  |  |  |  | perlcode    => 'l%$p%: for (my $row = 0; $row < $maxrow; $row++) {' , | 
| 121 |  |  |  |  |  |  | perlcodeend =>  '} %?*-htmltable%' , | 
| 122 |  |  |  |  |  |  | perlcoderemove => 1, | 
| 123 |  |  |  |  |  |  | stackname   => 'htmltable', | 
| 124 |  |  |  |  |  |  | 'push'        => '%$p%', | 
| 125 |  |  |  |  |  |  | mayjump     => 1, | 
| 126 |  |  |  |  |  |  | }, | 
| 127 |  |  |  |  |  |  | { | 
| 128 |  |  |  |  |  |  | procinfo => | 
| 129 |  |  |  |  |  |  | { | 
| 130 |  |  |  |  |  |  | 'embperl#2' => | 
| 131 |  |  |  |  |  |  | { | 
| 132 |  |  |  |  |  |  | perlcode => '{  my $_ep_selectname=%&*\'name%;', | 
| 133 |  |  |  |  |  |  | perlcodeend => '} %&*-name%', | 
| 134 |  |  |  |  |  |  | # push/pop is not (yet) supported in secondary entry, so don't use it!! | 
| 135 |  |  |  |  |  |  | #stackname   => 'htmltable', | 
| 136 |  |  |  |  |  |  | #'push'        => '%$p%', | 
| 137 |  |  |  |  |  |  | } | 
| 138 |  |  |  |  |  |  | } | 
| 139 |  |  |  |  |  |  | } | 
| 140 |  |  |  |  |  |  | ) ; | 
| 141 |  |  |  |  |  |  | # option tag are _not_ added as block, to allow | 
| 142 |  |  |  |  |  |  | # which are interpreted correct by most browsers | 
| 143 | 2 |  |  |  |  | 24 | $self -> AddTag ('option', ['value'], undef, ['selected'], | 
| 144 |  |  |  |  |  |  | { | 
| 145 |  |  |  |  |  |  | perlcode => | 
| 146 |  |  |  |  |  |  | [ | 
| 147 |  |  |  |  |  |  | '_ep_opt (%$n%, $_ep_selectname, %&*\'value%, %&\'selected%);', | 
| 148 |  |  |  |  |  |  | '_ep_opt (%$n%, $_ep_selectname, %>*\'1%, %&\'selected%);', | 
| 149 |  |  |  |  |  |  | #'_ep_opt (%$n%, %^*htmlselect%, %&*\'value%, %&\'selected%);', | 
| 150 |  |  |  |  |  |  | #'_ep_opt (%$n%, %^*htmlselect%, %>*\'1%, %&\'selected%);', | 
| 151 |  |  |  |  |  |  | ] | 
| 152 |  |  |  |  |  |  | }, | 
| 153 |  |  |  |  |  |  | { 'nodename' => ':<:>:option:', 'cdatatype' => ntypAttrValue, procinfo => {} }) ; | 
| 154 |  |  |  |  |  |  |  | 
| 155 | 2 |  |  |  |  | 33 | $self -> AddTagWithStart ('/option', 'option', undef, undef, undef, undef, | 
| 156 |  |  |  |  |  |  | { 'nodename' => '::option:', 'cdatatype' => ntypAttrValue, procinfo => {} } ) ; | 
| 157 |  |  |  |  |  |  |  | 
| 158 | 2 |  |  |  |  | 15 | $self -> AddTag ('a', undef, ['href'], undef, undef, { 'nodename' => ':<:>:a:', 'cdatatype' => ntypAttrValue, procinfo => {} }, 1) ; | 
| 159 | 2 |  |  |  |  | 13 | $self -> AddTag ('area', undef, ['href'], undef, undef, undef, 1) ; | 
| 160 | 2 |  |  |  |  | 11 | $self -> AddTag ('frame', undef, ['src'], undef, undef, undef, 1) ; | 
| 161 | 2 |  |  |  |  | 12 | $self -> AddTag ('iframe', undef, ['src'], undef, undef, undef, 1) ; | 
| 162 | 2 |  |  |  |  | 11 | $self -> AddTag ('embed', undef, ['src'], undef, undef) ; | 
| 163 | 2 |  |  |  |  | 12 | $self -> AddTag ('layer', undef, ['src'], undef, undef) ; | 
| 164 | 2 |  |  |  |  | 11 | $self -> AddTag ('img', undef, ['src'], undef, undef) ; | 
| 165 | 2 |  |  |  |  | 15 | $self -> AddTag ('form', undef, ['action'], undef, undef, { 'nodename' => ':<:>:form:', 'cdatatype' => ntypAttrValue, procinfo => {} }, 2) ; | 
| 166 |  |  |  |  |  |  |  | 
| 167 |  |  |  |  |  |  | } | 
| 168 |  |  |  |  |  |  |  | 
| 169 |  |  |  |  |  |  |  | 
| 170 |  |  |  |  |  |  |  | 
| 171 |  |  |  |  |  |  |  | 
| 172 |  |  |  |  |  |  |  | 
| 173 |  |  |  |  |  |  |  | 
| 174 |  |  |  |  |  |  | 1; | 
| 175 |  |  |  |  |  |  |  | 
| 176 |  |  |  |  |  |  |  | 
| 177 |  |  |  |  |  |  |  | 
| 178 |  |  |  |  |  |  | __END__ |