Ambrosia

 view release on metacpan or  search on metacpan

benchmark/Ambrosia/CommonGatewayInterface.b  view on Meta::CPAN

use Data::Dumper;

BEGIN
{
    use Ambrosia::Context;
    instance Ambrosia::Context({
            engine_name   => 'CGI',
            engine_params => {
                header_params => {
                    Pragma => 'no-cache',
                Cache_Control => 'no-cache, must-revalidate, no-store',
                },
            },
            proxy         => '',
        });

}

sub setEnv
{
    my $action = shift;

lib/Ambrosia/DataProvider.pm  view on Meta::CPAN

            },
            #........
        ],
        IO => [
            {
                engine_name => 'IO::CGI',
                source_name => 'cgi',
                engine_params => {
                    header_params => {
                            '-Pragma' => 'no-cache',
                            '-Cache_Control' => 'no-cache, must-revalidate, no-store'
                        }
                    }
            }
        ],
        
    };

    instance Ambrosia::Storage(application_name => $confDS);
    Ambrosia::DataProvider::assign 'application_name';

lib/Ambrosia/Validator.pm  view on Meta::CPAN

    $self->_violations = new Ambrosia::Validator::Violation(prototype => $self->_prototype);
    $self->_data = {};
}

my $qr_trim = qr/(?:^\s+)|(?:\s+$)/;
sub get_value
{
    return (map { $_ =~ s/$qr_trim//sg; $_; } grep defined $_, @_);
}

sub validate
{
    my $self = shift;
    my %rules = @_;

    no strict 'refs';
    my $Constraints = \%{$self->_prototype . '::Constraints'};

    foreach ( keys %rules)
    {
        my $c = $Constraints->{$_};

lib/Ambrosia/Validator.pm  view on Meta::CPAN

        {
            $self->_violations->add($_, $v, $c);
        }
        else
        {
            $self->_data->{$_} = $v;
        }
    }
}

sub prepare_validate :Abstract
{
}

sub verify
{
    my $self = shift;
    $self->prepare_validate;

    if ( $self->_violations->count > 0 )
    {
        foreach ( keys %{$self->_data} )
        {
            $self->_violations->add($_ => $self->_data->{$_});
        }
        return $self->_violations;
    }

script/ambrosia  view on Meta::CPAN

        ->on_complete(sub {
                if ( my $mng = $MANAGERS->{$action || Context->action} )
                {
                    if ( $mng->{template} )
                    {
                        my $xml = new Ambrosia::View::XSLT(charset => 'UTF-8', rootName => config()->ID)
                            ->render( $share_dir . $mng->{template}, Context->data);

                        my $doc = XML::LibXML->load_xml(string => $xml);
                        my $xmlschema = XML::LibXML::Schema->new( location => $share_dir . '/XSD/AmbrosiaDL.xsd' );
                        if ( eval { $xmlschema->validate( $doc ); 1; } )
                        {
                            if ( open(my $fh, '>', config()->ID . '.xml') )
                            {
                                print $fh $xml;
                                close $fh;
                            }
                            else
                            {
                                print STDERR "ERROR:$!\n";
                            }

share/Managers/buildApp.pm  view on Meta::CPAN

    $self->application->addChild(($source->getElementsByTagName('Relations'))[0]->cloneNode(1));
    $self->application->addChild(($source->getElementsByTagName('MenuGroups'))[0]->cloneNode(1));
}

our $encoding;

sub prepare
{
    my $self = shift;

    return unless $self->validateDocument();

    Context->repository->set(quiet => 1);
    my $appName = config->ID;

    my %hDir = $self->makeDirectorys($appName);

    $encoding = config->Charset || 'utf-8';
    ############################################################################

    my $tmplPath = (config->TemplatePath || '.');

share/Managers/buildApp.pm  view on Meta::CPAN

#   Now see the file "readmy" in directory ${projectName}/Apache then
#   type 'http://${ServerName}${ServerPort}/${projectName}/' in your browser.
#
#######################################################################

MESSAGE
    Context->repository->set( Message => $message );

}

sub validateDocument
{
    my $self = shift;
    my $xmlschema = XML::LibXML::Schema->new( location => (config->TemplatePath || '.') . '/XSD/AmbrosiaDL.xsd' );
    if ( eval { $xmlschema->validate( $self->source ); 1; } )
    {
        return 1;
    }
    print STDERR "ERROR: wrong in ADL file\n$@\n";
    return 0;
}

sub makeDirectorys
{
    my $self = shift;

share/Templates/Common/HandlerModule.xsl  view on Meta::CPAN

    my $result = accessor()->authenticate(
            Context->param('login')
                ? (Context->param('login'), Context->param('password'))
                : ($val->{login}, $val->{password}),
            $mng->{access}
        );

    if ( $result->IS_REDIRECT )
    {
        Context->redirect(
                -must_revalidate  => 1,
                -max_age  => 0,
                -no_cache => 1,
                -no_store => 1,
                -charset  => config->Charset,
                -uri      => (Context->proxy || Context->full_script_path) . $ENV{PATH_INFO},
                session->hasSessionData() ? (-cookie   => session->getSessionValue()) : (),
            );
        return 0;
    }

share/Templates/Common/Validator.xsl  view on Meta::CPAN


use Ambrosia::Meta;

class
{
    extends => [qw/Ambrosia::Validator/],
};

our $VERSION = sprintf('0.%03d', q$Revision: 01 $ =~ /(\d+)/o);

sub prepare_validate
{
    my $self = shift;

    $self->validate(
        <xsl:for-each select="atns:Field">
        <xsl:value-of select="@Name" /> => {
            value => (Ambrosia::Validator::get_value(Context->param(qw/<xsl:value-of select="@Name" />/)))[0] || undef,
        },
        </xsl:for-each>);
}

1;
</xsl:template>

share/Templates/Templates/XSLT+DOJO/edit_json.xsl  view on Meta::CPAN

<xsl:template>
	<xslt:attribute name="match"><xslt:value-of select="$UcAppName" /></xslt:attribute>
	<xslt:variable name="entityName" select="translate(//atns:Application/atns:Entity/@Name[1], $vUppercaseChars_CONST, $vLowercaseChars_CONST)"/>
	<form method="POST">
		<xsl:attribute name="action"><xsl:value-of select="@script" />/<xslt:value-of select="$entityName" /></xsl:attribute>
		<!-- input type="hidden" name="m" value=''>
			<xslt:attribute name="value">/save/<xslt:value-of select="$entityName" /></xslt:attribute>
		</input -->
		<xsl:apply-templates select="repository"/>

<!-- xsl:variable name="onClick">onClick:function(){ validate(); }</xsl:variable>
<button data-dojo-type="dijit.form.Button">
	<xsl:attribute name="data-dojo-props"><xsl:value-of select="$onClick" /></xsl:attribute>
	Validate form!</button -->
<button data-dojo-type="dijit.form.Button" data-dojo-props="type:'submit', value:'Submit'">Submit</button>

	</form>
</xsl:template>

<xsl:template match="repository">
	<xslt:apply-templates select="atns:Application/atns:Entity" />

share/Templates/db2xml.xsl  view on Meta::CPAN

			<xsl:value-of select="//repository/config/@label" /><!-- config->Label -->
		</xsl:attribute>
		<xsl:attribute name="Charset">
			<xsl:value-of select="//repository/config/@charset" /><!-- config->Charset -->
		</xsl:attribute>

		<Config>
			<CommonGatewayInterface Engine="ApacheRequest">
				<Params
					Pragma        = "no-cache"
					Cache_Control = "no-cache, must-revalidate, no-store"
				/>
			</CommonGatewayInterface>

			<Host Debug="YES">
				<xsl:attribute name="Name">
					<xsl:value-of select="concat(name(), '.deploy')" />
				</xsl:attribute>
				<xsl:attribute name="ServerName">
					<xsl:value-of select="//repository/config/@ServerName" />
				</xsl:attribute>



( run in 0.276 second using v1.01-cache-2.11-cpan-4d50c553e7e )