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

Contents of /lib/A3C/View.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 71 - (show annotations)
Thu Apr 10 21:33:37 2008 UTC (16 years ago) by dpavlin
File size: 1668 byte(s)
- change URL scheme
- added some desriptions in h1
- make search action sticky, so that search parametars are left in form after submit
1 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 'ldap' => page {
13 h1 { _('LDAP data about Schools in system') };
14 my $ldap = A3C::LDAP->new;
15 div {
16 $ldap->search(
17 base => 'dc=skole,dc=hr',
18 filter => '(objectClass=hrEduOrg)',
19 sizelimit => 10,
20 );
21 while ( my $entry = $ldap->current_search->shift_entry ) {
22 #warn $entry->dump;
23 ul {
24 foreach my $attr ( $entry->attributes ) {
25 li {
26 tt { $attr }
27 span { dump( $entry->get_value( $attr ) ) }
28 }
29 }
30 }
31 }
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 };

  ViewVC Help
Powered by ViewVC 1.1.26