--- lib/A3C/View/Strix.pm 2008/06/15 22:03:02 165 +++ lib/A3C/View/Strix.pm 2008/06/15 22:26:07 166 @@ -28,24 +28,21 @@ title is _('Strix sites'); + my $orgs = A3C::Model::StrixSiteCollection->new; + $orgs->unlimit; + + div { _('Number of sites in Strix: %1', $orgs->count ) }; + render_region( - name => 'user-selected-sites', + name => 'selected-sites', path => '/strix/selected-sites' ); render_region( - name => 'search_sites', - path => '/strix/search_sites', + name => 'search-sites', + path => '/strix/search-sites', ); - h1 { _('Statistics') } - - my $orgs = A3C::Model::StrixSiteCollection->new; - $orgs->unlimit; - - dt { _('Number of Strix sites') } - dd { $orgs->count } - }; =head2 name_diff @@ -54,7 +51,7 @@ template 'name_diff' => page { - title is _('Strix sites | name differences between php config and internal state'); + title is _('Strix name differences'); my $name_diff = A3C::SQL->new({ query => qq{ select @@ -65,8 +62,8 @@ where o != _site_name }}); - h1 { _('Name differences') } - dd { + if ( $name_diff->count > 0 ) { + table { row { th { _('Site') } @@ -81,6 +78,9 @@ } } } + + } else { + div { _("Can't find any site in strix which has different name than data from LDAP") } } }; @@ -95,11 +95,36 @@ title is _('Execute SQL'); + render_region( + name => 'selected-sites', + path => '/strix/selected-sites' + ); + + render_region( + name => 'execute-sql', + path => '/strix/execute-sql', + ); + +}; + +=head1 REGIONS + +=head2 execute-sql + +Execute SQL query on site + +=cut + +template 'execute-sql' => sub { + my $action = new_action( class => 'StrixSQL', moniker => 'strix-sql', sticky_on_success => 1, sticky_on_failure => 1, + arguments => { + strix => get('strix') + } ); form { @@ -114,7 +139,6 @@ while (my $row = $sql->next) { row { foreach my $col ( $sql->_column_names ) { - warn "++ $col\n"; cell { $row->$col } } } @@ -123,13 +147,11 @@ } }; -=head1 REGIONS - -=head2 search_sites +=head2 search-sites =cut -template 'search_sites' => sub { +template 'search-sites' => sub { h1 { _('Find site') } @@ -155,7 +177,7 @@ row { cell { tt { $strix->site } } cell { $strix->_site_name } - cell { show( 'site_selection', 'Create', '+', $strix->site ) } + cell { show( 'site-op', 'Create', '+', $strix->site ) } } } } @@ -163,7 +185,7 @@ }; -=head2 selected_sites +=head2 selected-sites Show Selected sites for current user @@ -215,7 +237,7 @@ row { cell { tt { $s->strix->site } } cell { $s->strix->_site_name } - cell { show( 'site_selection', 'Delete', '-', $s->strix->site ) } + cell { show( 'site-op', 'Delete', '-', $s->strix->site ) } } } } @@ -224,18 +246,18 @@ } }; -=head2 site_selection +=head2 site-op Display button to add/remove site from selection - show( 'site_selection', 'Delete', '-', $strix->site ); + show( 'site-op', 'Delete', '-', $strix->site ); =cut -template 'site_selection' => sub { +template 'site-op' => sub { my $self = shift; - warn "# site_selection = ",dump( @_ ); + warn "# site-op = ",dump( @_ ); my ( $op, $label, $site ) = @_; @@ -243,7 +265,7 @@ hyperlink( label => $label, onclick => { - refresh => 'user-selected-sites', + refresh => 'selected-sites', path => '/strix/selected-sites', args => { site => $site,