/[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 161 by dpavlin, Sun Jun 15 16:11:17 2008 UTC revision 172 by dpavlin, Mon Jun 16 13:32:01 2008 UTC
# Line 28  template 'index.html' => page { Line 28  template 'index.html' => page {
28    
29          title is _('Strix sites');          title is _('Strix sites');
30    
31            my $orgs = A3C::Model::StrixSiteCollection->new;
32            $orgs->unlimit;
33    
34            div { _('Number of sites in Strix: %1', $orgs->count ) };
35    
36          render_region(          render_region(
37                  name => 'user-selected-sites',                  name => 'selected-sites',
38                  path => '/strix/selected-sites'                  path => '/strix/selected-sites'
39          );          );
40    
41          render_region(          render_region(
42                  name => 'search_sites',                  name => 'search-sites',
43                  path => '/strix/search_sites',                  path => '/strix/search-sites',
44          );          );
45    
         h1 { _('Statistics') }  
   
         my $orgs = A3C::Model::StrixSiteCollection->new;  
         $orgs->unlimit;  
   
         dt { _('Number of Strix sites') }  
         dd { $orgs->count }  
   
46  };  };
47    
48  =head2 name_diff  =head2 name_diff
# Line 54  template 'index.html' => page { Line 51  template 'index.html' => page {
51    
52  template 'name_diff' => page {  template 'name_diff' => page {
53    
54          title is _('Strix sites | name differences between php config and internal state');          title is _('Strix name differences');
55    
56          my $name_diff = A3C::SQL->new({ query => qq{          my $name_diff = A3C::SQL->new({ query => qq{
57                  select                  select
# Line 65  template 'name_diff' => page { Line 62  template 'name_diff' => page {
62                  where o != _site_name                  where o != _site_name
63          }});          }});
64    
65          h1 { _('Name differences') }          if ( $name_diff->count > 0 ) {
66          dd {  
67                  table {                  table {
68                          row {                          row {
69                                  th { _('Site') }                                  th { _('Site') }
# Line 81  template 'name_diff' => page { Line 78  template 'name_diff' => page {
78                                  }                                  }
79                          }                          }
80                  }                  }
81            
82            } else {
83                    div { _("Can't find any site in strix which has different name than data from LDAP") }
84          }          }
85    
86  };  };
# Line 95  template 'sql' => page { Line 95  template 'sql' => page {
95    
96          title is _('Execute SQL');          title is _('Execute SQL');
97    
98            render_region(
99                    name => 'selected-sites',
100                    path => '/strix/selected-sites'
101            );
102    
103            render_region(
104                    name => 'execute-sql',
105                    path => '/strix/execute-sql',
106            );
107    
108    };
109    
110    =head2 sitemap
111    
112    =cut
113    
114    template 'sitemap' => page {
115    
116            title is _('Sitemap');
117    
118            my $strix = Strix->new({ site => 'new' });
119            my $sitemap = $strix->site_navigation( 1 );
120    
121            sub full_url {
122                    my $p = shift;
123                    hyperlink(
124                            url => 'http://new.cms-qa.skole.hr' . $p->{url},
125                            label => $p->{naziv},
126                    );
127            }
128    
129            sub children {
130                    my $c = shift;
131                    return unless defined $c->{children};
132                    ul {
133                            foreach my $p ( @{ $c->{children} } ) {
134                                    li {
135                                            full_url( $p );
136                                            children( $p );
137                                    }
138                            }
139                    }
140            }
141    
142            ul {
143                    foreach my $p ( @$sitemap ) {
144                            li {
145                                    full_url( $p );
146                                    children( $p );
147                            }
148                    }
149            }
150    
151    };
152    
153    =head1 REGIONS
154    
155    =head2 execute-sql
156    
157    Execute SQL query on site
158    
159    =cut
160    
161    template 'execute-sql' => sub {
162    
163          my $action = new_action(          my $action = new_action(
164                  class   => 'StrixSQL',                  class   => 'StrixSQL',
165                  moniker => 'strix-sql',                  moniker => 'strix-sql',
166                  sticky_on_success => 1,                  sticky_on_success => 1,
167                  sticky_on_failure => 1,                  sticky_on_failure => 1,
168                    arguments => {
169                            strix => get('strix')
170                    }
171          );          );
172    
173          form {          form {
# Line 114  template 'sql' => page { Line 182  template 'sql' => page {
182                          while (my $row = $sql->next) {                          while (my $row = $sql->next) {
183                                  row {                                  row {
184                                          foreach my $col ( $sql->_column_names ) {                                          foreach my $col ( $sql->_column_names ) {
                                                 warn "++ $col\n";  
185                                                  cell { $row->$col }                                                  cell { $row->$col }
186                                          }                                          }
187                                  }                                  }
# Line 123  template 'sql' => page { Line 190  template 'sql' => page {
190          }          }
191  };  };
192    
193  =head1 REGIONS  =head2 search-sites
   
 =head2 search_sites  
194    
195  =cut  =cut
196    
197  template 'search_sites' => sub {  template 'search-sites' => sub {
198    
199          h1 { _('Find site') }          h1 { _('Find site') }
200    
# Line 155  template 'search_sites' => sub { Line 220  template 'search_sites' => sub {
220                                  row {                                  row {
221                                          cell { tt { $strix->site } }                                          cell { tt { $strix->site } }
222                                          cell { $strix->_site_name }                                          cell { $strix->_site_name }
223                                          cell { show( 'site_selection', 'Create', '+', $strix->site ) }                                          cell { show( 'site-op', 'Create', '+', $strix->site ) }
224                                  }                                  }
225                          }                          }
226                  }                  }
# Line 163  template 'search_sites' => sub { Line 228  template 'search_sites' => sub {
228    
229  };  };
230    
231  =head2 selected_sites  =head2 selected-sites
232    
233  Show Selected sites for current user  Show Selected sites for current user
234    
# Line 215  template 'selected-sites' => sub { Line 280  template 'selected-sites' => sub {
280                                  row {                                  row {
281                                          cell { tt { $s->strix->site } }                                          cell { tt { $s->strix->site } }
282                                          cell { $s->strix->_site_name }                                          cell { $s->strix->_site_name }
283                                          cell { show( 'site_selection', 'Delete', '-', $s->strix->site ) }                                          cell { show( 'site-op', 'Delete', '-', $s->strix->site ) }
284                                  }                                  }
285                          }                          }
286                  }                  }
# Line 224  template 'selected-sites' => sub { Line 289  template 'selected-sites' => sub {
289          }          }
290  };  };
291    
292  =head2 site_selection  =head2 site-op
293    
294  Display button to add/remove site from selection  Display button to add/remove site from selection
295    
296    show( 'site_selection', 'Delete', '-', $strix->site );    show( 'site-op', 'Delete', '-', $strix->site );
297    
298  =cut  =cut
299    
300  template 'site_selection' => sub {  template 'site-op' => sub {
301          my $self = shift;          my $self = shift;
302    
303          warn "# site_selection = ",dump( @_ );          warn "# site-op = ",dump( @_ );
304    
305          my ( $op, $label, $site ) = @_;          my ( $op, $label, $site ) = @_;
306    
# Line 243  template 'site_selection' => sub { Line 308  template 'site_selection' => sub {
308                  hyperlink(                  hyperlink(
309                          label => $label,                          label => $label,
310                          onclick => {                          onclick => {
311                                  refresh => 'user-selected-sites',                                  refresh => 'selected-sites',
312                                  path => '/strix/selected-sites',                                  path => '/strix/selected-sites',
313                                  args => {                                  args => {
314                                          site => $site,                                          site => $site,

Legend:
Removed from v.161  
changed lines
  Added in v.172

  ViewVC Help
Powered by ViewVC 1.1.26