Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

c

  • Loading branch information...
commit ed71ede8981d53874ddc388a93295f4d69a9cf0b 1 parent d2e44a3
f-marais authored
11 lib/Schema/Result/StmListVw.pm
@@ -8,19 +8,22 @@ __PACKAGE__->table('entdet_vw');
8 8 __PACKAGE__->result_source_instance->is_virtual(1);
9 9 __PACKAGE__->result_source_instance->view_definition(
10 10 qq{
11   -select c.name em_nm,b.name tgt_ent_nm,a.name tgt_itm_nm,
  11 +select c.name em_nm,b.name tgt_ent_nm,b.type tgt_ent_type,
  12 + a.name tgt_itm_nm,
12 13 a.type tgt_itm_type, a.precision tgt_itm_precision,
13 14 a.scale tgt_itm_scale, a.bus_rule,
14 15 ifnull(f.src_itm_nm,' ') src_itm_nm,
15 16 ifnull(f.src_itm_type,' ') src_itm_type,
16 17 ifnull(f.src_itm_precision,' ') src_itm_precision,
17 18 ifnull(f.src_ent_nm,' ') src_ent_nm,
  19 + ifnull(f.src_ent_type,' ') src_ent_type,
18 20 a.deflt, a.seq
19 21 from item a join entity b on a.et_id=b.et_id
20 22 join entity_master c on b.em_id=c.em_id
21   - join (select c.tgt_id,d.name src_itm_nm,
  23 + left join (select c.tgt_id,d.name src_itm_nm,
22 24 d.type src_itm_type, d.precision src_itm_precision,
23   - e.name src_ent_nm,d.seq src_seq
  25 + e.name src_ent_nm,e.type src_ent_type,
  26 + d.seq src_seq
24 27 from i2i c, item d, entity e
25 28 where c.src_id=d.it_id and d.et_id=e.et_id) f
26 29 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,
31 34 __PACKAGE__->add_columns(
32 35 'em_nm' => { is_numeric=>0,data_type => 'varchar', },
33 36 'tgt_ent_nm' => { is_numeric=>0,data_type => 'varchar', },
  37 +'tgt_ent_type' => { is_numeric=>0,data_type => 'varchar', },
34 38 'tgt_itm_nm' => { is_numeric=>0,data_type => 'varchar', },
35 39 'tgt_itm_type' => { is_numeric=>0,data_type => 'varchar', },
36 40 'tgt_itm_precision' => { is_numeric=>1,data_type => 'integer', },
@@ -40,6 +44,7 @@ __PACKAGE__->add_columns(
40 44 'src_itm_type' => { is_numeric=>0,data_type => 'varchar', },
41 45 'src_itm_precision' => { is_numeric=>1,data_type => 'integer', },
42 46 'src_ent_nm' => { is_numeric=>0,data_type => 'varchar', },
  47 +'src_ent_type' => { is_numeric=>0,data_type => 'varchar', },
43 48 'deflt' => { is_numeric=>0,data_type => 'varchar', },
44 49 );
45 50 1;
13 mojo/templates/entdet.html.ep
@@ -4,7 +4,14 @@
4 4 % { 'me.name' => param('ent'),
5 5 % 'em.name' => param('em') },{
6 6 % join=> 'em',
7   -% columns => [qw(name scope type description )]});
8   -<%= include 'showrs', partial => 1,
9   - title => 'Entity', rs=> $rs, chk_blanks => 0, url => {} %>
  7 +% columns => [qw(scope type description )]});
  8 +% my $row=$rs->next;
  9 +<H3>STM: <%= param('em') %> Entity: <%= param('ent') %></H3>
  10 +<br><table class="Grid">
  11 +<tr><th class="th" FILTER=ALL align=left>Attribute</th>
  12 +<th class="th" FILTER=ALL align=left>Value</th></tr>
  13 +<tr><td>Scope</td><td><%= $row->scope %></td></tr>
  14 +<tr><td>Type</td><td><%= $row->type %></td></tr>
  15 +<tr><td>Description</td><td><%= $row->description %></td></tr>
  16 +</table>
10 17 <br>
114 mojo/templates/search.html.ep
@@ -7,49 +7,91 @@
7 7 % end
8 8 <!--a href= <= $self->url_for('assets/smart2.xls') > >smart</a-->
9 9 % if (param('match')) {
10   -% my $match=param('match');
11   -<H3>Entities</H3>
12   -% {
  10 +% (my $match=param('match'))=~s/(.*)/\U$1/g;
13 11 % my $em_rs = $self->app->schema->resultset('EntityMaster')->search(
14 12 % {max_version => 1});
  13 +% my (%ent,%itm,%bus_rule);
15 14 % while (my $em=$em_rs->next) {
16   -<H3><%= $em->name %></H3>
17 15 % my $rs = $self->app->schema->resultset('StmListVw')->search(
18   -% \[ 'em_nm=? AND (tgt_ent_nm like ? OR src_ent_nm like ?) ',
  16 +% \[ q{ em_nm=? AND (upper(tgt_ent_nm) like ?
  17 +% OR upper(src_ent_nm) like ?
  18 +% OR upper(src_itm_nm) like ?
  19 +% OR upper(tgt_itm_nm) like ?
  20 +% OR upper(bus_rule) like ?) },
19 21 % [ 'em_nm', $em->name ],
20   -% [ 'tgt_ent_nm', '%' . param('match') . '%' ],
21   -% [ 'src_ent_nm', '%' . param('match') . '%' ], ],
22   -% { columns => [qw(tgt_ent_nm src_ent_nm )],
  22 +% [ 'tgt_ent_nm', '%' . $match . '%' ],
  23 +% [ 'src_ent_nm', '%' . $match . '%' ],
  24 +% [ 'src_itm_nm', '%' . $match . '%' ],
  25 +% [ 'tgt_itm_nm', '%' . $match . '%' ],
  26 +% [ 'bus_rule', '%' . $match . '%' ],
  27 +% ],
  28 +% { columns => [qw(tgt_ent_nm src_ent_nm
  29 +% tgt_itm_nm bus_rule src_itm_nm tgt_ent_type src_ent_type)],
23 30 % distinct => 1});
24   -<%= include 'showrs', partial => 1,
25   - title => 'Entity', rs=> $rs, chk_blanks => 0 ,
26   - url => {src_ent_nm => '/stmlist?em='
27   - . $em->name . '&tgt=tgt_ent_nm&src=src_ent_nm',
28   - tgt_ent_nm => '/stmlist?em='
29   - . $em->name . '&tgt=tgt_ent_nm'}
30   -%>
  31 +% while (my $row = $rs->next) {
  32 +% if ($row->tgt_ent_nm =~/$match/i) {
  33 +% $ent{$em->name}{$row->tgt_ent_nm}{tgt}=1;
  34 +% $ent{$em->name}{$row->tgt_ent_nm}{type}=$row->tgt_ent_type;
  35 +% if ($row->src_ent_nm) {
  36 +% $ent{$em->name}{$row->tgt_ent_nm}{realtgt}=1;
  37 +% }
  38 +% }
  39 +% if ($row->tgt_itm_nm =~/$match/i) {
  40 +% $itm{$em->name}{$row->tgt_itm_nm}{$row->tgt_ent_nm}{tgt}=1;
  41 +% }
  42 +% if ($row->src_itm_nm =~/$match/i) {
  43 +% $itm{$em->name}{$row->src_itm_nm}{$row->src_ent_nm}{src}=1;
  44 +% }
  45 +%# if ($row->bus_rule =~/$match/ims) {
  46 +%# $itm{$em->name}{$row->bus_rule}
  47 +%# {$row->tgt_ent_nm}{$row->tgt_itm_nm}=1;
  48 +%# }
  49 +% if ($row->src_ent_nm && $row->src_ent_nm =~/$match/i) {
  50 +% $ent{$em->name}{$row->src_ent_nm}{src}=1;
  51 +% $ent{$em->name}{$row->src_ent_nm}{type}=$row->src_ent_type;
  52 +% }
  53 +% }
  54 +% }
  55 +<H3>Entities</H3>
  56 +% for my $em_nm (sort keys %ent) {
  57 +<H3><%= $em_nm %></H3> <table><tr>
  58 +<th class="th" FILTER=ALL align=left> Entity </th>
  59 +<th class="th" FILTER=ALL align=left> Type </th>
  60 +<th class="th" FILTER=ALL align=left> </th>
  61 +<th class="th" FILTER=ALL align=left> </th>
  62 +<th class="th" FILTER=ALL align=left> </th></tr>
  63 +% for my $ent_nm (sort keys %{$ent{$em_nm}}){
  64 +<tr><td><%= $ent_nm %></td>
  65 +<td><%= $ent{$em_nm}{$ent_nm}{type} %></td>
  66 +<td><%== $ent{$em_nm}{$ent_nm}{tgt} && $ent{$em_nm}{$ent_nm}{realtgt}
  67 + ? '<a href=' . url_for('/stmlist?em='
  68 + . $em_nm . '&tgt=' . $ent_nm) . '>Target</a>' : '' %></td>
  69 +<td><%== $ent{$em_nm}{$ent_nm}{src} ? '<a href=' . url_for('/stmlist?em='
  70 + . $em_nm . '&src=' . $ent_nm) . '>Source</a>' : '' %></td>
  71 +<td><a href= <%== url_for('/entdet?em=' . $em_nm . '&ent=' . $ent_nm) %> >
  72 +Attributes</a></td></tr>
  73 +% }
  74 +</table>
31 75 % }
32   -<br>
33 76 <H3>Items</H3>
  77 +% for my $em_nm (sort keys %itm) {
  78 +<H3><%= $em_nm %></H3> <table><tr>
  79 +<th class="th" FILTER=ALL align=left> Entity </th>
  80 +<th class="th" FILTER=ALL align=left> Item </th>
  81 +<th class="th" FILTER=ALL align=left> </th>
  82 +<th class="th" FILTER=ALL align=left> </th></tr>
  83 +% for my $itm_nm (sort keys %{$itm{$em_nm}}){
  84 +% for my $ent_nm (sort keys %{$itm{$em_nm}{$itm_nm}}){
  85 +% my $itm_att=$itm{$em_nm}{$itm_nm}{$ent_nm};
  86 +<tr><td><%= $itm_nm %></td><td><%= $ent_nm %></td>
  87 +<td><%== exists $itm_att->{tgt} ? '<a href=' . url_for('/stmlist?em='
  88 + . $em_nm . '&tgt=' . $ent_nm) . '>Target</a>' : '' %></td>
  89 +<td><%== exists $itm_att->{src} ? '<a href=' . url_for('/stmlist?em='
  90 + . $em_nm . '&src=' . $ent_nm) . '>Source</a>' : '' %></td>
  91 +</tr>
  92 +% }
  93 +% }
  94 +</table>
  95 +% }
34 96 % }
35   -% {
36   -% my $em_rs = $self->app->schema->resultset('EntityMaster')->search(
37   -% {max_version => 1});
38   -% while (my $em=$em_rs->next) {
39   -<H3><%= $em->name %></H3>
40   -% my $rs = $self->app->schema->resultset('StmListVw')->search(
41   -% \[ 'tgt_itm_nm like ? OR src_itm_nm like ? ',
42   -% [ 'em_nm', $em->name ],
43   -% [ 'tgt_itm_nm', '%' . param('match') . '%' ],
44   -% [ 'src_itm_nm', '%' . param('match') . '%' ], ],
45   -% { columns => [qw(tgt_ent_nm tgt_itm_nm src_itm_nm src_ent_nm )],
46   -% distinct => 1});
47   -<%= include 'showrs', partial => 1,
48   - title => 'Item', rs=> $rs, chk_blanks => 0 ,
49   - url => { src_itm_nm => '/itmdet?tgt=tgt_itm_nm&src=src_itm_nm',
50   - src_ent_nm => '/stmlist?tgt=tgt_ent_nm&src=src_ent_nm'}
51   -%>
52   -% }
53   -% }
54   -% }
55 97 <br>
14 mojo/templates/showrs.html.ep
... ... @@ -1,6 +1,4 @@
1 1 % use Data::Dumper;
2   -% my %urlfor= ('tgt_ent_nm'=> '/stmlist?tgt=tgt_ent_nm',
3   -% 'src_ent_nm'=>'/stmlist?src=src_ent_nm');
4 2 % $Data::Dumper::Indent=1;
5 3 <style>
6 4 .th { font-family:"ARIAL"; font-size: 8pt; font-style:"BOLD"; mso-number-format: "\@" }
@@ -53,20 +51,14 @@
53 51 % my $ul=$url->{$col};
54 52 % $ul=~s/$_/$row->$_/eg for @cols;
55 53 % $ul=url_for $ul;
56   -% $cel = '<a href=' . $ul . q{>} . $row->$col . '</a>';
57   -% } elsif (exists $urlfor{$col} && defined $urlfor{$col} ) {
58   -% my $ul=$urlfor{$col};
59   -% $ul=~s/$col/$row->$col/eg;
60   -% $ul=url_for $ul;
61   -% $cel = '<a href=' . $ul . '>' . $row->$col . '</a>';
62   -% }
  54 +% $cel = '<a href=' . $ul . q{>} . $row->$col . '</a>';
  55 +% }
