Changeset 1939
- Timestamp:
- 01/24/17 16:27:08 (7 years ago)
- Location:
- trunk/LATMOS-Accounts-Web
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Json/Tree.pm
r1484 r1939 29 29 my %users = map { $_ => 1 } $base->search_objects('user', 'active=1', 'givenName=*'); 30 30 my %dpmts = map { $_ => 1 } $base->search_objects('group', 'sutype=dpmt'); 31 my %userdpmt = $base->attributes_summary_by_object('user', 'department');32 31 my %dpmtmanager = $base->attributes_summary_by_object('group', 'managedBy'); 33 32 my %usermanager = $base->attributes_summary_by_object('user', 'managerContact'); 33 my %dpmtuser = $base->attributes_summary_by_object('user', 'department'); 34 34 35 35 my %nodes; … … 40 40 41 41 foreach my $user (keys %users) { 42 my $ouser = $base->get_object('user', $user); 42 43 push(@{ $data->{nodes} }, { 43 "name" => $ user,44 label => $ user,44 "name" => $ouser->id, 45 label => $ouser->get_attributes('displayName'), 45 46 }); 46 $nodes{$ user} = $#{ $data->{nodes} };47 $nodes{$ouser->id} = $#{ $data->{nodes} }; 47 48 } 48 push(@{ $data->{nodes} }, {49 "name" => '-direction',50 label => 'Direction',51 });52 $nodes{'-direction'} = $#{ $data->{nodes} };53 49 54 foreach my $user (keys %dpmts) { 55 push(@{ $data->{nodes} }, { 56 "name" => '-' . $user, 57 label => $user, 58 }); 59 $nodes{'-' . $user} = $#{ $data->{nodes} }; 50 foreach my $user (keys %users) { 51 my $manager = $usermanager{$user}->[0] || 52 $dpmtmanager { $dpmtuser{ $user }->[0] }->[0] or next; 53 54 if (!$nodes{$manager}) { 55 my $ouser = $base->get_object('user', $manager); 56 $nodes{$manager} = $nodes{$ouser->id}; 57 } 58 $nodes{$manager} or next; 59 60 60 push(@{ $data->{links} }, 61 61 { 62 "source" => $nodes{'-' . $user}, 63 "target" => $nodes{'-direction'}, 64 color => 'red', 62 "source" => $nodes{$user}, 63 "target" => $nodes{$manager}, 65 64 } 66 65 ); … … 68 67 } 69 68 70 71 foreach my $user (keys %users) {72 73 if (my $dpmt = $userdpmt{$user}) {74 push(@{ $data->{links} },75 {76 "source" => $nodes{$user},77 "target" => $nodes{'-' . $dpmt->[0]},78 }79 ) if ($dpmt->[0]);80 }81 if (my $manag = $usermanager{$user}) {82 my $target = $manag->[0];83 push(@{ $data->{links} },84 {85 "source" => $nodes{$user},86 "target" => $nodes{$target},87 }88 ) if ($target);89 }90 91 92 }93 94 69 $c->stash->{data} = $data; 95 70 } -
trunk/LATMOS-Accounts-Web/root/html/includes/wrapper.tt
r1758 r1939 32 32 <script src="[% c.uri_for('/static', 'js', 'd3', 'd3.v3.js') %]"></script> 33 33 <script src="[% c.uri_for('/static', 'js', 'timeline', 'timeframe.js') %]"></script> 34 <script src="[% c.uri_for('/static', 'js', 'jquery', 'jquery.orgchart.js') %]"></script> 35 <link rel="stylesheet" href="[% c.uri_for('/static/js/jquery/jquery.orgchart.css') %]" type="text/css"> 34 36 35 37 <link rel="stylesheet" href="[% c.uri_for('/static/js/jqplot/jquery.jqplot.css') %]" type="text/css"> -
trunk/LATMOS-Accounts-Web/root/html/summary/departments/index.tt
r1704 r1939 4 4 [% dpmts = c.model('Accounts').db.search_objects('group', 'sutype=dpmt') %] 5 5 6 <ul id="org-top" style="display: none"> 7 <li>Direction 8 6 9 [% FOREACH dpmt = dpmts %] 7 10 [% "<ul>" IF loop.first %] 8 11 [% odpmt = c.model('Accounts').db.get_object('group', dpmt) %] 9 <li><a href="#[% dpmt %]">[% odpmt.get_attributes('description') || dpmt | html %]</a></li> 10 [% "</ul>" IF loop.last %] 12 <li>[% dpmt | html %] 13 14 [% omanager = c.model('Accounts').db.get_object('user', odpmt.get_attributes('managedBy')) %] 15 16 [% IF omanager %] 17 <br> 18 [% omanager %] 11 19 [% END %] 12 13 [% FOREACH dpmt = dpmts %]14 [% odpmt = c.model('Accounts').db.get_object('group', dpmt) %]15 <h3><a name="[% dpmt %]">16 [%- odpmt.get_attributes('description') || dpmt | html -%]17 </a><a href="#top">â</a></h3>18 20 19 21 [% users = c.model('Accounts').db.fetchObjectInfo('user', 20 22 [ 'givenName', 'sn', 'managerContact', 'department', 'expire', 'description' ], 21 23 'active=1', 22 ' memberOf=' _ dpmt,24 'department=' _ dpmt, 23 25 ) %] 24 26 25 [% FOREACH user = users.keys.sort %] 26 [% IF loop.first %] 27 <table border=1> 28 <tr><th>Personnel</th><th>Responsable</th></tr> 29 [% END %] 30 [% ouser = users.$user %] 27 [% FOREACH user = users.keys.sort %] 28 [% IF loop.first %] 29 <ul> 30 [% END %] 31 [% ouser = users.$user %] 32 <li> 33 [% IF ouser.department.0 != dpmt %] 34 <span style="font-style: italic;"> 35 [% ELSE %] 36 <span> 37 [% END %] 38 [% ouser.givenName.0 _ ' ' _ ouser.sn.0 || ouser.description.0 || user | html %] 39 </span> 40 </li> 41 [% "</ul>" IF loop.last %] 42 [% END %] 31 43 32 <tr> 33 <td> 34 [% IF ouser.department.0 != dpmt %] 35 <span style="font-style: italic;"> 36 [% ELSE %] 37 <span> 38 [% END %] 39 [% ouser.givenName.0 _ ' ' _ ouser.sn.0 || ouser.description.0 || user | html %] 40 </span> 41 [% IF ouser.department.0 != dpmt %] 42 ([% ouser.department.0 || 'n/a' | html %]) 43 [% END %] 44 </td> 45 <td> 46 [% manager = ouser.managerContact.0 %] 47 [% IF manager %] 48 [% omanager = c.model('Accounts').db.get_object('user', ouser.managerContact.0) %] 49 [% omanager.get_attributes('displayName') || manager | html %] 50 [% END %] 51 </td> 52 </tr> 53 [% "</table>" IF loop.last %] 54 [% END %] 55 44 [% "</ul>" IF loop.last %] 56 45 [% END %] 57 46 47 </li> 48 </ul> 49 50 <div id=chart></div> 51 52 <style> 53 54 div.orgChart { 55 overflow-x: scroll 56 } 57 58 div.orgChart .level1 { 59 font-size: 12px; 60 } 61 62 div.stack-container { 63 border: solid; 64 } 65 66 div.orgChart ul.stack > li { 67 margin-top: 1em; 68 font-size: 10px; 69 line-height: 1em; 70 } 71 </style> 72 73 <script> 74 $(function() { 75 $("#org-top").orgChart({ 76 container: $("#chart"), 77 stack: true, 78 depth: 2 79 }); 80 }); 81 </script>
Note: See TracChangeset
for help on using the changeset viewer.