Posted by mtndan on January 25, 2008 at 2:10pm
Hi folks,
We're interested in the possibility of autogenerating an org chart with svg (or flash). We are currently using Visio to automatically create org charts from Active Directory data. This then is saved as awful visio html and manually uploaded to our site.
We have Drupal talking to Active Directory now, and would love to take the step of using Drupal to create the org chart dynamically.
Anyone tried this, or have ideas?

Comments
Graphviz->Dot->SVG->files/orgchart.svg
Active Directory->query
Should be fairly easy to do on the fly (I don't do Active Directory)
query ->php script->dot input file
dot input is very simple.
e.g. orgchart.dot
digraph orgchart {
a->{b c d}
b-> {e f}
c -> {g h i}
d-> {j}
e-> {k l}
}
mash query output into left and right parts.
Many options on formatting.
dot ->SVG
dot orgchart.dot -Tsvg -o orgchart.svg
dot svg example
http://ls.net/files/drupal.svg
Huh
Tarvid, cool!
Sam Rose
Social Synergy
Blog
Sam Rose
Hollymead Capital Partners
P2P Foundation
Social Media Classroom
very cool!
Tarvid,
Couple questions:
Could you provide the source or a step-by-step for how you did that?
Does svg allow for elements and/or the text within them to be hyperlinked? For example, we'd want to display only the top 2 levels of the org chart on the first page, then when you click you can drill down to deeper levels.
Are you available for some paid consulting?
--
Dan Katz
Solutions Architect, Acquia
Yes on all three counts.
I've posted some notes at http://ls.net/software/crossplatform/graphviz and attached the dot input file which generated the graph along with the cli
dot and svg support hyperlinks, you will find one or two in the graph. I've been mulling a sed script which would modify the input to make a set of instructions for building a Drupal site for a specific domain
I.m hungry, perhaps not ravenously, but I like Drupal
thanks
Great, I'll pm you next week with the requirements.
Active Directory is just LDAP. We're currently using the ldap modules to authenticate so the drupal-directory link is already there
--
Dan Katz
Solutions Architect, Acquia
tarvid
Thanks for info.
I've worked with Graphviz in the past. You mention above that you were thinking about Query -> php script -> dot input file
if I am reading this right, I am wondering how you go about generating these dot files? are you using PEAR::Image_GraphViz or something similar?
Sam Rose
Social Synergy
Blog
Sam Rose
Hollymead Capital Partners
P2P Foundation
Social Media Classroom
dot files
assuming your input looks like {name, parent, ...} the dot file can be as simple as
digraph orgchart {
name(root)
name(i)->parent(i)
...
}
PEAR::Image_GraphViz would generate a dot file for you but I am not sure it is as smart as dot and may just get in the way. My preference is the syntax which is closest to the semantics. I can't imagine anything closer than the dot language itself.
name(root) is the special node at the top of the graph which has no other node leading to it. For an organization chart, the name of the organization would just create a node above the top.
name(i)->parent(i) is an edge
a name referenced in an edge but not independently established is automatically made into a node
There are lots of options including shape, label and URL which can be set per element (node or edge) or set for a group.
Dot is an amazingly simple but elegant tool. I wonder where she has been all my life.
using shell scripts and PHP to generate AD Orgcharts
Hi,
Yes I have created a few stand alone scripts (unix shell, PHP to generate dot file that where fed into Graphviz), to generate org charts. The problem I found with using Microsoft Active Directory was that it wasn't as up todate as we thought it was. In then end I re-wrote parts of it, so that it would pull the data from our HR/Payroll (MS SQL) DB. I ended up with GIF, SVG and PDF files that displayed our org chart. Our organisation has around 340 staff spread over 4-5 levels of management.