| 1 | |||
| 2 | ################################################################################### | ||
| 3 | # | ||
| 4 | # Embperl - Copyright (c) 1997-2008 Gerald Richter / ecos gmbh www.ecos.de | ||
| 5 | # Embperl - Copyright (c) 2008-2015 Gerald Richter | ||
| 6 | # Embperl - Copyright (c) 2015-2023 actevy.io | ||
| 7 | # | ||
| 8 | # You may distribute under the terms of either the GNU General Public | ||
| 9 | # License or the Artistic License, as specified in the Perl README file. | ||
| 10 | # | ||
| 11 | # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR | ||
| 12 | # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | ||
| 13 | # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
| 14 | # | ||
| 15 | # $Id$ | ||
| 16 | # | ||
| 17 | ################################################################################### | ||
| 18 | |||
| 19 | package Embperl::Form::Control::button ; | ||
| 20 | |||
| 21 | use strict ; | ||
| 22 | use base 'Embperl::Form::Control' ; | ||
| 23 | |||
| 24 | use Embperl::Inline ; | ||
| 25 | |||
| 26 | 1 ; | ||
| 27 | |||
| 28 | __EMBPERL__ | ||
| 29 | |||
| 30 | [# --------------------------------------------------------------------------- | ||
| 31 | # | ||
| 32 | # show - output the control | ||
| 33 | #] | ||
| 34 | |||
| 35 | [$ sub show ($self, $req) | ||
| 36 | |||
| 37 | my $span = ($self->{width_percent}) ; | ||
| 38 | $self->{button} ||= [{}] ; | ||
| 39 | my $state = $self -> {state} ; | ||
| 40 | $]<table class="ef-element ef-element-width-[+ $self -> {width_percent} +] ef-element-[+ $self -> {type} +] [+ $self -> {state} +]"> | ||
| 41 | <tr> <td class="ui-label-box" > | ||
| 42 | [$ foreach my $button (@{$self->{button}}) $] | ||
| 43 | [$if $self -> {symbol} $] | ||
| 44 | <div class="cControlButtonDiv" | ||
| 45 | title="[+ $self -> {showtext}?($self->{text}):$self -> form -> convert_label ($self, undef, undef, $req) +]" | ||
| 46 | [$if $self -> {onclick} $] onClick="[+ do { local $escmode = 0 ; $self -> {onclick} } +]" [$endif$] | ||
| 47 | [+ do { local $escmode = 0 ; $self -> {eventattrs} } +]><img class="cControlButtonSymbol" src="[+ $self -> {symbol} +]"> | ||
| 48 | [+ $self -> {showvalue}?($self -> {value} || $self->{text}):$self -> form -> convert_label ($self, undef, undef, $req) +] | ||
| 49 | </div> | ||
| 50 | [$else$] | ||
| 51 | [# Workaround around segfault in Embperl 2.1.1-dev *grmpf* #] | ||
| 52 | <[# #]input | ||
| 53 | class="cBase cControl cControlButton" name="[+ $self->{name} +]" | ||
| 54 | value="[+ $self -> {showvalue}?($self -> {value} || $self->{text}):$self -> form -> convert_label ($self, undef, undef, $req) +]" | ||
| 55 | title="[+ $self -> {showtext}?($self->{text}):$self -> form -> convert_label ($self, undef, undef, $req) +]" | ||
| 56 | [$if $self -> {onclick} $] onClick="[+ do { local $escmode = 0 ; $self -> {onclick} } +]" [$endif$] | ||
| 57 | [+ do { local $escmode = 0 ; $self -> {eventattrs} } +] | ||
| 58 | [$if $self -> {image} $] | ||
| 59 | type="image" src="[+ $self -> {image} +]" | ||
| 60 | [$else$] | ||
| 61 | type="button" | ||
| 62 | [$endif$] | ||
| 63 | style="[+ $self->{style} || 'text-align: center;' +]" | ||
| 64 | [# onMouseOver="buttonover(this);" onMouseOut="buttonout(this);" #] | ||
| 65 | [$ foreach my $attr (keys %$button) $] | ||
| 66 | [$ if exists $button->{"__$attr".'_escmode'} $] | ||
| 67 | [+ $attr +]="[+ do { local $escmode = int $button->{"__${attr}_escmode"}; $button->{$attr}; } +]" | ||
| 68 | [$ else $] | ||
| 69 | [+ $attr +]="[+ $button->{$attr} +]" | ||
| 70 | [$ endif $] | ||
| 71 | [$ endforeach $]> | ||
| 72 | [$endif$] | ||
| 73 | [$ endforeach $] | ||
| 74 | |||
| 75 | </td></tr> | ||
| 76 | </table>[$endsub$] | ||
| 77 | |||
| 78 | __END__ |