/[A3C]/lib/A3C/View/Strix.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/A3C/View/Strix.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 217 by dpavlin, Fri Jun 20 22:37:33 2008 UTC revision 242 by dpavlin, Wed Oct 1 20:22:22 2008 UTC
# Line 45  template 'index.html' => page { Line 45  template 'index.html' => page {
45    
46  };  };
47    
48  =head2 name_diff  =head2 errors
49    
50  =cut  =cut
51    
52  template 'name_diff' => page {  template 'errors' => page {
53    
54          title is _('Strix name differences');          title is _('Strix errors');
55    
56          render_region(          render_region(
57                  name => 'selected-instances',                  name => 'selected-instances',
58                  path => '/strix/selected-instances'                  path => '/strix/selected-instances'
59          );          );
60    
61            h2 { _('Name differences') }
62    
63          my $name_diff = A3C::SQL->new({ query => qq{          my $name_diff = A3C::SQL->new({ query => qq{
64                  select                  select
65                          instance,hreduorgurl,                          instance,hreduorgurl,
# Line 92  template 'name_diff' => page { Line 94  template 'name_diff' => page {
94    
95  };  };
96    
97    =head2 instances
98    
99    =cut
100    
101    template 'instances' => page {
102    
103            title is _('Strix instances');
104    
105            my $sql = A3C::SQL->new({ query => qq{
106                    select
107                            hrEduOrgUrl, o, l, postalAddress, telephoneNumber, facsimileTelephoneNumber
108                    from strix_instances
109                    join hr_edu_orgs on cn = instance
110                    order by l,o
111            }});
112    
113            if ( $sql->count > 0 ) {
114    
115                    table {
116                            row {
117                                    th { _('hrEduOrgUrl') }
118                                    th { _('o') }
119                                    th { _('l') }
120                                    th { _('postalAddress') }
121                                    th { _('telephoneNumber') }
122                                    th { _('facsimileTelephoneNumber') }
123                            };
124                            while ( my $row = $sql->next ) {
125                                    row {
126                                            cell { outs_raw '<a href="http://' . $row->hrEduOrgUrl . '">' . $row->hrEduOrgUrl . '</a>' }
127                                            cell { $row->o }
128                                            cell { $row->l }
129                                            cell { $row->postalAddress }
130                                            cell { $row->telephoneNumber }
131                                            cell { $row->facsimileTelephoneNumber }
132                                    }
133                            }
134                    }
135    
136                    div { _("Found total of %1 strix instances", $sql->count) }
137    
138            } else {
139                    div { _("Can't find any strix instances") }
140            }
141    
142    };
143    
144  =head2 sql  =head2 sql
145    
146  Execute SQL query on instance  Execute SQL query on instance
# Line 122  sub strix { Line 171  sub strix {
171  sub strix_link {  sub strix_link {
172          my ( $url, $label ) = @_;          my ( $url, $label ) = @_;
173          hyperlink(          hyperlink(
174                  url => 'http://' . get('instance') . '.cms-qa.skole.hr' . $url,                  url => 'http://' . get('instance') . Jifty->config->app('strix')->{domain} . $url,
175                  label => $label || $url,                  label => $label || $url,
176                  target => 'strix',                  target => 'strix',
177          );          );
# Line 158  Execute SQL query on instance Line 207  Execute SQL query on instance
207    
208  template 'execute-sql' => sub {  template 'execute-sql' => sub {
209    
210            my $sql = get('sql') || Jifty->web->session->get('sql');
211            warn ">>>> sql = $sql";
212            my $instance = get('instance');
213            warn ">>>> instance = $instance";
214    
215          my $action = new_action(          my $action = new_action(
216                  class   => 'StrixSQL',                  class   => 'StrixSQL',
217                  moniker => 'strix-sql',                  moniker => 'strix-sql',
218                  sticky_on_success => 1,                  sticky_on_success => 1,
219                  sticky_on_failure => 1,                  sticky_on_failure => 1,
220                  arguments => {                  arguments => {
221                          instance => get('instance')                          instance => $instance,
222                  }                          sql => $sql,
223                    },
224          );          );
225    
226          form {          form {
227                  render_action( $action => [ 'instance', 'sql' ] );                  render_action( $action, [ 'instance', 'sql' ] );
228                  form_submit( label => _('Execute SQL') );                  form_submit( label => _('Execute SQL') );
229          };          };
230    
231          if ( my $sql = $action->result->content('sql') ) {          if ( my $sql = $action->result->content('sql') ) {
232                  div { _('Found %1 results', $sql->count ) }                  Jifty->web->session->set( sql => $sql->query );
233                    div { _('Found %1 results for %2', $sql->count, $instance ) }
234                  table {                  table {
235                          row { map { th { $_ } } $sql->_column_names };                          row { map { th { $_ } } $sql->_column_names };
236                          while (my $row = $sql->next) {                          while (my $row = $sql->next) {
# Line 186  template 'execute-sql' => sub { Line 242  template 'execute-sql' => sub {
242                          }                          }
243                  }                  }
244          }          }
245            warn ">>>> sql (at end) = ",Jifty->web->session->get('sql');
246  };  };
247    
248  =head2 search-instances  =head2 search-instances

Legend:
Removed from v.217  
changed lines
  Added in v.242

  ViewVC Help
Powered by ViewVC 1.1.26