]> git.sur5r.net Git - openldap/commitdiff
Initial revision
authorKurt Zeilenga <kurt@openldap.org>
Tue, 24 Nov 1998 18:01:09 +0000 (18:01 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 24 Nov 1998 18:01:09 +0000 (18:01 +0000)
22 files changed:
contrib/gtk-tool/COPYRIGHT [new file with mode: 0644]
contrib/gtk-tool/Gtk_LdapItem.cc [new file with mode: 0644]
contrib/gtk-tool/Gtk_LdapItem.h [new file with mode: 0644]
contrib/gtk-tool/Gtk_LdapTreeItem.cc [new file with mode: 0644]
contrib/gtk-tool/Gtk_LdapTreeItem.h [new file with mode: 0644]
contrib/gtk-tool/LICENSE [new file with mode: 0644]
contrib/gtk-tool/LdapEntry.cc [new file with mode: 0644]
contrib/gtk-tool/LdapEntry.h [new file with mode: 0644]
contrib/gtk-tool/Makefile [new file with mode: 0644]
contrib/gtk-tool/My_Scroller.cc [new file with mode: 0644]
contrib/gtk-tool/My_Scroller.h [new file with mode: 0644]
contrib/gtk-tool/My_Window.cc [new file with mode: 0644]
contrib/gtk-tool/My_Window.h [new file with mode: 0644]
contrib/gtk-tool/README [new file with mode: 0644]
contrib/gtk-tool/TODO [new file with mode: 0644]
contrib/gtk-tool/common.h [new file with mode: 0644]
contrib/gtk-tool/cpluscommon.h [new file with mode: 0644]
contrib/gtk-tool/db_node.xpm [new file with mode: 0644]
contrib/gtk-tool/gtk.h [new file with mode: 0644]
contrib/gtk-tool/ldap_manager.cc [new file with mode: 0644]
contrib/gtk-tool/main.cc [new file with mode: 0644]
contrib/gtk-tool/system.h [new file with mode: 0644]

diff --git a/contrib/gtk-tool/COPYRIGHT b/contrib/gtk-tool/COPYRIGHT
new file mode 100644 (file)
index 0000000..cf1515d
--- /dev/null
@@ -0,0 +1,8 @@
+Copyright 1998 Predrag Balorda, London, UK
+All rights reserved.
+
+Redistribution and use in source and binary forms are permitted only
+as authorized by the OpenLDAP Public License.  A copy of this
+license is available at http://www.OpenLDAP.org/license.html or
+in file LICENSE in the top-level directory of the distribution.
+
diff --git a/contrib/gtk-tool/Gtk_LdapItem.cc b/contrib/gtk-tool/Gtk_LdapItem.cc
new file mode 100644 (file)
index 0000000..0801101
--- /dev/null
@@ -0,0 +1,38 @@
+#include "Gtk_LdapItem.h"
+
+Gtk_LdapItem::Gtk_LdapItem() : Gtk_TreeItem() {
+       cout << "Gtk_LdapItem()" << endl;
+}
+
+Gtk_LdapItem::Gtk_LdapItem(char *c) : Gtk_TreeItem() {
+       cout << "Gtk_LdapItem(" << c << ")" << endl;
+       this->dn = c;
+}
+
+Gtk_LdapItem::Gtk_LdapItem(Gtk_TreeItem *item) : Gtk_TreeItem(*item) {
+       cout << "Gtk_LdapItem(*item)" << endl;  
+}
+
+Gtk_LdapItem::Gtk_LdapItem(Gtk_TreeItem &item) : Gtk_TreeItem(item) {
+       cout << "Gtk_LdapItem(&item)" << endl;  
+}
+
+void Gtk_LdapItem::expand_impl() {
+       cout << this->dn << " expanded" << endl;
+}
+
+void Gtk_LdapItem::collapse_impl() {
+       cout << this->dn << " collapsed" << endl;
+}
+
+void Gtk_LdapItem::select_impl() {
+       cout << this->dn << " selected" << endl;
+}
+
+void Gtk_LdapItem::deselect_impl() {
+       cout << this->dn << " deselected" << endl;
+}
+
+void Gtk_LdapItem::toggle_impl() {
+       cout << this->dn << " toggled" << endl;
+}
diff --git a/contrib/gtk-tool/Gtk_LdapItem.h b/contrib/gtk-tool/Gtk_LdapItem.h
new file mode 100644 (file)
index 0000000..8d63a14
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef GTK_LDAPITEM_H
+#define GTK_LDAPITEM_H
+#include "cpluscommon.h"
+#include "gtk.h"
+#include <Gtk_LdapTreeItem.h>
+class Gtk_LdapTreeItem;
+
+class Gtk_LdapItem {
+public:
+       Gtk_Tree *tree;
+       Gtk_LdapTreeItem *treeitem;
+};
+#endif
diff --git a/contrib/gtk-tool/Gtk_LdapTreeItem.cc b/contrib/gtk-tool/Gtk_LdapTreeItem.cc
new file mode 100644 (file)
index 0000000..a7d0e1b
--- /dev/null
@@ -0,0 +1,95 @@
+#include "Gtk_LdapTreeItem.h"
+
+Gtk_LdapTreeItem::Gtk_LdapTreeItem() : Gtk_TreeItem() {
+}
+Gtk_LdapTreeItem::Gtk_LdapTreeItem(char *c, My_Window *w) : Gtk_TreeItem(c) {
+       this->rdn = c;
+       this->par = w;
+}
+Gtk_LdapTreeItem::Gtk_LdapTreeItem(GtkTreeItem *t) : Gtk_TreeItem(t) {
+}
+int Gtk_LdapTreeItem::search() {
+       int error, entriesCount;
+       BerElement *ber;
+       LDAPMessage *entry;
+       char *attribute, **values;
+       Gtk_CList *table;
+       Gtk_Label *label;
+       GList *child_list;
+       Gtk_Notebook *g;
+       if (this->notebook != NULL) {
+               if (par->scroller2->children != NULL) {
+                       par->scroller2->remove_child(0);
+               }
+               par->scroller2->add_child(this->notebook);      
+       //      par->scroller2->remove((Gtk_Object)par->scroller2->children()->first());
+               this->notebook->reparent(par->scroller2);
+               this->notebook->show();
+               par->scroller2->show();
+               return 0;
+       }
+       error = ldap_search_s(this->ld, this->dn, LDAP_SCOPE_BASE, "objectclass=*", NULL, 0, &result_identifier);
+       entriesCount = ldap_count_entries(ld, result_identifier);
+       if (entriesCount == 0) return 0;
+       notebook = new Gtk_Notebook();
+       notebook->set_tab_pos(GTK_POS_LEFT);
+       gchar *titles[] = { "values" };
+       
+       for (entry = ldap_first_entry(ld, result_identifier); entry != NULL; entry = ldap_next_entry(ld, result_identifier)) {
+               for (attribute = ldap_first_attribute(ld, entry, &ber); attribute != NULL; attribute = ldap_next_attribute(ld, entry, ber)) {
+                       table = new Gtk_CList(1, titles);
+                       values = ldap_get_values(ld, entry, attribute);
+                       for (int i=0; i<ldap_count_values(values); i++) {
+                               gchar *t[] = { values[i] };
+                               table->append(t);
+                       }
+                       ldap_value_free(values);
+                       label = new Gtk_Label(attribute);
+                       notebook->append_page(table, label);
+                       table->show();
+                       label->show();
+               }
+       }
+       if (par->scroller2 != NULL) {
+               cout << "Scroller2 exists" << endl;
+               if (par->scroller2->children[0] != NULL) {
+                       cout << "There are children in scroller2" << endl;
+                       par->scroller2->remove_child(0);
+               }
+               par->scroller2->add_child(this->notebook);
+               this->notebook->show();
+               par->scroller2->show();
+       }
+       return 0;
+}
+void Gtk_LdapTreeItem::select_impl() {
+//     cout << this->dn << " selected" << endl;
+//     gtk_item_select(GTK_ITEM(GTK_TREE_ITEM(this->gtkobj())));
+       Gtk_c_signals_Item *sig=(Gtk_c_signals_Item *)internal_getsignalbase();
+       if (!sig->select) return;
+       sig->select(GTK_ITEM(gtkobj()));
+       this->search();
+}
+void Gtk_LdapTreeItem::collapse_impl() {
+       cout << this->dn << " collapsed" << endl;
+       Gtk_c_signals_TreeItem *sig=(Gtk_c_signals_TreeItem *)internal_getsignalbase();
+       if (!sig->collapse) return;
+       sig->collapse(GTK_TREE_ITEM(gtkobj()));
+//     gtk_widget_hide(GTK_WIDGET(GTK_TREE(GTK_TREE_ITEM (this->gtkobj())->subtree)));
+}
+void Gtk_LdapTreeItem::expand_impl() {
+       Gtk_c_signals_TreeItem *sig=(Gtk_c_signals_TreeItem *)internal_getsignalbase();
+       if (!sig->expand) return;
+       sig->expand(GTK_TREE_ITEM(gtkobj()));
+//     Gtk_Tree *t;
+//     t = new Gtk_Tree(GTK_TREE(GTK_TREE_ITEM(this->gtkobj())->subtree));
+//     bool vis = t->visible();
+//     if (vis == false) {
+//             gtk_widget_show(GTK_WIDGET(GTK_TREE(GTK_TREE_ITEM (this->gtkobj())->subtree)));
+//             cout << this->dn << " expanded" << endl;
+//     }
+//     else {
+//             gtk_widget_hide(GTK_WIDGET(GTK_TREE(GTK_TREE_ITEM (this->gtkobj())->subtree)));
+//             cout << this->dn << " collapsed" << endl;
+//     }
+}
diff --git a/contrib/gtk-tool/Gtk_LdapTreeItem.h b/contrib/gtk-tool/Gtk_LdapTreeItem.h
new file mode 100644 (file)
index 0000000..1e728ef
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef GTK_LDAPTREEITEM_H
+#define GTK_LDAPTREEITEM_H
+#include "gtk.h"
+#include <My_Window.h>
+#include <lber.h>
+#include <ldap.h>
+
+class My_Window;
+
+class Gtk_LdapTreeItem : public Gtk_TreeItem {
+public:
+       char *dn;
+       char *rdn;
+       LDAP *ld;
+       LDAPMessage *result_identifier;
+       My_Window *par;
+       Gtk_Notebook *notebook;
+       Gtk_LdapTreeItem();
+       Gtk_LdapTreeItem(char *c, My_Window *w);
+       Gtk_LdapTreeItem(GtkTreeItem *t);
+       int search();
+       void select_impl();
+       void collapse_impl();
+       void expand_impl();
+};
+#endif
diff --git a/contrib/gtk-tool/LICENSE b/contrib/gtk-tool/LICENSE
new file mode 100644 (file)
index 0000000..5731d2c
--- /dev/null
@@ -0,0 +1,122 @@
+The OpenLDAP Public License
+
+Version 1.2, 1 September 1998
+Copyright 1998, The OpenLDAP Foundation.
+All Rights Reserved.
+
+Note:
+       This license is derived from the "Artistic License" as distributed
+       with the Perl Programming Language.  As differences may exist, the
+       complete license should be read.
+
+PREAMBLE
+
+The intent of this document is to state the conditions under which a
+Package may be copied, such that the Copyright Holder maintains some
+semblance of artistic control over the development of the package,
+while giving the users of the package the right to use and distribute
+the Package in a more-or-less customary fashion, plus the right to make
+reasonable modifications.
+
+Definitions:
+
+       "Package" refers to the collection of files distributed by the
+       Copyright Holder, and derivatives of that collection of files
+       created through textual modification.
+
+       "Standard Version" refers to such a Package if it has not been
+       modified, or has been modified in accordance with the wishes
+       of the Copyright Holder.
+
+       "Copyright Holder" is whoever is named in the copyright or
+       copyrights for the package.
+
+       "You" is you, if you're thinking about copying or distributing
+       this Package.
+
+       "Reasonable copying fee" is whatever you can justify on the
+       basis of media cost, duplication charges, time of people involved,
+       and so on.  (You will not be required to justify it to the
+       Copyright Holder, but only to the computing community at large
+       as a market that must bear the fee.)
+
+       "Freely Available" means that no fee is charged for the item
+       itself, though there may be fees involved in handling the item.
+       It also means that recipients of the item may redistribute it
+       under the same conditions they received it.
+
+1. You may make and give away verbatim copies of the source form of the
+Standard Version of this Package without restriction, provided that you
+duplicate all of the original copyright notices and associated disclaimers.
+
+2. You may apply bug fixes, portability fixes and other modifications
+derived from the Public Domain or from the Copyright Holder.  A Package
+modified in such a way shall still be considered the Standard Version.
+
+3. You may otherwise modify your copy of this Package in any way, provided
+that you insert a prominent notice in each changed file stating how and
+when you changed that file, and provided that you do at least ONE of the
+following:
+
+    a) place your modifications in the Public Domain or otherwise make them
+    Freely Available, such as by posting said modifications to Usenet or
+    an equivalent medium, or placing the modifications on a major archive
+    site such as uunet.uu.net, or by allowing the Copyright Holder to include
+    your modifications in the Standard Version of the Package.
+
+    b) use the modified Package only within your corporation or organization.
+
+    c) rename any non-standard executables so the names do not conflict
+    with standard executables, which must also be provided, and provide
+    a separate manual page for each non-standard executable that clearly
+    documents how it differs from the Standard Version.
+
+    d) make other distribution arrangements with the Copyright Holder.
+
+4. You may distribute the programs of this Package in object code or
+executable form, provided that you do at least ONE of the following:
+
+    a) distribute a Standard Version of the executables and library files,
+    together with instructions (in the manual page or equivalent) on where
+    to get the Standard Version.
+
+    b) accompany the distribution with the machine-readable source of
+    the Package with your modifications.
+
+    c) accompany any non-standard executables with their corresponding
+    Standard Version executables, giving the non-standard executables
+    non-standard names, and clearly documenting the differences in manual
+    pages (or equivalent), together with instructions on where to get
+    the Standard Version.
+
+    d) make other distribution arrangements with the Copyright Holder.
+
+5. You may charge a reasonable copying fee for any distribution of this
+Package.  You may charge any fee you choose for support of this Package.
+You may not charge a fee for this Package itself.  However,
+you may distribute this Package in aggregate with other (possibly
+commercial) programs as part of a larger (possibly commercial) software
+distribution provided that you do not advertise this Package as a
+product of your own.
+
+6. The scripts and library files supplied as input to or produced as
+output from the programs of this Package do not automatically fall
+under the copyright of this Package, but belong to whomever generated
+them, and may be sold commercially, and may be aggregated with this
+Package.
+
+7. C subroutines supplied by you and linked into this Package in order
+to emulate subroutines and variables of the language defined by this
+Package shall not be considered part of this Package, but are the
+equivalent of input as in Paragraph 6, provided these subroutines do
+not change the language in any way that would cause it to fail the
+regression tests for the language.
+
+8. The name of the Copyright Holder may not be used to endorse or promote
+products derived from this software without specific prior written permission.
+
+9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+The End
diff --git a/contrib/gtk-tool/LdapEntry.cc b/contrib/gtk-tool/LdapEntry.cc
new file mode 100644 (file)
index 0000000..0bf6bc0
--- /dev/null
@@ -0,0 +1,49 @@
+#include "LdapEntry.h"
+
+LdapEntry* LdapEntry::get_entries(LDAP *ld, char *base_dn, int level,char *filter) {
+       printf("get_entries(%s)\n", base_dn);
+       LDAPMessage **result, *entry;
+       Entry *thing;
+       char *pele;
+       int res;
+       res = ldap_search(ld, base_dn, level, filter, NULL, 0);
+       res = ldap_result(ld, res, 1, NULL, result);
+       printf("%s\n", ldap_err2string(ldap_result2error(ld, *result, 1)));
+       int num_entries = ldap_count_entries(ld, *result);
+       printf("%i results\n", num_entries);
+       int i=0;
+       entry = ldap_first_entry(ld, *result);
+       thing->dn = ldap_get_dn(ld, entry);
+       pele = ldap_get_dn(ld, entry);
+       printf("%s\n", thing->dn);
+       while (entry) {
+               printf("Child %i\n", i);
+               thing->child[i] = get_entries(ld, pele, LDAP_SCOPE_ONELEVEL, filter);
+               i++;
+               entry = ldap_next_entry(ld, entry);
+       }
+       return thing;
+}
+
+Gtk_Tree *LdapEntry::make_tree(Entry *thing) {
+       Gtk_Tree *tree, **subtree;
+       Gtk_TreeItem *treeitem;
+       gchar *c;
+       tree = new Gtk_Tree();
+       tree->set_selection_mode(GTK_SELECTION_BROWSE);
+       tree->set_view_mode(GTK_TREE_VIEW_ITEM);
+       tree->set_view_lines(false);
+       c = g_strdup_printf("%s", thing->dn);
+       printf("%s\n", c);
+       treeitem = new Gtk_TreeItem(c);
+       tree->append(treeitem);
+       treeitem->show();
+       int i=0;
+       while (thing->child[i]) {
+               subtree[i] = make_tree(thing->child[i]);
+               treeitem->set_subtree(subtree[i]);
+               i++;
+       }
+       tree->show();
+       return tree;
+}
diff --git a/contrib/gtk-tool/LdapEntry.h b/contrib/gtk-tool/LdapEntry.h
new file mode 100644 (file)
index 0000000..3ee2b97
--- /dev/null
@@ -0,0 +1,15 @@
+#ifdef MY_LDAP_ENTRY_H
+#define MY_LDAP_ENTRY_H
+#include "common.h"
+#include "gtk.h"
+#include <lber.h>
+#include <ldap.h>
+
+class LdapEntry {
+public:
+       char *dn;
+       LdapEntry **children;
+       LdapEntry* get_entries(LDAP *ld, char *base_dn, int level, char *filter);
+       Gtk_Tree* make_tree(LdapEntry *thing);
+}
+#endif
diff --git a/contrib/gtk-tool/Makefile b/contrib/gtk-tool/Makefile
new file mode 100644 (file)
index 0000000..4fc862a
--- /dev/null
@@ -0,0 +1,31 @@
+HOME_LOCATION=$(shell pwd)
+CC=    gcc
+CPLUS= g++
+OPTS=-g -DmyDEBUG
+INCLUDES=`gtkmm-config --cflags` -I/usr/include -I/usr/local/gnome/include -I.
+LDFLAGS=`gtkmm-config --libs` -L/usr/lib -L/usr/X11/lib -L/usr/local/gnome/lib -L/usr/local/ldap/lib -lldap -llber
+LIBS=-lXext -lgtkmm -lX11 -lXt -lXxf86dga
+
+.EXPORT_ALL_VARIABLES:
+
+SOURCES=       My_Window.cc My_Scroller.cc Gtk_LdapTreeItem.cc main.cc
+OBJECTS=       My_Window.o My_Scroller.o Gtk_LdapTreeItem.o main.o
+
+################################################################################
+
+all:   $(OBJECTS) $(SOURCES)
+       $(CPLUS) $(OBJECTS) -o main $(LDFLAGS)
+       exec
+
+exec:  all
+       chmod a+x main
+       ls -al main
+
+%.o: %.c
+       $(CC) -c $(OPTS) $(INCLUDES) $<
+
+%.o: %.cc
+       $(CPLUS) -c $(OPTS) $(INCLUDES) $<
+
+clean: 
+       rm -f main a.out *.o straced core
diff --git a/contrib/gtk-tool/My_Scroller.cc b/contrib/gtk-tool/My_Scroller.cc
new file mode 100644 (file)
index 0000000..0f73c8a
--- /dev/null
@@ -0,0 +1,19 @@
+#include "My_Scroller.h"
+
+#include <gtk--/container.h>
+
+void My_Scroller::remove_child(int i) {
+       cout << "Unparenting child[" << i << "]" << endl;
+       this->children[i]->unparent();
+       cout << "Deleting child[" << i << "] from children" << endl;
+//     this->remove(children()->first());
+       delete this->children[i];
+       cout << "done" << endl;
+}
+void My_Scroller::add_child(Gtk_Widget *w) {
+       cout << "My_Scroller::add_child()" << endl;
+//     w->reparent(this);
+       this->add(w);
+       cout << "done" << endl;
+       this->children[0] = w;
+}
diff --git a/contrib/gtk-tool/My_Scroller.h b/contrib/gtk-tool/My_Scroller.h
new file mode 100644 (file)
index 0000000..15ff26c
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef MY_SCROLLER_H
+#define MY_SCROLLER_H
+#include <gtk--/container.h>
+#include "gtk.h"
+
+class My_Scroller : public Gtk_ScrolledWindow {
+public:
+       Gtk_Widget *children[2];
+       void add_child(Gtk_Widget *w);
+       void remove_child(int i);
+};
+#endif
diff --git a/contrib/gtk-tool/My_Window.cc b/contrib/gtk-tool/My_Window.cc
new file mode 100644 (file)
index 0000000..38d433b
--- /dev/null
@@ -0,0 +1,105 @@
+#include <My_Window.h>
+
+My_Window::My_Window(GtkWindowType t) : Gtk_Window(t) {
+       cout << "My_Window(t)" << endl;
+       Gtk_VBox *main_hbox;
+       Gtk_HBox *top_hbox;
+
+       pane = new Gtk_HPaned();
+       this->scroller = new Gtk_ScrolledWindow();
+       this->scroller->set_policy(GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+//     this->scroller->set_usize(this->height(), 400);
+       pane->add1(this->scroller);
+       this->scroller->show();
+
+       this->scroller2 = new My_Scroller();
+       this->scroller2->set_policy(GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+       pane->add2(this->scroller2);    
+       this->scroller2->show();
+
+       top_hbox = new Gtk_HBox();
+       this->urlfield = new Gtk_Entry();
+       top_hbox->pack_start(this->urlfield, TRUE, TRUE, 1);
+       this->urlfield->show();
+       this->display_button = new Gtk_Button("Display");
+       connect_to_method(this->display_button->clicked, this, &do_display);
+       top_hbox->pack_end(this->display_button, FALSE, FALSE, 1);
+       this->display_button->show();
+
+       main_hbox = new Gtk_VBox();
+       main_hbox->pack_start(top_hbox, FALSE, TRUE, 1);
+       main_hbox->pack_end(pane, TRUE, TRUE, 1);
+       top_hbox->show();
+       pane->show();
+       this->add(main_hbox);
+       main_hbox->show();
+}
+void My_Window::do_display() {
+       cout << this->urlfield->get_text() << endl;
+}
+void My_Window::expand(Gtk_TreeItem *t) {
+       gchar *name;
+       GtkLabel *label;
+       label = GTK_LABEL (GTK_BIN (t->gtkobj())->child);
+       gtk_label_get (label, &name);
+       g_print("%s selected\n", name);
+}
+
+gint My_Window::delete_event_impl(GdkEventAny *) {
+       Gtk_Main::instance()->quit();
+       return 0;
+}
+
+Gtk_LdapItem* My_Window::make_tree(My_Window *p, LDAP* l_i, char* b_d) {
+//     printf("make_tree(%s)\n", b_d);
+       Gtk_LdapItem *treeresult, *subtreeresult;
+       Gtk_Tree *tree, *subtree, *subsubtree;
+       Gtk_LdapTreeItem *treeitem, *subtreeitem;
+       LDAPMessage *r_i, *entry;
+       gchar *c;
+       char **s;
+       char *c_num;
+       int entriesCount = 0;
+       int error;
+       int r_e_i;
+
+       error = ldap_search_s(l_i, b_d, LDAP_SCOPE_ONELEVEL, "objectclass=*", NULL, 0, &r_i);
+//     printf("%s\n", ldap_err2string(error));
+       entriesCount = ldap_count_entries(l_i, r_i);
+//     printf("%i results\n", entriesCount);
+       s = ldap_explode_dn(b_d, 1);
+       c = g_strdup_printf("%s", s[0]);
+       treeitem = new Gtk_LdapTreeItem(c, p);
+       treeitem->dn = b_d; treeitem->ld = l_i;
+       treeresult = new Gtk_LdapItem();
+       if (entriesCount == 0) { 
+               treeresult->treeitem = new Gtk_LdapTreeItem(*treeitem);
+               treeresult->tree = NULL;
+               return treeresult;
+       }
+       subtree = new Gtk_Tree();
+       subtree->set_selection_mode(GTK_SELECTION_BROWSE);
+       subtree->set_view_mode(GTK_TREE_VIEW_ITEM);
+       subtree->set_view_lines(false);
+       entry = ldap_first_entry(l_i, r_i);
+       while (entry != NULL) {
+               s = ldap_explode_dn(ldap_get_dn(l_i, entry), 1);
+               subtreeresult = make_tree(p, l_i, ldap_get_dn(l_i, entry));
+               subtreeitem = new Gtk_LdapTreeItem(*subtreeresult->treeitem);
+               subtree->append(subtreeitem);
+               printf("inserting %s into %s", s[0], c);
+               if (subtreeresult->tree != NULL) {
+                       printf(".");
+                       subsubtree = new Gtk_Tree(*subtreeresult->tree);
+                       printf(".");
+                       subtreeitem->set_subtree(subsubtree);
+                       printf(".");
+               }
+               subtreeitem->show();
+               printf("\n");
+               entry = ldap_next_entry(l_i, entry);
+       }
+       treeresult->treeitem = new Gtk_LdapTreeItem(*treeitem);
+       treeresult->tree = new Gtk_Tree(*subtree);
+       return treeresult;
+}
diff --git a/contrib/gtk-tool/My_Window.h b/contrib/gtk-tool/My_Window.h
new file mode 100644 (file)
index 0000000..7ccce31
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef MY_WINDOW_H
+#define MY_WINDOW_H
+#include "cpluscommon.h"
+#include "gtk.h"
+#include <lber.h>
+#include <ldap.h>
+#include "My_Scroller.h"
+#include "Gtk_LdapItem.h"
+#include "Gtk_LdapTreeItem.h"
+class Gtk_LdapTreeItem;
+class Gtk_LdapItem;
+class My_Scroller;
+
+class My_Window : public Gtk_Window {
+public:
+       Gtk_ScrolledWindow *scroller;
+       My_Scroller *scroller2;
+       Gtk_Entry *urlfield;
+       Gtk_Button *display_button;
+       Gtk_Paned *pane;
+       My_Window(GtkWindowType t);
+       void do_display();
+       void expand(Gtk_TreeItem *t);
+       gint delete_event_impl(GdkEventAny *);
+       Gtk_LdapItem* make_tree(My_Window *p, LDAP* l_i, char* b_d);
+};
+#endif
diff --git a/contrib/gtk-tool/README b/contrib/gtk-tool/README
new file mode 100644 (file)
index 0000000..35f0660
--- /dev/null
@@ -0,0 +1,13 @@
+This is the first version of this README
+gtk-tool v0.5delta
+
+This package has been tested and run with the latest Gtk+/Gtk--
+OpenLDAP 1.1-devel. This thing doesn't run as it should, please
+read TODO!
+
+I really couldn't think of anything else to put here (at the moment
+that is). But please feel free to add whatever else you consider
+neccessary to understanding how this thing works. Enjoy, and I hope
+this can be useful to you in some miniscule way.
+
+Pele
diff --git a/contrib/gtk-tool/TODO b/contrib/gtk-tool/TODO
new file mode 100644 (file)
index 0000000..a9ce70d
--- /dev/null
@@ -0,0 +1,22 @@
+LOADS!!!
+
+Someone please figure out how to _remove_ a widget from a container
+in Gtk+/Gtk--. As far as I know, and from my discussion with a
+certain person, it can't due to a design flaw of Gtk+ people. We
+need that first to be able to continue. The bug is reproducable
+when you start the thing, it automatically goes to the top node,
+i.e. University of Michigan, if you expand the tree a bit, then
+click on any one of the items available, it'll blow. That's because
+it needs to remove the contents in the right side of the browser
+window to be able to insert new things about the current node. And
+I didn't want to be an idiot and do it by some other means, because,
+as they've taught me in school, OO programming is meant to be used
+in a black-box fashion. If all else fails, then we'll start thinking
+about stupid solutions and their consenquences. No pun intended.
+
+All emails to -devel list, and plase make sure you put "GTK-TOOL"
+in the subject line, so other people who are not interested don't
+have to read our garbage.
+
+Pele
+pele@openldap.org
diff --git a/contrib/gtk-tool/common.h b/contrib/gtk-tool/common.h
new file mode 100644 (file)
index 0000000..1d87d13
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef MY_COMMON
+#define MY_COMMON
+
+#include "system.h"
+#include "cpluscommon.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <error.h>
+#include <string.h>
+extern int errno;
+#endif
diff --git a/contrib/gtk-tool/cpluscommon.h b/contrib/gtk-tool/cpluscommon.h
new file mode 100644 (file)
index 0000000..e16988e
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef MY_CPLUS_COMMON
+#define MY_CPLUS_COMMON
+
+#include <iostream.h>
+#include <iomanip.h>
+#include <fstream.h>
+#include <strstream.h>
+#include <unistd.h>
+#endif
diff --git a/contrib/gtk-tool/db_node.xpm b/contrib/gtk-tool/db_node.xpm
new file mode 100644 (file)
index 0000000..698b2e2
--- /dev/null
@@ -0,0 +1,364 @@
+/* XPM */
+static char * db_node_xpm[] = {
+"100 100 261 2",
+"      c None",
+".     c #010101",
+"+     c #080808",
+"@     c #090909",
+"#     c #0A0909",
+"$     c #121111",
+"%     c #222121",
+"&     c #2A2929",
+"*     c #191919",
+"=     c #0E0E0E",
+"-     c #060606",
+";     c #000000",
+">     c #030303",
+",     c #1A1919",
+"'     c #1C1B1B",
+")     c #2F2E2E",
+"!     c #3D3C3C",
+"~     c #424141",
+"{     c #545252",
+"]     c #565454",
+"^     c #555353",
+"/     c #4F4D4D",
+"(     c #3E3D3D",
+"_     c #212121",
+":     c #080707",
+"<     c #101010",
+"[     c #2F2D2D",
+"}     c #383737",
+"|     c #504E4E",
+"1     c #514F4F",
+"2     c #4B4949",
+"3     c #302F2F",
+"4     c #252424",
+"5     c #0D0D0D",
+"6     c #020202",
+"7     c #212020",
+"8     c #4E4C4C",
+"9     c #464444",
+"0     c #323131",
+"a     c #151515",
+"b     c #525050",
+"c     c #474646",
+"d     c #141313",
+"e     c #4D4B4B",
+"f     c #424040",
+"g     c #201F1F",
+"h     c #1B1A1A",
+"i     c #454444",
+"j     c #676767",
+"k     c #242424",
+"l     c #3B3A3A",
+"m     c #535151",
+"n     c #4C4A4A",
+"o     c #1B1B1B",
+"p     c #AEAEAE",
+"q     c #DBDBDB",
+"r     c #D0D0D0",
+"s     c #777777",
+"t     c #1F1F1F",
+"u     c #464545",
+"v     c #3C3A3A",
+"w     c #3F3F3F",
+"x     c #8C8C8C",
+"y     c #EEEEEE",
+"z     c #FFFFFF",
+"A     c #E7E7E7",
+"B     c #AAAAAA",
+"C     c #575757",
+"D     c #403F3F",
+"E     c #393838",
+"F     c #2E2D2D",
+"G     c #171616",
+"H     c #272727",
+"I     c #949494",
+"J     c #BEBEBE",
+"K     c #F3F3F3",
+"L     c #C7C7C7",
+"M     c #8F8F8F",
+"N     c #606060",
+"O     c #2F2F2F",
+"P     c #222222",
+"Q     c #474545",
+"R     c #4A4848",
+"S     c #2B2A2A",
+"T     c #303030",
+"U     c #868686",
+"V     c #F7F7F7",
+"W     c #FEFEFE",
+"X     c #636363",
+"Y     c #4B4B4B",
+"Z     c #111111",
+"`     c #121212",
+" .    c #131313",
+"..    c #2C2A2A",
+"+.    c #343333",
+"@.    c #232222",
+"#.    c #171717",
+"$.    c #181818",
+"%.    c #646464",
+"&.    c #9E9E9E",
+"*.    c #D5D5D5",
+"=.    c #9B9B9B",
+"-.    c #D4D4D4",
+";.    c #F9F9F9",
+">.    c #F4F4F4",
+",.    c #C6C6C6",
+"'.    c #6D6D6D",
+").    c #CCCCCC",
+"!.    c #292929",
+"~.    c #9F9F9F",
+"{.    c #BCBCBC",
+"].    c #8B8B8B",
+"^.    c #999999",
+"/.    c #FAFAFA",
+"(.    c #DFDFDF",
+"_.    c #D9D9D9",
+":.    c #1A1A1A",
+"<.    c #EBEBEB",
+"[.    c #202020",
+"}.    c #C4C4C4",
+"|.    c #686868",
+"1.    c #727272",
+"2.    c #FCFCFC",
+"3.    c #BDBDBD",
+"4.    c #A6A6A6",
+"5.    c #9A9A9A",
+"6.    c #CACACA",
+"7.    c #D7D7D7",
+"8.    c #2E2E2E",
+"9.    c #A5A5A5",
+"0.    c #EAEAEA",
+"a.    c #B5B5B5",
+"b.    c #A8A8A8",
+"c.    c #B9B9B9",
+"d.    c #989898",
+"e.    c #D6D6D6",
+"f.    c #E9E9E9",
+"g.    c #B1B1B1",
+"h.    c #ABABAB",
+"i.    c #BABABA",
+"j.    c #969696",
+"k.    c #DCDCDC",
+"l.    c #B3B3B3",
+"m.    c #BBBBBB",
+"n.    c #909090",
+"o.    c #A1A1A1",
+"p.    c #B7B7B7",
+"q.    c #EDEDED",
+"r.    c #ECECEC",
+"s.    c #0C0C0C",
+"t.    c #8D8D8D",
+"u.    c #E1E1E1",
+"v.    c #232323",
+"w.    c #E2E2E2",
+"x.    c #DADADA",
+"y.    c #1E1E1E",
+"z.    c #E5E5E5",
+"A.    c #D3D3D3",
+"B.    c #2A2A2A",
+"C.    c #141414",
+"D.    c #AFAFAF",
+"E.    c #656565",
+"F.    c #717171",
+"G.    c #C1C1C1",
+"H.    c #313131",
+"I.    c #B0B0B0",
+"J.    c #4F4F4F",
+"K.    c #CECECE",
+"L.    c #343434",
+"M.    c #B8B8B8",
+"N.    c #363636",
+"O.    c #E0E0E0",
+"P.    c #050505",
+"Q.    c #C5C5C5",
+"R.    c #C8C8C8",
+"S.    c #262626",
+"T.    c #252525",
+"U.    c #CFCFCF",
+"V.    c #F8F8F8",
+"W.    c #0A0A0A",
+"X.    c #161616",
+"Y.    c #0B0B0B",
+"Z.    c #282828",
+"`.    c #595959",
+" +    c #505050",
+".+    c #494949",
+"++    c #D1D1D1",
+"@+    c #666666",
+"#+    c #6A6A6A",
+"$+    c #2C2C2C",
+"%+    c #ACACAC",
+"&+    c #EFEFEF",
+"*+    c #5C5C5C",
+"=+    c #797979",
+"-+    c #BFBFBF",
+";+    c #535353",
+">+    c #838383",
+",+    c #F2F2F2",
+"'+    c #828282",
+")+    c #404040",
+"!+    c #353535",
+"~+    c #3B3B3B",
+"{+    c #A9A9A9",
+"]+    c #FDFDFD",
+"^+    c #4C4C4C",
+"/+    c #FBFBFB",
+"(+    c #CDCDCD",
+"_+    c #2B2B2B",
+":+    c #F6F6F6",
+"<+    c #585858",
+"[+    c #C9C9C9",
+"}+    c #7E7E7E",
+"|+    c #E4E4E4",
+"1+    c #919191",
+"2+    c #393939",
+"3+    c #ADADAD",
+"4+    c #A3A3A3",
+"5+    c #B4B4B4",
+"6+    c #B2B2B2",
+"7+    c #E6E6E6",
+"8+    c #D2D2D2",
+"9+    c #A4A4A4",
+"0+    c #CBCBCB",
+"a+    c #F0F0F0",
+"b+    c #3A3A3A",
+"c+    c #E3E3E3",
+"d+    c #9D9D9D",
+"e+    c #767676",
+"f+    c #C3C3C3",
+"g+    c #5A5A5A",
+"h+    c #707070",
+"i+    c #747474",
+"j+    c #808080",
+"k+    c #C0C0C0",
+"l+    c #DDDDDD",
+"m+    c #3D3D3D",
+"n+    c #898989",
+"o+    c #959595",
+"p+    c #F5F5F5",
+"q+    c #848484",
+"r+    c #545454",
+"s+    c #888888",
+"t+    c #383838",
+"u+    c #7D7D7D",
+"v+    c #878787",
+"w+    c #626262",
+"x+    c #6E6E6E",
+"y+    c #4A4A4A",
+"z+    c #616161",
+"A+    c #858585",
+"B+    c #929292",
+"C+    c #F1F1F1",
+"D+    c #3C3C3C",
+"E+    c #757575",
+"F+    c #6B6B6B",
+"G+    c #C2C2C2",
+"H+    c #373737",
+"I+    c #E8E8E8",
+"J+    c #7C7C7C",
+"K+    c #565656",
+"L+    c #5F5F5F",
+"                                                                                                                                                                                                        ",
+"                                                                                                                                                                                                        ",
+"                                                                                                                                                                                                        ",
+"                                                                                                                                                                                                        ",
+"                                                                                                                                                                                                        ",
+"                                                                                                                                                                                                        ",
+"                                                                                                                                                                                                        ",
+"                                                                                                                                                                                                        ",
+"                                                                                                                                                                                                        ",
+"                                                                                                                                                                                                        ",
+"                                                                                                                                                                                                        ",
+"                                                                                                                                                                                                        ",
+"                                                                        . + @ @ # $ % & & & & & & & & & & & & & & * = @ @ @ - ;                                                                         ",
+"                                                        ; ; > , ' ) ! ! ~ { ] ] ] ] ] ] ] ] ] ] ] ] ^ ] ] ] ] ] ] ] ] ] ] ] / ( ! ! _ ' $ ; ;                                                           ",
+"                                                ; : < [ } | 1 ^ ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ^ ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] { | 2 3 4 5 6                                                   ",
+"                                            6 7 ! 8 ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ^ ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] 9 0 a ;                                             ",
+"                                        + 0 b ^ ] ^ ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ^ ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ^ c _ 6                                         ",
+"                                      d e ] ] ] ] ^ ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ^ ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ^ ! >                                       ",
+"                                    ; f ] ] ] ] ] ^ ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ^ ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] g                                       ",
+"                                      h b ] ] ] ] ^ ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ^ ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ^ i =                                       ",
+"                                      j k l m ] ] ^ ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ^ ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] n & o p                                       ",
+"                                      q r s t & u 1 ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ^ ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] e v t w x y q                                       ",
+"                                      q z z A B C 5 , } D ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ^ ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] 1 E F G H I J z z z q                                       ",
+"                                      q z z z z z K L M N O F P 4 } Q Q R ^ ] ] ] ] ] ] ] ] ] ] ] ] ^ ] ] ] ] ] ] ] ] ] ] ] 1 c Q Q S 4 k T O U M y V z z z z z q                                       ",
+"                                      q z z z z z W z z z z V L L s X X Y Z ` `  .h ..+.+.+.+.+.+.+.+.+.+.+.+.+.+.@.#.` ` ` $.%.X X &.L *.z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z p =.=.=.=.=.=.=.=.=.=.=.=.=.=.-.z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z ;.>.>.>.>.;.z z z z z z z z z z W W z z z z z z z ,.'.z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z ).!.~.L {.].^./.z z z z z z z z r (.z z z z z z z _.:.z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z <.[.}.z z ;.|.1.2.3.4.{.5.6.W 7.8.9.0.a.b.c.d.e.z _.:.f.L 9.B V ;.g.h.i.j.k.z 2.i.l.m.n.*.z 7.o.p.9.q.z z z z q                                       ",
+"                                      q z z z z z r._ }.z z z ,.s.r t.V z u.v.w.x.y.b.z.M 2.z A.B.f._.C.D.2.2.E.F.A 5.z z G.H.>.I.J.W z e.*.K.L.z.z M.N.r.z z z q                                       ",
+"                                      q z z z z z r._ }.z z z O.P.h./.(.Q.R.S.p z T.U.z V.q Q.U.W.R._.X.O.z z Q.Y.q.;.7.L {.$.r I Z.p.k.<.2.`. +{.{.m..+,.z z z q                                       ",
+"                                      q z z z z z r._ }.z z z ++- m.@+#+-.u.$+%+z T.U.&+*+=+e.<.Y.L _.:.z z z q ; -+;+>+x.*.:.U.,+'+)+!+t ].!+>+z z z z z z z z q                                       ",
+"                                      q z z z z z r._ }.z z z ].~+i.Z w.z K B.%+z T.U.{+ ./.z ;.Y.L _.$.q.z z M.< t.[.W z w.:.U.V.z ]+2.&.T.%.J.z z z <.3.z z z q                                       ",
+"                                      q z z z z z K.s.h.;.;.{.^+e.f.t {+/+++L.9.z S.D.A.t J /+R.v.-+(+_+o./.:+<+5.L * U./.}.t [+}+|+2./.n.1+k.2+Q./+:+3+&+z z z q                                       ",
+"                                      q z z z z z L 4+h.G.J 6.;.z z &+5+A.y [+3.z }.3+/+f.6+-.>.-+L L L q.6.p -.z z 7+5+*.>.c.(+8+9+J m.0+]+z >.3+i.Q./+z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z W A %+a.g.d.*.z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z a+b+A.z z U.1.z z W u.V z z z ]+2.V.:+z z z z z z z z z K |+z z z z /+z &+z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z i.y.c+z z z ,+z b.1.++d+e+,+f+2+3+2+-.g+2+/+z z #+d.K 1.~.K.h+I.]+i+1.j+`.z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z q s._+@+1+k+V _.[.l+z /.m+n+u.` j.7+/.e._ 7.z z o+p+q+r+z z U.$._.s+B.r f.z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z _.F.w _+Y.t+u+S.{.{.{.{.++u.X._.W z z v+w+]+_._.2.$+x+{.{.{.{.<.s+y+z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z V.z z z p+l. .z+_+V z z z O.u.X._.W z z q.!.,.[+]+2.B.A+z z z V.A s+y+z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z B+u.z z z w.T ).$.).z z C+{+u.X._.W z z z n.~+0.z W n+D+2.z z L A.s+y+z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z 5. +g.*.L E+Q.z 3.F+G+,.m.p+5+y.l.W z z z f.'+z z z p+x v+r m.r /.%.H+&+z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z f.z.A 2.z z z W I+>.z z z z z W z z z z /+z z z z z V A 2.z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                      q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z q                                       ",
+"                                    ; q z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z 4.                                      ",
+"                                    ; p.z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z z z ;+                                      ",
+"                                      Y.n+A z z z W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z z z z z 0+^+                                        ",
+"                                          :.J+U./+W z z z z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z z z z ]+/+b.K+-                                           ",
+"                                              ; ; L+].f+V z z z z z z z z z z z z z z z z z z z z z W z z z z z z z z z z z z z z z z z z z z O.f+%.b+;                                                 ",
+"                                                      ; P H *+].].x.&+&+K z z z z z z z z z z z z z W z z z z z z z z z z z ]+&+&+&+l.].].!+H  .;                                                       ",
+"                                                                  ; ; ; #.;+;+;+;+;+9+p.p.p.p.p.p.p.p.p.p.p.p.p.p.u+;+;+;+;+y+; ; ; ;                                                                   ",
+"                                                                                                                                                                                                        ",
+"                                                                                                                                                                                                        ",
+"                                                                                                                                                                                                        ",
+"                                                                                                                                                                                                        ",
+"                                                                                                                                                                                                        ",
+"                                                                                                                                                                                                        ",
+"                                                                                                                                                                                                        ",
+"                                                                                                                                                                                                        ",
+"                                                                                                                                                                                                        ",
+"                                                                                                                                                                                                        ",
+"                                                                                                                                                                                                        ",
+"                                                                                                                                                                                                        ",
+"                                                                                                                                                                                                        "};
diff --git a/contrib/gtk-tool/gtk.h b/contrib/gtk-tool/gtk.h
new file mode 100644 (file)
index 0000000..13233c7
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef MY_GTK_INCLUDES
+#define MY_GTK_INCLUDES
+
+#include <gtk--.h>
+#include <gtk/gtk.h>
+#include <gtk--/widget.h>
+#include <gtk--/button.h>
+#include <gtk--/window.h>
+#include <gtk--/list.h>
+#include <gtk--/main.h>
+#include <gtk--sig.h>
+#include <gtk--/container.h>
+
+#endif
diff --git a/contrib/gtk-tool/ldap_manager.cc b/contrib/gtk-tool/ldap_manager.cc
new file mode 100644 (file)
index 0000000..6ede1e9
--- /dev/null
@@ -0,0 +1,132 @@
+#include "ldap_entry.h"
+
+class ldap_manager {
+       ldap_entry *entries;
+       int result_identifier;
+       char *search_filter, *base_dn;
+       char *ldap_action, *host;
+       int link_identifier;
+       int entriesCount;
+
+       int connect(char *host) {
+               this->link_identifier = ldap_connect(host);
+               if (this->link_identifier) return 1;
+               return 0;
+       }
+
+       void disconnect() {
+       //      ldap_close($this->link_identifier);
+       }
+
+       int ldapTakeAction(char *a) {
+               char *func_ptr = "ldap_".$a;
+               if (this->result_identifier = func_ptr(this->link_identifier, this->base_dn, this->search_filter)) {
+                       this->entriesCount = ldap_count_entries(this->link_identifier, this->result_identifier);
+                       return 1;
+               }
+               return 0;
+       }
+       
+       int getEntries() {
+               int i=0;
+               entry = new ldap_entry(this->link_identifier);
+               entry->r_e_i = ldap_first_entry(this->link_identifier, this->result_identifier);
+               while(entry->r_e_i) {
+                       entry->dn = ldap_get_dn(this->link_identifier, entry->r_e_i);
+                       entry->getAttributes();
+                       this->entries[i] = $entry;
+                       i++;
+                       r = entry->r_e_i;
+                       entry = new ldap_entry(this->link_identifier);
+                       entry->r_e_i = ldap_next_entry(this->link_identifier, r);
+               }
+//             ldap_free_result(this->result_identifier);
+       }
+
+       void displayEntries() {
+               printf(this->formatHTMLEntries());
+       }
+
+       void loadAttributeNames() {
+               global $attribute_names;
+               fp = fopen("at.conf2", "r");
+               int i = 0;
+               while (!feof(fp)) {
+                       string = "";
+                       foo = "";
+                       string = fgets(fp, 80);
+                       foo = strtok(string, " ");
+                       attribute_names[i][0] = foo;
+                       foo = strtok("\n");
+                       attribute_names[i][1] = foo;
+                       i++;
+               }
+               return $attribute_names;
+       }
+       char* formatHTMLBaseDN(char *dn) {
+               global $FILE, $host;
+               char *string = "";
+               attribs = ldap_explode_dn(dn, 0);
+               names = ldap_explode_dn(dn, 1);
+               for (int i=0; i<attribs["count"]; i++) {
+                       s = attribs[i];
+                       for (j=i+1; j<attribs["count"]; j++) {
+                               s = sprintf(",", attribs[j]);
+                       }
+                       if ((s[0] == "c") && (s[1] == "n")) {
+                               string = sprintf("<a href=".$FILE."?ldap_action=read&base_dn=".urlencode($s).">".$names[$i]."</a>, ";
+                       }
+                       else {
+                               $string .= "<a href=".$FILE."?ldap_action=list&base_dn=".urlencode($s).">".$names[$i]."</a>, ";
+                       }
+               }
+               return $string;
+       }
+
+       cfunction formatHTMLEntries() {
+               $string = "";
+               $string .= '<table width="100%" border=1 cellpadding=0 cellspacing=0>';
+               $string .= "\n";
+               for ($i=0; $i<count($this->entries); $i++) {
+                       $e = $this->entries[$i];
+                       $string .= $e->formatHTMLAttributes();
+               }       
+               $string .= "</table>\n";
+               return $string;
+       }
+
+       cfunction calculateTime($string, $s_t, $e_t) {
+               $tok1 = strtok($s_t, " ");
+               $msecs1 = $tok1;
+               $tok1 = strtok(" ");
+               $secs1 = $tok1;
+        
+               $tok2 = strtok($e_t, " ");
+               $msecs2 = $tok2;
+               $tok2 = strtok(" ");
+               $secs2 = $tok2;
+               $t_t = (float) ($secs2 + $msecs2) - (float) ($secs1 + $msecs1);
+               echo "execution time for <b>".$string."</b> : <b>".$t_t."</b> seconds<br>\n";
+       //      echo "start: ".$secs1."<br>\n";
+       //      echo "end: ".$secs2."<br>\n";
+               return (float) $t_t;
+       }
+       
+       cfunction stripString($string, $tokens) {
+               $s = $string;
+               for ($i=0; $i<count($tokens); $i++) {
+                       $result = "";
+                       $tok = strtok($s, $tokens[$i]);
+                       while($tok) {
+                               $result .= $tok;
+                       //      echo "result = ".$result."\n";
+                               $tok = strtok($tokens[$i]);
+                       }
+                       $s = $result;
+               //      echo "s = ".$s."\n";
+               }
+       //      echo "result = ".$result."\n";
+               return $result;
+       }
+}
+?>
diff --git a/contrib/gtk-tool/main.cc b/contrib/gtk-tool/main.cc
new file mode 100644 (file)
index 0000000..c5dfb27
--- /dev/null
@@ -0,0 +1,50 @@
+#include "cpluscommon.h"
+#include "gtk.h"
+#include <lber.h>
+#include <ldap.h>
+#include <My_Window.h>
+#include <Gtk_LdapItem.h>
+#include <Gtk_LdapTreeItem.h>
+
+int main(int argc, char **argv) {
+       My_Window *window;
+       Gtk_LdapItem *treeresult;
+       Gtk_Tree *tree, *subtree;
+       Gtk_LdapTreeItem *treeitem;
+       LDAPMessage **thing;
+       LDAP *ld;
+       char *base_dn;
+
+       Gtk_Main m(&argc, &argv);
+
+       window = new My_Window(GTK_WINDOW_TOPLEVEL);
+
+       if ((ld = ldap_open("localhost", LDAP_PORT))==NULL) {
+               perror("connection");
+       }
+
+       tree = new Gtk_Tree();
+       base_dn = "o=University of Michigan, c=US";
+       treeresult = window->make_tree(window, ld, base_dn);
+       treeitem = new Gtk_LdapTreeItem(*treeresult->treeitem);
+       tree->append(treeitem);
+       if (treeresult->tree != NULL) {
+               subtree = new Gtk_Tree(*treeresult->tree);
+               printf("inserting %s into root\n", base_dn);
+               treeitem->set_subtree(subtree);
+       }
+       treeitem->show();
+       window->scroller->add(tree);
+       tree->show();
+       window->scroller->show();
+       treeitem->search();
+       window->set_title("Hello");
+       window->activate();
+
+       window->set_usize(450, 450);
+
+       window->show();
+
+       m.run();
+       return 0;
+}
diff --git a/contrib/gtk-tool/system.h b/contrib/gtk-tool/system.h
new file mode 100644 (file)
index 0000000..a9ca018
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef MY_SYSTEM_H
+#define MY_SYSTEM_M
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <linux/string.h> /* for memcpy.h */
+#endif