[Rt-commit] rt branch, lcore, updated. cd630d931d04fef7a9c600b2865f2c23d075d59d
jesse
jesse at bestpractical.com
Fri Aug 21 11:18:06 EDT 2009
The branch, lcore has been updated
via cd630d931d04fef7a9c600b2865f2c23d075d59d (commit)
from f44304c4f412658b7a656cde3bf7703ea7b8eeb4 (commit)
Summary of changes:
TODO.lorzy | 86 ++++++++++++++++++++++++++++++++++
lib/RT/View/RuleBuilder.pm | 4 +-
share/web/static/css/rulebuilder.css | 82 ++++++++++++++++++++++++++++++--
share/web/static/js/rulebuilder.js | 35 +++++++++++---
4 files changed, 194 insertions(+), 13 deletions(-)
- Log -----------------------------------------------------------------
commit cd630d931d04fef7a9c600b2865f2c23d075d59d
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Tue Aug 11 09:13:57 2009 +0100
rulebuilder ui work
diff --git a/TODO.lorzy b/TODO.lorzy
index b451c3d..51ebd47 100644
--- a/TODO.lorzy
+++ b/TODO.lorzy
@@ -44,7 +44,93 @@ on ticket creation
and resolve the ticket
+
+ when =~ mac: $ticket->set_owner('bob');
+ when =~ pc: $ticket->set_owner('joe');
+ when =~ vax: $ticket->set_status('resolved'); send_email($ticket->requestors, "ha ha. no");
+
+
+ if
+
on ticket resolve,
if this ticket has never been resolved before, send email
to the requestor telling them their ticket has been resolved.
+
+rules and language features we need
+
+
+ let
+
+ use variable
+
+ if/elsif/else
+
+ foreach
+
+ string match
+
+ integer operations
+
+ arithmetic
+
+ logical operators
+
+ on transaction batch - when all other rules complete?
+
+ "if ticket has no unresolved dependencies"
+
+ when ticket's status is set to rejected
+
+ if status is in the list of {inactive,active} statuses
+
+ find tickets:
+ takes ticketsql?
+ takes "template" to match against?
+
+ filter transactions by "template".
+ "grep" + accessors
+
+
+ ticket has unresolved dependencies
+ by type"
+
+ set status
+
+
+ find users
+ get watchers by type
+
+
+ add correspondence
+ takes a ticket id
+ might take a template
+ might take a block of text
+
+ add comment
+ see "add correspondence"
+
+ find tickets
+
+ call other lambda by name?
+
+ run rule action:
+ notify "set of people" with template "template"
+
+
+ "send email"
+ to
+ cc
+ bcc
+ subject
+ body
+ attachments
+ template
+ extra headers
+ encryption
+
+ create a ticket
+
+
+
+accessors "for everything"
diff --git a/lib/RT/View/RuleBuilder.pm b/lib/RT/View/RuleBuilder.pm
index 1adfc13..d00fb7f 100644
--- a/lib/RT/View/RuleBuilder.pm
+++ b/lib/RT/View/RuleBuilder.pm
@@ -7,13 +7,15 @@ use Jifty::View::Declare -base;
template 'index.html' => page {
title => "rule",
} content {
- h1 { "to build a rule" };
+ h1 { "Rule Builder"};
# given transaction :: RT::Model::Transaction
# ticket :: RT::Model::Ticket
# expect Bool
+ div { { id is 'expression-filter'};
input { { id is 'type-filter-type', type is 'text' } };
input { { id is 'type-filter', type is 'button', value is 'filter' } };
input { { id is 'type-unfilter', type is 'button', value is 'unfilter' } };
+ }
div { { id is 'expressionbuilder' } };
input { { id is 'add-expression', type is 'button', value is 'Add Expression' } };
outs_raw('<script type="text/javascript">
diff --git a/share/web/static/css/rulebuilder.css b/share/web/static/css/rulebuilder.css
index 5bc0fed..bf945e7 100644
--- a/share/web/static/css/rulebuilder.css
+++ b/share/web/static/css/rulebuilder.css
@@ -4,15 +4,89 @@ div.expression span.type {
color:#555555;
font-style:italic;
}
-
div.application-params span.param-placeholder,
div.function span.return-type {
background-color:lightBlue;
border:2px solid blue;
+
}
-div.application-params span.param-placeholder {
- background-color:pink;
- border:1px solid red;
+.signature .parameter {
+ border: 1px solid red;
+}
+
+.expression .type {
+ background-color: lightGreen;
+ border: 2px solid green;
+}
+
+.signature .parameter {
+ background-color: lightGreen;
+ border: 2px solid green;
+}
+
+div.application-params span.param-placeholder,
+div.function span.return-type,
+.signature .parameter,
+.expression .type {
+ font-size: 0.8em;
+ display: inline-block;
+ text-align: left;
+ padding: 0.25em;
+ padding-left: 0.5em;
+ margin-right: 0.5em;
+ width: 8em;
+ overflow: hidden;
+}
+
+
+div#body {
+ margin-left: 1em;
+
+}
+
+#expression-filter input[type=text] {
+ display: block;
+}
+
+#expressionbuilder {
+}
+.application {
+ position: relative;
+ top: -7em;
+ left: 20em;
+
+}
+
+.library {
+ position: relative;
+ top: -5em;
+ left: 1em;
+ width: 15em;
+ padding: 0.5em;
+ background: #ccc;
+ -moz-border-radius: 0.5em;
+
+}
+
+
+div.application-params span.param {
padding:0.5em;
+ background: lightGreen;
+ border 1px solid green;
+
+}
+
+div.application-params span.param-placeholder,
+.application-params .param{
+ background-color: #fcc;
+ border:1px solid red;
+}
+
+div.application-params span.param-placeholder.current {
+ background: #f99;
+}
+
+.signature {
+ padding-left: 2em;
}
diff --git a/share/web/static/js/rulebuilder.js b/share/web/static/js/rulebuilder.js
index f62a3fd..0eee9cf 100644
--- a/share/web/static/js/rulebuilder.js
+++ b/share/web/static/js/rulebuilder.js
@@ -35,20 +35,22 @@ RuleBuilder.prototype.init = function () {
jQuery._div({'class': 'application'})
._h3_().text("New Expression")
- ._div_({'class': 'application-function'})
- ._div_({'class': 'application-params'})
+ ._div_({'class': 'application-function function'})
+ ._div_({'class': 'application-params signature'})
.div_()
.appendTo(ebuilder);
- jQuery("#add-expression").appendTo(ebuilder);
+ jQuery("#add-expression")
+ .appendTo(jQuery(".application"));
- ebuilder.append('<h3>Functions</h3>');
- ebuilder.append('<div class="functions">');
+ ebuilder.append('<div class="functions">');
+ functions_div = jQuery('.functions');
+ functions_div.append('<h3>Functions</h3>');
jQuery.each(this.functions,
function(key, val) {
- ebuilder.append('<div class="function ret_'+val.return_type+'"><span class="function-name">'+key+'</span> <span class="return-type">'+val.return_type+'</span></div>');
+ functions_div.append('<div class="function ret_'+val.return_type+'"> <span class="return-type">'+val.return_type+'</span> <span class="function-name">'+key+'</span>'+render_signature(val.parameters).html() +'</div>');
});
- ebuilder.append('</div>');
+
this.update_expressions();
@@ -59,6 +61,23 @@ RuleBuilder.prototype.init = function () {
that.update_application();
});
// jQuery(this.sel+' div.application').hide();
+ function render_signature(sig) {
+ var content = jQuery._span_({'class': 'outer node we should not need but createdomnodes is broken'});
+ if (!sig)
+ return content.append()._div_({ 'class': 'signature empty'});
+
+ var innercontent = content.append()._div_({ 'class': 'signature'});
+
+ jQuery.map(sig,
+ function (item) {
+ name = item.name;
+ type = item.type;
+ innercontent.append(content._div({class: 'parameter'})._span_({ 'class': 'name'}).text(name)
+ ._span_({ 'class': 'type'}).text(type).div_());
+
+ });
+ return content;
+ }
};
RuleBuilder.prototype.update_expressions = function() {
@@ -78,8 +97,8 @@ RuleBuilder.prototype.update_expressions = function() {
jQuery.each(this.expressions,
function(idx, val) {
jQuery._div({'class': 'expression ret_'+val.type})
- ._span_({ 'class': 'expression-text' }).text(val.expression)
._span_({ 'class': 'type' }).text(val.type)
+ ._span_({ 'class': 'expression-text' }).text(val.expression)
.div_().click(function(e) {
if (that.current_application_param != null) {
if (val.type !=
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list