Embperl

 view release on metacpan or  search on metacpan

Embperl/Form/Control/selectdyn.pm  view on Meta::CPAN


###################################################################################
#
#   Embperl - Copyright (c) 1997-2008 Gerald Richter / ecos gmbh  www.ecos.de
#   Embperl - Copyright (c) 2008-2015 Gerald Richter
#   Embperl - Copyright (c) 2015-2023 actevy.io
#
#   You may distribute under the terms of either the GNU General Public
#   License or the Artistic License, as specified in the Perl README file.
#
#   THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
#   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
#   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
#   $Id$
#
###################################################################################

package Embperl::Form::Control::selectdyn ;

use strict ;
use vars qw{%fdat} ;
use base 'Embperl::Form::ControlMultValue' ;

use Embperl::Inline ;

# ------------------------------------------------------------------------------------------

sub get_std_control_attr
    {
    my ($self, $req, $id, $type, $addclass) = @_ ;

    if ($type eq 'readonly')
        {
        $id = $req -> {uuid} . '_' . $self -> {name} ;
        my $url  = $self -> {showurl} ;
        $url =~ s/<id>/$self -> get_id_from_value ($Embperl::fdat{$self -> {name}}, $req)/e ;
        my $attr = $self -> SUPER::get_std_control_attr ($req, $id, $type, 'ef-control-selectdyn-readonly') ;
        return $attr . qq{ onDblClick="\$('#$self->{use_ajax}').ef_document ('load', '$url');"} ;
        }
	
    return $self -> SUPER::get_std_control_attr ($req, $id, $type, $addclass) ;
    }
    
# ------------------------------------------------------------------------------------------
#
#   init_data - daten aufteilen
#

sub init_data
    {
    my ($self, $req) = @_ ;

    my $val = $self -> get_value ($req) ;
    if ($val ne '')
        {
        my $name = $self -> {name} ;
        my $fdat = $req -> {docdata} || \%Embperl::fdat ;
        $fdat -> {'_opt_' . $name} = $self -> get_option_from_value ($val, $req) ;
        $fdat -> {'_id_' .  $name} = $self -> get_id_from_value ($val, $req) ;
        }
    }
    
# ------------------------------------------------------------------------------------------
#
#   prepare_fdat - daten zusammenfuehren
#

sub xprepare_fdat
    {
    my ($self, $req) = @_ ;

    return if ($self -> is_readonly ($req)) ;

    my $fdat  = $req -> {form} || \%fdat ;
    my $name    = $self->{name} ;
    $fdat -> {$name} = '' if (exists ($fdat -> {"_opt_$name"}) && $fdat -> {"_opt_$name"} eq '') ;
    delete $fdat -> {"_opt_$name"} ;
    delete $fdat -> {"_id_$name"} ;
    }

# ---------------------------------------------------------------------------

sub show_control_addons
    {
    my ($self, $req) = @_ ;

    }
    
# ---------------------------------------------------------------------------

sub get_doctypes_for_new_menu
    {
    my ($self, $req) = @_ ;

    return ;
    }
    
# ---------------------------------------------------------------------------

sub get_datasource
    {
    my ($self) = @_ ;
    
    return  $self -> {datasrcobj} ;
    }

# ---------------------------------------------------------------------------

sub add_query_param
    {
    my ($self, $req, $datasource) = @_ ;
    
    return  '' ;
    }

1 ;



( run in 1.297 second using v1.01-cache-2.11-cpan-39bf76dae61 )