/[A3C]/lib/A3C/View.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.pm

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

revision 83 by dpavlin, Sat Apr 12 10:29:30 2008 UTC revision 155 by dpavlin, Sat Jun 14 22:04:11 2008 UTC
# Line 13  template '/' => page { Line 13  template '/' => page {
13    
14          h1 { _('Statistics') }          h1 { _('Statistics') }
15    
16          my $orgs = A3C::Model::OrganizationCollection->new;          my $orgs = A3C::Model::hrEduOrgCollection->new;
17          $orgs->unlimit;          $orgs->unlimit;
18    
19          dt { _('Number of schools in system') }          dt { _('Number of schools in system') }
20          dd { $orgs->count }          dd { $orgs->count }
21    
22          my $people = A3C::Model::PersonCollection->new;          my $people = A3C::Model::hrEduPersonCollection->new;
23          $people->unlimit;          $people->unlimit;
24    
25          dt { _('Number of persons in system') }          dt { _('Number of persons in system') }
# Line 27  template '/' => page { Line 27  template '/' => page {
27    
28          my $by_towns = A3C::SQL->new({ query => qq{          my $by_towns = A3C::SQL->new({ query => qq{
29                  select count(uid),l                  select count(uid),l
30                  from organizations                  from hr_edu_orgs
31                  inner join towns on towns.name = l                  inner join towns on towns.name = l
32                  group by l                  group by l
33                  order by count desc                  order by count desc
# Line 48  template '/' => page { Line 48  template '/' => page {
48                          count(uid) as schools,                          count(uid) as schools,
49                          county,                          county,
50                          count(distinct municipality) as municipalities                          count(distinct municipality) as municipalities
51                  from organizations                  from hr_edu_orgs
52                  inner join towns on towns.name = l                  inner join towns on towns.name = l
53                  group by county                  group by county
54                  order by schools desc                  order by schools desc
# Line 100  template 'people' => page { Line 100  template 'people' => page {
100          h1 { _('Find people') }          h1 { _('Find people') }
101    
102          my $action = new_action(          my $action = new_action(
103                  class   => 'SearchPerson',                  class   => 'SearchhrEduPerson',
104                  moniker => 'search-users',                  moniker => 'search-users',
105                  sticky_on_success => 1,                  sticky_on_success => 1,
106                  sticky_on_failure => 1,                  sticky_on_failure => 1,
# Line 109  template 'people' => page { Line 109  template 'people' => page {
109    
110          form {          form {
111                  render_action( $action => [ 'uid_contains', 'cn_contains' ] );                  render_action( $action => [ 'uid_contains', 'cn_contains' ] );
112                  form_submit( label => _('Find someone') );                  form_submit( label => _('Search') );
113          };          };
114    
115  #       warn dump( $action->result->content );  #       warn dump( $action->result->content );
116    
117          if ( my $search = $action->result->content('search') ) {          if ( my $search = $action->result->content('search') ) {
118                  div { sprintf(_('Found %d results'), $search->count ) }                  div { _('Found %1 results', $search->count ) }
119                  ol {                  table {
120                          while (my $user = $search->next) {                          while (my $user = $search->next) {
121                                  li {                                  row {
122                                          span { $user->cn }                                          cell { $user->cn }
123                                          tt { $user->uid }                                          cell { tt { $user->uid } }
124                                            cell { tt { $user->hrEduPersonUniqueID } }
125                                            cell { $user->hrEduPersonHomeOrg }
126                                  }                                  }
127                          }                          }
128                  }                  }
# Line 138  template 'sync' => page { Line 140  template 'sync' => page {
140          );          );
141    
142          form {          form {
143                  render_action( $action => [ 'cn' ] );                  render_action( $action => [ 'org_uid' ] );
144                  form_submit( label => _('Sync Organization') );                  form_submit( label => _('Sync Organization') );
145          };          };
146    
# Line 154  template 'sync' => page { Line 156  template 'sync' => page {
156          }          }
157    
158  };  };
159    
160    # mount other views
161    use A3C::View::Organization;
162    
163    # we can't really use following form because Jifty would upper case first
164    # letter of model and try to find A3C::Model::HrEduOrg which doesn't exit!
165    #Jifty::View::Declare::CRUD->mount_view('hrEduOrg', 'A3C::View::Organization', '/organizations');
166    alias A3C::View::Organization under '/organizations', {
167            object_type => 'hrEduOrg',
168    };
169    
170    use A3C::View::Strix;
171    alias A3C::View::Strix under '/strix';
172    
173    1;

Legend:
Removed from v.83  
changed lines
  Added in v.155

  ViewVC Help
Powered by ViewVC 1.1.26