From: Clif H. <ch...@us...> - 2001-12-29 22:53:50
|
Update of /cvsroot/perl-ldap/ldap/contrib In directory usw-pr-cvs1:/tmp/cvs-serv22555/ldap/contrib Modified Files: tklkup Log Message: Added code to allow the schema information to be stored in a file as DSML XML data. User can now select to store the data as text or XML. Index: tklkup =================================================================== RCS file: /cvsroot/perl-ldap/ldap/contrib/tklkup,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- tklkup 2001/12/29 01:50:27 1.22 +++ tklkup 2001/12/29 22:53:47 1.23 @@ -22,6 +22,11 @@ # # Revisions: # $Log$ +# Revision 1.23 2001/12/29 22:53:47 charden +# +# Added code to allow the schema information to be stored in a file as +# DSML XML data. User can now select to store the data as text or XML. +# # Revision 1.22 2001/12/29 01:50:27 charden # # Added code to allow editing of a entry's attributes. @@ -179,6 +184,7 @@ use Net::LDAP::Filter; use Net::LDAP::Util qw(ldap_error_name ldap_error_text); use Net::LDAP::Constant; +use Net::LDAP::DSML; use Getopt::Std; use Tk; @@ -1371,6 +1377,13 @@ -variable => \$Global{'sfile'}, -onvalue => 1, -offvalue => 0, -font => $Global{'Font'} ) -> pack(-anchor => "w" ); + +$srbfilelabel -> Checkbutton( + -text => "Write schema data to file in DSML XML format.", + -variable => \$Global{'xml'}, -onvalue => 1, -offvalue => 0, + -font => $Global{'Font'} ) + -> pack(-anchor => "w" ); + # # Create Text Entry list box. # @@ -1403,7 +1416,8 @@ $selframe = $slframe -> LabFrame(-label => "DISPLAY SELECTED OBJECTS", -labelside => "acrosstop" ) - ->pack( -side => $Global{'hand'}, -expand => 1, -fill => "both" ); + ->pack( -side => $Global{'hand'}, + -expand => 1, -fill => "both" ); $sellframe = $selframe->Frame( -borderwidth => 0, -relief => "raised")->pack( @@ -1518,7 +1532,7 @@ # # -# Search the directory for data +# Get the directory schema # # # @@ -1591,6 +1605,7 @@ $schema = undef(); my @items; my @item; +my $dsml; $schemaHash{'schema'} = $ldap->schema(); @@ -1598,15 +1613,34 @@ { if ( $Global{'sfile'} && defined($schemaHash{'schema'}) ) { + if ( $Global{'xml'} ) + { # - # write to file instead of text box + # write XML text to file instead of text box # + $dsml = Net::LDAP::DSML->new(); + open(FXML, ">$Global{'fdata'}"); + $dsml->open(*FXML); + $dsml->write($schemaHash{'schema'}); + $dsml->finish(); + close(FXML); + } + else + { + # + # write straight text to file instead of text box + # $schemaHash{'schema'}->dump( $Global{'fdata'} ); - $schema_list->insert("end", "Schema data written to file: $Global{'fdata'}\n"); + } + + $schema_list->insert("end", + "Schema data written to file: $Global{'fdata'}\n"); $Global{'sfile'} = 0; $Global{'fdata'} = ""; + $Global{'xml'} = 0; $ldap->unbind if ( defined($ldap)); return; + } $ra_atts = []; |