/[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 122 by dpavlin, Tue May 20 09:47:59 2008 UTC revision 208 by dpavlin, Thu Jun 19 21:24:26 2008 UTC
# Line 9  use A3C::SQL; Line 9  use A3C::SQL;
9    
10  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
11    
12    private template 'menu' => sub {
13            div {
14                    attr { id => "navigation" };
15                    Jifty->web->navigation->render_as_classical_menu;
16            };
17    };
18    
19    
20  template '/' => page {  template '/' => page {
21    
22          h1 { _('Statistics') }          h1 { _('Statistics') }
# Line 72  template '/' => page { Line 80  template '/' => page {
80  };  };
81    
82    
 template 'ldap' => page {  
         h1 { _('LDAP data about Schools in system') };  
         my $ldap = A3C::LDAP->new;  
         div {  
                 $ldap->search(  
                         base    => 'dc=skole,dc=hr',  
                         filter  => '(objectClass=hrEduOrg)',  
                         sizelimit => 10,  
                 );  
                 while ( my $entry = $ldap->current_search->shift_entry ) {  
                         #warn $entry->dump;  
                         ul {  
                                 foreach my $attr ( $entry->attributes ) {  
                                         li {  
                                                 tt { $attr }  
                                                 span { dump( $entry->get_value( $attr ) ) }  
                                         }  
                                 }  
                         }  
                 }  
         }  
 };  
   
83  template 'people' => page {  template 'people' => page {
84                    
85          h1 { _('Find people') }          h1 { _('Find people') }
# Line 109  template 'people' => page { Line 94  template 'people' => page {
94    
95          form {          form {
96                  render_action( $action => [ 'uid_contains', 'cn_contains' ] );                  render_action( $action => [ 'uid_contains', 'cn_contains' ] );
97                  form_submit( label => _('Find someone') );                  form_submit( label => _('Search') );
98          };          };
99    
100  #       warn dump( $action->result->content );  #       warn dump( $action->result->content );
101    
102          if ( my $search = $action->result->content('search') ) {          if ( my $search = $action->result->content('search') ) {
103                  div { sprintf(_('Found %d results'), $search->count ) }                  div { _('Found %1 results', $search->count ) }
104                  ol {                  table {
105                          while (my $user = $search->next) {                          while (my $user = $search->next) {
106                                  li {                                  row {
107                                          span { $user->cn }                                          cell { $user->cn }
108                                          tt { $user->uid }                                          cell { tt { $user->uid } }
109                                            cell { tt { $user->hrEduPersonUniqueID } }
110                                            cell { $user->hrEduPersonHomeOrg }
111                                  }                                  }
112                          }                          }
113                  }                  }
# Line 128  template 'people' => page { Line 115  template 'people' => page {
115    
116  };  };
117    
118  template 'sync' => page {  # mount other views
119    use A3C::View::Organization;
         h1 { _('Sync school from LDAP') }  
120    
121          my $action = new_action(  # we can't really use following form because Jifty would upper case first
122                  class   => 'SyncOrganization',  # letter of model and try to find A3C::Model::HrEduOrg which doesn't exit!
123                  moniker => 'sync-organization'  #Jifty::View::Declare::CRUD->mount_view('hrEduOrg', 'A3C::View::Organization', '/organizations');
124          );  alias A3C::View::Organization under '/organizations', {
125            object_type => 'hrEduOrg',
126    };
127    
128          form {  use A3C::View::LDAP;
129                  render_action( $action => [ 'org_uid' ] );  alias A3C::View::LDAP under '/ldap';
                 form_submit( label => _('Sync Organization') );  
         };  
130    
131          if ( my $users = $action->result->content('synced-users') ) {  use A3C::View::Strix;
132                  ol {  alias A3C::View::Strix under '/strix';
                         while (my $user = $users->next) {  
                                 li {  
                                         span { $user->cn }  
                                         tt { { class is 'email' } '<' . $user->mail . '>' }  
                                 }  
                         }  
                 }  
         }  
133    
134  };  1;

Legend:
Removed from v.122  
changed lines
  Added in v.208

  ViewVC Help
Powered by ViewVC 1.1.26