Ambrosia

 view release on metacpan or  search on metacpan

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

  `Age` tinyint(4) NOT NULL,
  PRIMARY KEY (`Client_Id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8
CREATE_TABLE
$d->save_transaction();

my $NUM_ITER = 1000;

#    my $q = $d->reset()
#                ->source('tClient')
#                ->select()
#                ->what(qw/LastName FirstName MiddleName Age/)
#                ->predicate(['Client_Id', '<=', 30],['Client_Id', '>', $NUM_ITER-10])
#                ->next();
#exit;
my $count = 0;
sub insert
{
    my $i = shift;
    $d->reset()
        ->source('tClient')
        ->insert()
        ->what(qw/LastName FirstName MiddleName Age/)
        ->execute('LastName'.$i, 'FirstName'.$i, 'MiddleName'.$i, 20+$i);
    $d->save_transaction();
}

sub createSQL
{
    $d->reset()
        ->source('tClient')
        ->select()
        ->what(qw/LastName FirstName MiddleName Age/)
        ->predicate(['Age', '<=', 30],['Age', '>', $NUM_ITER])
        ;#->order_by('Age');
}

sub select
{
    my $q = $d->reset()
                ->source('tClient')
                ->select()
                ->what(qw/LastName FirstName MiddleName Age/)
                ->predicate(['Age', '<=', 30],['Age', '>', $NUM_ITER])
                ;#->order_by('Age');

    while( my $r = $q->next() )
    {
        $count++;
    }
    $d->save_transaction();
}

sub selectIndex
{
    my $q = $d->reset()
                ->source('tClient')
                ->select()
                ->what(qw/LastName FirstName MiddleName Age/)
                ->predicate(['Client_Id', '<=', 30],['Client_Id', '>', $NUM_ITER-10])
                ;#->order_by('Age');

    while( my $r = $q->next() )
    {
        $count++;
    }
    $d->save_transaction();
}

sub selectIndex2
{
    my $q = $d->reset()
                ->source('tClient')
                ->select()
                ->what(qw/LastName FirstName MiddleName Age/)
                ->predicate('Client_Id', '=', 30)
                ;#->order_by('Age');

    while( my $r = $q->next() )
    {
        $count++;
    }
    $d->save_transaction();
}

sub dbi
{
    my $r = $d->handler->selectall_arrayref(q~
SELECT
    `tClient`.`LastName` AS tClient_LastName,
    `tClient`.`FirstName` AS tClient_FirstName,
    `tClient`.`MiddleName` AS tClient_MiddleName,
    `tClient`.`Age` AS tClient_Age
FROM `tClient`
WHERE (`tClient`.`Client_Id` <= '30' OR `tClient`.`Client_Id` > '990')
~, { Slice => {} });
    $d->save_transaction();
}

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

timethese($NUM_ITER, {
    'insert' => sub { insert($i++) },
});

timethese($NUM_ITER*10, {
    'createSQL' => \&createSQL,
});
print "\n";

timethese($NUM_ITER, {
    'select' => \&select,
});
print "rows count=$count\n\n"; $count=0;

timethese($NUM_ITER, {
    'selectIndex' => \&selectIndex,
    'dbi' => \&dbi,
});
print "rows count=$count\n\n"; $count=0;

timethese($NUM_ITER, {
    'selectIndex2' => \&selectIndex2,
});
print "rows count=$count\n"; $count=0;

$dbh->do(q~DROP TABLE IF EXISTS `tClient`~);

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

        ->insert()
        ->what(qw/LastName FirstName MiddleName Age/)
        ->execute('LastName'.$_, 'FirstName'.$_, 'MiddleName'.$_, 20+$_);
}
$d->save_transaction();

my $e;
my $cnt=0;

timethese($NUM_ITER, {
    'selectWithoutLimit' => sub {
        my @r = Ambrosia::QL
            ->from('tClient', \$e)
            ->in(storage()->driver('DBI', 'Client'))
            ->select()
            ->what(qw/LastName FirstName MiddleName Age/)
            ->predicate(sub{
                $cnt++;
                $e->{tClient_Age} == 32})
            ->take(3);
    },
    'selectWithLimit' => sub {
        my @r = Ambrosia::QL
            ->from('tClient', \$e)
            ->in(storage()->driver('DBI', 'Client'))
            ->select()
            ->what(qw/LastName FirstName MiddleName Age/)
            ->predicate('Age', '=', 32)
            ->take(3);
    },
    'selectWithIndexSerch' => sub {
        my @r = Ambrosia::QL
            ->from('tClient', \$e)
            ->in(storage()->driver('DBI', 'Client'))
            ->select()
            ->what(qw/LastName FirstName MiddleName Age/)
            ->predicate('ClientId', '<', 20)
            ->take(3);
    },
});

$dbh->do(q~DROP TABLE IF EXISTS `tClient`~);
$d->save_transaction();
print "\n$cnt\n";

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

sub PREDICATE() { 6 }
sub LIMIT()    { 7 }
sub ORDER_BY() { 8 }
sub NO_QUOTE() { 9 }
sub JOIN()     { 10 }
sub ON()       { 11 }
sub UNIQ()     { 12 }
sub UNION()    { 13 }
#####################
sub get_what      { $_[0]->_cql_query->[&WHAT] }
sub get_select    { $_[0]->_cql_query->[&SELECT] }
sub get_insert    { $_[0]->_cql_query->[&INSERT] }
sub get_update    { $_[0]->_cql_query->[&UPDATE] }
sub get_delete    { $_[0]->_cql_query->[&DELETE] }
sub get_source    { $_[0]->_cql_query->[&SOURCE] }
sub get_predicate { $_[0]->_cql_query->[&PREDICATE] }
sub get_limit     { $_[0]->_cql_query->[&LIMIT] }
sub get_order_by  { $_[0]->_cql_query->[&ORDER_BY] }
sub get_no_quote  { $_[0]->_cql_query->[&NO_QUOTE] }
sub get_join      { $_[0]->_cql_query->[&JOIN] }
sub get_on        { $_[0]->_cql_query->[&ON] }
sub get_uniq      { $_[0]->_cql_query->[&UNIQ] }
sub get_union     { $_[0]->_cql_query->[&UNION] }

sub what
{
    my $self = shift;
    $self->_cql_query->[&WHAT] = [@_];
    return $self;
}

sub select
{
    return $_[0];
}

sub insert
{
    return $_[0];
}

sub update

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

{
    return '';
}

sub _make_query
{
    my $self = shift;

    if ( $self->_cql_query->[&Ambrosia::DataProvider::BaseDriver::SELECT] )
    {
        return $self->_make_select . ' '
            . _make_limit($self->_cql_query->[&Ambrosia::DataProvider::BaseDriver::LIMIT]);
    }
    elsif ( $self->_cql_query->[&Ambrosia::DataProvider::BaseDriver::INSERT] )
    {
        return $self->_make_insert;
    }
    elsif ( $self->_cql_query->[&Ambrosia::DataProvider::BaseDriver::UPDATE] )
    {
        return $self->_make_update;
    }

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

            . ($self->_handler ? $self->_handler->errstr : '');
    }
}

sub next
{
    my $self = shift;

    unless ( $self->__sth )
    {
        $self->__select->execute(@_);
    }

    my $r;
    unless ( $r = $self->__sth->fetchrow_hashref() )
    {
        $self->__sth->finish if $self->__sth;
        $self->__sth = undef;
        return;
    }
    return $r;

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


    $self->__sth->finish if $self->__sth; #На всякий случай
    $self->__sth = undef;

    local $self->_cql_query->[&Ambrosia::DataProvider::BaseDriver::SELECT];
    local $self->_cql_query->[&Ambrosia::DataProvider::BaseDriver::WHAT];
    local $self->_cql_query->[&Ambrosia::DataProvider::BaseDriver::UNIQ];
    local $self->_cql_query->[&Ambrosia::DataProvider::BaseDriver::NO_QUOTE];
    local $self->_cql_query->[&Ambrosia::DataProvider::BaseDriver::LIMIT];

    my $res = $self->__select()->what('count(*) AS numRows')->no_quote(1)->next();

    $self->__sth->finish if $self->__sth;
    $self->__sth = undef;

    return $res->{numRows};
}

sub __select
{
    my $self = shift;
    $self->_cql_query->[&Ambrosia::DataProvider::BaseDriver::SELECT] = 'SELECT ' . join ' ', @_;
    return $self;
}

sub insert
{
    my $self = shift;
    $self->_cql_query->[&Ambrosia::DataProvider::BaseDriver::INSERT] = 'INSERT ' . (shift || '');

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

    if ( my $uniq = $self->_cql_query->[&Ambrosia::DataProvider::BaseDriver::UNIQ] )
    {
        return __what($self->handler, $self->_cql_query->[&Ambrosia::DataProvider::BaseDriver::SOURCE], ' DISTINCT ', $uniq, $self->_cql_query->[&Ambrosia::DataProvider::BaseDriver::NO_QUOTE]);
    }
    else
    {
        return __what($self->handler, $self->_cql_query->[&Ambrosia::DataProvider::BaseDriver::SOURCE], '', $self->_cql_query->[&Ambrosia::DataProvider::BaseDriver::WHAT], $self->_cql_query->[&Ambrosia::DataProvider::BaseDriver::NO_QUOTE]);
    }
}

sub _make_select
{
    my $self = shift;
    my $res;
    if ( $res = $self->_cql_query->[&Ambrosia::DataProvider::BaseDriver::SELECT] )
    {
        my $dbh = $self->handler;

        my $stJoin = $self->_make_join();
        $res .= $self->_make_what();

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

    assert {$driver} 'Not defined driver';
    return new Ambrosia::core::Nil unless $driver;

    my $source_path = join '_', grep defined $_, $class->source_path();

    my $entity;
    my $query = Ambrosia::QL
        ->from([$class->source_path()], \$entity)
        ->in($driver)
        ->what($class->fields_mapping)
        ->select(sub {
                my %h = map { my $v = $entity->{$_}; s/^${source_path}_//; $_ => $v } keys %$entity;
                if ( my $old = $driver->cache->get($class->get_cache_code($class->id_value_from_hash(\%h))) )
                {
                    return $old;
                }
                my $e = $class->new(%h);
                $driver->cache->set($e->get_cache_code, $e);
                $e->after_load;
                return $e;
            });

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


    my $key = $class->key;

    foreach ( ref $key ? @$key : ($key) )
    {
        $query->predicate($_, '=', shift(@val));
    }

    my $source_path = join '_', grep defined $_, $class->source_path();

    my @new_e = $query->select(sub {
            my %h = map { my $v = $entity->{$_}; s/^${source_path}_//; $_ => $v } keys %$entity;
            if ( my $old = $driver->cache->get($class->get_cache_code($class->id_value_from_hash(\%h))) )
            {
                return $old;
            }
            my $e = $class->new(%h);
            $driver->cache->set($e->get_cache_code, $e);
            $e->after_load;
            return $e;
        })->take(1);

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


    my $source_path = join '_', grep defined $_, $class->source_path();

    return Ambrosia::EntityDataModel::_find->new(
                edm => $class,
                var => \$var,
                query => Ambrosia::QL
                    ->from([$class->source_path()], \$var)
                    ->in($driver)
                    ->what($class->fields_mapping)
                    ->select(sub {
                            my %h = map { my $v = $var->{$_}; s/^${source_path}_//; $_ => $v } keys %$var;
                            %$var = %h;
                            if ( my $old = $driver->cache->get($class->get_cache_code($class->id_value_from_hash(\%h))) )
                            {
                                return $old;
                            }
                            my $e = $class->new(%h);
                            $driver->cache->set($e->get_cache_code, $e);
                            $e->after_load;
                            return $e;

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


#=rem
#
#driver: источник данных:
#    - ARRAY;
#    - Ambrosia::QL;
#    - класс у которго реализован метод CQL().
#
#__variable: содержит ссылку на переменную в которой размещен объект;
#__predicate: ссылка на функцию, которая проверяет соответствие полученного объекта заданному условию;
#__select: ссылка на функцию, которая может проделать дополнительную обработку полученного объекта;
#__join: ссылка на родителя
#
#=cut
#

class sealed {
    public  => [qw/driver source/],
    private => [qw/__variable __predicate __on __select __join __join_kw __limit __skip/],
};

our $VERSION = 0.010;

sub new :Private
{
}

sub _TRUE { 1 }

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

        $self->__on = sub { $old->(@_) && $p->(@_) }
    }
    else
    {
        $self->driver->on(@_);
    }

    return $self;
}

sub select
{
    my $root = shift;
    my $code = shift;

    while( my $j = $root->__join )
    {
        $j->driver->join($root->__join_kw, $root->driver);
        $root = $j;
    };
    my $var = $root->__variable;

    if ( $code )
    {
        $root->__select = sub {
            if (my @a = $root->driver->next())
            {
                $$var = $a[0];
                if ( $root->__predicate->($$var) )
                {
                    local $_ = $$var;
                    return $code->();
                }
                return;
            }
            $root->__limit = 0;
            return;
        };
    }
    else
    {
        $root->__select = sub {
            if (my @a = $root->driver->next())
            {
                $$var = $a[0];
                return $$var if $root->__predicate->($$var);
                return;
            }
            $root->__limit = 0;
            return;
        };
    }

    return $root;
}

sub __next
{
    return $_[0]->__select->();
}

sub next
{
    my $self = shift;
    $self->select() unless $self->__select;

    my @val = ();
    while(1)
    {
        @val = $self->__next();
        return if !$self->__limit && scalar @val == 0;
        return $val[0] if scalar @val;
    }
    return;
}

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

    my $self = shift;
    my $cnt = shift;

    if ( $cnt && not $self->__limit )
    {
        $self->driver->limit($cnt);
    }

    $cnt = -1 unless defined $cnt;

    $self->select() unless $self->__select;

    my @values = ();
    while( 1 )
    {
        my @val = $self->__next();
        last if !$self->__limit && scalar @val == 0;
        $self->__skip--, next if $self->__limit && $self->__skip;
        if ( scalar @val )
        {
            push @values, @val;

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

    return $val, $cnt;
}

sub destroy
{
    my $self = shift;

    $self->driver = new Ambrosia::core::Nil();
    $self->__predicate = \&_TRUE;
    $self->__on        = \&_TRUE;
    $self->__select    = undef;
    $self->__join->reset() if $self->__join;
    $self->__join = undef;
    $self->__join_kw = undef;

}

#TODO??
#sub let($&)
#{
#    my $p = shift;

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

=head1 SYNOPSIS

    use Ambrosia::QL;

    #get all rows from table tClient in data source described by to words
    #'DBI' (type of source) and 'Client' (name of source)
    my @r1 = Ambrosia::QL
        ->from('tClient')
        ->in(storage()->driver('DBI', 'Client'))
        ->what(qw/LastName FirstName MiddleName Age/)
        ->select()
        ->take();

    #get one row from table tClient in data source described by to words
    #'DBI' (type of source) and 'Client' (name of source)
    #and where ClientId is 22
    my @r = Ambrosia::QL
        ->from('tClient')
        ->in(storage()->driver('DBI', 'Client'))
        ->what(qw/LastName FirstName MiddleName Age/)
        ->predicate('ClientId', '=', 22)
        ->select()
        ->take(1);

    #get one row from table tClient in data source described by to words
    #'DBI' (type of source) and 'Client' (name of source)
    #and that have been tested in 'checkClient'
    my @r = Ambrosia::QL
        ->from('tClient')
        ->in(storage()->driver('DBI', 'Client'))
        ->what(qw/LastName FirstName MiddleName Age/)
        ->predicate(\&checkClient)
        ->select()
        ->take(1);

=head1 DESCRIPTION

C<Ambrosia::QL> is a query language for getting data from data source provided by L<Ambrosia::DataProvider>.

=head1 CONSTRUCTOR

=head2 from (tableName, referenceToVariable)

=over 4

=item tableName

Name of the table which is a source of data.

=item referenceToVariable

Optional. Reference to a variable. This variable can be subsequently used in the select method as a hash.

=back

=head1 METHODS

=head2 in (driver)

Set data of sorce.

=head2 what (@_)

Describe what columns you want to get from data source.

    $ql->what(qw/Name Age/);
    $ql->what();

If parameters not present then whil select all columns.

=head2 predicate (ColumnName, Operation, Value)

You can use this method in two ways:

=over 4

=item Pointing to two or three parameters.

In this case, the processing of a predicate will be carried out on the side of the driver

    $ql->predicate('Name', '=', 'John');

    $ql->predicate('Name', '=', 'John')
       ->predicate('Age', '<', 42);
This means that the rows will be selected in which the column Name is "John" and Age less than 42

    $ql->predicate(['Name', '=', 'John'],['Name', '=', 'Jack']);
This means that the rows will be selected in which the column Name is "John" or "Jack"

Value is optional. So you can write: $ql->predicate('Name', 'IS NOT NULL')

=item Pointing to subrutine.

    $ql->predicate(sub { shift()->{tableName_columnName} =~ /^Jo/ });

This procedure is passed a hash whose keys are of the form "tableName_columnName" if you use method L<Ambrosia::QL/what>
and "columnName" if you not use method L<Ambrosia::QL/what>.

You can also combine calling some this methods.
    $ql->predicate(sub { shift()->{table_Name} =~ /^Jo/ })
       ->predicate(sub { shift()->{table_Age} == 42 });

That conjunction of predicates.

=back

=head2 select (subrutine)

You can call this method, indicating the subroutine for rows processing.

    my $client;
    my @r = Ambrosia::QL
        ->from('tClient', \$client)
        ->in(storage()->driver('DBI', 'Client'))
        ->what(qw/LastName FirstName MiddleName Age/)
        ->predicate(sub{
            shift->{tClient_Age} == 42})
        ->select(sub {
            return {map { my $k = $_; $k =~ s/^tClient_//; $k => $client->{$_}; } keys %$client};
        })
        ->take(1);

    #now @r contained
    #(
    #    {
    #     LastName   => 'LastName22',
    #     FirstName  => 'FirstName22',
    #     MiddleName => 'MiddleName22',

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

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:ambr="app://Ambrosia/EntityDataModel/2011/V1"
    extension-element-prefixes="ambr">

<xsl:output method="text" indent="yes"  />

<xsl:include href="../incName.xsl" />

<xsl:template match="/">
package <xsl:value-of select="$RealAppName" />::Accessor;
use strict;
use warnings;

use Ambrosia::Config;
use Ambrosia::Addons::Session;
use Ambrosia::Meta;

class sealed
{
    extends => [qw/Ambrosia::Addons::Accessor/],

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

    xmlns:atns="app://Ambrosia/EntityDataModel/2011/V1">

<xsl:output method="text" indent="yes" />

<xsl:include href="../incName.xsl" />

<xsl:template match="/">

Listen <xsl:choose
        ><xsl:when test="boolean(atns:Application/atns:Host/@ServerPort)"
            ><xsl:value-of select="atns:Application/atns:Host/@ServerPort"/></xsl:when
        ><xsl:otherwise>80</xsl:otherwise></xsl:choose>

&lt;VirtualHost *:<xsl:value-of select="atns:Application/atns:Host/@ServerPort"/>>
    ServerAdmin webmaster@<xsl:value-of select="atns:Application/atns:Host/@ServerName"/>
    DocumentRoot <xsl:value-of select="atns:Application/atns:Host/@ProjectPath"/>/<xsl:value-of select="$RealAppName" />/htdocs
    ServerName <xsl:value-of select="atns:Application/atns:Host/@ServerName"/>
    ErrorLog <xsl:value-of select="atns:Application/atns:Host/@ProjectPath"/>/<xsl:value-of select="$RealAppName" />/apache_logs/<xsl:value-of select="$RealAppName" />-error_log
    CustomLog <xsl:value-of select="atns:Application/atns:Host/@ProjectPath"/>/<xsl:value-of select="$RealAppName" />/apache_logs/<xsl:value-of select="$RealAppName" />-access_log common

    &lt;Directory "<xsl:value-of select="atns:Application/atns:Host/@ProjectPath"/>/<xsl:value-of select="$RealAppName" />/htdocs">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
    &lt;/Directory>

    &lt;IfModule mod_perl.c>
        PerlSetEnv  <xsl:value-of select="$UcAppName" />_ROOT <xsl:value-of select="atns:Application/atns:Host/@ProjectPath" />
        PerlSetEnv  <xsl:value-of select="$UcAppName" />_MODE <xsl:value-of select="atns:Application/atns:Host/@Name" />

        <xsl:if test="boolean(atns:Application/atns:Host/@PerlLibPath)">
        #sometimes it not work correctly
        #PerlSetEnv PERL5LIB <xsl:value-of select="translate(atns:Application/atns:Host/@PerlLibPath, ' ', ':')"></xsl:value-of>:<xsl:value-of select="atns:Application/atns:Host/@ProjectPath"/>
        </xsl:if>

        &lt;Perl>
            use lib qw(<xsl:value-of select="atns:Application/atns:Host/@PerlLibPath"
                        /><xsl:text> </xsl:text
                        ><xsl:value-of select="atns:Application/atns:Host/@ProjectPath"/>);

            $ENV{PATH} = "/usr/local/bin:/usr/bin:/bin";
            delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; 

            use Ambrosia::Config;

            my $rootPath = ($ENV{<xsl:value-of select="$UcAppName" />_ROOT} || '') . '/<xsl:value-of select="$RealAppName" />';

            instance Ambrosia::Config(<xsl:value-of select="$RealAppName" /> => $rootPath . '/Config/<xsl:value-of select="$RealAppName" />.conf');
            config('<xsl:value-of select="$RealAppName" />')->root_path = $rootPath;

            use Ambrosia::Logger;
            instance Ambrosia::Logger('<xsl:value-of select="$RealAppName" />', DEBUG => 1, INFO_EX => 1, INFO => 1, -prefix => '<xsl:value-of select="$RealAppName" />_', -dir => config('<xsl:value-of select="$RealAppName" />')->logger_path);
        &lt;/Perl>

        &lt;LocationMatch "^/<xsl:value-of select="$RealAppName" />ServiceHandler">
            SetHandler  perl-script
            PerlHandler <xsl:value-of select="$RealAppName" />::<xsl:value-of select="$RealAppName" />ServiceHandler
        &lt;/LocationMatch>

        &lt;LocationMatch "^/<xsl:value-of select="$RealAppName" />">
            SetHandler  perl-script
            PerlHandler <xsl:value-of select="$RealAppName" />::<xsl:value-of select="$RealAppName" />
        &lt;/LocationMatch>
    &lt;/IfModule>
&lt;/VirtualHost>

</xsl:template>
</xsl:stylesheet>

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

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:ambr="app://Ambrosia/EntityDataModel/2011/V1"
    extension-element-prefixes="ambr">

<xsl:output method="text" indent="yes"  />

<xsl:include href="../incName.xsl" />

<xsl:template match="/">
package <xsl:value-of select="$RealAppName" />::Authorize;
use strict;
use warnings;

use <xsl:value-of select="$RealAppName" />::Entity::<xsl:value-of select="$RealAppName" />SysUser;
use Ambrosia::core::Nil;
use Ambrosia::Config;

use Ambrosia::Meta;

class sealed
{
    extends => [qw/Ambrosia::Addons::Authorize/],
};

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

sub get
{
    my $self = shift;
    my $login = shift;
    my $level = shift;

    if ( $login eq config->login )
    {
        return new <xsl:value-of select="$RealAppName" />::Entity::<xsl:value-of select="$RealAppName" />SysUser(
            Password => config->password,
            Levels => [keys %{config->ACCESS_LEVELS->{config->ID}->{LEVELS}}]);
    }

    return new Ambrosia::core::Nil;
}

1;
</xsl:template>

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

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:ambr="app://Ambrosia/EntityDataModel/2011/V1"
    extension-element-prefixes="ambr">

<xsl:output method="text" indent="yes"  />

<xsl:include href="../incName.xsl" />

<xsl:template match="/">package <xsl:value-of select="$RealAppName" />::Managers::AuthorizeManager;
use strict;
use warnings;

use Ambrosia::Meta;
class
{
    extends => [qw/Ambrosia::BaseManager/]
};

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

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

<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:atns="app://Ambrosia/EntityDataModel/2011/V1">

<xsl:output method="text" indent="yes"  />

<xsl:include href="../incName.xsl" />

<xsl:template match="/">package <xsl:value-of select="$RealAppName" />::Managers::BaseManager;
use strict;
use warnings;

use Ambrosia::Meta;
class
{
    extends => [qw/Ambrosia::BaseManager/]
};

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

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

<xsl:include href="../incName.xsl" />

<xsl:template match="/">#!/usr/bin/perl
use strict;
use warnings;

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

BEGIN
{
    use lib qw(<xsl:value-of select="atns:Application/atns:Host/@PerlLibPath"
                /><xsl:text> </xsl:text
                ><xsl:value-of select="atns:Application/atns:Host/@ProjectPath"/>);

    $ENV{PATH} = "/usr/local/bin:/usr/bin:/bin";
    delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; 

    use Ambrosia::Config;

    my $rootPath = ($ENV{<xsl:value-of select="$UcAppName" />_ROOT} || '') . '/<xsl:value-of select="$RealAppName" />';

    instance Ambrosia::Config(<xsl:value-of select="$RealAppName" /> => $rootPath . '/Config/<xsl:value-of select="$RealAppName" />.conf');
    config('<xsl:value-of select="$RealAppName" />')->root_path = $rootPath;

    use Ambrosia::Logger;
    instance Ambrosia::Logger('<xsl:value-of select="$RealAppName" />', DEBUG => 1, INFO_EX => 1, INFO => 1, -prefix => '<xsl:value-of select="$RealAppName" />_', -dir => config('<xsl:value-of select="$RealAppName" />')->logger_path);
};

use <xsl:value-of select="$RealAppName" />::<xsl:value-of select="$RealAppName" />;
<xsl:value-of select="$RealAppName" />::<xsl:value-of select="$RealAppName" />::handler();

</xsl:template>
</xsl:stylesheet>

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

<xsl:include href="../incName.xsl" />

<xsl:template match="/">#!/usr/bin/perl
use strict;
<xsl:apply-templates />
</xsl:template>

<xsl:template match="atns:Application">
our $VERSION = sprintf('0.%03d', q$Revision: 01 $ =~ /(\d+)/o);

my $LEVEL = $ENV{<xsl:value-of select="$UcAppName"/>_MODE};

my ( $ROOT, $DEBUG, $SITE_URL, $LIB_PATH, $PROXY,
<xsl:for-each select="/atns:Application/atns:DataSource/atns:Type/atns:Source">
    $DS_NAME_<xsl:value-of select="../@Name"/>_<xsl:value-of select="@Name"/>,
    $DS_ENGINE_<xsl:value-of select="../@Name"/>_<xsl:value-of select="@Name"/>,
    <xsl:if test="boolean(@Catalog)">$DS_CATALOG_<xsl:value-of select="../@Name"/>_<xsl:value-of select="@Name"/>,</xsl:if>
    $DS_SCHEMA_<xsl:value-of select="../@Name"/>_<xsl:value-of select="@Name"/>,
    $DS_USER_<xsl:value-of select="../@Name"/>_<xsl:value-of select="@Name"/>,
    $DS_PASSWORD_<xsl:value-of select="../@Name"/>_<xsl:value-of select="@Name"/>,
    $DS_CHARSET_<xsl:value-of select="../@Name"/>_<xsl:value-of select="@Name"/>,
    $DS_PARAMS_<xsl:value-of select="../@Name"/>_<xsl:value-of select="@Name"/>,
</xsl:for-each>
);

for ($LEVEL)
{
    <xsl:for-each select="atns:Config/atns:Host">
    /^<xsl:value-of select="@Name" />$/ &amp;&amp; do {
        $DEBUG    = '<xsl:value-of select="@Debug" />';
        $ROOT     = '<xsl:value-of select="@ProjectPath" />';
        $SITE_URL = 'http://<xsl:value-of select="@ServerName" /><xsl:if test="boolean(@ServerPort)">:<xsl:value-of select="@ServerPort" /></xsl:if>';
        $PROXY    = undef;
        $LIB_PATH = '<xsl:value-of select="@PerlLibPath" /><xsl:text> </xsl:text><xsl:value-of select="@PerlLibPath" />';
<xsl:for-each select="/atns:Application/atns:DataSource/atns:Type/atns:Source">
        $DS_NAME_<xsl:value-of select="../@Name"/>_<xsl:value-of select="@Name"/> = '<xsl:value-of select="@Name"/>';
        $DS_ENGINE_<xsl:value-of select="../@Name"/>_<xsl:value-of select="@Name"/> = '<xsl:value-of select="@Engine"/>';
        <xsl:if test="boolean(@Catalog)">$DS_CATALOG_<xsl:value-of select="../@Name"/>_<xsl:value-of select="@Name"/> = '<xsl:value-of select="@Catalog"/>';</xsl:if>
        $DS_SCHEMA_<xsl:value-of select="../@Name"/>_<xsl:value-of select="@Name"/> = '<xsl:value-of select="@Schema"/>';
        $DS_USER_<xsl:value-of select="../@Name"/>_<xsl:value-of select="@Name"/> = '<xsl:value-of select="@User"/>';
        $DS_PASSWORD_<xsl:value-of select="../@Name"/>_<xsl:value-of select="@Name"/> = '<xsl:value-of select="@Password"/>';
        $DS_CHARSET_<xsl:value-of select="../@Name"/>_<xsl:value-of select="@Name"/> = '<xsl:value-of select="@Charset"/>';
        $DS_PARAMS_<xsl:value-of select="../@Name"/>_<xsl:value-of select="@Name"/> = '<xsl:value-of select="@Params"/>';
</xsl:for-each>
        1;
    } ||
    </xsl:for-each>
    die "Unknown level in config file: $LEVEL";
}

my $TPL_DIR = "$ROOT/<xsl:value-of select="@Name"/>/Templates";
my $LOG_DIR = "$ROOT/app_log/";

my $OPEN_ACCESS = 0;
my $AUTHORIZE_ACCESS = -1;
<xsl:for-each select="atns:Entitys/atns:Entity">
<xsl:variable name="type" select="translate(@Type, $vLowercaseChars_CONST, $vUppercaseChars_CONST)"/><xsl:if test="$type='TABLE' or $type='TREE'">
my $EDIT_<xsl:value-of select="@Name"/> = <xsl:value-of select="position()*2-1"/>;</xsl:if><xsl:if test="$type!='ABSTRACT' and $type!='BIND'">
my $VIEW_<xsl:value-of select="@Name"/> = <xsl:value-of select="position()*2"/>;
</xsl:if></xsl:for-each>

return
{
    ID       => '<xsl:value-of select="$UcAppName"/>',
    LABEL    => '<xsl:value-of select="@Label"/>',
    Charset  => '<xsl:value-of select="@Charset"/>',
    ROOT     => $ROOT,
    DEBUG    => $DEBUG,

    #The root directory that is defined in the main module
    root_path => undef,

    #The path to log file.
    logger_path => $LOG_DIR,

    template_path => $TPL_DIR,

    template_web_path => $SITE_URL . '/Templates_<xsl:value-of select="$UcAppName"/>',


    MANAGERS => {
        #manager that returns the main page
        '*' => {
            manager  => '<xsl:value-of select="@Name"/>::Managers::MainManager',
            template => 'main.xsl',
            access   => $AUTHORIZE_ACCESS
        },
        '/list' => {
            manager => '<xsl:value-of select="@Name"/>::Managers::ListManager',
            template => 'list_json.xsl',
            access   => $OPEN_ACCESS
        },
        <xsl:if test="/atns:Application/@Authorization!='NO'">
        '/authorize' => {
            manager => '<xsl:value-of select="@Name"/>::Managers::AuthorizeManager',
            template => 'authorize.xsl',
            access   => $OPEN_ACCESS
        },
        '/exit' => {
            manager  => '<xsl:value-of select="@Name"/>::Managers::ExitManager',
            #template => 'authorize.xsl',
            access   => $OPEN_ACCESS
        },
        </xsl:if>
<xsl:if test="boolean(./atns:Entitys/atns:Entity[@Type='TREE'])">
        '/tree' => {
            manager => '<xsl:value-of select="@Name"/>::Managers::ListManager',
            template => 'tree_json.xsl',
            access   => $OPEN_ACCESS
        },
</xsl:if>

<xsl:text>
</xsl:text>
    <xsl:for-each select="./atns:Entitys/atns:Entity">
        <xsl:variable name="entityName" select="translate(@Name, $vUppercaseChars_CONST, $vLowercaseChars_CONST)"/>
        <xsl:variable name="typeEntity" select="translate(@Type, $vLowercaseChars_CONST, $vUppercaseChars_CONST)"/>
        <xsl:if test="$typeEntity='TABLE' or $typeEntity='TREE'">
        '/get/<xsl:value-of select="$entityName"/>' => {
            manager  => '<xsl:value-of select="../../@Name"/>::Managers::<xsl:value-of select="@Name"/>EditManager',
            template => '<xsl:value-of select="$entityName"/>_edit_json.xsl',
            access   => $EDIT_<xsl:value-of select="@Name"/>
        },
        '/save/<xsl:value-of select="$entityName"/>' => {
            manager  => '<xsl:value-of select="../../@Name"/>::Managers::<xsl:value-of select="@Name"/>SaveManager',
            access   => $EDIT_<xsl:value-of select="@Name"/>
        },
        </xsl:if>
        <xsl:if test="$typeEntity!='ABSTRACT' and $typeEntity!='BIND' and $typeEntity!='TREE'">
        '/list/<xsl:value-of select="$entityName"/>' => {
            manager => '<xsl:value-of select="../../@Name"/>::Managers::<xsl:value-of select="@Name"/>ListManager',
            access   => $VIEW_<xsl:value-of select="@Name"/>
        },
        </xsl:if>
        <xsl:if test="$typeEntity='TREE'">
        '/list/<xsl:value-of select="$entityName"/>' => {
            manager => '<xsl:value-of select="../../@Name"/>::Managers::<xsl:value-of select="@Name"/>TreeManager',
            access   => $VIEW_<xsl:value-of select="@Name"/>
        },
        </xsl:if>
        <xsl:text>
        </xsl:text>
    </xsl:for-each>
    },

    CommonGatewayInterface => {
        engine_name   => '<xsl:value-of select="/atns:Application/atns:Config/atns:CommonGatewayInterface/@Engine" />',
        engine_params => {
            header_params => {
                <xsl:for-each select="/atns:Application/atns:Config/atns:CommonGatewayInterface/atns:Params/@*">
                    <xsl:value-of select="name()" /> => '<xsl:value-of select="." />',
            </xsl:for-each>},
        },
        proxy         => $PROXY,
    },

    data_source => {
        <xsl:for-each select="/atns:Application/atns:DataSource/atns:Type">
        <xsl:value-of select="@Name" /> => [<xsl:for-each select="atns:Source">{
            source_name   => $DS_NAME_<xsl:value-of select="../@Name"/>_<xsl:value-of select="@Name"/>,
            engine_name   => $DS_ENGINE_<xsl:value-of select="../@Name"/>_<xsl:value-of select="@Name"/>,
            <xsl:if test="boolean(@Catalog)">catalog       => $DS_CATALOG_<xsl:value-of select="../@Name"/>_<xsl:value-of select="@Name"/>,</xsl:if>
            schema        => $DS_SCHEMA_<xsl:value-of select="../@Name"/>_<xsl:value-of select="@Name"/>,
            user          => $DS_USER_<xsl:value-of select="../@Name"/>_<xsl:value-of select="@Name"/>,
            password      => $DS_PASSWORD_<xsl:value-of select="../@Name"/>_<xsl:value-of select="@Name"/>,
            engine_params => $DS_PARAMS_<xsl:value-of select="../@Name"/>_<xsl:value-of select="@Name"/>,
            additional_params => { AutoCommit => 0, RaiseError => 1, LongTruncOk => 1 },
            additional_action => sub { my $dbh = shift; $dbh->do("SET NAMES $DS_CHARSET_<xsl:value-of select="../@Name"/>_<xsl:value-of select="@Name"/>")},
        },</xsl:for-each>],</xsl:for-each>
    },

#delete this block if your application don't use remoute services or change it
    service_conf => {
        'SOAP::Lite' => [
                {
                    name => '<xsl:value-of select="$RealAppName"/>',
                    __proxy => 'uri of calling service',
                    __outputxml => 'false',
                    __readable => 0,
                    __default_ns => 'urn:<xsl:value-of select="$RealAppName"/>/<xsl:value-of select="$RealAppName"/>Services',
                    #__ns => 'urn:<xsl:value-of select="$RealAppName"/>/<xsl:value-of select="$RealAppName"/>Services',
                    __soapversion => '1.2',
                    __timeout => undef,
                    #__on_error #you can use `on_error(sub{})` method of Ambrosia::RPC::Service::SOAP::Lite
                },
            ],
    },

    NUMBER_PER_PAGE => 20,

<xsl:if test="/atns:Application/@Authorization!='NO'">
    login => 'god',
    password => 'fv,hjpbz',

    ACCESS_LEVELS => {
        <xsl:value-of select="$UcAppName"/> => {
            LABEL => '<xsl:value-of select="@Label"/>',
            LEVELS => {<xsl:for-each select="./atns:Entitys/atns:Entity"><xsl:variable name="type" select="translate(@Type, $vLowercaseChars_CONST, $vUppercaseChars_CONST)"/>
<xsl:if test="$type='TABLE'">
                $EDIT_<xsl:value-of select="@Name"/> => 'Edit <xsl:value-of select="@Label" />',</xsl:if><xsl:if test="$type!='ABSTRACT' and $type!='BIND'">
                $VIEW_<xsl:value-of select="@Name"/> => 'View <xsl:value-of select="@Label" />',
</xsl:if></xsl:for-each>
            }
        }
    },
</xsl:if>

};
</xsl:template>

</xsl:stylesheet>

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


<xsl:output method="text" indent="yes" />

<xsl:include href="../incName.xsl" />

<!-- Root -->
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>

<xsl:template match="atns:Application/atns:Entity">package <xsl:value-of select="$RealAppName" />::Managers::<xsl:value-of select="@Name"/>EditManager;
<xsl:variable name="EId" select="@Id" />
use strict;
use warnings;

use Ambrosia::core::Nil;
use Ambrosia::Context;
require <xsl:value-of select="$RealAppName" />::Entity::<xsl:value-of select="@Name"/>;

use Ambrosia::Meta;
class
{
    extends => [qw/<xsl:value-of select="$RealAppName" />::Managers::BaseManager/]
};

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

sub prepare
{
    Context->repository->put(
        <xsl:value-of select="@Name"/> => deferred::call {(
                <xsl:value-of select="$RealAppName" />::Entity::<xsl:value-of select="@Name"/>->load(
                    <xsl:choose><xsl:when test="atns:Key/@AutoUniqueValue">Context->resource_id</xsl:when><xsl:otherwise>
[<xsl:for-each select="atns:Key/atns:FieldRef">Context->param('<xsl:value-of select="@Name" />')||undef, </xsl:for-each>]</xsl:otherwise></xsl:choose>
                    ) || new Ambrosia::core::Nil)->as_hash(0, qw/<xsl:apply-templates select="//atns:Relations/atns:Relation[@RefId=$EId]/atns:EntityRef" mode="link"/>/)
            } );
}

1;
</xsl:template>

<xsl:template match="atns:EntityRef" mode="link">
<xsl:variable name="ref_id" select="@RefId"/>
<xsl:if test="boolean(/atns:Application/atns:EntitysRef/atns:Entity[@Id=$ref_id]/@Type='TABLE')"><xsl:if test="position()>1"><xsl:text> </xsl:text></xsl:if><xsl:value-of select="@Role" /></xsl:if>
</xsl:template>

</xsl:stylesheet>

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

<xsl:include href="../incName.xsl" />

<!-- Root -->
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>

<!-- Entity -->
<xsl:template match="atns:Application/atns:Entity">=head1 NAME

Class for mapping entity to data source <xsl:value-of select="concat(@DataSourceNameRef, ':', @SourcePath)"/>.

=cut

package <xsl:value-of select="$RealAppName" />::Entity::<xsl:value-of select="@Name"/>;
use strict;
use warnings;

use Ambrosia::error::Exceptions;
use Ambrosia::core::Nil;
use Ambrosia::Validator::Constraint;
<xsl:variable name="type" select="translate(@Type, $vLowercaseChars_CONST, $vUppercaseChars_CONST)"/>
use Ambrosia::Meta;
class <xsl:choose>
    <xsl:when test="$type='ABSTRACT'"><xsl:text>abstract</xsl:text></xsl:when>
    <xsl:otherwise><xsl:text>sealed</xsl:text></xsl:otherwise>
</xsl:choose>
{<xsl:variable name="extends" select="@Extends" />
    extends => [qw/<xsl:choose>
    <xsl:when test="$extends!=''"><xsl:value-of select="$RealAppName" />::Entity::<xsl:value-of select="//EntitysRef/Entity[@Name=$extends]/@Name" /></xsl:when>
    <xsl:when test="$type='TREE'">Ambrosia::Addons::Tree::NodeTree</xsl:when>
    <xsl:otherwise>Ambrosia::EntityDataModel</xsl:otherwise>
</xsl:choose>/],
<!-- Fields of class(fields table in schema) -->
    public  => [qw/
        <xsl:for-each select="atns:Field/@Name">
            <xsl:if test="../../@Type != 'TREE' or (. != 'TreeId' and . != 'ParentId')"><xsl:value-of select="." /><xsl:text>
        </xsl:text></xsl:if></xsl:for-each>/],
};

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

<xsl:if test="@Type='TABLE' or @Type='TREE'">
our %Constraints = (
    <xsl:for-each select="atns:Field">
        <xsl:variable name='name' select="@Name" />
        <xsl:value-of select="$name" /> => Ambrosia::Validator::Constraint->new(name => '<xsl:value-of select="$name" />')
            -><xsl:value-of select="@Type" />(errorMessage => '',)<xsl:if test="@Type='String'">
            ->StringLength(min => undef, max => <xsl:value-of select="@Size" />,errorMessage => '',)
            </xsl:if
        ><xsl:if test="@IsNullable='NO' and ../atns:Key[@AutoUniqueValue='YES']/atns:FieldRef/@Name!=$name"
        >->Require(notEmpty => 1, errorMessage => '',)</xsl:if>,
    </xsl:for-each>);
</xsl:if>

<xsl:if test="@Type='TABLE' or @Type='VIEW'">
sub RepresentationMeta
{
<xsl:variable name="eId" select="/atns:Application/atns:Entity/@Id"/>
    return [<xsl:for-each select="atns:Field"><xsl:variable name='name' select="@Name" />
        {
            label => '<xsl:value-of select="@Label" />',
            <xsl:if test="not(//atns:Relations/atns:Relation/atns:EntityRef[@RefId=$eId and @To=$name])"
                >field => '<xsl:value-of select="$name" />',</xsl:if>
            <xsl:if test="../atns:Key/atns:FieldRef/@Name=$name">key => 1,</xsl:if>
            <xsl:if test="@Hidden='YES'">hidden => 1,</xsl:if>
            <xsl:apply-templates select="//atns:Relations/atns:Relation/atns:EntityRef[@RefId=$eId and @To=$name]" mode="ref" />
        },</xsl:for-each>
    ];
}

sub Representation
{
    my $self = shift;
    my $clean = shift;
    my $level = shift || 0;
    my @res = ();

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

                push @res, $f, $v;
                push @values, $v unless $_->{hidden};
            }
        }
        else
        {
            push @res, $f, $self->$f;
            push @values, $self->$f unless $_->{hidden};
        }
    }
    return @res, <xsl:value-of select="@Name"/> => join ' ', @values;
}
</xsl:if>

<xsl:if test="@Type='TREE'">
sub RepresentationMeta
{
    return [
        {
            label => 'id',
            field => 'TreeId',
        },
        {
            label => 'parent',
            field => 'ParentId',
        },
    <xsl:for-each select="atns:Field[@Name!='TreeId' and @Name!='ParentId']"><xsl:variable name='name' select="@Name" />
        {
            label => '<xsl:value-of select="translate($name, $vUppercaseChars_CONST, $vLowercaseChars_CONST)" />',
            <xsl:if test="not(//atns:Relations/atns:Relation/atns:EntityRef[@RefId=/atns:Application/atns:Entity/@Id and @To=$name])">field => '<xsl:value-of select="$name" />',
            </xsl:if>
        },</xsl:for-each>
    ];
}

sub Representation
{
    my $self = shift;
    my @res = ();
    my $f;

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

    }
    return @res;
}
</xsl:if>

sub mutable
{
    1;
}

<xsl:apply-templates select="//atns:Relations" mode="require" />

<xsl:if test="@DataSourceTypeRef!='DBI'">
=head2 driver_type

Return type of driver of data source.

=cut

sub driver_type
{
    return '<xsl:value-of select="@DataSourceTypeRef"/>';
}
</xsl:if>


=head2 source_name

Returned the name of data source.

=cut

sub source_name
{
    return '<xsl:value-of select="@DataSourceNameRef"/>';
}

=head2 table

Returned the name of table.

=cut

sub table
{
    return '<xsl:value-of select="@SourcePath"/>';
}

<xsl:choose>
<xsl:when test="atns:Key/@AutoUniqueValue">
=head2 primary_key

Returned name of primary key that have auto increment.

=cut

sub primary_key
{
    return '<xsl:value-of select="atns:Key/atns:FieldRef/@Name"/>';
}
</xsl:when>
<xsl:otherwise>
=head2 key

Returned the list of key fields.

=cut

sub key
{
    return [<xsl:for-each select="atns:Key/atns:FieldRef">'<xsl:value-of select="@Name" />',</xsl:for-each>];
}
</xsl:otherwise>
</xsl:choose>


<xsl:apply-templates select="//atns:Relations" mode="link" />

<xsl:apply-templates />

1;
</xsl:template>

<xsl:template match="atns:EntityRef" mode="ref">
    field => '<xsl:value-of select="../@Type" />',
    ref => '<xsl:value-of select="$RealAppName" />::Entity::<xsl:value-of select="../@Type" />',
</xsl:template>

<xsl:template match="//atns:Relations" mode="require">
<xsl:variable name="eId" select="/atns:Application/atns:Entity/@Id"/>
<xsl:apply-templates select="atns:Relation[@RefId=$eId]/atns:EntityRef[@RefId=//atns:EntitysRef/atns:Entity/@Id and @RefId != $eId]" mode="require" />
<xsl:apply-templates select="atns:Relation/atns:EntityRef[@RefId=$eId and @Feedback='YES']" mode="require_revers" />
</xsl:template>

<xsl:template match="atns:EntityRef" mode="require">
<xsl:variable name="refId" select="@RefId"/>
require <xsl:value-of select="$RealAppName"
            />::Entity::<xsl:value-of
                        select="//atns:EntitysRef/atns:Entity[@Id=$refId]/@Name" />;</xsl:template>

<xsl:template match="atns:EntityRef" mode="require_revers">
<xsl:variable name="refId" select="../@RefId"/>
require <xsl:value-of select="$RealAppName"
            />::Entity::<xsl:value-of
                        select="//atns:EntitysRef/atns:Entity[@Id=$refId]/@Name" />;</xsl:template>

<xsl:template match="//atns:Relations" mode="link">
<xsl:variable name="eId" select="/atns:Application/atns:Entity/@Id"/>
<xsl:apply-templates select="atns:Relation[@RefId=$eId]/atns:EntityRef[@RefId=//atns:EntitysRef/atns:Entity/@Id and @RefId != $eId]" mode="link" />
<xsl:apply-templates select="atns:Relation/atns:EntityRef[@RefId=$eId and @Feedback='YES']" mode="link_revers" />
</xsl:template>

<xsl:template match="atns:EntityRef" mode="link">
    <xsl:variable name="refId" select="@RefId"/>
    <xsl:variable name="linkProc">
        <xsl:choose>
            <xsl:when test="@Multiplicity='YES'">
                <xsl:text>link_one2many</xsl:text>
            </xsl:when>
            <xsl:otherwise>
                <xsl:text>link_one2one</xsl:text>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    <xsl:variable name="optional">
        <xsl:choose>
            <xsl:when test="@Optional='YES'">
                <xsl:text>1</xsl:text>
            </xsl:when>
            <xsl:otherwise>
                <xsl:text>0</xsl:text>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
__PACKAGE__-><xsl:value-of select="$linkProc"
                />(name => '<xsl:value-of select="@Role"
                />', type => '<xsl:value-of select="$RealAppName"
                                />::Entity::<xsl:value-of select="//atns:EntitysRef/atns:Entity[@Id=$refId]/@Name"
                />', from => '<xsl:value-of select="@From"
                />', to => '<xsl:value-of select="@To"
                />', optional => <xsl:value-of select="$optional"
                />);</xsl:template>

<xsl:template match="atns:EntityRef" mode="link_revers">
    <xsl:variable name="refId" select="../@RefId"/>
__PACKAGE__->link_one2one(name => '<xsl:value-of select="../@Type"
                />', type => '<xsl:value-of select="$RealAppName"
                                />::Entity::<xsl:value-of select="//atns:EntitysRef/atns:Entity[@Id=$refId]/@Name"
                />', from => '<xsl:value-of select="@To"
                />', to => '<xsl:value-of select="@From"
                />', optional => 0);</xsl:template>

</xsl:stylesheet>

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

<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:atns="app://Ambrosia/EntityDataModel/2011/V1">

<xsl:output method="text" indent="yes"  />

<xsl:include href="../incName.xsl" />

<xsl:template match="/">package <xsl:value-of select="$RealAppName" />::Managers::ExitManager;
use strict;
use warnings;

use <xsl:value-of select="$RealAppName" />::Accessor;

use Ambrosia::Meta;
class
{
    extends => [qw/Ambrosia::BaseManager/]
};

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

sub prepare
{
    $_[0]->internal_redirect('*');
    <xsl:value-of select="$RealAppName" />::Accessor->exit;
}

1;
</xsl:template>

</xsl:stylesheet>

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


<xsl:output method="text" indent="yes" />

<xsl:include href="../incName.xsl" />

<!-- Root -->
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>

<xsl:template match="atns:Application/atns:Entity">package <xsl:value-of select="$RealAppName" />::Managers::<xsl:value-of select="@Name"/>EditManager;
use strict;
use JSON::XS;

use Ambrosia::core::Nil;
use Ambrosia::Context;
require <xsl:value-of select="$RealAppName" />::Entity::<xsl:value-of select="@Name"/>;

use Ambrosia::Meta;
class
{
    extends => [qw/<xsl:value-of select="$RealAppName" />::Managers::BaseManager/]
};

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

sub prepare
{
    my $id = Context->resource_id;
    my $node = undef;

    if ( $id eq 'root' )
    {
        $node = <xsl:value-of select="$RealAppName" />::Entity::<xsl:value-of select="@Name"/>->root();
    }
    else
    {
        $node = <xsl:value-of select="$RealAppName" />::Entity::<xsl:value-of select="@Name"/>->load($id);
    }

    if ( $node )
    {
        Context->repository->set( response => 
                {
                    $node->Representation(),
                    children => [
                        map {
                            {

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

<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:atns="app://Ambrosia/EntityDataModel/2011/V1">

<xsl:output method="text" indent="yes"  />

<xsl:include href="../incName.xsl" />

<xsl:template match="/">
package <xsl:value-of select="$RealAppName" />::<xsl:value-of select="$RealAppName" />;
use strict;
use warnings;

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

our $dispatcher;
BEGIN
{
    use Ambrosia::Config assign => '<xsl:value-of select="$RealAppName" />';
    use Ambrosia::Logger assign => '<xsl:value-of select="$RealAppName" />';
    use Ambrosia::Context;
    use Ambrosia::DataProvider;
    use Ambrosia::Dispatcher;
    use Ambrosia::View::XSLT;
    use Ambrosia::View::JSON;
    use Ambrosia::BaseManager;
<xsl:if test="/atns:Application/@Authorization!='NO'">
    use Ambrosia::Addons::Session;
    use Ambrosia::Addons::Session::Cookie;
    use Ambrosia::Addons::Accessor;
    use <xsl:value-of select="$RealAppName" />::Accessor;
    use <xsl:value-of select="$RealAppName" />::Authorize;

    instance <xsl:value-of select="$RealAppName" />::Accessor( <xsl:value-of select="$RealAppName" /> => authorize => new <xsl:value-of select="$RealAppName" />::Authorize() );
</xsl:if>

    instance Ambrosia::Context(config->CommonGatewayInterface)
        ->on_start( sub {
                instance Ambrosia::Addons::Session(storage => new Ambrosia::Addons::Session::Cookie())
            } )
        ->on_abort( sub {session->destroy} )
        ->on_finish( sub {session->destroy} );

    instance Ambrosia::DataProvider(<xsl:value-of select="$RealAppName" /> => config->data_source);

    my $viewXML  = new Ambrosia::View::XSLT( charset => config->Charset, rootName => '<xsl:value-of select="$UcAppName" />' );
    my $viewJSON = new Ambrosia::View::JSON( charset => config->Charset );

    $dispatcher = Ambrosia::Dispatcher
        ->new()
<xsl:if test="/atns:Application/@Authorization!='NO'">
        ->on_check_access(\&amp;check_access)
</xsl:if>
        ->on_error(sub { error($_[1]) })
        ->on_complete(sub {
                Context->repository->set( __debug => config->DEBUG );

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

use Ambrosia::RPC;
    instance Ambrosia::RPC(config->service_conf);
=cut

}

sub handler
{
    eval
    {
        Ambrosia::Config::assign '<xsl:value-of select="$RealAppName" />';
        Ambrosia::Logger::assign '<xsl:value-of select="$RealAppName" />';
        Ambrosia::DataProvider::assign '<xsl:value-of select="$RealAppName" />';
<xsl:if test="/atns:Application/@Authorization!='NO'">
        Ambrosia::Addons::Accessor::assign '<xsl:value-of select="$RealAppName" />';
</xsl:if>
#        Ambrosia::RPC::assign '<xsl:value-of select="$RealAppName" />';

        controller( __managers => config->MANAGERS );
        do
        {
            Context->start_session();
            $dispatcher->run(Context->action);
            Context->finish_session;
        } while (!Context->is_complete);
    };

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

</HTML>
EOB

    Context->abort_session();
}

<xsl:if test="/atns:Application/@Authorization!='NO'">
sub check_access
{
    my $mng = shift;
    my $val = session()->getItem(<xsl:value-of select="$RealAppName" />::Accessor::get_access_key_name()) || {};
    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(

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


<xsl:output method="text" indent="yes" />

<xsl:include href="../incName.xsl" />

<!-- Root -->
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>

<xsl:template match="atns:Application/atns:Entity">package <xsl:value-of select="$RealAppName" />::Managers::<xsl:value-of select="@Name"/>ListManager;
use strict;
use warnings;

use Ambrosia::Config;
use Ambrosia::Context;
require <xsl:value-of select="$RealAppName" />::Entity::<xsl:value-of select="@Name"/>;

use Ambrosia::Meta;
class
{
    extends => [qw/<xsl:value-of select="$RealAppName" />::Managers::BaseManager/]
};

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

sub prepare
{
    my ($list, $numRows) = <xsl:value-of select="$RealAppName" />::Entity::<xsl:value-of select="@Name"/>
        ->list(Context->param('start') || 0,
               Context->param('count') || config->NUMBER_PER_PAGE || 25,
               1
            );

    Context->repository->set(
        items   => [map { {$_->Representation()}; } @$list],
        numRows => $numRows,
    );
}

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

<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:atns="app://Ambrosia/EntityDataModel/2011/V1">

<xsl:output method="text" indent="yes"  />

<xsl:include href="../incName.xsl" />

<xsl:template match="/">package <xsl:value-of select="$RealAppName" />::Managers::ListManager;
use strict;
use warnings;

use Ambrosia::Context;
use Ambrosia::core::ClassFactory;

use Ambrosia::Meta;
class
{
    extends => [qw/<xsl:value-of select="$RealAppName" />::Managers::BaseManager/]
};

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

sub prepare
{
    my $entity = Context->param('entity');
    Context->repository->set(
        Field   => Ambrosia::core::ClassFactory::load_class($entity)->RepresentationMeta(),
        Name    => lc(( $entity =~ /.+::(.+)$/ )[0]),

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

<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:atns="app://Ambrosia/EntityDataModel/2011/V1">

<xsl:output method="text" indent="yes"  />

<xsl:include href="../incName.xsl" />

<xsl:template match="/">package <xsl:value-of select="$RealAppName" />::Managers::MainManager;
use strict;
use warnings;

use Ambrosia::Meta;
class
{
    extends => [qw/<xsl:value-of select="$RealAppName" />::Managers::BaseManager/]
};

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

sub prepare
{
}

1;
</xsl:template>

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


<xsl:output method="text" indent="yes" />

<xsl:include href="../incName.xsl" />

<!-- Root -->
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>

<xsl:template match="atns:Application/atns:Entity">package <xsl:value-of select="$RealAppName" />::Managers::<xsl:value-of select="@Name"/>SaveManager;
use strict;
use warnings;

use Ambrosia::Context;
require <xsl:value-of select="$RealAppName" />::Validators::<xsl:value-of select="@Name"/>Validator;
require <xsl:value-of select="$RealAppName" />::Entity::<xsl:value-of select="@Name"/>;

use Ambrosia::Meta;
class
{
    extends => [qw/<xsl:value-of select="$RealAppName" />::Managers::BaseManager/]
};

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

sub prepare
{
    my $self = shift;

    eval
    {
        my $validator = new <xsl:value-of select="$RealAppName" />::Validators::<xsl:value-of select="@Name"/>Validator(_prototype => '<xsl:value-of select="$RealAppName" />::Entity::<xsl:value-of select="@Name"/>');
        if ( my $violations = $validator->verify )
        {
            Context->repository->set(<xsl:value-of select="@Name"/> => $violations);
            $self->add_error($violations, '<xsl:value-of select="@Name"/>');
        }
        else
        {
            Context->repository->set(<xsl:value-of select="@Name"/> => undef);
            $validator->Instance->save;
            $self->add_message('Data saved successfully.');
        }
    };
    if ( $@ )
    {
        $self->add_error($@, '<xsl:value-of select="@Name"/>');
    }

    <xsl:variable name="entityName" select="translate(@Name, $vUppercaseChars_CONST, $vLowercaseChars_CONST)"/>
    $self->relegate('/get/<xsl:value-of select="$entityName"/>');
}

1;
</xsl:template>

</xsl:stylesheet>

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

<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:atns="app://Ambrosia/EntityDataModel/2011/V1">

<xsl:output method="text" indent="yes"  />

<xsl:include href="../incName.xsl" />

<xsl:template match="/">
{
    package <xsl:value-of select="$RealAppName" />::<xsl:value-of select="$RealAppName" />ServiceHandler;
    use strict;
    use warnings;

    use Ambrosia::Logger assign => '<xsl:value-of select="$RealAppName" />';
    our $VERSION = sprintf('0.%03d', q$Revision: 01 $ =~ /(\d+)/o);


    #use SOAP::Lite +trace => 'all';
    use SOAP::Transport::HTTP;
    $SOAP::Constants::DO_NOT_USE_XML_PARSER = 1;

    sub handler
    {
        my $r = shift;

        my $server = SOAP::Transport::HTTP::Apache
            ->dispatch_with( { $ENV{HTTP_SOAPACTION} => '<xsl:value-of select="$RealAppName" />::<xsl:value-of select="$RealAppName" />Services' } );

        eval
        {
            $server->handler($r);
        };
        if ( $@ )
        {
            logger->error($@);
        }
        1;
    }
}

{
    package <xsl:value-of select="$RealAppName" />::<xsl:value-of select="$RealAppName" />Services;
    use strict;
    use warnings;
    our $VERSION = sprintf('0.%03d', q$Revision: 01 $ =~ /(\d+)/o);

    BEGIN
    {
        use Ambrosia::Config assign => '<xsl:value-of select="$RealAppName" />';
        use Ambrosia::Logger assign => '<xsl:value-of select="$RealAppName" />';
    }

    use Ambrosia::Context;
    use Ambrosia::DataProvider;
    use Ambrosia::Dispatcher;
    use Ambrosia::View::XSLT;
    use Ambrosia::View::JSON;
    use Ambrosia::BaseManager;

    our $dispatcher;
    our $Result;
    our $viewXML;
    our $viewJSON;
    BEGIN
    {
        instance Ambrosia::DataProvider( <xsl:value-of select="$RealAppName" /> => config->data_source);
        instance Ambrosia::Context();

        $viewXML  = new Ambrosia::View::XSLT( charset => config->Charset, rootName => '<xsl:value-of select="$UcAppName" />' );
        $viewJSON = new Ambrosia::View::JSON( charset => config->Charset );

        $dispatcher = Ambrosia::Dispatcher
            ->new()
            ->on_error(sub {
                    logger->error(@_);
                    storage->foreach('cancel_transaction');
                    storage->foreach('close_connection');
                    Context->error(@_);
                    die $@;

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

                    else
                    {
                        error('Action is undefined.');
                    }

                    storage->foreach('save_transaction');
                    storage->foreach('close_connection');
                });
    }

<xsl:for-each select="//atns:Entitys/atns:Entity">
    <xsl:variable name="entityName" select="translate(@Name, $vUppercaseChars_CONST, $vLowercaseChars_CONST)"/>
    <xsl:variable name="typeEntity" select="translate(@Type, $vLowercaseChars_CONST, $vUppercaseChars_CONST)"/>
    <xsl:if test="$typeEntity='TABLE' or $typeEntity='VIEW'">
    sub get<xsl:value-of select="@Name"/>
    {
        my $proto = shift;
        <xsl:for-each select="./atns:Key/atns:FieldRef">my $<xsl:value-of select="@Name"/> = shift;
</xsl:for-each>
        run(
            action => '/get/<xsl:value-of select="$entityName" />',
            <xsl:for-each select="./atns:Key/atns:FieldRef">
            <xsl:value-of select="@Name"/> => $<xsl:value-of select="@Name"/>,</xsl:for-each>
        );
        return $Result;
    }
    </xsl:if>
</xsl:for-each>


    sub run
    {
        my %params = @_;
        eval
        {
            Ambrosia::Config::assign '<xsl:value-of select="$RealAppName" />';
            Ambrosia::Logger::assign '<xsl:value-of select="$RealAppName" />';
            Ambrosia::DataProvider::assign '<xsl:value-of select="$RealAppName" />';
            controller(__managers => config->MANAGERS);
            do
            {
                Context->start_session();
                Context->param($_ => $params{$_}) foreach (keys %params);

                $dispatcher->run(Context->action);
                Context->finish_session;
            } while (!Context->is_complete);
        };

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


<xsl:include href="../incName.xsl" />

<!-- Root -->
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>

<!-- Entity -->
<xsl:template match="/">
package <xsl:value-of select="$RealAppName" />::Entity::<xsl:value-of select="$RealAppName" />SysUser;
use strict;
use warnings;

use Ambrosia::Meta;
class sealed 
{
    public  => [qw/Password Levels/],
};

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

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


<xsl:output method="text" indent="yes" />

<xsl:include href="../incName.xsl" />

<!-- Root -->
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>

<xsl:template match="atns:Application/atns:Entity">package <xsl:value-of select="$RealAppName" />::Managers::<xsl:value-of select="@Name"/>TreeManager;
use strict;
use JSON::XS;

use Ambrosia::Config;
use Ambrosia::Context;
require <xsl:value-of select="$RealAppName" />::Entity::<xsl:value-of select="@Name"/>;

use Ambrosia::Meta;
class
{
    extends => [qw/<xsl:value-of select="$RealAppName" />::Managers::BaseManager/]
};

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

sub prepare
{
    if ( my $node = <xsl:value-of select="$RealAppName" />::Entity::<xsl:value-of select="@Name"/>->root() )
    {
        Context->repository->set( response => [
            map {
                {
                    '$ref' => $_->TreeId,
                    $_->Representation(),
                    ($_->have_children() ? (children => JSON::XS::true ) : ())
                };
            } @{$node->load_children()}
        ] );

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


<xsl:output method="text" indent="yes" />

<xsl:include href="../incName.xsl" />

<!-- Root -->
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>

<xsl:template match="atns:Application/atns:Entity"><xsl:variable name="type" select="translate(@Type, $vLowercaseChars_CONST, $vUppercaseChars_CONST)"/>
package <xsl:value-of select="$RealAppName" />::Validators::<xsl:value-of select="@Name"/>Validator;
use strict;
use warnings;

use Ambrosia::Context;
use Ambrosia::Validator;
require <xsl:value-of select="$RealAppName" />::Entity::<xsl:value-of select="@Name"/>;

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>

</xsl:stylesheet>

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


<xsl:stylesheet version="1.0">

<xsl:output method="html" indent="yes" />

<xsl:template match="/"><xsl:text disable-output-escaping="yes">&lt;!DOCTYPE HTML>
</xsl:text>
<html lang="en">
	<xslt:if test="boolean(/Application/@Language)">
		<xslt:attribute name="lang">
			<xslt:value-of select="/Application/@Language"/>
		</xslt:attribute>
	</xslt:if>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<xslt:apply-imports/>
		<script type="text/javascript">
				require(["dijit/dijit","dijit/form/Form","dijit/form/Button","dijit/form/ValidationTextBox","dojo/domReady!","dojo/parser"]);
		</script>
	</head>
	<body class="claro">
		<xsl:apply-templates select="//repository/mng_EWM"/>
		<xsl:apply-templates>
			<xslt:attribute name="select"><xslt:value-of select="$UcAppName" /></xslt:attribute>
		</xsl:apply-templates>
	</body>
</html>
</xsl:template>
<xsl:template>
	<xslt:attribute name="match"><xslt:value-of select="$UcAppName" /></xslt:attribute>
	<xslt:variable name="entityName" select="translate(/atns:Application/atns:Entitys/atns:Entity/@Name[1], $vUppercaseChars_CONST, $vLowercaseChars_CONST)"/>
	<form method="POST">
		<xsl:attribute name="action"><xsl:value-of select="@script" />/</xsl:attribute>
		<xsl:apply-templates select="repository"/>
		<button data-dojo-type="dijit.form.Button" data-dojo-props="type:'submit', value:'Submit'">Submit</button>
	</form>
</xsl:template>

<xsl:template match="repository">
<table>
	<tr>
		<td>Username</td>
		<td>
			<xsl:variable name="value">,value:"<xsl:value-of select="./SysUser/@login"/>"</xsl:variable>
			<input data-dojo-type="dijit.form.ValidationTextBox">
				<xsl:attribute name="data-dojo-props">
					<xsl:value-of select="concat('id:&quot;id_Login&quot;,name:&quot;login&quot;,type:&quot;text&quot;,trim:true,maxLength:&quot;32&quot;,promptMessage:&quot;Login&quot;',$value)"/>
				</xsl:attribute>
			</input>
		</td>
	</tr>
	<tr>
		<td>Password</td>
		<td>
			<xsl:variable name="value">,value:"<xsl:value-of select="./SysUser/@pswd"/>"</xsl:variable>
			<input data-dojo-type="dijit.form.ValidationTextBox">
			<xsl:attribute name="data-dojo-props">
				<xsl:value-of select="concat('id:&quot;id_Password&quot;,name:&quot;password&quot;,type:&quot;password&quot;,trim:true,maxLength:&quot;32&quot;,promptMessage:&quot;Password&quot;',$value)"/>
			</xsl:attribute>
		  </input>
		</td>
	</tr>
</table>
</xsl:template>
</xsl:stylesheet>

</xslt:template>

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


<xsl:stylesheet version="1.0">
<xsl:output method="html" indent="yes" />
<xsl:include href="_message.xsl"/>

<xsl:template match="/"><xsl:text disable-output-escaping="yes">&lt;!DOCTYPE HTML>
</xsl:text>
<html lang="en">
	<xslt:if test="boolean(/Application/@Language)">
		<xslt:attribute name="lang">
			<xslt:value-of select="/Application/@Language"/>
		</xslt:attribute>
	</xslt:if>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<xslt:apply-imports/>

		<script type="text/javascript">
			require([
			"dijit/dijit",
			"dijit/form/Form",
			"dijit/form/Button",
			"dijit/form/ValidationTextBox",
<xslt:for-each select="//atns:Application/atns:Entity/atns:Field[not(@Type=preceding-sibling::atns:Field/@Type)]">
	<xslt:choose>
		<xslt:when test="@Type='String' and not(@Hidden)">
			"dijit/form/TextBox",</xslt:when>

		<xslt:when test="@Type='Number'">
			"dijit/form/NumberTextBox",</xslt:when>

		<xslt:when test="@Type='Double' and not(@Hidden)">
		</xslt:when>

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

		<xslt:when test="@type='Text'">
			"dijit/form/Textarea",
			"dijit/form/SimpleTextarea",
			"dijit/Editor",</xslt:when>
	</xslt:choose>
</xslt:for-each>
			"dojo/domReady!", "dojo/parser"]);
		</script>
	</head>
	<body class="claro">
		<xsl:apply-templates select="//repository/mng_EWM" />
		<xsl:apply-templates>
			<xslt:attribute name="select"><xslt:value-of select="$UcAppName" /></xslt:attribute>
		</xsl:apply-templates>
	</body>
</html>
</xsl:template>

<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" />
</xsl:template>

</xsl:stylesheet>

</xslt:template>

<xslt:template match="atns:Application/atns:Entity">
	<xslt:variable name="label">
		<xslt:choose>
			<xslt:when test="not(@Label) or @Label!=''">
				<xslt:value-of select="@Label"/>
			</xslt:when>
			<xslt:otherwise>
				<xslt:value-of select="@Name"/>
			</xslt:otherwise>
		</xslt:choose>
	</xslt:variable>
	<xslt:for-each select="atns:Key">
		<input type="hidden">
			<xslt:attribute name="name"><xslt:value-of select="atns:FieldRef/@Name"/></xslt:attribute>
		<xsl:attribute name="value"><xsl:value-of>
				<xslt:attribute name="select"><xslt:value-of select="concat('./',../@Name,'/@',atns:FieldRef/@Name)"/></xslt:attribute>
			</xsl:value-of>
			</xsl:attribute>
		</input>
	</xslt:for-each>
	<table>
		<tr><td colspan="2" align="center" style="font-size: 1.2em;">
			<b>Edit <xslt:value-of select="$label" /></b>
		</td></tr>
		<xslt:apply-templates select="atns:Field"/>

		<xslt:variable name="EId" select="@Id" />
		<xslt:if test="boolean(/atns:Application/atns:EntitysRef/atns:Entity[@Id=/atns:Application/atns:Relations/atns:Relation[@RefId=$EId]/atns:EntityRef/@RefId and @Type='BIND'])">
		<xslt:apply-templates
			select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=/atns:Application/atns:Relations/atns:Relation[@RefId=$EId]/atns:EntityRef/@RefId and @Type='BIND']" mode="bind" />
		</xslt:if>
	</table>
</xslt:template>

<xslt:template match="atns:Field">
	<xslt:variable name="EId" select="../@Id" />
	<xslt:variable name="FName" select="@Name" />
	<xslt:variable name="label">
		<xslt:choose>
			<xslt:when test="not(@Label) or @Label!=''">
				<xslt:value-of select="@Label"/>
			</xslt:when>
			<xslt:when test="boolean(/atns:Application/atns:Relations/atns:Relation/atns:EntityRef[@RefId=$EId and @To=$FName]/../@Type)">
				<xslt:value-of select="/atns:Application/atns:Relations/atns:Relation/atns:EntityRef[@RefId=$EId]/../@Type"/>
			</xslt:when>
			<xslt:otherwise>
				<xslt:value-of select="@Name"/>
			</xslt:otherwise>
		</xslt:choose>
	</xslt:variable>

	<xslt:if test="not(@Hidden)">
	<tr>
		<td><xslt:value-of select="$label"/></td>
		<td>
			<xslt:variable name="name" select="@Name"/>
			<xslt:variable name="value" select="concat('./',../@Name,'/@',@Name)"/>
			<xslt:variable name="in_type">
				<xslt:choose>
					<xslt:when test="boolean(@Hidden)">hidden</xslt:when>
					<xslt:otherwise>text</xslt:otherwise>
				</xslt:choose>
			</xslt:variable>

			<xslt:choose>
				<xslt:when test="@Type='Bool'">
					<xsl:variable name="value">,value:1</xsl:variable>
				</xslt:when>
				<xslt:otherwise>
					<xsl:variable name="value">,value:&quot;<xsl:value-of><xslt:attribute name="select"><xslt:value-of select="$value" /></xslt:attribute></xsl:value-of>&quot;</xsl:variable>
				</xslt:otherwise>
			</xslt:choose>
			<xsl:variable name="regExp"><xslt:if test="@Type='Email'">,regExp:<xsl:variable name="s24"><xslt:value-of select="concat('{','2,4}')" /></xsl:variable>&quot;[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]<xsl:value-of select="$s24" />&quot;</xslt:if></xsl:vari...
			<xslt:variable name="dojoProps">id:&quot;id_<xslt:value-of select="$name" />&quot;,name:&quot;<xslt:value-of select="$name" />&quot;,type:&quot;<xslt:value-of select="$in_type" />&quot;,trim:true,maxLength:&quot;<xslt:value-of select="@Size" />&qu...
<!--xslt:variable name="dojoProps">
id:&quot;id_<xslt:value-of select="$name" />&quot;,
name:&quot;<xslt:value-of select="$name" />&quot;,
type:&quot;<xslt:value-of select="$in_type" />&quot;,
trim:true,
maxLength:&quot;<xslt:value-of select="@Size" />&quot;,
promptMessage:&quot;<xslt:value-of select="@Title" />&quot;</xslt:variable-->

			<xslt:variable name="dojoType">
				<xslt:choose>
					<xslt:when test="@Type='Email'">dijit.form.ValidationTextBox</xslt:when>
					<xslt:when test="@Type='String'">dijit.form.ValidationTextBox</xslt:when>
					<xslt:when test="@Type='Number'">dijit.form.NumberTextBox</xslt:when>
					<xslt:when test="@Type='Double'">dijit.form.NumberTextBox</xslt:when>
					<xslt:when test="@Type='Date'">dijit.form.DateTextBox</xslt:when>
					<xslt:when test="@Type='Datetime'">dijit.form.DateTextBox</xslt:when>
					<xslt:when test="@Type='Bool'">dijit.form.CheckBox</xslt:when>
					<xslt:otherwise>dijit.form.ValidationTextBox</xslt:otherwise>
				</xslt:choose>
			</xslt:variable>

<xslt:choose>
	<xslt:when test="boolean(/atns:Application/atns:Relations/atns:Relation/atns:EntityRef[@RefId=$EId and @To=$name])">
<xslt:apply-templates
	select="/atns:Application/atns:Relations/atns:Relation/atns:EntityRef[@RefId=$EId and @To=$name]" mode="ref" />
	</xslt:when>

	<xslt:when test="@Type='Bool'">
<input type="checkbox" id="" data-dojo-type="dijit.form.CheckBox" name="" value="1">
	<xsl:attribute name="id">id_<xslt:value-of select="$name" /></xsl:attribute>
	<xsl:attribute name="name"><xslt:value-of select="$name" /></xsl:attribute>
</input>
	</xslt:when>
	<xslt:otherwise>
		<input style="width:15em;">
			<xslt:if test="@Type='Date' or @Type='Datetime'">
				<xslt:attribute name="lang">
					<xslt:choose>
						<xslt:when test="boolean(/atns:Application/@Language)"><xslt:value-of select="/atns:Application/@Language"/></xslt:when>
						<xslt:otherwise>en-us</xslt:otherwise>
					</xslt:choose>
				</xslt:attribute>
			</xslt:if>
			<xslt:attribute name="title">
				<xslt:value-of select="@Title"/>
			</xslt:attribute>
			<xslt:attribute name="data-dojo-type">
				<xslt:value-of select="$dojoType"/>
			</xslt:attribute>
			<xsl:attribute name="data-dojo-props"><xsl:value-of>
					<xslt:attribute name="select">
					<xslt:value-of select="concat('concat(',$s_q,$dojoProps,$s_q,',', '$', 'value,', '$', 'regExp', ')')"/>
			</xslt:attribute></xsl:value-of></xsl:attribute>
		</input>
	</xslt:otherwise>
</xslt:choose>
		</td>
	</tr>
	</xslt:if>
</xslt:template>

<xslt:template match="atns:EntityRef" mode="ref" >
<xslt:variable name="p_ref_id" select="../@RefId"/>
<xslt:variable name="ref_id" select="./@RefId"/>
<xslt:variable name="ref" select="concat('./', /atns:Application/atns:Entity[@Id=$ref_id]/@Name, '/@', @To)" />

<xsl:variable name="value_ref">
	<xsl:choose>
		<xsl:when >
			<xslt:attribute name="test">
				<xslt:value-of select="concat('boolean(', $ref, ')')" />
			</xslt:attribute><xsl:value-of select="">
			<xslt:attribute name="select">
				<xslt:value-of select="$ref" />
			</xslt:attribute>
			</xsl:value-of>
		</xsl:when>
		<xsl:otherwise>
		</xsl:otherwise>
	</xsl:choose>
</xsl:variable>

<xsl:variable name="url"><xsl:value-of select=""><xslt:attribute name="select"><xslt:value-of select="concat('//',$UcAppName,'/@script')" /></xslt:attribute></xsl:value-of>/json</xsl:variable>
<xslt:variable name="entityName" select="translate(/atns:Application/atns:EntitysRef/atns:Entity[@Id=$p_ref_id]/@Name, $vUppercaseChars_CONST, $vLowercaseChars_CONST)"/>
<xslt:variable name="label">
	<xslt:choose>
		<xslt:when test="not(/atns:Application/atns:EntitysRef/atns:Entity[@Id=$p_ref_id]/@Label) or /atns:Application/atns:EntitysRef/atns:Entity[@Id=$p_ref_id]/@Label=''">
			<xslt:value-of select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=$p_ref_id]/@Name"/>
		</xslt:when>
		<xslt:otherwise>
			<xslt:value-of select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=$p_ref_id]/@Label"/>
		</xslt:otherwise>
	</xslt:choose>
</xslt:variable>

<script type="text/javascript">
	require(["dijit/form/Select", "dojo/data/ItemFileReadStore", "dojo/store/JsonRest"],
		function(Select, ItemFileReadStore, JsonRest){
			new JsonRest({target:"<xsl:value-of select="$url" />"})
				.get('/<xslt:value-of select="$entityName" />/').then(function(data){
					var readStore = new ItemFileReadStore({data: {
						identifier: "<xslt:value-of select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=$p_ref_id]/atns:Key[@AutoUniqueValue='YES']/atns:FieldRef/@Name"/>",
						label: "<xslt:value-of select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=$p_ref_id]/@Name"/>",
<!-- - - >
						label: "<xslt:call-template name="join">
							<xslt:with-param name="valueList" select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=$p_ref_id]/atns:Field[@Hidden!='YES' or not(@Hidden)]/@Name"/>
							<xslt:with-param name="separator" select="'_'"/>
						</xslt:call-template>",
<! - - -->
						items: data.repository.items}
					});
					var select = new Select({
						id: 'id_<xslt:value-of select="@To"/>',
						name: "<xslt:value-of select="@To"/>",
						value: "<xsl:value-of select="$value_ref"/>",
						promptMessage: "Select <xslt:value-of select="$label"/>",
						store: readStore
					}, "id_<xslt:value-of select="@To"/>");
					select.set('style','width: 15em; overflow: hidden;');
					select.startup();
				});
});
</script>

<input id="id_"><xsl:attribute name="id">id_<xslt:value-of select="@To"/></xsl:attribute></input>

</xslt:template>


<xslt:template match="atns:Entity" mode="bind" >
<xslt:variable name="bindId" select="@Id"/>
<xslt:variable name="EId" select="/atns:Application/atns:Entity/@Id"/>
<xslt:variable name="endId" select="/atns:Application/atns:Relations/atns:Relation[@RefId != $EId]/atns:EntityRef[@RefId = $bindId]/../@RefId"/>

<!--bindId=<xslt:value-of select="$bindId"/>
EId=<xslt:value-of select="$EId"/>
endId=<xslt:value-of select="$endId"/>
name1=<xslt:value-of select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=1]/@Name"/>
name2=<xslt:value-of select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=2]/@Name"/>
name3=<xslt:value-of select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=3]/@Name"/>
name4=<xslt:value-of select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=4]/@Name"/>
name5=<xslt:value-of select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=5]/@Name"/>
-->
<xsl:variable name="url"><xsl:value-of select=""><xslt:attribute name="select"><xslt:value-of select="concat('//',$UcAppName,'/@script')" /></xslt:attribute></xsl:value-of>/json</xsl:variable>
<xslt:variable name="entityName" select="translate(/atns:Application/atns:EntitysRef/atns:Entity[@Id=$bindId]/@Name, $vUppercaseChars_CONST, $vLowercaseChars_CONST)"/>
<xslt:variable name="label">
	<xslt:choose>
		<xslt:when test="not(/atns:Application/atns:EntitysRef/atns:Entity[@Id=$endId]/@Label) or /atns:Application/atns:EntitysRef/atns:Entity[@Id=$endId]/@Label=''">
			<xslt:value-of select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=$endId]/@Name"/>
		</xslt:when>
		<xslt:otherwise>
			<xslt:value-of select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=$endId]/@Label"/>
		</xslt:otherwise>
	</xslt:choose>
</xslt:variable>
<tr><td><xslt:value-of select="$label"/></td>
	<td>
<script type="text/javascript">
	require(["dijit/form/MultiSelect", "dojo/data/ItemFileReadStore", "dojo/store/JsonRest"],
		function(Select, ItemFileReadStore, JsonRest){
			new JsonRest({target:"<xsl:value-of select="$url" />"})
				.get('/<xslt:value-of select="$entityName" />/').then(function(data){
					var readStore = new ItemFileReadStore({data: {
						identifier: "<xslt:value-of select="/atns:Application/atns:Relations/atns:Relation[@RefId = $endId]/atns:EntityRef[@RefId = $bindId]/@To"/>",
						label: "<xslt:value-of select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=$endId]/@Name"/>",
						items: data.repository.items}
					});
					var select = new Select({
						id: 'id_<xslt:value-of select="/atns:Application/atns:Relations/atns:Relation[@RefId = $endId]/atns:EntityRef[@RefId = $bindId]/@To"/>',
						name: "<xslt:value-of select="/atns:Application/atns:Relations/atns:Relation[@RefId = $endId]/atns:EntityRef[@RefId = $bindId]/@To"/>",
						value: "",
						promptMessage: "Select <xslt:value-of select="$label"/>",
						store: readStore
					}, "id_<xslt:value-of select="/atns:Application/atns:Relations/atns:Relation[@RefId = $endId]/atns:EntityRef[@RefId = $bindId]/@To"/>");
					select.set('style','width: 15em; overflow: hidden;');
					select.startup();
				});
});
</script>

<input id="id_"><xsl:attribute name="id">id_<xslt:value-of select="/atns:Application/atns:Relations/atns:Relation[@RefId = $endId]/atns:EntityRef[@RefId = $bindId]/@To"/></xsl:attribute></input>
	</td></tr>
</xslt:template>


<!-- xslt:template match="atns:Field" mode="relationAttr"><xslt:value-of select="concat($s_q, @Name, $s_q, ':', $s_q, '@', @Name, $s_q)" /><xslt:if test="position()!=last()">,</xslt:if></xslt:template -->

</xslt:stylesheet>

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

	xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
	xmlns:xsl="http://www.w3.org/1999/XSL/TransformAlias"
	xmlns:atns="app://Ambrosia/EntityDataModel/2011/V1">

<xslt:strip-space elements="*" />

<xslt:template match="/">
<xsl:variable name="dojo_host" >/ajax/libs/dojo/1.7.2</xsl:variable>

<style type="text/css" media="screen">
	@import "<xsl:value-of select="$dojo_host" />/dojo/resources/dojo.css";
	@import "<xsl:value-of select="$dojo_host" />/dijit/themes/claro/claro.css";
	@import "<xsl:value-of select="$dojo_host" />/dijit/themes/claro/document.css";

	html, body {
		height: 100%;
		margin: 0;
		overflow: hidden;
		padding: 0;
		font-size: 1.1em;
		font-family: Geneva, Arial, Helvetica, sans-serif;
	}

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

	dojoConfig= {
		has: {
			"dojo-firebug": true
		},
		parseOnLoad: true,
		async: true
	};
</script>

<script type="text/javascript" src="">
	<xsl:attribute name="src"><xsl:value-of select="$dojo_host" />/dojo/dojo.js</xsl:attribute>
</script>

</xslt:template>

</xslt:stylesheet>

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

			#grid {
				width: 98%;
				height: 80%;
			}
		</style>
		<link rel="stylesheet" type="text/css" href="/ajax/libs/dojo/1.7.2/dojox/grid/enhanced/resources/claro/EnhancedGrid.css"/>
		<link rel="stylesheet" type="text/css" href="/ajax/libs/dojo/1.7.2/dojox/grid/enhanced/resources/EnhancedGrid_rtl.css"/>


		<xsl:variable name="urlList">
		<xsl:value-of select="">
			<xslt:attribute name="select"><xslt:value-of select="concat('//',$UcAppName,'/@script')" /></xslt:attribute>
		</xsl:value-of>/json/<xsl:value-of select="//repository/@Name"/>
		</xsl:variable>

		<xsl:variable name="urlEdit">
		<xsl:value-of select="">
			<xslt:attribute name="select"><xslt:value-of select="concat('//',$UcAppName,'/@script')" /></xslt:attribute>
		</xsl:value-of>/<xsl:value-of select="//repository/@Name"/>
		</xsl:variable>

		<script type="text/javascript">
			require([
				"dojo/dom",
				"dojox/grid/EnhancedGrid",
				"dojox/data/QueryReadStore",
				"dojox/grid/enhanced/plugins/Pagination", "dojox/grid/enhanced/plugins/Filter",
		<xsl:if test="//repository/@mutable=1">
				"dijit/dijit", "dijit/form/Button", "dijit/Dialog",
		</xsl:if>
				"dojo/domReady!", "dojo/parser"], function(dom, DataGrid, QueryReadStore) {

					var qstore;
					function showFormEdit(id)
					{
						document.getElementById('exFormFrame').src="<xsl:value-of select="$urlEdit" />/"+id;
						dijit.byId('exForm').show();
					}

					var formatSaveButton = function(value){
						return new dijit.form.Button({
							label: "Edit",
							iconClass: "dijitIconEdit",
							onClick: function(){ showFormEdit(value) }
						});
					};

					dojo.declare("my.data.QueryReadStore", [QueryReadStore], {
							_filterResponse: function(data){
								return {numRows: data.repository.numRows, items:data.repository.items};
							},
						});

					qstore = new my.data.QueryReadStore({
						url: "<xsl:value-of select="$urlList" />"
					});

					var grid = new DataGrid({
						store: qstore,
						query: {},
						plugins: {
							pagination: {
								pageSizes: ["25", "50", "100", "All"],
								description: "30%",
								sizeSwitch: "200px",
								pageStepper: "30em",
								gotoButton: true,
								maxPageStep: 5,
								position: "bottom"
							},
							filter: {
								itemsName: '<xsl:value-of select="//repository/@Name"/>',
								closeFilterbarButton: true,
								ruleCount: 8
							}
						},
						structure: [
							<xsl:apply-templates select="//repository/Field"/>
							<xsl:if test="//repository/@mutable=1">,
							{
								name: "Edit",
								field: "<xsl:apply-templates select="//repository/Field[@key=1]/@field"/>",
								styles: "text-align:center;",
								width: 8,
								formatter: formatSaveButton
							}
							</xsl:if>
						]
					}, "grid");
					grid.startup();
				});
		</script>
	</head>
	<body class="claro">
		<div class="claro dojoxGridMasterHeader head">List of <xsl:value-of select="//repository/@Name"/></div>
		<div id="grid"></div>
	<xsl:if test="//repository/@mutable=1">
		<div id="exForm" data-dojo-type="dijit.Dialog" title="Edit" style="overflow:auto; width: 300px; height: 300px; display:none;">
			<iframe id="exFormFrame" src="" style="overflow:auto; width: 99%; border:0px;">
			</iframe>
		</div>
	</xsl:if>
	</body>
</html>
</xsl:template>

<xsl:template match="//repository/Field">
	{
		name: "<xsl:value-of select="@label"/>",
		field: "<xsl:value-of select="@field"/>",
		styles: "text-align:right;",
		width:8
	}<xsl:if test="position()!=last()">,</xsl:if>
</xsl:template>

</xsl:stylesheet>
</xslt:template>

</xslt:stylesheet>



( run in 1.728 second using v1.01-cache-2.11-cpan-49f99fa48dc )