Group
Extension

Matches 40

RapidApp ( V/VA/VANSTYN/RapidApp-1.3500.tar.gz, VANSTYN, 2021; MetaCPAN )
RapidApp/lib/RapidApp/View/JSON.pm ( view source; MetaCPAN )
package RapidApp::View::JSON;

use Moose;
use namespace::autoclean;
BEGIN { extends 'Catalyst::View'; }

use RapidApp::JSON::MixedEncoder;
use Scalar::Util 'blessed', 'reftype';
use HTML::Entities;
us
e RapidApp::Util qw(:all);

=head1 NAME

RapidApp::View::JSON

=head1 DESCRIPTION

This view displays content as a JSON packet that will be used by RapidApp's
client-side javascript.

It also handles 
*
so that the browser doesn't screw it up, and then the rendered text of the
HTML should be valid JSON that the Javascript uses.

This is also where error/exceptions are processed. This view used to h
RapidApp ( V/VA/VANSTYN/RapidApp-1.3500.tar.gz, VANSTYN, 2021; MetaCPAN )
RapidApp/lib/RapidApp/JSON/ScriptWithData.pm ( view source; MetaCPAN )
:JSON::ScriptWithData;

use strict;
use warnings;
use Scalar::Util;
use RapidApp::JSON::MixedEncoder 'encode_json';

=head1 NAME

RapidApp::JSON::ScriptWithData

=head1 SYNOPSIS

  use RapidApp::JSON:
:ScriptWithData;
  use RapidApp::JSON::MixedEncoder 'encode_json';
  
  $swd= RapidApp::JSON::ScriptWithData->new(
    'function () {',
      'blah(12345);',
      'var b= foo(bar(', $self->getSomethi

  return encode_json($swd);

=cut

sub new {
	my ($class, @args)= @_;
	return bless \@args, $class;
}

sub TO_JSON_RAW {
	my $self= shift;
	return join '', (map { ref $_? encode_json($_) : $_ } @$sel
RapidApp ( V/VA/VANSTYN/RapidApp-1.3500.tar.gz, VANSTYN, 2021; MetaCPAN )
RapidApp/lib/RapidApp/JSON/MixedEncoder.pm ( view source; MetaCPAN )
idApp::JSON::MixedEncoder;

use strict;
use warnings;
use Scalar::Util 'blessed';
use Data::Dumper;
use base 'JSON::PP';

our @EXPORT = qw{
  encode_json decode_json encode_json_utf8 decode_json_utf8 
encode_json_ascii decode_json_ascii
};

# ---
# These are values that we might encounter as ScalarRefs and how to
# translate them into safe values for the JSON encoder. There are 
# only a few cases 
fied this is where they should be put.
# (Note: \0 and \1 are already handled and expected by the JSON encoder)
# (Note: vals are lc before being tested, so \'NULL' is already seen as \'null')
our %SC
RapidApp ( V/VA/VANSTYN/RapidApp-1.3500.tar.gz, VANSTYN, 2021; MetaCPAN )
RapidApp/lib/RapidApp/JSON/RawJavascript.pm ( view source; MetaCPAN )
kage RapidApp::JSON::RawJavascript;

use strict;
use warnings;
use Moose;

use overload '""' => sub { (shift)->stringify(@_) };

sub stringify {
	my $self = shift;
	return $self->TO_JSON_RAW;
}

has '
js' => ( is => 'rw', isa => 'Str' );

# compat with RapidApp::JSONFunc API:
sub func { (shift)->js }

around BUILDARGS => sub {
	my $orig= shift;
	my $class= shift;
	if (scalar(@_) == 1 && !ref $_[0])
 js => $_[0] ); # interpret single-param as a javascript fragment
	} else {
		return $class->$orig(@_);
	}
};

sub TO_JSON_RAW {
	return (shift)->js;
}

no Moose;
__PACKAGE__->meta->make_immutable;
1;
RapidApp ( V/VA/VANSTYN/RapidApp-1.3500.tar.gz, VANSTYN, 2021; MetaCPAN )
RapidApp/lib/RapidApp/View/Viewport.pm ( view source; MetaCPAN )
# make sure config_params is a string of JSON
  if (ref $c->stash->{config_params}) {
    $c->stash->{config_params}= RapidApp::JSON::MixedEncoder::encode_json($c->stash->{config_params});
  }

  if (
ref $c->stash->{panel_cfg}) {
    $c->stash->{panel_cfg}= RapidApp::JSON::MixedEncoder::encode_json($c->stash->{panel_cfg});
  }

  return $self->next::method($c);
}