63 56 % else { $cel=$row->$col }
64 57 % if ($rs->result_source->column_info($col)->{is_numeric}) {
65 58 <td align=right> <%= $cel %> </td>
66 59 % }
67 60 % else {
68   -% if ((exists $urlfor{$col} && defined $urlfor{$col})
69   -% || (exists $url->{$col} && defined $url->{$col})) {
  61 +% if (exists $url->{$col} && defined $url->{$col}) {
70 62 <td align=left > <%== $cel %> </td>
71 63 % } else {
72 64 <td align=left > <%= $cel %> </td>
26 mojo/templates/stmlist.html.ep
@@ -6,34 +6,24 @@
6 6 <H3> <%= (param('tgt') ? 'Target:' . param('tgt')
7 7 : ' ') . (param('src') ? 'Source:' . param('src') : ' ') %></H3>
8 8 % if (param('src')) {
9   -% if (param('tgt')) {
10 9 <br><%= param('src') %><a href=<%= $self->url_for('/stmlist?em='
11   - . param('em') . '&src=' . param('src')) %>> as Source</a>
12   -% $rs = $self->app->schema->resultset('StmListVw')->search(
13   -% { 'tgt_ent_nm' => param('tgt'),
14   -% 'em_nm' => param('em'),
15   -% 'src_ent_nm' => param('src') },{
16   -% columns=> [qw(tgt_itm_nm tgt_itm_type tgt_itm_precision
17   -% tgt_itm_scale bus_rule src_itm_nm src_itm_type
18   -% src_itm_precision deflt )] ,
19   -% distinct => 1});
20   -% } else {
21   -<br><a href=<%= $self->url_for('/stmlist?em=' . param('em') . '&tgt='
22   - . param('src')) %>>Show <%= param('src') %> as Target</a>
  10 + . param('em') . '&tgt=' . param('src')) %>> as Target</a>
23 11 % $rs = $self->app->schema->resultset('StmListVw')->search(
24 12 % { 'src_ent_nm' => param('src') ,
25 13 % 'em_nm' => param('em') },{
26 14 % columns=> [qw(tgt_ent_nm tgt_itm_nm tgt_itm_type
27 15 % tgt_itm_precision tgt_itm_scale bus_rule src_itm_nm
28 16 % src_itm_type src_itm_precision deflt)],distinct => 1});
  17 +<%= include 'showrs', partial => 1, rs=> $rs, chk_blanks => 0 ,
  18 +url => {tgt_ent_nm => '/stmlist?em=' . param('em') . '&tgt=tgt_ent_nm'} %>
29 19 % }
30   -<%= include 'showrs', partial => 1, rs=> $rs, chk_blanks => 0 , url => {} %>
31   -% } else {
32   -<br><a href=<%= $self->url_for('/stmlist?em=' . param('em') . '&src='
33   - . param('tgt')) %>>Show <%= param('tgt') %> as Source</a>
  20 +% else {
  21 +<br><%= param('tgt') %><a href=<%= $self->url_for('/stmlist?em='
  22 + . param('em') . '&src=' . param('tgt')) %>> as Source</a>
34 23 % $rs = $self->app->schema->resultset('StmListVw')->search(
35 24 % { 'tgt_ent_nm' => param('tgt'), 'em_nm' => param('em') },
36 25 % {columns=> $cols, order_by => 'seq',distinct => 1});
37   -<%= include 'showrs', partial => 1, rs=> $rs, chk_blanks => 5 , url => {} %>
  26 +<%= include 'showrs', partial => 1, rs=> $rs, chk_blanks => 5 ,
  27 + url => {src_ent_nm => '/stmlist?em=' . param('em') . '&src=src_ent_nm'} %>
38 28 % }
39 29 <br>

0 comments on commit ed71ede

Please sign in to comment.
Something went wrong with that request. Please try again.