/[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

Annotation of /lib/A3C/View.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 49 - (hide annotations)
Mon Mar 31 22:00:20 2008 UTC (14 years, 10 months ago) by dpavlin
File size: 1159 byte(s)
simple search through local users (using auto-generated SearchModel action)
1 dpavlin 37 package A3C::View;
2    
3     use strict;
4     use warnings;
5    
6     use Jifty::View::Declare -base;
7     use A3C::LDAP;
8    
9     use Data::Dump qw/dump/;
10    
11    
12     template '/skole' => page {
13     h1 { _('Schools in system') };
14     show 'skole_sve';
15     };
16    
17     private template 'skole_sve' => sub {
18 dpavlin 40 my $ldap = A3C::LDAP->new;
19 dpavlin 37 div {
20 dpavlin 40 $ldap->search(
21 dpavlin 37 base => 'dc=skole,dc=hr',
22     filter => '(objectClass=hrEduOrg)',
23     sizelimit => 10,
24     );
25 dpavlin 41 while ( my $entry = $ldap->current_search->shift_entry ) {
26 dpavlin 37 #warn $entry->dump;
27     ul {
28     foreach my $attr ( $entry->attributes ) {
29     li {
30     tt { $attr }
31 dpavlin 39 span { dump( $entry->get_value( $attr ) ) }
32 dpavlin 37 }
33     }
34     }
35     }
36     }
37     };
38    
39 dpavlin 49 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    

  ViewVC Help
Powered by ViewVC 1.1.26