#################### main pod documentation begin ################### =head1 NAME Zymonic::FieldFillCalculation::FromSupersetDefinition - Zymonic Workflow System FieldFillCalculation module =head1 SYNOPSIS use Zymonic::FieldFillCalculation::FromSupersetDefinition; =head1 DESCRIPTION This can be used to pull the json definition of a Superset chart from the embeddable iframe code that can be copied from Superset. Should set FromOther Field as with a regular FieldFillCalculation. =head1 BUGS NONE =head1 SUPPORT As in the license, Zymonic is provided without warranty or support unless purchased separately, however... If you email zymonic-support@zednax.com your issue will be noted and may receive a response. For security issues, please contact zymonic-security@zednax.com and someone will respond within 8 working hours. =head1 AUTHOR Alex Masidlover et al. CPAN ID: MODAUTHOR Zednax Limited alex.masidlover@zednax.com http://www.zednax.com =head1 COPYRIGHT This program is free software licensed under the... Zymonic Public License 1.0 (ZPL 1.0) The full text of the license can be found in the LICENSE file included with this module. =head1 SEE ALSO Zymonic perl(1). =cut #################### main pod documentation end ################### package Zymonic::FieldFillCalculation::FromSupersetDefinition; use strict; BEGIN { use Exporter (); use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); $VERSION = '0.01'; @ISA = qw(Exporter); #Give a hoot don't pollute, do not export more than needed by default @EXPORT = qw(); @EXPORT_OK = qw(); %EXPORT_TAGS = (); } use base "Zymonic::FieldFillCalculation"; use Zymonic::Utils qw(debug get_array rethrow_exception debug_function_start debug_function_stop); use URI::Encode qw(uri_encode uri_decode); #################### subroutine header begin #################### =head2 init Usage : N/A Purpose : The init method is called by the object constructor to initialise the object fields. Returns : nothing Argument : nothing Throws : Zymonic::Exception::FieldFillCalculation Comment : See Also : =cut #################### subroutine header end #################### sub init { my $self = shift; $self->SUPER::init; $self->{def_field_zname} = $self->{xmldef}->{FromOther}->{FieldZName}->{content}; Zymonic::Exception::FieldFillCalculation->throw( error => 'No FromOther FieldZName specified.', zname => $self->{zname}, catchable => 'false' ) unless $self->{def_field_zname} } #################### subroutine header begin #################### =head2 fill_value Usage : $self->fill_value; Purpose : Looks up the LinkedField ValueField and returns it. Returns : the field's fill value Argument : nothing Throws : Zymonic::Exception::FieldFillCalculation Comment : See Also : =cut #################### subroutine header end #################### sub fill_value { my $self = shift; my %in = @_; my $def = $self->get_field_value( $self->{def_field_zname} ); if ( $def =~ /src=".*\?(.*?)"/ ) { my @vars = split( /&/, $1 ); foreach my $var (@vars) { my ( $key, $value ) = split( /=/, $var ); if ( $key eq 'form_data' ) { return uri_decode($value); } } } else { return undef; } } #################### subroutine header begin #################### =head2 script_includes Usage : $self->script_includes Purpose : Provides the list of required javascript files to include. Returns : array of filenames Argument : nothing Throws : nothing Comment : See Also : =cut #################### subroutine header end #################### sub script_includes { my $self = shift; return ( $self->SUPER::script_includes(), '/Zymonic/FieldFillCalculation/01_FromSupersetDefinition.js' ); } 1;