[Fedora-directory-commits] dsgw/orgbin myorg.in, NONE, 1.1 org.in, NONE, 1.1
Nathan Kinder (nkinder)
fedora-directory-commits at redhat.com
Fri Jan 11 21:58:12 UTC 2008
- Previous message (by thread): [Fedora-directory-commits] dsgw/orghtml aim-online.gif, NONE, 1.1 arrow.gif, NONE, 1.1 botframe.html, NONE, 1.1 branch-cc1.gif, NONE, 1.1 index.html, NONE, 1.1 ldap-person.gif, NONE, 1.1 mag.gif, NONE, 1.1 mail.gif, NONE, 1.1 new-branch-blank.gif, NONE, 1.1 new-branch-first.gif, NONE, 1.1 new-branch-straight.gif, NONE, 1.1 orgicon.gif, NONE, 1.1 starthelp.gif, NONE, 1.1 styles.css, NONE, 1.1 topframe.html.in, NONE, 1.1
- Next message (by thread): [Fedora-directory-commits] ldapserver/ldap/servers/plugins/replication cl5_api.c, 1.9, 1.9.2.1 repl5_replica_config.c, 1.6, 1.6.2.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: nkinder
Update of /cvs/dirsec/dsgw/orgbin
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv20288/orgbin
Added Files:
myorg.in org.in
Log Message:
Added orgchart to dsgw.
--- NEW FILE myorg.in ---
#!@perlexec@
#
# BEGIN COPYRIGHT BLOCK
# This Program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 2 of the License.
#
# This Program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
#
# In addition, as a special exception, Red Hat, Inc. gives You the additional
# right to link the code of this Program with code not covered under the GNU
# General Public License ("Non-GPL Code") and to distribute linked combinations
# including the two, subject to the limitations in this paragraph. Non-GPL Code
# permitted under this exception must only link to the code of this Program
# through those well defined interfaces identified in the file named EXCEPTION
# found in the source code files (the "Approved Interfaces"). The files of
# Non-GPL Code may instantiate templates or use macros or inline functions from
# the Approved Interfaces without causing the resulting work to be covered by
# the GNU General Public License. Only Red Hat, Inc. may make changes or
# additions to the list of Approved Interfaces. You must obey the GNU General
# Public License in all respects for all of the Program code and other code used
# in conjunction with the Program except the Non-GPL Code covered by this
# exception. If you modify this file, you may extend this exception to your
# version of the file, but you are not obligated to do so. If you do not wish to
# provide this exception without modification, you must delete this exception
# statement from your version and license this file solely under the GPL without
# exception.
#
#
# Copyright (C) 2005 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
#
#set ts=4
$|=1;
print "Content-type: te at orguri@;charset=UTF-8\n\n";
#print "Content-type: te at orguri@\n\n";
#
# Read orgchart.conf settings for MyOrgChart-specific items
#
&read_config_file();
#-------------------------------------
print "
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
<html>
<head>
<title>Customize: Directory Server Org Chart</title>
<LINK REL=stylesheet TYPE=\"text/css\" HREF=\"@orguri@/styles.css\">
";
#-------------------------------------
&print_javascript();
print "</head>";
&print_body();
print @orguri@>";
exit(0);
#==============================================================================
sub read_config_file()
{
if (!open (FILE, "@contextdir@/orgchart.conf") )
{
print "\n\n<BR><BR>Can't open configuration file: orgchart.conf\n\n<BR><BR>Error from OS: $!\n\n";
exit;
}
#
# let's set some default values, so in case a setting
# does not exist both in the orgchart.conf file, as well
# as does not exist via a user's MyOrgChart cookie,
# we at least have some type of valid value present.
#
%config_tokens = (
"icons-aim-visible","disabled",
"icons-email-visible","disabled",
"icons-phonebook-visible","disabled",
"icons-locator-visible","disabled",
"max-levels-drawn", "3",
);
#
# read in the orgchart.conf file
#
while(<FILE>)
{
chop;
foreach $f (keys %config_tokens)
{
$config_tokens{$f} = $1 if ($_ =~ /^$f[ \t]+(.+)/);
}
}
close (FILE);
#
# check the "max-levels-drawn" setting for numeric, and to
# make sure it is a number greater than zero.
#
# If a bad setting, let's set it to 3 so that at least it
# is set to a valid number, but then a user's MyOrgChart
# preferences can override it (if their setting is 1, 2,
# or 3 only).
#
# check for non-numeric first
$temp = $config_tokens{"max-levels-drawn"};
$temp =~ s/[\d]//g;
if ( length($temp) != 0 )
{
# a non-numeric setting
$config_tokens{"max-levels-drawn"} = 3;
}
else
{
# a numeric setting, but: check for less than value of 1
if ( $config_tokens{"max-levels-drawn"} < 1 )
{
$config_tokens{"max-levels-drawn"} = 3;
}
}
#
# if every icon has been disabled, set a state so that later on
# we don't draw the header and the footer text for the icons.
#
if ( ($config_tokens{"icons-email-visible"} eq "disabled") && ($config_tokens{"icons-phonebook-visible"} eq "disabled") && ($config_tokens{"icons-aim-visible"} eq "disabled") && ($config_tokens{"icons-locator-visible"} eq "disabled") )
{
$all_icons_disabled = "yes";
}
else
{
$all_icons_disabled = "no";
}
}
#==============================================================================
sub print_body()
{
print "
<body bgcolor=\"#FFFFFF\" leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onLoad=\"initValues()\">
<FORM name=\"customize\">
<table width=\"500\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\">
<tr>
<td height=\"20\"> </td></tr>
</table>
<table width=\"500\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\">
<tr>
<td width=\"500\" height=\"22\" valign=\"top\" bgcolor=\"#cccccc\" class=\"pageHeader\">Customize View</td>
</tr>
<tr>
<td height=\"236\" valign=\"top\">
<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\">
<tr height=\"7\"></tr>
";
#
# If all icons are "disabled" by the admin, we better not display the
# window dressing (header and footer) text that normally surrounds the
# icon options. This is the header.
#
if ( "$all_icons_disabled" eq "no" )
{
print "
<tr>
<td width=\"28\" height=\"21\" valign=\"top\"> </td>
<td valign=\"top\" colspan=\"4\" class=\"prefsPageHead\">Icon Settings</td>
</tr>
<tr height =\"7\"></tr>
<tr>
<td width=\"35\" height=\"21\"></td>
<td width=\"35\" valign=\"top\" class=\"prefsPageData\">Icon:</td>
<td width=\"25\"></td>
<td width=\"105\" valign=\"top\" class=\"prefsPageData\">Description:</td>
<td width=\"21\"></td>
<td width=\"205\" valign=\"top\" class=\"prefsPageData\">Location:</td>
</tr>
";
}
#
# don't draw the email option if admin has disabled it !
#
if ( $config_tokens{"icons-email-visible"} ne "disabled" )
{
print "
<tr height=\"6\"></tr>
<tr>
<td width=\"33\" height=\"21\"></td>
<td width=\"20\" valign=\"top\" class=\"prefsPageData\"> <img src=\"@orguri@/mail.gif\" alt=\"\" width=\"14\" height=\"16\" border=\"0\"></td>
<td width=\"25\"></td>
<td width=\"105\" valign=\"top\" class=\"prefsPageData\">EMail</td>
<td width=\"21\"></td>
<td width=\"205\" valign=\"center\" class=\"prefsPageData\"><select NAME=\"email\">
";
# --------------------------------------------
$selected1 = $selected2 = $selected3 = "";
if ($config_tokens{"icons-email-visible"} eq "no") { $selected1 = " SELECTED"; }
if ($config_tokens{"icons-email-visible"} eq "forefront") { $selected2 = " SELECTED"; }
if ($config_tokens{"icons-email-visible"} eq "layer") { $selected3 = " SELECTED"; }
# --------------------------------------------
print "
<option value=\"no\"$selected1>Never display this icon</option>
<option value=\"forefront\"$selected2>Next to name</option>
<option value=\"layer\"$selected3>In floating layer</option>
</select></td>
</tr>
";
}
#
# don't draw the phonebook option if admin has disabled it !
#
if ( $config_tokens{"icons-phonebook-visible"} ne "disabled" )
{
print "
<tr height=\"6\"></tr>
<tr>
<td width=\"33\" height=\"21\"></td>
<td width=\"20\" valign=\"top\" class=\"prefsPageData\"> <img src=\"@orguri@/ldap-person.gif\" alt=\"\" width=\"12\" height=\"16\" border=\"0\"></td>
<td width=\"25\"></td>
<td width=\"125\" valign=\"top\" class=\"prefsPageData\" nowrap>Phonebook Entry</td>
<td width=\"21\"></td>
<td width=\"205\" valign=\"center\" class=\"prefsPageData\"><select NAME=\"phonebook\">
";
# --------------------------------------------
$selected1 = $selected2 = $selected3 = "";
if ($config_tokens{"icons-phonebook-visible"} eq "no") { $selected1 = " SELECTED"; }
if ($config_tokens{"icons-phonebook-visible"} eq "forefront") { $selected2 = " SELECTED"; }
if ($config_tokens{"icons-phonebook-visible"} eq "layer") { $selected3 = " SELECTED"; }
# --------------------------------------------
print "
<option value=\"no\"$selected1>Never display this icon</option>
<option value=\"forefront\"$selected2>Next to name</option>
<option value=\"layer\"$selected3>In floating layer</option>
</select></td>
</tr>
";
}
#
# don't draw the locator option if admin has disabled it !
#
if ( $config_tokens{"icons-locator-visible"} ne "disabled" )
{
print "
<tr height=\"6\"></tr>
<tr>
<td width=\"33\" height=\"21\"></td>
<td width=\"20\" valign=\"top\" class=\"prefsPageData\"> <img src=\"@orguri@/mag.gif\" alt=\"\" width=\"15\" height=\"15\" border=\"0\"></td>
<td width=\"25\"></td>
<td width=\"125\" valign=\"top\" class=\"prefsPageData\" nowrap>Locate User</td>
<td width=\"21\"></td>
<td width=\"205\" valign=\"top\" class=\"prefsPageData\"><select NAME=\"locate\">
";
# --------------------------------------------
$selected1 = $selected2 = $selected3 = "";
if ($config_tokens{"icons-locator-visible"} eq "no") { $selected1 = " SELECTED"; }
if ($config_tokens{"icons-locator-visible"} eq "forefront") { $selected2 = " SELECTED"; }
if ($config_tokens{"icons-locator-visible"} eq "layer") { $selected3 = " SELECTED"; }
# --------------------------------------------
print "
<option value=\"no\"$selected1>Never display this icon</option>
<option value=\"forefront\"$selected2>Next to name</option>
<option value=\"layer\"$selected3>In floating layer</option>
</select></td>
</tr>
";
}
#
# don't draw the AIM option if admin has disabled it !
#
if ( $config_tokens{"icons-aim-visible"} ne "disabled" )
{
print "
<tr height=\"6\"></tr>
<tr>
<td width=\"33\" height=\"21\"></td>
<td width=\"20\" valign=\"top\" class=\"prefsPageData\"> <img src=\"@orguri@/aim-online.gif\" alt=\"\" width=\"15\" height=\"15\" border=\"0\"></td>
<td width=\"25\"></td>
<td width=\"125\" valign=\"top\" class=\"prefsPageData\" nowrap>AIM Presence</td>
<td width=\"21\"></td>
<td width=\"205\" valign=\"top\" class=\"prefsPageData\"><select NAME=\"aim\">
";
# --------------------------------------------
$selected1 = $selected2 = $selected3 = "";
if ($config_tokens{"icons-aim-visible"} eq "no") { $selected1 = " SELECTED"; }
if ($config_tokens{"icons-aim-visible"} eq "forefront") { $selected2 = " SELECTED"; }
if ($config_tokens{"icons-aim-visible"} eq "layer") { $selected3 = " SELECTED"; }
# --------------------------------------------
print "
<option value=\"no\"$selected1>Never display this icon</option>
<option value=\"forefront\"$selected2>Next to name</option>
<option value=\"layer\"$selected3>In floating layer</option>
</select></td>
</tr>
";
}
#
# If all icons are "disabled" by the admin, we better not display the
# window dressing (header and footer) text that normally surrounds the
# icon options. This is the footer.
#
if ( "$all_icons_disabled" eq "no" )
{
print "
<tr height=\"15\">
</tr>
<tr>
<td width=\"28\" height=\"21\" valign=\"top\"> </td>
<td valign=\"middle\" colspan=\"4\"><hr></td>
</tr>
";
}
print "
<tr>
<td width=\"28\" height=\"21\" valign=\"top\"> </td>
<td valign=\"top\" colspan=\"4\" class=\"prefsPageHead\">Organization Chart Depth</td>
</tr>
<tr height=\"10\">
</tr>
<tr>
<td width=\"35\" height=\"28\"></td>
<td width=\"10\" valign=\"top\" class=\"prefsPageData\">Show </td>
<td width=\"20\" valign=\"top\" class=\"prefsPageData\"><select NAME=\"leveldepth\">
";
for ( $num = 1 ; $num <= $config_tokens{"max-levels-drawn"} ; $num++ )
{
if ( $num < $config_tokens{"max-levels-drawn"} )
{
print "<option value=\"$num\">$num</option>";
}
else
{
print "<option value=\"$num\" SELECTED>$num</option>";
}
}
print "
</select></td>
<td width=\"350\" colspan=\"3\" class=\"prefsPageData\"> levels of organization depth</td>
</tr>
<td height=\"30\"></td>
</table>
</td>
</tr>
</table>
<table width=\"500\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\">
<tr>
<td height=\"20\"> </td></tr>
<tr>
<td align=\"right\"><input type=\"button\" name=\"save\" value=\" Finished \" onClick=\"saveSettings();\"></td>
<td width=\"20\"</td>
<td><input type=\"button\" name=\"del_cookie\" value=\"Restore Defaults\" onClick=\"deleteCookie();\"></td>
</tr>
</table>
</form>
</body>
";
}
#==============================================================================
sub print_javascript()
{
print "
<SCRIPT language=\"javascript\">
var today = new Date();
var expires = new Date();
var expired = new Date(today.getTime() - 1000 * 24 * 60 * 60 * 1000);
function initValues()
{
var myorgsettings = getCookie(\"MyOrgChart\");
var possvalues = new Array(\"no\",\"forefront\",\"layer\");
";
# --------------------------------------------------------------
#
# let's build up a string like the contents below of Array
# (if max-levels-drawn was 3):
#
# var posslevelvalues = new Array("1","2","3");
#
$finalstring = "var posslevelvalues = new Array(";
for ( $num = 1 ; $num <= $config_tokens{"max-levels-drawn"} ; $num++ )
{
$finalstring = "$finalstring\"$num\"";
if ( $num != $config_tokens{"max-levels-drawn"} )
{
$finalstring = "$finalstring,";
}
}
$finalstring = "$finalstring);";
# --------------------------------------------------------------
print "
$finalstring
// If there is a cookie already set, let's correct the
// values of the HTML form to be based on their personal
// settings, for easier editing and also lack of confusion
if ( myorgsettings != \"\" )
{
var splitorgvalues = myorgsettings.split(\"&\");
var tempstr;
// alert(myorgsettings);
for (var loop=0; loop < splitorgvalues.length; loop++)
{
tempstr = splitorgvalues[loop].split(\"=\");
";
# --start---------------------------------------------------------
if ( $config_tokens{"icons-email-visible"} ne "disabled" )
{
print "
if ( tempstr[0] == \"email\" )
{
for (var innerloop=0; innerloop < possvalues.length; innerloop++)
{
if ( tempstr[1] == possvalues[innerloop] )
document.customize.email.options[innerloop].selected = true;
}
}
";
}
# --end---------------------------------------------------------
# --start---------------------------------------------------------
if ( $config_tokens{"icons-phonebook-visible"} ne "disabled" )
{
print "
if ( tempstr[0] == \"pb\" )
{
for (var innerloop=0; innerloop < possvalues.length; innerloop++)
{
if ( tempstr[1] == possvalues[innerloop] )
document.customize.phonebook[innerloop].selected = true;
}
}
";
}
# --end---------------------------------------------------------
# --start---------------------------------------------------------
if ( $config_tokens{"icons-locator-visible"} ne "disabled" )
{
print "
if ( tempstr[0] == \"maps\" )
{
for (var innerloop=0; innerloop < possvalues.length; innerloop++)
{
if ( tempstr[1] == possvalues[innerloop] )
document.customize.locate[innerloop].selected = true;
}
}
";
}
# --end---------------------------------------------------------
# --start---------------------------------------------------------
if ( $config_tokens{"icons-aim-visible"} ne "disabled" )
{
print "
if ( tempstr[0] == \"aim\" )
{
for (var innerloop=0; innerloop < possvalues.length; innerloop++)
{
if ( tempstr[1] == possvalues[innerloop] )
document.customize.aim[innerloop].selected = true;
}
}
";
}
# --end---------------------------------------------------------
print "
if ( tempstr[0] == \"maxlevels\" )
{
for (var innerloop=0; innerloop < $config_tokens{\"max-levels-drawn\"}; innerloop++)
{
if ( tempstr[1] == posslevelvalues[innerloop] )
document.customize.leveldepth.options[innerloop].selected=true;
}
}
}
}
return;
}
function getCookie(Name)
{
var search = Name + \"=\"
if (document.cookie.length > 0)
{ // if there are any cookies
offset = document.cookie.indexOf(search)
if (offset != -1)
{ // if cookie exists
offset += search.length // set index of beginning of value
end = document.cookie.indexOf(\";\", offset) // set index of end of cookie value
if (end == -1)
end = document.cookie.length
return unescape(document.cookie.substring(offset, end))
}
}
return (\"\");
}
function deleteCookie()
{
document.cookie=\"MyOrgChart\" + \"=null; expires=\" + expired.toGMTString();
alert(\"Your preferences have been deleted from your browser.\");
document.location.href = \"myorg\";
}
function saveSettings()
{
var i;
var finalString;
finalString = \"\";
// alert(document.customize.email.options[document.customize.email.selectedIndex].value);
";
if ( $config_tokens{"icons-email-visible"} ne "disabled" )
{
print"
finalString += \"&email=\" + document.customize.email.options[document.customize.email.selectedIndex].value;
";
}
if ( $config_tokens{"icons-phonebook-visible"} ne "disabled" )
{
print"
finalString += \"&pb=\" + document.customize.phonebook.options[document.customize.phonebook.selectedIndex].value;
";
}
if ( $config_tokens{"icons-locator-visible"} ne "disabled" )
{
print"
finalString += \"&maps=\" + document.customize.locate.options[document.customize.locate.selectedIndex].value;
";
}
if ( $config_tokens{"icons-aim-visible"} ne "disabled" )
{
print"
finalString += \"&aim=\" + document.customize.aim.options[document.customize.aim.selectedIndex].value;
";
}
print "
finalString += \"&maxlevels=\" + document.customize.leveldepth.options[document.customize.leveldepth.selectedIndex].value;
expires.setTime(today.getTime() + 1000*60*60*24*365);
setCookie(\"MyOrgChart\", finalString, expires);
alert(\"Your preferences have been saved in your browser.\");
// alert(\"Your preferences have been saved in your browser as:\\n\" + finalString);
return;
}
function setCookie(name, value, expire)
{
document.cookie = name + \"=\" + escape(value)
+ ((expire == null) ? \"\" : (\"; expires=\" + expire.toGMTString()));
}
</SCRIPT>
";
}
#==============================================================================
--- NEW FILE org.in ---
#!@perlexec@
#
# BEGIN COPYRIGHT BLOCK
# This Program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 2 of the License.
#
# This Program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
#
# In addition, as a special exception, Red Hat, Inc. gives You the additional
# right to link the code of this Program with code not covered under the GNU
# General Public License ("Non-GPL Code") and to distribute linked combinations
# including the two, subject to the limitations in this paragraph. Non-GPL Code
# permitted under this exception must only link to the code of this Program
# through those well defined interfaces identified in the file named EXCEPTION
# found in the source code files (the "Approved Interfaces"). The files of
# Non-GPL Code may instantiate templates or use macros or inline functions from
# the Approved Interfaces without causing the resulting work to be covered by
# the GNU General Public License. Only Red Hat, Inc. may make changes or
# additions to the list of Approved Interfaces. You must obey the GNU General
# Public License in all respects for all of the Program code and other code used
# in conjunction with the Program except the Non-GPL Code covered by this
# exception. If you modify this file, you may extend this exception to your
# version of the file, but you are not obligated to do so. If you do not wish to
# provide this exception without modification, you must delete this exception
# statement from your version and license this file solely under the GPL without
# exception.
#
#
# Copyright (C) 2005 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
#
#set ts=4
# ------------
#
# Notes for anybody reading the code below:
#
# [1] The concept of the $uid variable throughout the code
# is whatever the leftmost RDN value is for a given user DN,
# and this relates to the "attrib-farleft-rdn" setting in
# orgchart.conf, of what the attribute name will always be.
#
# ------------
use lib qw(@perlpath@);
use Mozilla::LDAP::Conn;
use Mozilla::LDAP::Utils qw(:all);
use CGI;
$cg = new CGI;
$|=1;
print "Content-type: text/html;charset=UTF-8\n\n";
##########################################
#
# Let's find out what browswer they are using
#
##########################################
$agentstring = $ENV{'HTTP_USER_AGENT'};
# IE 6.0 : ---Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)---
# Comm478 : ---Mozilla/4.78 [en] (Windows NT 5.0; U)---
# Nscp622 : ---Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4.1) Gecko/20020314 Netscape6/6.2.2---
$browser_is_msie = "MSIE" if $agentstring =~ /MSIE/;
# is this Windows?
$isWindows = -d '\\';
##########################################
#
# Read orgchart.conf settings, set by the administrator
#
##########################################
&read_config_file();
##########################################
#
# Let's look at what is being passed in, from the user.
#
##########################################
#
# "data" is a generic FORM variable name from
# the topframe.html document that we receive our incoming query
# from.
#
# (See comment at start of this file about "$uid" variable.)
#
if ( defined $cg->param("data") )
{
$uid = $cg->param("data");
}
#
# For coexistence with the DSGW, when we crosslink, we need to
# make sure that the user is taken back to the correct dsgw
# context
#
$contextParamString = "";
if ( defined $cg->param("context") )
{
$context = $cg->param("context");
$contextParamString = "context=${context}&";
$config_tokens{"url-phonebook-base"} =~ s/context=.*?&/$contextParamString/g;
}
#
# But they may have entered this code from clicking on an org
# chart icon from an already-drawn org chart, in which case
# we know what the RDN attribute name is (cn, uid, etc.), so i
# that has priority, if present.
#
if ( defined $cg->param("$config_tokens{'attrib-farleft-rdn'}") )
{
$uid = $cg->param("$config_tokens{'attrib-farleft-rdn'}")
}
if ($uid eq "")
{
&output_html_header("no-javascript");
print "No username selected...</BODY></HTML>";
#print "\n</BODY></HTML>";
exit(0);
}
##########################################
#
# If the user has asked this org chart to be prepared for printing
#
##########################################
if ( (defined $cg->param("print")) && ( $cg->param("print") eq "yes" ) )
{
$print_mode = 1;
}
else
{
$print_mode = 0;
}
if ( !($print_mode) )
{
$fontstring="<font face=\"verdana, Arial, Helvetica, sans-serif\" style=\"font-size: 11px\">";
}
else
{
# if printing, let's make the font smaller, to fit more org chart on one page
#
$fontstring="<font face=\"verdana, Arial, Helvetica, sans-serif\" style=\"font-size: 8px\">";
}
##########################################
#
# See if the user has their own preferences to use.
#
#
##########################################
&check_myorgchart_settings();
##########################################
#
# Let's configure which attributes to request from LDAP,
# based on preferences read above...
#
##########################################
&config_ldap_return_attrib_list();
##########################################
#
# global variable descriptions:
#
# $total : stores the displayed statistic of "Total # of people" that is printed under org chart
# $display_indent : helps track how deeply "indented" in the org chart hierarchy a given person is, to help
# draw an internal data structure of the hierarchy. See details in get_org_data() function.
# $tempnum : just generic variable used for different reasons, always within a very small (controllable)
# scope within a given function only, since a generic all-purpose variable
# $anothertempnum : same idea as $tempnum, just another variable for the same generic purpose
# $tempstr : same idea as $tempnum, just another variable for the same generic purpose
#
[...1645 lines suppressed...]
{
print "<img SRC=\"@orguri@/new-branch-blank.gif\" align=TEXTTOP>";
}
}
else
{
for ( $anothertempnum = 0 ; $anothertempnum < $current_indent - 2 ; $anothertempnum++ )
{
print "<img SRC=\"@orguri@/new-branch-straight.gif\" align=TEXTTOP>";
}
}
if ( ("$sortedPeople[$tempnum][8]" eq "cc1") || ( $sortedPeople[$tempnum][8] =~ /rounded/ ) )
{
print "<img SRC=\"@orguri@/branch-cc1.gif\" align=TEXTTOP>";
}
else
{
print "<img SRC=\"@orguri@/new-branch-first.gif\" align=TEXTTOP>";
}
}
$aimid = is_aimid_in_layer ( $config_tokens{"icons-aim-visible"} , "discover" , $sortedPeople[$tempnum][5] );
$emailstr = is_email_in_layer ( $config_tokens{"icons-email-visible"}, $sortedPeople[$tempnum][3] );
$pbstr = is_pb_in_layer ( $config_tokens{"icons-phonebook-visible"}, $sortedPeople[$tempnum][2] );
$locatorstr = is_locator_in_layer ( $config_tokens{"icons-locator-visible"}, $sortedPeople[$tempnum][6] );
if ( !($print_mode) )
{
print "\n\n <A HREF='javascript:return false;' target=_top onMouseOver=\"showLayer('$sortedPeople[$tempnum][6]','$sortedPeople[$tempnum][4]','$emailstr','$pbstr','$locatorstr','$aimid');\" onMouseOut=\"OutLayer();\">";
print "<img src=\"@orguri@/arrow.gif\" border=0 align=TEXTTOP>";
print "</A> \n";
}
print "$tempdata[@tempdata-1] \n";
#
# If they are a nonleaf entry based on the next person being below them, or if they
# are a nonleaf person based on "nonleaf" value which happens when max depth is exceeded
# such that all people below them were chopped off (were on the next level that was chopped
# off, hence why we needed to previously record "nonleaf" before the chop happened)
#
# then print the org chart icon
#
if ( ( $sortedPeople[$tempnum+1][0] =~ /$tempdata[@tempdata-1]/ ) || ( $sortedPeople[$tempnum][7] =~ /nonleaf/ ) )
{
if ( ($print_mode) && ($current_indent == 1 ) )
{
# special exception #1 of 2:
# if we are in "prepare this page for printing" mode, and drawing a user in
# a box, then let's not print the org icon next to their name ---> not needed
# in the hardcopy printout (not helpful)
}
else
{
if ( ($print_mode) && ( $sortedPeople[$tempnum+1][0] =~ /$tempdata[@tempdata-1]/ ) )
{
# special exception #2 of 2: if we are preparing this org chart for printing,
# and if the org icon we are about to draw is for a group of people that are
# already being printed on this same org chart under that person, there is
# no point in hardcopy printing this icon next to the person's name
#
# but in the "else" block below, we do want to print the icon next to their name
# (both for print and non-print org charts) because it signifies people underneath
# that person when we CANNOT/WON'T see those people listed under that person
}
else
{
if ( !( $sortedPeople[$tempnum+1][0] =~ /$tempdata[@tempdata-1]\/$/ ) )
{
print "<a href=org?${contextParamString}" . $config_tokens{'attrib-farleft-rdn'} . "=" . url_encode($sortedPeople[$tempnum][1]) . ">";
print "<img src=\"@orguri@/orgicon.gif\" border=0 height=15 width=17 align=TEXTTOP></a>";
}
}
}
}
print_aim_icon_if_outside_layer( $config_tokens{"icons-aim-visible"}, "discover", $sortedPeople[$tempnum][5] );
print_email_icon_if_outside_layer( $config_tokens{"icons-email-visible"}, $sortedPeople[$tempnum][3] );
print_pb_icon_if_outside_layer( $config_tokens{"icons-phonebook-visible"}, $sortedPeople[$tempnum][2] );
print_locator_icon_if_outside_layer( $config_tokens{"icons-locator-visible"}, $sortedPeople[$tempnum][6] );
#
# if the person's name is being printed within a box,
# then also print their title below their name
#
if ( $current_indent == 1 )
{
print "<BR>$sortedPeople[$tempnum][4]";
}
print "</font>";
if ( $current_indent == 1 )
{
print" </CENTER></td></tr> </table> </td> </tr> </table> </td> </tr> </table> ";
}
print "<BR>";
}
}
}
##########################################
#
# If they exceeded max depth allowed, let's still figure out
# which people are managers of some type and make sure we
# still put an org chart icon next to their name, so that the
# user can tell that there is extra org chart branches that were
# chopped off.
#
# We do this by over-filling the array of the org chart structure,
# and then make sure that when we chop off the extra level below,
# we record for the manager-types that have now chopped-off people
# that they are a non-leaf item (which needs an org chart icon next
# to their name
#
##########################################
sub detect_nonleaf_depth_exceeded()
{
if ( $incomplete == 1 )
{
$indelete = 0;
$anothertempnum = @sortedPeople;
for ( $tempnum = $anothertempnum-1 ; $tempnum >= 0 ; $tempnum-- )
{
# number of levels in current array element
#
$num = ($sortedPeople[$tempnum][0] =~ tr/\//\//) - 1;
if ( $num > $config_tokens{"max-levels-drawn"} )
{
splice(@sortedPeople,$tempnum,1);
$indelete = 1;
# $total is the total number of people we read in from LDAP
# as reporting to the person entered. But now that we are
# chopping people off that exceed the max depth, we better
# adjust the $total accordingly as well, or else the
# "Total Reports: XXX" summary info at bottom of org chart
# will be too high/inaccurate.
#
--$total;
}
else
{
if ( $indelete == 1 )
{
$indelete = 0;
$sortedPeople[$tempnum][7] = "nonleaf";
}
else
{
$sortedPeople[$tempnum][7] = "leaf";
}
}
}
}
}
##########################################
#
# See location this function is called from for comments on purpose.
#
##########################################
sub output_html_header()
{
my ($js_output) = @_;
print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n";
print "<HTML>\n";
print "<HEAD>\n";
print " <title>Directory Server Org Chart</title>\n";
if ( $js_output ne "with-javascript" )
{
print " <LINK REL=stylesheet TYPE=\"text/css\" HREF=\"../html/styles.css\">\n";
}
if ( $js_output eq "with-javascript" )
{
&print_javascript();
}
print "</HEAD>\n";
print "<BODY BGCOLOR=\"#FFFFFF\">\n";
}
#=== end ===================================================================
- Previous message (by thread): [Fedora-directory-commits] dsgw/orghtml aim-online.gif, NONE, 1.1 arrow.gif, NONE, 1.1 botframe.html, NONE, 1.1 branch-cc1.gif, NONE, 1.1 index.html, NONE, 1.1 ldap-person.gif, NONE, 1.1 mag.gif, NONE, 1.1 mail.gif, NONE, 1.1 new-branch-blank.gif, NONE, 1.1 new-branch-first.gif, NONE, 1.1 new-branch-straight.gif, NONE, 1.1 orgicon.gif, NONE, 1.1 starthelp.gif, NONE, 1.1 styles.css, NONE, 1.1 topframe.html.in, NONE, 1.1
- Next message (by thread): [Fedora-directory-commits] ldapserver/ldap/servers/plugins/replication cl5_api.c, 1.9, 1.9.2.1 repl5_replica_config.c, 1.6, 1.6.2.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Fedora-directory-commits
mailing list