Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

c

  • Loading branch information...
commit ed71ede8981d53874ddc388a93295f4d69a9cf0b 1 parent d2e44a3
f-marais authored
11 lib/Schema/Result/StmListVw.pm
View
@@ -8,19 +8,22 @@ __PACKAGE__->table('entdet_vw');
__PACKAGE__->result_source_instance->is_virtual(1);
__PACKAGE__->result_source_instance->view_definition(
qq{
-select c.name em_nm,b.name tgt_ent_nm,a.name tgt_itm_nm,
+select c.name em_nm,b.name tgt_ent_nm,b.type tgt_ent_type,
+ a.name tgt_itm_nm,
a.type tgt_itm_type, a.precision tgt_itm_precision,
a.scale tgt_itm_scale, a.bus_rule,
ifnull(f.src_itm_nm,' ') src_itm_nm,
ifnull(f.src_itm_type,' ') src_itm_type,
ifnull(f.src_itm_precision,' ') src_itm_precision,
ifnull(f.src_ent_nm,' ') src_ent_nm,
+ ifnull(f.src_ent_type,' ') src_ent_type,
a.deflt, a.seq
from item a join entity b on a.et_id=b.et_id
join entity_master c on b.em_id=c.em_id
- join (select c.tgt_id,d.name src_itm_nm,
+ left join (select c.tgt_id,d.name src_itm_nm,
d.type src_itm_type, d.precision src_itm_precision,
- e.name src_ent_nm,d.seq src_seq
+ e.name src_ent_nm,e.type src_ent_type,
+ d.seq src_seq
from i2i c, item d, entity e
where c.src_id=d.it_id and d.et_id=e.et_id) f
on a.it_id=f.tgt_id
@@ -31,6 +34,7 @@ select c.name em_nm,b.name tgt_ent_nm,a.name tgt_itm_nm,
__PACKAGE__->add_columns(
'em_nm' => { is_numeric=>0,data_type => 'varchar', },
'tgt_ent_nm' => { is_numeric=>0,data_type => 'varchar', },
+'tgt_ent_type' => { is_numeric=>0,data_type => 'varchar', },
'tgt_itm_nm' => { is_numeric=>0,data_type => 'varchar', },
'tgt_itm_type' => { is_numeric=>0,data_type => 'varchar', },
'tgt_itm_precision' => { is_numeric=>1,data_type => 'integer', },
@@ -40,6 +44,7 @@ __PACKAGE__->add_columns(
'src_itm_type' => { is_numeric=>0,data_type => 'varchar', },
'src_itm_precision' => { is_numeric=>1,data_type => 'integer', },
'src_ent_nm' => { is_numeric=>0,data_type => 'varchar', },
+'src_ent_type' => { is_numeric=>0,data_type => 'varchar', },
'deflt' => { is_numeric=>0,data_type => 'varchar', },
);
1;
13 mojo/templates/entdet.html.ep
View
@@ -4,7 +4,14 @@
% { 'me.name' => param('ent'),
% 'em.name' => param('em') },{
% join=> 'em',
-% columns => [qw(name scope type description )]});
-<%= include 'showrs', partial => 1,
- title => 'Entity', rs=> $rs, chk_blanks => 0, url => {} %>
+% columns => [qw(scope type description )]});
+% my $row=$rs->next;
+<H3>STM: <%= param('em') %> Entity: <%= param('ent') %></H3>
+<br><table class="Grid">
+<tr><th class="th" FILTER=ALL align=left>Attribute</th>
+<th class="th" FILTER=ALL align=left>Value</th></tr>
+<tr><td>Scope</td><td><%= $row->scope %></td></tr>
+<tr><td>Type</td><td><%= $row->type %></td></tr>
+<tr><td>Description</td><td><%= $row->description %></td></tr>
+</table>
<br>
114 mojo/templates/search.html.ep
View
@@ -7,49 +7,91 @@
% end
<!--a href= <= $self->url_for('assets/smart2.xls') > >smart</a-->
% if (param('match')) {
-% my $match=param('match');
-<H3>Entities</H3>
-% {
+% (my $match=param('match'))=~s/(.*)/\U$1/g;
% my $em_rs = $self->app->schema->resultset('EntityMaster')->search(
% {max_version => 1});
+% my (%ent,%itm,%bus_rule);
% while (my $em=$em_rs->next) {
-<H3><%= $em->name %></H3>
% my $rs = $self->app->schema->resultset('StmListVw')->search(
-% \[ 'em_nm=? AND (tgt_ent_nm like ? OR src_ent_nm like ?) ',
+% \[ q{ em_nm=? AND (upper(tgt_ent_nm) like ?
+% OR upper(src_ent_nm) like ?
+% OR upper(src_itm_nm) like ?
+% OR upper(tgt_itm_nm) like ?
+% OR upper(bus_rule) like ?) },
% [ 'em_nm', $em->name ],
-% [ 'tgt_ent_nm', '%' . param('match') . '%' ],
-% [ 'src_ent_nm', '%' . param('match') . '%' ], ],
-% { columns => [qw(tgt_ent_nm src_ent_nm )],
+% [ 'tgt_ent_nm', '%' . $match . '%' ],
+% [ 'src_ent_nm', '%' . $match . '%' ],
+% [ 'src_itm_nm', '%' . $match . '%' ],
+% [ 'tgt_itm_nm', '%' . $match . '%' ],
+% [ 'bus_rule', '%' . $match . '%' ],
+% ],
+% { columns => [qw(tgt_ent_nm src_ent_nm
+% tgt_itm_nm bus_rule src_itm_nm tgt_ent_type src_ent_type)],
% distinct => 1});
-<%= include 'showrs', partial => 1,
- title => 'Entity', rs=> $rs, chk_blanks => 0 ,
- url => {src_ent_nm => '/stmlist?em='
- . $em->name . '&tgt=tgt_ent_nm&src=src_ent_nm',
- tgt_ent_nm => '/stmlist?em='
- . $em->name . '&tgt=tgt_ent_nm'}
-%>
+% while (my $row = $rs->next) {
+% if ($row->tgt_ent_nm =~/$match/i) {
+% $ent{$em->name}{$row->tgt_ent_nm}{tgt}=1;
+% $ent{$em->name}{$row->tgt_ent_nm}{type}=$row->tgt_ent_type;
+% if ($row->src_ent_nm) {
+% $ent{$em->name}{$row->tgt_ent_nm}{realtgt}=1;
+% }
+% }
+% if ($row->tgt_itm_nm =~/$match/i) {
+% $itm{$em->name}{$row->tgt_itm_nm}{$row->tgt_ent_nm}{tgt}=1;
+% }
+% if ($row->src_itm_nm =~/$match/i) {
+% $itm{$em->name}{$row->src_itm_nm}{$row->src_ent_nm}{src}=1;
+% }
+%# if ($row->bus_rule =~/$match/ims) {
+%# $itm{$em->name}{$row->bus_rule}
+%# {$row->tgt_ent_nm}{$row->tgt_itm_nm}=1;
+%# }
+% if ($row->src_ent_nm && $row->src_ent_nm =~/$match/i) {
+% $ent{$em->name}{$row->src_ent_nm}{src}=1;
+% $ent{$em->name}{$row->src_ent_nm}{type}=$row->src_ent_type;
+% }
+% }
+% }
+<H3>Entities</H3>
+% for my $em_nm (sort keys %ent) {
+<H3><%= $em_nm %></H3> <table><tr>
+<th class="th" FILTER=ALL align=left> Entity </th>
+<th class="th" FILTER=ALL align=left> Type </th>
+<th class="th" FILTER=ALL align=left> </th>
+<th class="th" FILTER=ALL align=left> </th>
+<th class="th" FILTER=ALL align=left> </th></tr>
+% for my $ent_nm (sort keys %{$ent{$em_nm}}){
+<tr><td><%= $ent_nm %></td>
+<td><%= $ent{$em_nm}{$ent_nm}{type} %></td>
+<td><%== $ent{$em_nm}{$ent_nm}{tgt} && $ent{$em_nm}{$ent_nm}{realtgt}
+ ? '<a href=' . url_for('/stmlist?em='
+ . $em_nm . '&tgt=' . $ent_nm) . '>Target</a>' : '' %></td>
+<td><%== $ent{$em_nm}{$ent_nm}{src} ? '<a href=' . url_for('/stmlist?em='
+ . $em_nm . '&src=' . $ent_nm) . '>Source</a>' : '' %></td>
+<td><a href= <%== url_for('/entdet?em=' . $em_nm . '&ent=' . $ent_nm) %> >
+Attributes</a></td></tr>
+% }
+</table>
% }
-<br>
<H3>Items</H3>
+% for my $em_nm (sort keys %itm) {
+<H3><%= $em_nm %></H3> <table><tr>
+<th class="th" FILTER=ALL align=left> Entity </th>
+<th class="th" FILTER=ALL align=left> Item </th>
+<th class="th" FILTER=ALL align=left> </th>
+<th class="th" FILTER=ALL align=left> </th></tr>
+% for my $itm_nm (sort keys %{$itm{$em_nm}}){
+% for my $ent_nm (sort keys %{$itm{$em_nm}{$itm_nm}}){
+% my $itm_att=$itm{$em_nm}{$itm_nm}{$ent_nm};
+<tr><td><%= $itm_nm %></td><td><%= $ent_nm %></td>
+<td><%== exists $itm_att->{tgt} ? '<a href=' . url_for('/stmlist?em='
+ . $em_nm . '&tgt=' . $ent_nm) . '>Target</a>' : '' %></td>
+<td><%== exists $itm_att->{src} ? '<a href=' . url_for('/stmlist?em='
+ . $em_nm . '&src=' . $ent_nm) . '>Source</a>' : '' %></td>
+</tr>
+% }
+% }
+</table>
+% }
% }
-% {
-% my $em_rs = $self->app->schema->resultset('EntityMaster')->search(
-% {max_version => 1});
-% while (my $em=$em_rs->next) {
-<H3><%= $em->name %></H3>
-% my $rs = $self->app->schema->resultset('StmListVw')->search(
-% \[ 'tgt_itm_nm like ? OR src_itm_nm like ? ',
-% [ 'em_nm', $em->name ],
-% [ 'tgt_itm_nm', '%' . param('match') . '%' ],
-% [ 'src_itm_nm', '%' . param('match') . '%' ], ],
-% { columns => [qw(tgt_ent_nm tgt_itm_nm src_itm_nm src_ent_nm )],
-% distinct => 1});
-<%= include 'showrs', partial => 1,
- title => 'Item', rs=> $rs, chk_blanks => 0 ,
- url => { src_itm_nm => '/itmdet?tgt=tgt_itm_nm&src=src_itm_nm',
- src_ent_nm => '/stmlist?tgt=tgt_ent_nm&src=src_ent_nm'}
-%>
-% }
-% }
-% }
<br>
14 mojo/templates/showrs.html.ep
View
@@ -1,6 +1,4 @@
% use Data::Dumper;
-% my %urlfor= ('tgt_ent_nm'=> '/stmlist?tgt=tgt_ent_nm',
-% 'src_ent_nm'=>'/stmlist?src=src_ent_nm');
% $Data::Dumper::Indent=1;
<style>
.th { font-family:"ARIAL"; font-size: 8pt; font-style:"BOLD"; mso-number-format: "\@" }
@@ -53,20 +51,14 @@
% my $ul=$url->{$col};
% $ul=~s/$_/$row->$_/eg for @cols;
% $ul=url_for $ul;
-% $cel = '<a href=' . $ul . q{>} . $row->$col . '</a>';
-% } elsif (exists $urlfor{$col} && defined $urlfor{$col} ) {
-% my $ul=$urlfor{$col};
-% $ul=~s/$col/$row->$col/eg;
-% $ul=url_for $ul;
-% $cel = '<a href=' . $ul . '>' . $row->$col . '</a>';
-% }
+% $cel = '<a href=' . $ul . q{>} . $row->$col . '</a>';
+% }
% else { $cel=$row->$col }
% if ($rs->result_source->column_info($col)->{is_numeric}) {
<td align=right> <%= $cel %> </td>
% }
% else {
-% if ((exists $urlfor{$col} && defined $urlfor{$col})
-% || (exists $url->{$col} && defined $url->{$col})) {
+% if (exists $url->{$col} && defined $url->{$col}) {
<td align=left > <%== $cel %> </td>
% } else {
<td align=left > <%= $cel %> </td>
26 mojo/templates/stmlist.html.ep
View
@@ -6,34 +6,24 @@
<H3> <%= (param('tgt') ? 'Target:' . param('tgt')
: ' ') . (param('src') ? 'Source:' . param('src') : ' ') %></H3>
% if (param('src')) {
-% if (param('tgt')) {
<br><%= param('src') %><a href=<%= $self->url_for('/stmlist?em='
- . param('em') . '&src=' . param('src')) %>> as Source</a>
-% $rs = $self->app->schema->resultset('StmListVw')->search(
-% { 'tgt_ent_nm' => param('tgt'),
-% 'em_nm' => param('em'),
-% 'src_ent_nm' => param('src') },{
-% columns=> [qw(tgt_itm_nm tgt_itm_type tgt_itm_precision
-% tgt_itm_scale bus_rule src_itm_nm src_itm_type
-% src_itm_precision deflt )] ,
-% distinct => 1});
-% } else {
-<br><a href=<%= $self->url_for('/stmlist?em=' . param('em') . '&tgt='
- . param('src')) %>>Show <%= param('src') %> as Target</a>
+ . param('em') . '&tgt=' . param('src')) %>> as Target</a>
% $rs = $self->app->schema->resultset('StmListVw')->search(
% { 'src_ent_nm' => param('src') ,
% 'em_nm' => param('em') },{
% columns=> [qw(tgt_ent_nm tgt_itm_nm tgt_itm_type
% tgt_itm_precision tgt_itm_scale bus_rule src_itm_nm
% src_itm_type src_itm_precision deflt)],distinct => 1});
+<%= include 'showrs', partial => 1, rs=> $rs, chk_blanks => 0 ,
+url => {tgt_ent_nm => '/stmlist?em=' . param('em') . '&tgt=tgt_ent_nm'} %>
% }
-<%= include 'showrs', partial => 1, rs=> $rs, chk_blanks => 0 , url => {} %>
-% } else {
-<br><a href=<%= $self->url_for('/stmlist?em=' . param('em') . '&src='
- . param('tgt')) %>>Show <%= param('tgt') %> as Source</a>
+% else {
+<br><%= param('tgt') %><a href=<%= $self->url_for('/stmlist?em='
+ . param('em') . '&src=' . param('tgt')) %>> as Source</a>
% $rs = $self->app->schema->resultset('StmListVw')->search(
% { 'tgt_ent_nm' => param('tgt'), 'em_nm' => param('em') },
% {columns=> $cols, order_by => 'seq',distinct => 1});
-<%= include 'showrs', partial => 1, rs=> $rs, chk_blanks => 5 , url => {} %>
+<%= include 'showrs', partial => 1, rs=> $rs, chk_blanks => 5 ,
+ url => {src_ent_nm => '/stmlist?em=' . param('em') . '&src=src_ent_nm'} %>
% }
<br>
Please sign in to comment.
Something went wrong with that request. Please try again.