[Rt-commit] rt branch, lcore2, updated. bff7a512bb735ff52dadc38bb53d0bf698d21e88
clkao at bestpractical.com
clkao at bestpractical.com
Mon Nov 2 09:07:59 EST 2009
The branch, lcore2 has been updated
via bff7a512bb735ff52dadc38bb53d0bf698d21e88 (commit)
via e7104dfc3f53986a817c799f663e84553db4a50e (commit)
from f6781ad28ab1bea2213d4a89a1386408f9262c80 (commit)
Summary of changes:
lib/RT.pm | 18 ------------------
lib/RT/Lorzy.pm | 31 +++++++++++++++++++++++++++++++
2 files changed, 31 insertions(+), 18 deletions(-)
- Log -----------------------------------------------------------------
commit e7104dfc3f53986a817c799f663e84553db4a50e
Author: Chia-liang Kao <clkao at bestpractical.com>
Date: Wed Oct 28 21:40:09 2009 +0800
fix an error caused by the merge.
diff --git a/lib/RT.pm b/lib/RT.pm
index 39c0a7d..797ae91 100644
--- a/lib/RT.pm
+++ b/lib/RT.pm
@@ -310,24 +310,6 @@ sub init_jifty {
Jifty->new;
}
- Jifty->web->add_javascript(
- qw( titlebox-state.js util.js ahah.js fckeditor.js list.js
- jquery.createdomnodes.js
- combobox.js cascaded.js rulebuilder.js
-
- )
- );
-
- Jifty::Web->add_trigger(
- name => 'after_include_javascript',
- callback => sub {
- my $webpath = RT->config->get('web_path') || '/';
- Jifty->web->out(
- qq{<script type="text/javascript">RT = {};RT.WebPath = '$webpath';</script>}
- );
- },
- );
-
=head2 local_path
The root of F</local> (user overrides)
commit bff7a512bb735ff52dadc38bb53d0bf698d21e88
Author: Chia-liang Kao <clkao at bestpractical.com>
Date: Wed Oct 28 23:28:54 2009 +0800
examples for enum types.
diff --git a/lib/RT/Lorzy.pm b/lib/RT/Lorzy.pm
index 97b5003..c00033f 100644
--- a/lib/RT/Lorzy.pm
+++ b/lib/RT/Lorzy.pm
@@ -23,6 +23,22 @@ $LCORE->env->set_symbol('Str.Eq' => LCore::Primitive->new
return_type => 'Bool'
));
+my $ticket_status = enum 'RT::TicketStatus' => [qw(new open stalled resolved rejected deleted)];
+
+install_enum_consts($ticket_status);
+
+# XXX type class eq
+$LCORE->env->set_symbol('TicketStatus.Eq' => LCore::Primitive->new
+ ( body => sub {
+ die 'not yet';
+ return $_[0] eq $_[1];
+ },
+ parameters => [ LCore::Parameter->new({ name => 'left', type => 'RT::TicketStatus' }),
+ LCore::Parameter->new({ name => 'right', type => 'RT::TicketStatus' })],
+ return_type => 'Bool'
+ ));
+
+
$LCORE->env->set_symbol('RT.RuleAction.Prepare' => LCore::Primitive->new
( body => sub {
my ($name, $template, $context, $ticket, $transaction) = @_;
@@ -66,6 +82,20 @@ $LCORE->env->set_symbol('RT.RuleAction.Run' => LCore::Primitive->new
));
+
+sub install_enum_consts {
+ my ($type) = @_;
+ # this helper installs const functions for the possible values of
+ # an enum type.
+ for (@{$type->values}) {
+ $LCORE->env->set_symbol($type.'.'.$_ => LCore::Primitive->new
+ ( body => sub { $_ },
+ parameters => [],
+ return_type => $type,
+ ));
+ }
+}
+
sub install_model_accessors {
my ($env, $model) = @_;
my $modelname = lc($model);
@@ -97,6 +127,7 @@ sub install_model_accessors {
my $name = $column->name;
my $type = $column->type;
$type = $column->refers_to ? $column->refers_to
+ : $name eq 'status' ? 'RT::TicketStatus' # XXX hack for now
: $type =~ m/^varchar/ ? 'Str'
: $type eq 'timestamp' ? 'DateTime'
: $type eq 'boolean' ? 'Bool'
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list