sub _get_asset_controller_urls {
RapidApp ( V/VA/VANSTYN/RapidApp-1.3500.tar.gz, VANSTYN, 2021; MetaCPAN )
RapidApp/lib/RapidApp/Template/Controller.pm ( view source; MetaCPAN )
dule' controller does:
    $content_type = 'text/javascript; charset=utf-8';
    $output = encode_json_ascii($cnf);
  }
  else {
    # This is a direct browser call:
    
    my $html = $self->_render
RapidApp ( V/VA/VANSTYN/RapidApp-1.3500.tar.gz, VANSTYN, 2021; MetaCPAN )
RapidApp/lib/RapidApp/Template/Context.pm ( view source; MetaCPAN )
plate . '</div>',
        #'<div class="template-format">' . $format . '</div>',
        encode_json_ascii($meta),
      '</div>',
      
      (
        $exists ?
        '<div title="Edit \''
="display:none;">',
        #'<div class="template-name">', $template, '</div>',
        encode_json_ascii({ 
          name => $template,
          format => $self->Access->get_template_format($t
RapidApp ( V/VA/VANSTYN/RapidApp-1.3500.tar.gz, VANSTYN, 2021; MetaCPAN )
RapidApp/lib/RapidApp/Module/Grid.pm ( view source; MetaCPAN )
ord_url or defined $self->add_record_class) {
    $self->add_listener(  beforerender => RapidApp::JSONFunc->new( raw => 1, func => 
      'Ext.ux.RapidApp.AppTab.cnt_init_loadTarget' 
    ));
  }
  
 
2Def:
  #if (defined $self->open_record_url) {
  #  $self->add_listener( rowdblclick => RapidApp::JSONFunc->new( raw => 1, func => 
  #    'Ext.ux.RapidApp.AppTab.gridrow_nav' 
  #  ));
  #}
  # --
  
extconfig( init_quick_search_mode => $qs_mode );
  }
  
  
  #$self->apply_config(store => $self->JsonStore);
  $self->apply_extconfig(tbar => $self->tbar_items) if (defined $self->tbar_items);
}



s
RapidApp ( V/VA/VANSTYN/RapidApp-1.3500.tar.gz, VANSTYN, 2021; MetaCPAN )
RapidApp/lib/RapidApp/View/Printview.pm ( view source; MetaCPAN )

	# make sure config_params is a string of JSON
	if (ref $c->stash->{config_params}) {
		$c->stash->{config_params}= RapidApp::JSON::MixedEncoder::encode_json($c->stash->{config_params});
	}
	
	return
RapidApp ( V/VA/VANSTYN/RapidApp-1.3500.tar.gz, VANSTYN, 2021; MetaCPAN )
RapidApp/lib/RapidApp/Util/MetaKeys.pm ( view source; MetaCPAN )
s::Standard qw(:all);
use Scalar::Util qw(blessed);

use RapidApp::Util::MetaKeys::FK;
use JSON qw( from_json -support_by_pp );
use Path::Class qw( file dir );
use Try::Tiny;

sub load {
  my ($self, 
from_string {
  my ($self, $string) = @_;
  
  my $data = scalar(
    # Assume JSON as the first format
    try{ from_json($string, {allow_singlequote => 1, allow_barekey => 1}) } ||
    
    # free-f
RapidApp ( V/VA/VANSTYN/RapidApp-1.3500.tar.gz, VANSTYN, 2021; MetaCPAN )
RapidApp/lib/RapidApp/Template/Provider.pm ( view source; MetaCPAN )
="display:none;">',
        #'<div class="template-name">', $template, '</div>',
        encode_json_ascii({ 
          name => $template,
          format => $self->Access->get_template_format($t
RapidApp ( V/VA/VANSTYN/RapidApp-1.3500.tar.gz, VANSTYN, 2021; MetaCPAN )
RapidApp/lib/RapidApp/Functions.pm ( view source; MetaCPAN )
per::Concise 'Dumper';
use RapidApp::RootModule;
use Clone qw(clone);
use RapidApp::JSON::MixedEncoder qw(encode_json);
use Try::Tiny;
use Time::HiRes qw(gettimeofday tv_interval);

sub scream {
	loca
out		=> undef,
		newline			=> 0,
		list_args		=> 0,
		list_out		=> 0,
		dump_maxdepth	=> 3,
		use_json		=> 0,
		stack			=> 0,
		instance		=> 0,
		color			=> GREEN,
		ret_color		=> RED.BOLD,
		arg_igno
eturn Dumper(@_) unless ($opt{use_json});
		#return RapidApp::JSON::MixedEncoder->new->allow_blessed->convert_blessed->allow_nonref->encode(\@_);
		return encode_json(\@_);
	} unless ($opt{dump_func})
RapidApp ( V/VA/VANSTYN/RapidApp-1.3500.tar.gz, VANSTYN, 2021; MetaCPAN )
RapidApp/lib/RapidApp/Util.pm ( view source; MetaCPAN )
rm::ANSIColor qw(:constants);
use RapidApp::JSON::MixedEncoder qw(
  encode_json decode_json encode_json_utf8 decode_json_utf8 encode_json_ascii decode_json_ascii
);

use RapidApp::Util::Hash::Merge q
 finally
    gettimeofday tv_interval
    Dumper
    encode_json decode_json encode_json_utf8 decode_json_utf8 encode_json_ascii decode_json_ascii
    merge
  );

  push @EXPORT_OK, @{$Term::ANSIColor

use RapidApp::Responder::InfoStatus;
use RapidApp::JSONFunc;
use RapidApp::JSON::MixedEncoder;
use RapidApp::JSON::RawJavascript;
use RapidApp::JSON::ScriptWithData;

use RapidApp::HTML::RawHtml;
use
RapidApp ( V/VA/VANSTYN/RapidApp-1.3500.tar.gz, VANSTYN, 2021; MetaCPAN )
RapidApp/lib/RapidApp/Sugar.pm ( view source; MetaCPAN )
',''
);

1;
__END__


use Exporter qw( import );
use Data::Dumper;
use RapidApp::JSON::MixedEncoder;
use RapidApp::JSON::RawJavascript;
use RapidApp::HTML::RawHtml;
use RapidApp::Responder::UserError;
ORT = qw(
  asjson rawjs mixedjs ashtml rawhtml usererr userexception 
  jsfunc blessed merge infostatus clone
);

# Module shortcuts
#


# JSON shortcuts
#

# encode the object into JSON text, with a
b asjson {
	scalar(@_) == 1 or die "Expected single argument";
	return RapidApp::JSON::MixedEncoder::encode_json($_[0]);
}

# Bless a string as RawJavascript so that it doesn't get encoded as JSON dat
RapidApp ( V/VA/VANSTYN/RapidApp-1.3500.tar.gz, VANSTYN, 2021; MetaCPAN )
RapidApp/lib/RapidApp/Module.pm ( view source; MetaCPAN )
tv_interval);
use Catalyst::Utils;
use Scalar::Util qw(blessed weaken);
use RapidApp::JSONFunc;
use RapidApp::JSON::MixedEncoder;

use RapidApp::Util qw(:all);

has 'base_params'         => ( is => 'r
ams->{'X-RapidApp-CustomPrompt-Data'};
    return {} unless (defined $rawdata);
    return $self->json->decode($rawdata);
  }
);


##################################
#### Original Controller Role ####
ult => sub {{}} );
has 'default_action'      => ( is => 'ro',  default => undef );
has 'render_as_json'      => ( is => 'rw',  default => 1, traits => [ 'RapidApp::Role::PerRequestBuildDefReset' ]  );
RapidApp ( V/VA/VANSTYN/RapidApp-1.3500.tar.gz, VANSTYN, 2021; MetaCPAN )
RapidApp/lib/RapidApp/JSONFunc.pm ( view source; MetaCPAN )
package RapidApp::JSONFunc;
use strict;
use warnings;
use Moose;

# This object allows returning functions within JSON. To prevent the function from being
# quoted (i.e. turned into a string), thi
 be encoded with RapidApp::JSON::MixedEncoder
# which extends JSON::PP and modifies the behavior to return TO_JSON_RAW as-is

use RapidApp::Util qw(:all);
use RapidApp::JSON::MixedEncoder;

has 'func'
 => 'ro', default => 0 );

has 'json' => ( is => 'ro', lazy_build => 1 );
sub _build_json {
	my $self = shift;
	return RapidApp::JSON::MixedEncoder->new;
}

sub TO_JSON {
	my $self = shift;
	return $
RapidApp ( V/VA/VANSTYN/RapidApp-1.3500.tar.gz, VANSTYN, 2021; MetaCPAN )
RapidApp/lib/RapidApp/Test.pm ( view source; MetaCPAN )
mport::Into;

use Time::HiRes qw(gettimeofday tv_interval);
use HTTP::Request::Common;
use JSON qw(decode_json);
use Catalyst::Utils;
use RapidApp::Test::Client;

my $target;
my $app_class;

sub impor
RapidApp ( V/VA/VANSTYN/RapidApp-1.3500.tar.gz, VANSTYN, 2021; MetaCPAN )
RapidApp/lib/RapidApp/Module/StorCmp.pm ( view source; MetaCPAN )
s 'DataStore' => (
	is			=> 'rw',
	isa		=> 'RapidApp::Module::DatStor',
	handles => {
		JsonStore								=> 'JsonStore',
#		store_read							=> 'store_read',
#		store_read_raw					=> 'store_read_raw',
 the 'store'
# key predeclared as the first key. Because the ExtJS client decodes and processes
# JSON in order, we want to make sure the store is processed before other parts
# which may need to refe
DataStore->getStore_func );
	}
	else {
		$self->apply_extconfig( store => $self->Module('store')->JsonStore );
	}
}


has 'add_edit_formpanel_defaults', is => 'ro', isa => 'HashRef', lazy => 1, defaul
RapidApp ( V/VA/VANSTYN/RapidApp-1.3500.tar.gz, VANSTYN, 2021; MetaCPAN )
RapidApp/lib/RapidApp/Include.pm ( view source; MetaCPAN )
r::InfoStatus';
	calleruse 'RapidApp::JSONFunc';
	calleruse 'RapidApp::JSON::MixedEncoder';
	calleruse 'RapidApp::JSON::RawJavascript';
	calleruse 'RapidApp::JSON::ScriptWithData';
	calleruse 'RapidAp
RapidApp ( V/VA/VANSTYN/RapidApp-1.3500.tar.gz, VANSTYN, 2021; MetaCPAN )
RapidApp/lib/RapidApp/Module/ExtComponent.pm ( view source; MetaCPAN )
resenting the event name, and the
# remaining elements representing 1 or more handlers (RapidApp::JSONFunc
# objects). Unlike "listeners" which is a built-in config param associated
# with all Ext.Obs
le::PerRequestBuildDefReset'
  ],
  is        => 'ro',
  isa       => 'HashRef[ArrayRef[RapidApp::JSONFunc]]',
  default   => sub { {} },
  handles   => {
     apply_listener_callbacks  => 'set',
    
$list, $func;
    }
    else {
      # Auto convert strings into RapidApp::JSONFunc objects:
      push @$list, RapidApp::JSONFunc->new( raw => 1, func => $func );
    }
  }
  
  return $self->apply_l

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.