191 lines
8.5 KiB
Perl
Executable File
191 lines
8.5 KiB
Perl
Executable File
#!/usr/bin/perl
|
|
# tta_modou.cgi
|
|
# Modify STTA OrgUnits
|
|
# STTA Rev. 1.3 Copyright (c) 2001-2004 Jesús Pérez Lorenzo --- license GNU GPL
|
|
# stta: (@#) 1.31051043346- [2004_01_29_102036]
|
|
|
|
require './stta-lib.pl';
|
|
&foreign_require("proc", "proc-lib.pl");
|
|
if ( $config{'is_ldapcache'} eq "true" ) { do "ldap-lib.pl"; }
|
|
&ReadParse();
|
|
|
|
$userou = $in{userou};
|
|
$ouname = $in{ouname};
|
|
$dn = $in{dn};
|
|
if (!$userou) { &redirect("tta_selou.cgi?form=modou"); }
|
|
$postform = $in{postform};
|
|
$ttacmd="edit";
|
|
# Cleaning and reset values ...
|
|
$descrip="";
|
|
$conntype="";
|
|
$inherit="";
|
|
$cdm="";
|
|
$webtop="";
|
|
$alias = "";
|
|
&headerstta($text{'index_moddou'}, "", "moddou",undef,1,0,"$text{'headpage_right'}"."$text{'head_logout'}",undef,undef,"$text{head_below}" );
|
|
print "<hr><p>\n";
|
|
%h_ou=&list_ous();
|
|
if ( $h_ou{$userou}->{'alias'} ne $userou ) {
|
|
$err_msg=$text{'list_errno'};
|
|
&footHere;
|
|
exit;
|
|
}
|
|
$dn_ou=$h_ou{$userou}->{'obj'};
|
|
$ens_ou=$h_ou{$userou}->{'ens'};
|
|
$organizationname=$h_ou{$userou}->{'name'};
|
|
$ouname=$h_ou{$userou}->{'name'};
|
|
$maxsess=$h_ou{$userou}->{'maxsess'};
|
|
if ( $postform eq "tta_selou" ) {
|
|
$userorg = $userou;
|
|
} else {
|
|
$userorg = $in{userorg};
|
|
}
|
|
$dn = "$dn_ou,".$config{ldap_base};
|
|
$ens_obj = "\"".$config{tta_base}."/$ens_ou\"";
|
|
# loading object defaults ....
|
|
$temp_f=$config{'tta_defaults_ou'};
|
|
%h_ttaobj=&load_ttaobj();
|
|
$cdm =$h_ttaobj{'cdm'}->{'value'};
|
|
$inherit =$h_ttaobj{'inherit'}->{'value'};
|
|
$webtop =$h_ttaobj{'webtop'}->{'value'};
|
|
$conntype=$h_ttaobj{'conntype'}->{'value'};
|
|
if ( $ouname ) {
|
|
if ( $in{postform} ) {
|
|
# loading object attributes ...
|
|
$op="attributes";
|
|
$type_cmd="attributes";
|
|
$status_cmd=&run_tta_cmd($type_cmd,$ens_obj);
|
|
if ( !$status_cmd ) { $str_cmds="<tr><td> ".$text{'tta_noobject'}."</td></tr>";}
|
|
}
|
|
if ( $config{'is_ldapcache'} eq "true" ) {
|
|
$dn_cache="cn=$config{ldapcache_defaultobj},$dn_ou,".$config{ldapcache_base};
|
|
$ldapcache_server=$in{ldapcacheserver} || "1";
|
|
&connect_cache();
|
|
# loading variables
|
|
&load_tta3tier_vars($dn_cache);
|
|
}
|
|
}
|
|
# Assigning and collecting values to be used in the form ...
|
|
%h_ttaobj=();
|
|
%h_ttaobj=&load_ttaobj();
|
|
$descrip =$h_ttaobj{'description'}->{'value'};
|
|
if ( $h_ttaobj{'cdm'}->{'value'} ne "" ) { $cdm =$h_ttaobj{'cdm'}->{'value'}; }
|
|
if ( $h_ttaobj{'inherit'}->{'value'} ne "" ) { $inherit =$h_ttaobj{'inherit'}->{'value'}; }
|
|
if ( $h_ttaobj{'webtop'}->{'value'} ne "" ) { $webtop =$h_ttaobj{'webtop'}->{'value'}; }
|
|
if ( $h_ttaobj{'conntype'}->{'value'} ne "" ) { $conntype=$h_ttaobj{'conntype'}->{'value'}; }
|
|
$temp_f="";
|
|
print "<SCRIPT SRC=\"global.js\">\n";
|
|
print "</SCRIPT>\n";
|
|
print "<SCRIPT LANGUAGE=\"JavaScript\">\n";
|
|
print "/* Strings for locales */\n";
|
|
print "var msg0=\"".$text{'msg_0'},"\";\n";
|
|
print "var msg1=\"".$text{'msg_1'},"\";\n";
|
|
print "var msg2=\"".$text{'msg_2'},"\";\n";
|
|
print "var msg3=\"".$text{'msg_3'},"\";\n";
|
|
print "var msg4=\"".$text{'msg_4'},"\";\n";
|
|
print "var msg5=\"".$text{'msg_5'},"\";\n";
|
|
print "var msg6=\"".$text{'msg_6'},"\";\n";
|
|
print "var msg7=\"".$text{'msg_7'},"\";\n";
|
|
print "/******************************************************************\n";
|
|
print " showHelp(item)\n";
|
|
print "*******************************************************************/\n";
|
|
print "function showHelp(item) {\n";
|
|
print " var str=\"\";\n";
|
|
print " if ( item == \"conntype\" ) {\n";
|
|
print " window.open('/help.cgi/stta/conntype','help',",
|
|
"'toolbar=no,menubar=no,scrollbars=yes,width=400,height=300,resizable=yes')\n";
|
|
print " }\n";
|
|
print " if ( item == \"cdm\" ) {\n";
|
|
print " window.open('/help.cgi/stta/cdm','help',",
|
|
"'toolbar=no,menubar=no,scrollbars=yes,width=400,height=300,resizable=yes')\n";
|
|
print " }\n";
|
|
print "}\n";
|
|
print "/******************************************************************\n";
|
|
print " Check_fields(obj)\n";
|
|
print "*******************************************************************/\n";
|
|
print "function Check_fields(obj) {\n";
|
|
print " if ( get_value(\"select\",obj.webtop) == \"none\" ) {\n";
|
|
print " alert(obj.webtop.name+\":\"+msg1);\n";
|
|
print " obj.webtop.focus();\n";
|
|
print " return false;\n";
|
|
print " } \n";
|
|
print " nro=parseInt(obj.maxsess.value);\n";
|
|
print " if ( nro+1 > 0) { \n";
|
|
print " obj.maxsess.value=nro;\n";
|
|
print " } else {;\n";
|
|
print " alert(obj.maxsess.name+\":\"+msg1+\"->\"+obj.maxsess.value+\"<-\");\n";
|
|
print " obj.maxsess.focus();\n";
|
|
print " return false;\n";
|
|
print " };\n";
|
|
if ( $config{'is_ldapcache'} eq "true" ) { &script_cache_chek; };
|
|
print " return true;\n";
|
|
print "}\n";
|
|
print "//-->\n";
|
|
print "</SCRIPT>\n";
|
|
print "<table width=100% border>\n";
|
|
if ( $ouname ) {
|
|
print "<tr $tb> <td><font color='$revtext'><b>".&text('titidx_modou',$organizationname)."</b></td> </tr>\n";
|
|
}
|
|
else {
|
|
print "<tr $tb> <td><font color='$revtext'><b>".$text{'titidx_modou0'}."</b></td> </tr>\n";
|
|
}
|
|
print $str_cmds."\n";
|
|
print "<tr $cb> <td><table width=100%>\n";
|
|
print "<form METHOD=POST name=modou ACTION=\"modou.cgi\" onSubmit=\"return Check_fields(this)\">\n";
|
|
print "\n";
|
|
if ( $ouname ) {
|
|
print " <input TYPE=\"hidden\" NAME=\"ouname\" VALUE=\"",$ouname,"\">\n";
|
|
print " <input TYPE=\"hidden\" NAME=\"userou\" VALUE=\"",$userou,"\">\n";
|
|
print " <input TYPE=\"hidden\" NAME=\"userorg\" VALUE=\"",$userou,"\">\n";
|
|
print " <input TYPE=\"hidden\" NAME=\"dn\" VALUE=\"",$dn,"\">\n";
|
|
}
|
|
else {
|
|
print " <tr><td valign=top>",&hlink("<b>$text{'f_groupname'}</b>","fgroupname")," ",$ouname,"\n";
|
|
print " <td valign=top><input TYPE=\"text\" NAME=\"ouname\" VALUE=\"\" cols=\"22\" size=\"12\" ALIGN=left></td></tr>\n";
|
|
}
|
|
print " <input TYPE=\"hidden\" NAME=\"ttacmd\" VALUE=\"",$ttacmd,"\">\n";
|
|
print " <tr><td valign=top>",&hlink("<b>$text{'f_descrip'}</b>","fdescrip"),"</td>\n";
|
|
print " <td valign=top><input TYPE=\"text\" NAME=\"descrip\" VALUE=\"$descrip\" cols=\"40\" size=\"40\" ALIGN=left></td></tr>\n";
|
|
print " <tr><td valign=top>",&hlink("<b>$text{'f_webtop'}</b>","fwebtop")," <td valign=top><select NAME=\"webtop\">\n";
|
|
|
|
%h_webtops=&list_webtops();
|
|
$nItems=0;
|
|
foreach $item (keys (%h_webtops)) {
|
|
if ( $h_webtops{$item}->{'obj'} eq $webtop ) {
|
|
print " <option VALUE=\"".$h_webtops{$item}->{'alias'}."\" selected>". $h_webtops{$item}->{'name'}."\n";
|
|
}
|
|
else {
|
|
print " <option VALUE=\"".$h_webtops{$item}->{'alias'}."\" >".$h_webtops{$item}->{'name'}." ";
|
|
}
|
|
$nItems++;
|
|
}
|
|
print " </select></td></tr>\n";
|
|
print " <tr><td valign=top>",&hlink("<b>$text{'f_inherit'}</b>","finherit")," </td><td valign=top><input TYPE=\"checkbox\" NAME=\"inherit\" VALUE=\"$inherit\" ";
|
|
if ( $inherit eq 1 ) { print " checked "; }
|
|
print "></td></tr>\n";
|
|
print " <tr><td valign=top>",&hlink("<b>$text{'f_conect'}</b>","fconect"),"\n";
|
|
print " ",&hlink("<b>$text{'f_ipaddr'}</b>","fipaddr"),"-",&hlink("<b>$text{'f_contype'}</b>","fcontype")," </td>\n";
|
|
"\n";
|
|
print " <td valign=top> <input TYPE=\"button\" NAME=\"?\" VALUE=\"?\" onClick=\"showHelp('conntype');\" >\n";
|
|
print " <input TYPE=\"text\" NAME=\"conntype\" VALUE=\"$conntype\" cols=\"32\" size=\"32\"></td></tr> \n";
|
|
print " <tr><td valign=top>",&hlink("<b>$text{'f_cdm'}</b>","fcdm"),"</td>\n";
|
|
print " <td valign=top><input TYPE=\"button\" NAME=\"?\" VALUE=\"?\" onClick=\"showHelp('cdm');\" >\n";
|
|
print " <input TYPE=\"text\" NAME=\"cdm\" VALUE=\"$cdm\" cols=\"42\" size=\"42\"></td></tr> \n";
|
|
print " <tr><td valign=top>",&hlink("<b>$text{'f_maxsess'}</b>","fmaxsess")," </td>\n";
|
|
print " <td valign=top><input TYPE=\"text\" NAME=\"maxsess\" VALUE=\"$maxsess\" cols=\"4\" size=\"4\" ALIGN=left onChange=\"isNroThis(this)\">\n";
|
|
print "\n";
|
|
if ( $config{'is_ldapcache'} eq "true" ) { $formObj="modou";$msgObj=$text{'default_obj'};&htmlCacheapp(msgObj) }
|
|
print " <tr><td valign=top><input TYPE=\"submit\" NAME=\"",$text{'f_sendreq'},"\" VALUE=\"",$text{'f_sendreq'},"\">\n";
|
|
print " </td>\n";
|
|
print " <td valign=top><input TYPE=\"reset\" NAME=\"",$text{'f_cancelreq'},"\" VALUE=\"",$text{'f_cancelreq'},"\"></td></tr>\n";
|
|
print " </form>\n";
|
|
print " \n";
|
|
print "<tr></tr><tr></tr></table></table><hr><p>\n";
|
|
&footer($config{'back_return'},$text{'index'});
|
|
print "<p><p><p>\n";
|
|
do "footer.pl";
|
|
exit;
|
|
|
|
|
|
|