| 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::addremove ; | ||
| 20 | |||
| 21 | use strict ; | ||
| 22 | use base 'Embperl::Form::Control' ; | ||
| 23 | |||
| 24 | use Embperl::Inline ; | ||
| 25 | |||
| 26 | |||
| 27 | # --------------------------------------------------------------------------- | ||
| 28 | # | ||
| 29 | # new - create a new control | ||
| 30 | # | ||
| 31 | |||
| 32 | |||
| 33 | sub new | ||
| 34 | |||
| 35 | { | ||
| 36 | my ($class, $args) = @_ ; | ||
| 37 | |||
| 38 | my $self = Embperl::Form::Control -> new($args) ; | ||
| 39 | bless $self, $class ; | ||
| 40 | |||
| 41 | $self -> {removesource} ||= 0 ; | ||
| 42 | $self -> form -> add_code_at_bottom("ef_addremoveInitOptions (document, document.getElementsByName('$self->{src}')[0], document.getElementsByName('$self->{dest}')[0], document.getElementsByName('$self->{name}')[0], $self->{removesource})") ; | ||
| 43 | return $self ; | ||
| 44 | } | ||
| 45 | |||
| 46 | |||
| 47 | |||
| 48 | 1 ; | ||
| 49 | |||
| 50 | __EMBPERL__ | ||
| 51 | |||
| 52 | |||
| 53 | [# --------------------------------------------------------------------------- | ||
| 54 | # | ||
| 55 | # show - output the control | ||
| 56 | #] | ||
| 57 | |||
| 58 | [$ sub show ($self, $req) | ||
| 59 | |||
| 60 | my $name = $self -> {name} ; | ||
| 61 | |||
| 62 | $]<table class="ef-element ef-element-width-[+ $self -> {width_percent} +] ef-element-[+ $self -> {type} +] [+ ' ' . $self -> {state} +]"> | ||
| 63 | <tr> | ||
| 64 | <td class="cBase cControlBox cControlAddRemoveBox"> | ||
| 65 | <input type="hidden" id="[+ $name +]" name="[+ $name +]"> | ||
| 66 | <img src="[+ $self -> {imagedir} +]/toleft.gif" title="Hinzufügen" onClick="ef_addremoveAddOption (document, document.getElementsByName('[+ $self->{src} +]')[0], document.getElementsByName('[+ $self->{dest} +]')[0], document.getElementsByName('[+ $name +]')[0], [+ $self->{removesource} +])"> | ||
| 67 | <img src="[+ $self -> {imagedir} +]/toright.gif" title="Entfernen" onClick="ef_addremoveRemoveOption (document, document.getElementsByName('[+ $self->{src} +]')[0], document.getElementsByName('[+ $self->{dest} +]')[0], document.getElementsByName('[+ $name +]')[0], [+ $self->{removesource} +])"> | ||
| 68 | |||
| 69 | </td> | ||
| 70 | </tr> | ||
| 71 | </table> | ||
| 72 | [$endsub$] | ||
| 73 | |||
| 74 | __END__ |