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

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

  ViewVC Help
Powered by ViewVC 1.1.26