/[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 37 by dpavlin, Sun Mar 30 02:33:01 2008 UTC revision 71 by dpavlin, Thu Apr 10 21:33:37 2008 UTC
# Line 9  use A3C::LDAP; Line 9  use A3C::LDAP;
9  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
10    
11    
12  template '/skole' => page {  template 'ldap' => page {
13          h1 { _('Schools in system') };          h1 { _('LDAP data about Schools in system') };
14          show 'skole_sve';          my $ldap = A3C::LDAP->new;
 };  
   
 private template 'skole_sve' => sub {  
15          div {          div {
16                  my $search = A3C::LDAP->search(                  $ldap->search(
17                          base    => 'dc=skole,dc=hr',                          base    => 'dc=skole,dc=hr',
18                          filter  => '(objectClass=hrEduOrg)',                          filter  => '(objectClass=hrEduOrg)',
19                          sizelimit => 10,                          sizelimit => 10,
20                  );                  );
21                  while ( my $entry = $search->shift_entry ) {                  while ( my $entry = $ldap->current_search->shift_entry ) {
22                          #warn $entry->dump;                          #warn $entry->dump;
23                          ul {                          ul {
24                                  foreach my $attr ( $entry->attributes ) {                                  foreach my $attr ( $entry->attributes ) {
25                                          li {                                          li {
26                                                  tt { $attr }                                                  tt { $attr }
27                                                  span { dump( $entry->get_value( $attr ) }                                                  span { dump( $entry->get_value( $attr ) ) }
28                                          }                                          }
29                                  }                                  }
30                          }                          }
# Line 35  private template 'skole_sve' => sub { Line 32  private template 'skole_sve' => sub {
32          }          }
33  };  };
34    
35    template 'people' => page {
36            
37            h1 { _('Find people') }
38    
39            my $action = new_action(
40                    class   => 'SearchPerson',
41                    moniker => 'search-users',
42                    sticky_on_success => 1,
43                    sticky_on_failure => 1,
44            );
45    
46    
47            form {
48                    render_action( $action => [ 'uid_contains', 'cn_contains' ] );
49                    form_submit( label => _('Find someone') );
50            };
51    
52    #       warn dump( $action->result->content );
53    
54            if ( my $search = $action->result->content('search') ) {
55                    div { sprintf(_('Found %d results'), $search->count ) }
56                    ol {
57                            while (my $user = $search->next) {
58                                    li {
59                                            span { $user->cn }
60                                            tt { $user->uid }
61                                    }
62                            }
63                    }
64            }
65    
66    };
67    
68    template 'sync' => page {
69    
70            h1 { _('Sync school from LDAP') }
71    
72            my $action = new_action(
73                    class   => 'SyncOrganization',
74                    moniker => 'sync-organization'
75            );
76    
77            form {
78                    render_action( $action => [ 'cn' ] );
79                    form_submit( label => _('Sync Organization') );
80            };
81    
82            if ( my $users = $action->result->content('synced-users') ) {
83                    ol {
84                            while (my $user = $users->next) {
85                                    li {
86                                            span { $user->cn }
87                                            tt { { class is 'email' } '<' . $user->mail . '>' }
88                                    }
89                            }
90                    }
91            }
92    
93    };

Legend:
Removed from v.37  
changed lines
  Added in v.71

  ViewVC Help
Powered by ViewVC 1.1.26