From: Clif H. <ch...@us...> - 2003-01-24 04:47:41
|
Update of /cvsroot/perl-ldap/ldap/contrib In directory sc8-pr-cvs1:/tmp/cvs-serv5761/ldap/contrib Modified Files: tklkup Log Message: Corrected several errors. Added a list box for process messages. Corrected a memory hogging issue with the way returned entry data was stored. Index: tklkup =================================================================== RCS file: /cvsroot/perl-ldap/ldap/contrib/tklkup,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- tklkup 21 Jan 2003 01:45:51 -0000 1.34 +++ tklkup 24 Jan 2003 04:47:38 -0000 1.35 @@ -96,6 +96,7 @@ $Global{'max'} = 0; $Global{'infoFilter'} = "equal"; $Global{'nismapname'} = 0; +$Global{'records'} = 0; my $sbbframe; my @base = (); @@ -512,17 +513,6 @@ } - -# -# Create bind button. -# This will cause another window to be displayed where -# the user will enter the bind DN and password. -# - -##$abind = $stframe -> Button(-text => " SET BIND\n CREDENTIALS", -## -relief => "raised", -command => \&BIND, -## -font => $Global{'Font'}, -borderwidth => 3 ) -## -> pack( -side => $Global{'hand'}, -anchor => "w", -pady => 2); # # Create a LDAP version Checkbutton that will set up variable # setVersion to set the LDAP version before each directory query. @@ -789,25 +779,18 @@ } # End of foreach (@attribute) +$msgframe = $attframe->LabFrame(-label => "Process Messages", + -labelside => "acrosstop" ) + ->pack( -fill => "both", -side => "right", -padx => 1, -pady => 1 ); -##$schframe = $attframe->LabFrame(-label => "DIRECTORY SCHEMA", -## -labelside => "acrosstop" ) -## ->pack( -fill => "both", -side => "right", -padx => 1, -pady => 1 ); - -# -# Create schema button. -# This will cause another window to be displayed where -# the user will be able to display schema information. -# - -##$abind = $schframe -> Button(-text => " EXPLORE DIRECTORY\n SCHEMA", -## -relief => "raised", -command => \&SCHEMA, -## -font => $Global{'Font'}, -borderwidth => 3 ) -## -> pack( -side => "$Global{'hand'}", -anchor => "w" ); +$msgbox = $msgframe ->Scrolled('Listbox', -scrollbars => 's', + -width => 50, -height => 2 ); +$msgbox->pack( -side => "bottom" ); $splash->Destroy() if ( $Global{splash} ); +$splash = undef(); # # Run the Main loop looking for events. # @@ -860,6 +843,8 @@ $Global{'slist'}->insert(0 , $Global{'LDAP_SERVER'}); $sslist->insert(0 , $Global{'LDAP_SERVER'}) if ( Exists($sslist) ) ; +$Global{mainWindow} -> update; # Allow Tk to update + $ptr = 1; # @@ -898,6 +883,9 @@ ) or $error = 1; } +$msgbox->delete("0.0", "end"); +$msgbox->update(); + if ( !$error ) { @@ -937,6 +925,7 @@ { foreach my $ncbase ( @$attr ) { + $Global{mainWindow}->update; my $t1 = []; ${$NC{$ncbase}}[0] = [ "0" ]; # dummy load in position 0 ${$NC{$ncbase}}[1] = $t1; # @@ -992,6 +981,11 @@ } +else +{ +$msgbox->insert("1", "Connection error."); + +} if ( @NcKeys) { @@ -1454,6 +1448,11 @@ $srbfilelabel->Entry(-textvariable => \$Global{'fdata'}, -width => 25 ) -> pack(-fill => 'x'); +# +# Allow mainWindow to update +# + +$Global{'mainWindow'}->update; # # Create list frame. @@ -1560,6 +1559,13 @@ $schema_list->pack( -side => "bottom" ); + +# +# Allow mainWindow to update +# + +$Global{'mainWindow'}->update; + &schema; } @@ -1710,6 +1716,13 @@ } + +# +# Allow mainWindow to update +# + +$Global{'mainWindow'}->update; + $ra_atts = []; # # Get the attributes @@ -2019,6 +2032,13 @@ } + +# +# Allow mainWindow to update +# + +$Global{'mainWindow'}->update; + # # Set up the Tk windows. # @@ -2098,7 +2118,8 @@ $Global{'list'}->insert("end", " \n"); foreach my $var (@objectclasses) - { + { + $Global{mainWindow}->update; $oid = $$obj{$var}->[0]; # # Get the various other items associated with @@ -2392,8 +2413,6 @@ if Tk::Exists($Global{'ldapActionWindow'}); delete($Global{'ldapActionWindow'}); -&displaySearch(); - &displaySearch(); # create the entry data display window. # clear the entry data display window. @@ -3817,11 +3836,6 @@ $Global{'searchHList'}->destroy if Tk::Exists($Global{'searchHList'}); # -# Display the DN search results list box. -# -displayDnList(); - -# # Parameter(s) to return # @@ -3891,7 +3905,7 @@ if ( $error == 1 ) { - $list->insert("end", "Bad filter '$match'.\n"); + ERROR("Bad filter $match."); return; } @@ -3916,7 +3930,7 @@ if ( $error == 1 ) { - $list->insert("end", "Connect error: $@\n"); + ERROR("Connect error: $@"); return; } @@ -3935,6 +3949,14 @@ } +# +# Display the DN search results list box. +# +displayDnList(); + +$msgbox->delete("0.0", "end"); +$msgbox->update; +$Global{'records'} = 0; # initialize record count. $Global{'searchResults'} = {}; # initialize results hash. $mesg = $Global{ldap}->search( @@ -3946,11 +3968,7 @@ if ( $mesg->code && $mesg->code != 48 ) { - $errstr = $mesg->code; - $list->insert("end", "Error code: $errstr\n"); - $errstr = ldap_error_text($errstr); - $list->insert("end", "$errstr\n"); - return; + ERROR($mesg->code); } @@ -4000,13 +4018,17 @@ if ( !defined($entry) ) { -# $list->insert("end", "No records found matching filter $match.\n") -# if ($mesg->count == 0) ; - return; } $dn = $entry->dn; # store the entry dn + ++$Global{'records'}; + $msgbox->delete("0.0", "end") + if ( !($Global{'records'} % 10 )); + $msgbox->update if ( !($Global{'records'} % 10 )); + $msgbox->insert("0.0", "Entries found: $Global{'records'}") + if ( !($Global{'records'} % 10 )); + $msgbox->update if ( !($Global{'records'} % 10 )); # # # @@ -4015,7 +4037,7 @@ { foreach (@ref ) { - $list->insert("end", "LDAP Referral: $_ \n"); + ERROR("LDAP Referral: $_"); } } @@ -4040,7 +4062,9 @@ # foreach (@attrs) { - my $attr = $entry->get_value($_, asref => 1); +# my $attr = $entry->get_value($_, asref => 1); + my $attr = []; + @$attr = $entry->get_value($_); next unless $attr; if ( /^jpegPhoto/i ) @@ -4142,6 +4166,14 @@ { if ( @base < $Global{'limit'} ) { + $splashList->insert("1", "Searching $base") + if ( defined( $splash) ); + $splash->update() + if ( defined( $splash) ); + $msgbox->insert("0", "Searching $base") + if ( defined( $msgbox) ); + $msgbox->update() + if ( defined( $msgbox) ); my @new_base = calBase($base, $f ); push(@base, @new_base); } @@ -4196,14 +4228,14 @@ $_ = $dn; # -# Record only dn that start with ou=, o=, or in some cases nismapname. +# Record only dn that start with ou=, or in some cases nismapname. # Normal entrys can be mixed in with these objects. # - if ( $Global{'nismapname'} && ( /^ou=/ || /^o=/ || /^nismapname/i ) ) + if ( $Global{'nismapname'} && ( /^ou=/ || /^nismapname/i ) ) { push(@new_base, $dn); # record only dn that start with ou= } - elsif ( /^ou=/ || /^o=/ ) + elsif ( /^ou=/ ) { push(@new_base, $dn); # record only dn that start with ou= } |