--- lib/A3C/View.pm 2008/04/01 19:44:31 57 +++ lib/A3C/View.pm 2008/04/11 23:23:42 79 @@ -5,16 +5,49 @@ use Jifty::View::Declare -base; use A3C::LDAP; +use A3C::SQL; use Data::Dump qw/dump/; +template '/' => page { + + h1 { _('Statistics') } + + my $orgs = A3C::Model::OrganizationCollection->new; + $orgs->unlimit; + + dt { _('Number of schools in system') } + dd { $orgs->count } + + my $people = A3C::Model::PersonCollection->new; + $people->unlimit; + + dt { _('Number of persons in system') } + dd { $people->count } + + my $sql = A3C::SQL->new({ query => qq{ + select count(uid),l + from organizations + inner join towns on towns.name = l + group by l + order by count desc + limit 25 + }}); + + dt { _('Top %1 towns by schools', $sql->count) } + dd { + ul { + while ( my $row = $sql->next ) { + li { outs_raw( $row->count, ' ', $row->l ) } + } + } + } -template '/skole' => page { - h1 { _('Schools in system') }; - show 'skole_sve'; }; -private template 'skole_sve' => sub { + +template 'ldap' => page { + h1 { _('LDAP data about Schools in system') }; my $ldap = A3C::LDAP->new; div { $ldap->search( @@ -36,13 +69,18 @@ } }; -template '/search-users' => page { +template 'people' => page { + + h1 { _('Find people') } my $action = new_action( - class => 'SearchUser', - moniker => 'search-users' + class => 'SearchPerson', + moniker => 'search-users', + sticky_on_success => 1, + sticky_on_failure => 1, ); + form { render_action( $action => [ 'uid_contains', 'cn_contains' ] ); form_submit( label => _('Find someone') ); @@ -64,7 +102,9 @@ }; -template '/sync' => page { +template 'sync' => page { + + h1 { _('Sync school from LDAP') } my $action = new_action( class => 'SyncOrganization',