]> git.sur5r.net Git - openldap/commitdiff
Update contrib software.
authorKurt Zeilenga <kurt@openldap.org>
Sun, 29 Nov 1998 22:20:20 +0000 (22:20 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sun, 29 Nov 1998 22:20:20 +0000 (22:20 +0000)
33 files changed:
contrib/gtk-tool/ChangeLog [new file with mode: 0644]
contrib/gtk-tool/Gtk_LdapTreeItem.cc
contrib/gtk-tool/Gtk_LdapTreeItem.h
contrib/gtk-tool/Makefile
contrib/gtk-tool/My_Window.cc
contrib/gtk-tool/My_Window.h
contrib/gtk-tool/README
contrib/gtk-tool/TODO
contrib/gtk-tool/main.cc
contrib/php3-tool/at.conf
contrib/php3-tool/images/I.gif [new file with mode: 0644]
contrib/php3-tool/images/L.gif [new file with mode: 0644]
contrib/php3-tool/images/Lminus.gif [new file with mode: 0644]
contrib/php3-tool/images/Lplus.gif [new file with mode: 0644]
contrib/php3-tool/images/T.gif [new file with mode: 0644]
contrib/php3-tool/images/Tminus.gif [new file with mode: 0644]
contrib/php3-tool/images/Tplus.gif [new file with mode: 0644]
contrib/php3-tool/images/foldericon.gif [new file with mode: 0644]
contrib/php3-tool/images/htmlicon.gif [new file with mode: 0644]
contrib/php3-tool/images/openfoldericon.gif [new file with mode: 0644]
contrib/php3-tool/images/top.gif [new file with mode: 0644]
contrib/php3-tool/images/topopen.gif [new file with mode: 0644]
contrib/php3-tool/images/white.gif [new file with mode: 0644]
contrib/php3-tool/include/ldap_entry.inc [new file with mode: 0644]
contrib/php3-tool/include/ldap_entry_attribute.inc [new file with mode: 0644]
contrib/php3-tool/include/ldap_manager.inc [new file with mode: 0644]
contrib/php3-tool/include/preferences.inc [new file with mode: 0644]
contrib/php3-tool/include/query_manager.inc [new file with mode: 0644]
contrib/php3-tool/include/search_form.inc [new file with mode: 0644]
contrib/php3-tool/javascript/expandable-outlines.js [new file with mode: 0644]
contrib/php3-tool/javascript/resize.js [new file with mode: 0644]
contrib/php3-tool/php3tool.conf [new file with mode: 0644]
contrib/php3-tool/style.css [new file with mode: 0644]

diff --git a/contrib/gtk-tool/ChangeLog b/contrib/gtk-tool/ChangeLog
new file mode 100644 (file)
index 0000000..dbd38b3
--- /dev/null
@@ -0,0 +1,32 @@
+ChangeLog for gtk-tool
+
+28/11/1998 - Pele
+       * Fixes, enhancements, started using ldap utility api
+       * It now traverses the whole tree at startup, not sure if it's smart
+       but I did it because of something that has no relevance to network
+       traffic
+
+27/11/1998 - Pele
+       * Added viewports, both sides now scroll automatically
+       * Brought back the "cache" stuff, now data gets reused if it's allready
+       available without redundant searches/listings.
+       * Editing pixmaps by hand is so much, er, fun!
+       * Miniscule fixes
+
+26/11/1998 - Pele
+       * Added nice icons in the browser pane - looks decent now.
+       * Fixed scrolling in the data (right) pane - now scrolls if there is
+       a long tab
+       * removed class My_Scroller
+       * removed file Gtk_LdapItem.cc (useless)
+       * commented-out the part where data gets reused instead of re-querying
+       the server, stupid I know, but for the time being if resolves some
+       problems with replacement of right pane.
+       * Misc. fixes
+
+26/11/1998 - Pele
+       * First appearance of ChangeLog
+       * Fixed removal of scrolled window on the right hand side
+         thus making gtk-tool a viable project to be worked on
+       * added command-line parameter parsing - now accepts
+         -s for server, -p for port, -b for baseDN
index a7d0e1b43bd73aecab9cce04c3524d2bb383b6a8..7efcb58d6c408ce2e0d57a14a828ac86950eb4b3 100644 (file)
@@ -1,14 +1,67 @@
 #include "Gtk_LdapTreeItem.h"
+#include <gtk--/base.h>
 
 Gtk_LdapTreeItem::Gtk_LdapTreeItem() : Gtk_TreeItem() {
+       this->objectClass = NULL;
 }
-Gtk_LdapTreeItem::Gtk_LdapTreeItem(char *c, My_Window *w) : Gtk_TreeItem(c) {
+
+Gtk_LdapTreeItem::Gtk_LdapTreeItem(char *c, My_Window *w) : Gtk_TreeItem() {
        this->rdn = c;
        this->par = w;
+       this->objectClass = NULL;
 }
+
 Gtk_LdapTreeItem::Gtk_LdapTreeItem(GtkTreeItem *t) : Gtk_TreeItem(t) {
 }
-int Gtk_LdapTreeItem::search() {
+
+Gtk_LdapTreeItem::~Gtk_LdapTreeItem() {
+       cout << "Bye" << endl;
+       delete this;
+}
+
+void Gtk_LdapTreeItem::setType(int t) {
+       cout << "Gtk_LdapTreeItem::setType(" << t << ")" << endl;
+       Gtk_Pixmap *xpm_icon;
+       Gtk_Label *label;
+       if (this->getchild() != NULL) {
+               xpm_label = new Gtk_HBox(GTK_HBOX(this->getchild()->gtkobj()));
+               xpm_label->remove_c(xpm_label->children()->nth_data(0));
+               xpm_label->remove_c(xpm_label->children()->nth_data(0));
+       }
+       else xpm_label = new Gtk_HBox();
+       if (strcasecmp(this->objectClass,"organization") == 0)
+               xpm_icon=new Gtk_Pixmap(*xpm_label, root_node);
+       else if (strcasecmp(this->objectClass,"organizationalunit") == 0)
+               xpm_icon=new Gtk_Pixmap(*xpm_label, branch_node);
+       else if (strcasecmp(this->objectClass,"person") == 0)
+               xpm_icon=new Gtk_Pixmap(*xpm_label, leaf_node);
+       else xpm_icon=new Gtk_Pixmap(*xpm_label, general_node);
+       label = new Gtk_Label(this->rdn);
+       xpm_label->pack_start(*xpm_icon, false, false, 1);
+       xpm_label->pack_start(*label, false, false, 1);
+       if (this->getchild() == NULL) this->add(xpm_label);
+       label->show();
+       xpm_label->show();
+       xpm_icon->show();
+}
+
+int Gtk_LdapTreeItem::showDetails() {
+       cout << "Gtk_LdapTreeItem::showDetails()" << endl;
+       if (this->notebook != NULL) {
+               if (par->viewport->getchild() != NULL) {
+                       par->viewport->remove_c(par->viewport->getchild()->gtkobj());
+               }
+               par->viewport->add(this->notebook);
+               this->notebook->show();
+               par->viewport->show();
+               return 0;
+       }
+       else this->getDetails();
+       this->showDetails();
+}
+
+int Gtk_LdapTreeItem::getDetails() {
+       cout << "Gtk_LdapTreeItem::getDetails()" << endl;
        int error, entriesCount;
        BerElement *ber;
        LDAPMessage *entry;
@@ -17,49 +70,36 @@ int Gtk_LdapTreeItem::search() {
        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;
-       }
+       Gtk_Viewport *viewport;
        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" };
+       const 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);
+                       if (strcasecmp(attribute, "objectclass") == 0) {
+                               if (strcasecmp(values[0],"top") == 0)
+                                       this->objectClass = strdup(values[1]);
+                               else this->objectClass = values[0];
+                       }
+                       table = new Gtk_CList(1, titles);
                        for (int i=0; i<ldap_count_values(values); i++) {
-                               gchar *t[] = { values[i] };
+                               const gchar *t[] = { values[i] };
                                table->append(t);
                        }
                        ldap_value_free(values);
                        label = new Gtk_Label(attribute);
-                       notebook->append_page(table, label);
+                       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();
-       }
+       this->setType(1);
+       cout << ".";
        return 0;
 }
 void Gtk_LdapTreeItem::select_impl() {
@@ -68,16 +108,19 @@ void Gtk_LdapTreeItem::select_impl() {
        Gtk_c_signals_Item *sig=(Gtk_c_signals_Item *)internal_getsignalbase();
        if (!sig->select) return;
        sig->select(GTK_ITEM(gtkobj()));
-       this->search();
+       this->showDetails();
 }
+
 void Gtk_LdapTreeItem::collapse_impl() {
-       cout << this->dn << " collapsed" << endl;
+//     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() {
+//     cout << this->dn << " expanded" << endl;
        Gtk_c_signals_TreeItem *sig=(Gtk_c_signals_TreeItem *)internal_getsignalbase();
        if (!sig->expand) return;
        sig->expand(GTK_TREE_ITEM(gtkobj()));
index 1e728ef3375572a0ea81d1c3acc205c9f8dcd3fc..ee8f711a1e2f588ea5b75106cdcb581501677464 100644 (file)
@@ -4,6 +4,15 @@
 #include <My_Window.h>
 #include <lber.h>
 #include <ldap.h>
+/*#include "XPMLabelBox.h"*/
+#include "icons/root_node.h"
+#include "icons/branch_node.h"
+#include "icons/leaf_node.h"
+#include "icons/general_node.h"
+
+#define ROOT_NODE 1
+#define BRANCH_NODE 2
+#define LEAF_NODE 3
 
 class My_Window;
 
@@ -11,14 +20,19 @@ class Gtk_LdapTreeItem : public Gtk_TreeItem {
 public:
        char *dn;
        char *rdn;
+       char *objectClass;
        LDAP *ld;
        LDAPMessage *result_identifier;
        My_Window *par;
        Gtk_Notebook *notebook;
+       Gtk_HBox *xpm_label;
        Gtk_LdapTreeItem();
        Gtk_LdapTreeItem(char *c, My_Window *w);
        Gtk_LdapTreeItem(GtkTreeItem *t);
-       int search();
+       ~Gtk_LdapTreeItem();
+       void setType(int t);
+       int getDetails();
+       int showDetails();
        void select_impl();
        void collapse_impl();
        void expand_impl();
index 4fc862a06019632404e919d3135259c5b47eb34b..65a52f157f2a35cc713f0a775d4f03a91f3234ed 100644 (file)
@@ -2,14 +2,14 @@ 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
+INCLUDES=`gtkmm-config --cflags` -I.
+LDFLAGS=`gtkmm-config --libs` -L/usr/lib -L/usr/X11/lib -L/usr/local/gnome/lib -L/usr/local/ldap/lib -lldap -llber -L/usr/local/kerberos/lib -lkrb5 -lkrb4
 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
+SOURCES=       My_Window.cc Gtk_LdapTreeItem.cc main.cc
+OBJECTS=       My_Window.o Gtk_LdapTreeItem.o main.o
 
 ################################################################################
 
index 38d433b0c52fd73b0dd10ac2b4a3523db1cce322..6fbe8c45c954673a8e347555e1bcae5fe0fa6e64 100644 (file)
@@ -9,31 +9,40 @@ My_Window::My_Window(GtkWindowType t) : Gtk_Window(t) {
        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);
+       pane->add1(*this->scroller);
        this->scroller->show();
 
-       this->scroller2 = new My_Scroller();
+//     this->scroller2 = new My_Scroller();
+       this->scroller2 = new Gtk_ScrolledWindow();
+       this->viewport = new Gtk_Viewport();
        this->scroller2->set_policy(GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-       pane->add2(this->scroller2);    
+       this->scroller2->add(*this->viewport);
+       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);
+       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);
+       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);
+       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();
 }
+
+My_Window::~My_Window() {
+       cout << "~My_Window()" << endl;
+       delete this;
+}
+
 void My_Window::do_display() {
        cout << this->urlfield->get_text() << endl;
 }
@@ -72,7 +81,9 @@ Gtk_LdapItem* My_Window::make_tree(My_Window *p, LDAP* l_i, char* b_d) {
        treeitem = new Gtk_LdapTreeItem(c, p);
        treeitem->dn = b_d; treeitem->ld = l_i;
        treeresult = new Gtk_LdapItem();
+       treeitem->getDetails();
        if (entriesCount == 0) { 
+       //      treeitem->setType(LEAF_NODE);
                treeresult->treeitem = new Gtk_LdapTreeItem(*treeitem);
                treeresult->tree = NULL;
                return treeresult;
@@ -86,19 +97,20 @@ Gtk_LdapItem* My_Window::make_tree(My_Window *p, LDAP* l_i, char* b_d) {
                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);
+       //      printf("inserting %s into %s", s[0], c);
+               subtree->append(*subtreeitem);
                if (subtreeresult->tree != NULL) {
-                       printf(".");
+       //              printf(".");
                        subsubtree = new Gtk_Tree(*subtreeresult->tree);
-                       printf(".");
-                       subtreeitem->set_subtree(subsubtree);
-                       printf(".");
+       //              printf(".");
+                       subtreeitem->set_subtree(*subsubtree);
+       //              printf(".");
                }
                subtreeitem->show();
-               printf("\n");
+       //      printf("\n");
                entry = ldap_next_entry(l_i, entry);
        }
+//     treeitem->setType(BRANCH_NODE);
        treeresult->treeitem = new Gtk_LdapTreeItem(*treeitem);
        treeresult->tree = new Gtk_Tree(*subtree);
        return treeresult;
index 7ccce313469d8b9d9a65d387103f242430ff5ccf..f39091ef0aa6c1f8dccd86d539b963b664940ccb 100644 (file)
@@ -4,7 +4,7 @@
 #include "gtk.h"
 #include <lber.h>
 #include <ldap.h>
-#include "My_Scroller.h"
+/*#include "My_Scroller.h"*/
 #include "Gtk_LdapItem.h"
 #include "Gtk_LdapTreeItem.h"
 class Gtk_LdapTreeItem;
@@ -13,12 +13,14 @@ class My_Scroller;
 
 class My_Window : public Gtk_Window {
 public:
-       Gtk_ScrolledWindow *scroller;
-       My_Scroller *scroller2;
+       Gtk_ScrolledWindow *scroller, *scroller2;
+       Gtk_Viewport *viewport;
+//     My_Scroller *scroller2;
        Gtk_Entry *urlfield;
        Gtk_Button *display_button;
        Gtk_Paned *pane;
        My_Window(GtkWindowType t);
+       ~My_Window();
        void do_display();
        void expand(Gtk_TreeItem *t);
        gint delete_event_impl(GdkEventAny *);
index 35f066054822e144e386a8d6be11b854953b6313..fd9a625cb3b5ae26f789e6f7e227300dfc34a3b5 100644 (file)
@@ -1,13 +1,33 @@
-This is the first version of this README
-gtk-tool v0.5delta
+README for gtk-tool v0.6
 
 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!
 
+Just type 'make' to compile and if you have all the necessary stuff it'll do so.
+You do need the latest version of Gtk+ and Gtk-- (which may be tricky to build).
+After that, hopefully all goes well, you start the thing by doing:
+./main
+
+It will default to base of o=University of Michigan, c=US", localhost, and 
+LDAP_PORT (389). This is because OpenLDAP comes with the UMICH ldif and the 
+assumption is that many of you have actually created a test db with that data 
+(to see that people don't lie when they say OpenLDAP actually works or 
+something). If you want to change any of these do ./main -h and it will give 
+you a list of supported parameters. 
+
+In short this is what you can do:
+
+./main -h ldap-server.somewhere.net -p 28345 -b "o=OpenLDAP Foundation, c=US"
+
 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.
 
+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
index a9ce70d0426f2dcb85a353197194cb0b541e0142..c8aebd70573f647c4893d033a4def535fe82f4b5 100644 (file)
@@ -1,22 +1,14 @@
 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.
+Priorities:
+       Make it useful!
+       Implement searches
+       port to autoconf (anyone? it should be easy)
 
-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.
+Optional:
+       comments in the source code     
+       port it to NT so we can use it with the NT port of OpenLDAP
+       (is there a NT port of Gtk+?)
 
 Pele
 pele@openldap.org
index c5dfb272d3de2586300d16fb7ff7207b5f9a5b06..44c8e41aa5e6307b393a927fefbadff2a5c4a9dd 100644 (file)
@@ -11,37 +11,65 @@ int main(int argc, char **argv) {
        Gtk_LdapItem *treeresult;
        Gtk_Tree *tree, *subtree;
        Gtk_LdapTreeItem *treeitem;
+       Gtk_Viewport *viewport;
        LDAPMessage **thing;
        LDAP *ld;
-       char *base_dn;
+       char *host = NULL;
+       char *base_dn = NULL;
+       int c, port = 0;
+
+       while ((c = getopt(argc, argv, "b:s:p:h")) != -1) {
+               switch (c) {
+                       case 'b':
+                               base_dn = optarg; break;
+                       case 's':
+                               host = strdup(optarg); break;
+                       case 'p':
+                               port = atoi(optarg); break;
+                       case 'h':
+                       default:
+                               fprintf(stderr, "Usage: %s [-s server] [-p port] [-b base_dn]\n", argv[0]);
+                               exit(-1);
+               }
+       }
+
+//     if (base_dn == NULL) base_dn = ldap_get_option(NULL, LDAP_OPT_BASE);
+       if (base_dn == NULL) base_dn = "o=University of Michigan, c=US";
+       if (host == NULL) ldap_get_option(NULL, LDAP_OPT_HOST_NAME, host);
+       //host = "localhost";
+       if (port == 0) port = LDAP_PORT;
 
        Gtk_Main m(&argc, &argv);
 
        window = new My_Window(GTK_WINDOW_TOPLEVEL);
 
-       if ((ld = ldap_open("localhost", LDAP_PORT))==NULL) {
+       if ((ld = ldap_open(host, 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);
+//     treeresult->treeitem->setType(ROOT_NODE);
+       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);
+       //      cout << "Inserting " << base_dn << " into root" << endl;
+               treeitem->set_subtree(*subtree);
        }
        treeitem->show();
-       window->scroller->add(tree);
+       viewport = new Gtk_Viewport();
+       viewport->add(tree);
+       window->scroller->add(viewport);
        tree->show();
+       viewport->show();
        window->scroller->show();
-       treeitem->search();
+       treeitem->showDetails();
+//     treeitem->select();
        window->set_title("Hello");
        window->activate();
 
-       window->set_usize(450, 450);
+       window->set_usize(600, 500);
 
        window->show();
 
index 9d567611dbbeca0e92494fb7b85c7de73a15a59a..b47e4984311d21b67819475f01f1307e6efefe63 100644 (file)
@@ -31,7 +31,7 @@ naminglink,Naming Link,TRUE
 nobatchupdates,No Batch Updates,FALSE
 notice,Notice,TRUE
 o,Organization,TRUE
-objectclass,Object Class,FALSE
+objectclass,Object Class,TRUE
 onvacation,On Vacation,TRUE
 ou,Organizational Unit,TRUE
 owner,Owner,TRUE
diff --git a/contrib/php3-tool/images/I.gif b/contrib/php3-tool/images/I.gif
new file mode 100644 (file)
index 0000000..e9067b2
Binary files /dev/null and b/contrib/php3-tool/images/I.gif differ
diff --git a/contrib/php3-tool/images/L.gif b/contrib/php3-tool/images/L.gif
new file mode 100644 (file)
index 0000000..a11cead
Binary files /dev/null and b/contrib/php3-tool/images/L.gif differ
diff --git a/contrib/php3-tool/images/Lminus.gif b/contrib/php3-tool/images/Lminus.gif
new file mode 100644 (file)
index 0000000..c316c83
Binary files /dev/null and b/contrib/php3-tool/images/Lminus.gif differ
diff --git a/contrib/php3-tool/images/Lplus.gif b/contrib/php3-tool/images/Lplus.gif
new file mode 100644 (file)
index 0000000..701c16c
Binary files /dev/null and b/contrib/php3-tool/images/Lplus.gif differ
diff --git a/contrib/php3-tool/images/T.gif b/contrib/php3-tool/images/T.gif
new file mode 100644 (file)
index 0000000..5803c1d
Binary files /dev/null and b/contrib/php3-tool/images/T.gif differ
diff --git a/contrib/php3-tool/images/Tminus.gif b/contrib/php3-tool/images/Tminus.gif
new file mode 100644 (file)
index 0000000..1a3b056
Binary files /dev/null and b/contrib/php3-tool/images/Tminus.gif differ
diff --git a/contrib/php3-tool/images/Tplus.gif b/contrib/php3-tool/images/Tplus.gif
new file mode 100644 (file)
index 0000000..536dbc9
Binary files /dev/null and b/contrib/php3-tool/images/Tplus.gif differ
diff --git a/contrib/php3-tool/images/foldericon.gif b/contrib/php3-tool/images/foldericon.gif
new file mode 100644 (file)
index 0000000..96b709e
Binary files /dev/null and b/contrib/php3-tool/images/foldericon.gif differ
diff --git a/contrib/php3-tool/images/htmlicon.gif b/contrib/php3-tool/images/htmlicon.gif
new file mode 100644 (file)
index 0000000..2a8fd4f
Binary files /dev/null and b/contrib/php3-tool/images/htmlicon.gif differ
diff --git a/contrib/php3-tool/images/openfoldericon.gif b/contrib/php3-tool/images/openfoldericon.gif
new file mode 100644 (file)
index 0000000..c60c811
Binary files /dev/null and b/contrib/php3-tool/images/openfoldericon.gif differ
diff --git a/contrib/php3-tool/images/top.gif b/contrib/php3-tool/images/top.gif
new file mode 100644 (file)
index 0000000..7284af1
Binary files /dev/null and b/contrib/php3-tool/images/top.gif differ
diff --git a/contrib/php3-tool/images/topopen.gif b/contrib/php3-tool/images/topopen.gif
new file mode 100644 (file)
index 0000000..9aa4240
Binary files /dev/null and b/contrib/php3-tool/images/topopen.gif differ
diff --git a/contrib/php3-tool/images/white.gif b/contrib/php3-tool/images/white.gif
new file mode 100644 (file)
index 0000000..6a62ac8
Binary files /dev/null and b/contrib/php3-tool/images/white.gif differ
diff --git a/contrib/php3-tool/include/ldap_entry.inc b/contrib/php3-tool/include/ldap_entry.inc
new file mode 100644 (file)
index 0000000..eb9d387
--- /dev/null
@@ -0,0 +1,105 @@
+<?
+include 'include/ldap_entry_attribute.inc';
+class ldap_entry {
+       var $attributes;
+       var $dn;
+       var $parent;
+       var $attributeCount;
+       var $link_identifier;
+       var $r_e_i;
+
+       cfunction ldap_entry($l_i) {
+       //      echo "creating new ldap_entry<br>\n";
+               $this->link_identifier = $l_i;
+       }
+
+       cfunction getAttributes() {
+               $i=0;
+               $attrib = new ldap_entry_attribute($this->dn);
+               $n = ldap_first_attribute($this->link_identifier, $this->r_e_i, &$ber);
+               while ($n) {
+                       $attrib->name = $n;
+                       $attrib->getValues($this->link_identifier,$this->r_e_i);
+                       $this->attributes[$i] = $attrib;
+                       $i++;
+                       $attrib = new ldap_entry_attribute($this->dn);
+                       $n = ldap_next_attribute($this->link_identifier, $this->r_e_i, $ber);
+               }
+       }
+
+       cfunction formatHTMLDN($dn) {
+               global $FILE, $host;
+               $string = "";
+               $attribs = ldap_explode_dn($dn, 0);
+               $names = ldap_explode_dn($dn, 1);
+               for ($i=0; $i<$attribs["count"]; $i++) {
+                       $s = $attribs[$i];
+                       for ($j=$i+1; $j<$attribs["count"]; $j++) {
+                               $s .= ",".$attribs[$j];
+                       }
+                       if (($s[0] == "c") && ($s[1] == "n")) {
+                               $string .= "<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>";
+                       }
+                       if ($i<$attribs["count"]-1) { $string .= ", "; }
+               }
+               return $string;
+       }
+
+       cfunction formatHTMLAttributes() {
+               global $FILE, $host;
+               $s = "";
+               $s .= "<tr>\n\t";
+               $s .= '<td colspan=2 bgcolor="#9380DB" align="center" valign="middle">';
+               $s .= "\n\t\t<h3 class=head>".$this->formatHTMLDN($this->dn)."</h3>\n";
+               $s .= "\t\t</td>\n\t</tr>\n";   
+               $c = count($this->attributes);
+               for ($i=0; $i<$c; $i++) {
+                       $attrib = $this->attributes[$i];
+                       if ($attrib->isVisible($attrib->name) == "TRUE") {
+                               $s .= $attrib->formatHTMLValues();
+                       }
+               }
+               $a = $this->attributes[0];
+               $v = $a->values[1];
+               if ($v == "organizationalUnit" || $v == "organization") {
+                       $s .= "<tr>\n\t<td colspan=2>\n";
+                       $s .= "\t\t<a href=".$FILE."?host=".urlencode($host)."&ldap_action=list&base_dn=".urlencode($this->dn).">Browse</a>\n";
+                       $s .= "\t\t</td>\n\t</tr>\n";
+               }
+               else if ($v == "person") {
+                       $s .= "<tr>\n\t<td colspan=2>\n";
+                       $s .= "\t\t<a href=".$FILE."?host=".urlencode($host)."&ldap_action=read&admin_action=modify&base_dn=".urlencode($this->dn).">Modify</a>\n";
+                       $s .= "\t\t</td>\n\t</tr>\n";
+               }
+               else {
+                       $s .= "<tr>\n\t<td colspan=2>\n\t\t&nbsp;\n\t\t</td>\n\t</tr>\n";
+               }
+               return $s;
+       }
+
+       cfunction display() {
+               global $FILE, $host;
+               echo "<tr><td colspan=2 bgcolor=gray>";
+               echo "<h3>".ldap_dn2ufn($this->dn)."</h3>";
+               echo "</td></tr>";
+               $c = count($this->attributes);
+               for ($i=0; $i<$c; $i++) {
+                       $attrib = $this->attributes[$i];
+                       $attrib->display();
+               }
+               $a = $this->attributes[0];
+               $v = $a->values[1];
+               if ($v == "organizationalUnit" || $v == "organization") {
+                       echo "<tr><td colspan=2>";
+                       echo "<a href=".$FILE."?host=".urlencode($host)."&ldap_action=list&base_dn=".urlencode($this->dn).">Browse</a>";
+                       echo "</td></tr>";
+               }
+               else {
+                       echo "<tr><td colspan=2>&nbsp;</td></tr>";
+               }
+       }
+}
+?>
diff --git a/contrib/php3-tool/include/ldap_entry_attribute.inc b/contrib/php3-tool/include/ldap_entry_attribute.inc
new file mode 100644 (file)
index 0000000..1d2167c
--- /dev/null
@@ -0,0 +1,169 @@
+<?
+class ldap_entry_attribute {
+       var $name, $values, $parent;
+       cfunction ldap_entry_attribute($d) {
+       //      echo "creating new ldap_entry_attribtute<br>\n";
+               $this->dn = $d;
+               $a = ldap_explode_dn($this->dn, 1);
+               $this->cn = $a[0];
+       }
+
+       cfunction getAttributeName($string) {
+               global $prefs;
+               for ($i=0; $i<count($prefs->attribute_names); $i++) {
+                       if ($prefs->attribute_names[$i][0] == $string) {
+                               return $prefs->attribute_names[$i][1];
+                       }       
+               }
+               return $string;
+       }
+       cfunction isVisible($string) {
+               global $prefs;
+               for ($i=0; $i<count($prefs->attribute_names); $i++) {
+                       if ($prefs->attribute_names[$i][0] == $string) {
+                               return $prefs->attribute_names[$i][2];
+                       }
+               }
+               return "FALSE";
+       }
+       
+       cfunction getValues($l_i, $r_e_i) {
+               //echo "My name is ".$this->name."<br>\n";
+               $this->values = ldap_get_values($l_i, $r_e_i, $this->name);
+       }
+
+       cfunction display() {
+               echo "<tr>\n\t<td valign=top bgcolor=white>\n";
+               echo "\t\t".$this->name."\n\t\t</td>\n\t<td valign=top bgcolor=lightyellow>\n";
+               echo "<ul type=square>\n";
+               for($i=0; $i<$this->values["count"]; $i++) {
+                       //echo "Displaying value ".$i."<br>\n";
+                       echo "<li>";
+                       $this->displayValue($i);
+                       echo "<br>\n";
+               }
+               echo "</ul>\n";
+               echo "</td>\n</tr>\n";
+       }
+
+       cfunction formatHTMLValues() {
+               $ct = $this->values["count"];
+               $str = "";
+               $str .= "<tr>\n\t<td valign=top bgcolor=white>\n";
+               $n = $this->getAttributeName($this->name);
+               $str .= "\t\t".$n."\n\t\t</td>\n\t<td valign=top bgcolor=lightyellow>\n\t\t<ul type=square>\n";
+       //      if ($ct > 1) {
+       //              $str .= "\t\t<ul type=square>\n";
+       //      }
+               for ($i=0; $i<$this->values["count"]; $i++) {
+                       $str .= "\t\t\t<li>";
+                       $str .= $this->formatHTMLValue($i);
+                       $str .= "<br>\n";
+               }
+               //if ($ct > 1) { $str .= "\t\t\t</ul>\n"; }
+               $str .= "\t\t\t</ul>\n\t\t</td>\n\t</tr>\n";
+               return $str;
+       }
+       
+       cfunction formatHTMLValue($index) {
+               global $prefs, $FILE, $host;
+               $p = "";
+               switch ($this->name) {
+                       case "cn":
+                               $p .= "<a href=".$FILE."?host=".urlencode($host)."&ldap_action=read&base_dn=".urlencode($this->dn).">".$this->values[$index]."</a>";
+                               break;
+                       case "ou":
+                               $p .= "<a href=".$FILE."?ldap_action=list&host=".urlencode($host)."&base_dn=".urlencode($this->dn).">".$this->values[$index]."</a>";
+                               break;
+                       case "seealso":
+                       case "member":
+                       case "requeststo":
+                       case "errorsto":
+                       case "owner":
+                       case "lastmodifiedby":
+                       case "modifiersname":
+                               $p .= "<a href=".$FILE."?host=".urlencode($host)."&ldap_action=read&base_dn=".urlencode($this->values[$index]).">".ldap_dn2ufn($this->values[$index])."</a>";
+                               break;
+                       case "mail":
+                               $p .= "<a href=mailto:".$this->values[$index].">".$this->values[$index]."</a>";
+                               break;
+                       case "postaladdress":
+                       case "homepostaladdress":
+                               $i=0;
+                               $tok = strtok($this->values[$index], "$");
+                               while ($tok) {
+                                       $p .= $i." ".$tok."<br>\n";
+                                       $tok = strtok("$");
+                                       $i++;
+                               }
+                               break;
+                       case "labeledurl":
+                               $tok = strtok($this->values[$index], " ");
+                               $tok2 = strtok("\0");
+                               $p .=  '<a href='.$tok.'>'.$tok2.'</a>';
+                               break;
+                       case "lastmodifiedtime":
+                       case "modifytimestamp":
+                               $t = $this->values[$index];
+                               $hour = (int) $t[6].$t[7];
+                               $minute = (int) $t[8].$t[9];
+                               $second = (int) $t[10].$t[11];
+                               $month = (int) $t[2].$t[3];
+                               $day = (int) $t[4].$t[5];
+                               $year = (int) $t[0].$t[1];
+                               $timestamp = mktime($hour, $minute, $second, $month, $day, $year);
+                               $date = date("h:i:sa, on l, dS of F Y", $timestamp);
+                               $p .= $date;
+                               break;
+                       case "jpegphoto":
+                               $p .= '<a href="'.$prefs->get("PATH.photo").'?base_dn='.urlencode($this->dn).'"><img src="'.$prefs->get("PATH.photo").'?base_dn='.urlencode($this->dn).'" alt="Image of '.$this->cn.'" border=0></a>';
+                               break;
+                       default:
+                               $p .= $this->values[$index];
+                               break;
+               }
+               return $p;
+       }
+
+       cfunction displayValue($index) {
+               //echo "ldap_entry_attribute.displayValue(".$index.")<br>\n";
+               global $FILE, $host;
+               if ($this->name == "cn") {
+                       print "<a href=".$FILE."?host=".urlencode($host)."&ldap_action=read&base_dn=".urlencode($this->dn).">".$this->values[$index]."</a>";
+               }
+               else if ($this->name == "ou") {
+                       print "<a href=".$FILE."?ldap_action=list&host=".urlencode($host)."&base_dn=".urlencode($this->dn).">".$this->values[$index]."</a>";
+               }
+               else if ($this->name == "seealso" || $this->name == "member" || $this->name == "requeststo" || $this->name == "errorsto" || $this->name == "owner" || $this->name == "lastmodifiedby" || $this->name == "modifiersname") {
+                       print "<a href=".$FILE."?host=".urlencode($host)."&ldap_action=read&base_dn=".urlencode($this->values[$index]).">".ldap_dn2ufn($this->values[$index])."</a>";
+               }
+               else if ($this->name == "mail") {
+                       print "<a href=mailto:".$this->values[$index].">".$this->values[$index]."</a>";
+               }
+               else if ($this->name == "labeledurl") {
+                       $tok = strtok($this->values[$index], " ");
+                       $tok2 = strtok("\0");
+                       print '<a href='.$tok.'>'.$tok2.'</a>';
+               }
+               else if ($this->name == "lastmodifiedtime" || $this->name == "modifytimestamp") {
+                       $t = $this->values[$index];
+                       $hour = (int) $t[6].$t[7];
+                       $minute = (int) $t[8].$t[9];
+                       $second = (int) $t[10].$t[11];
+                       $month = (int) $t[2].$t[3];
+                       $day = (int) $t[4].$t[5];
+                       $year = (int) $t[0].$t[1];
+                       $timestamp = mktime($hour, $minute, $second, $month, $day, $year);
+                       $date = date("h:i:sa, on l, dS of F Y", $timestamp);
+               //      $date = getdate($timestamp);
+               //      $date = getdate($this->values[$index]);
+               //      echo "".$date["hours"].":".$date["minutes"].",
+               //      ".$date["weekday"].",".$date["month"]." ".$date["mday"].", ".$date["year"]."<br>\n";
+                       print $date;
+               }
+               else {
+                       print $this->values[$index];
+               }
+       }
+}
+?>
diff --git a/contrib/php3-tool/include/ldap_manager.inc b/contrib/php3-tool/include/ldap_manager.inc
new file mode 100644 (file)
index 0000000..6db3fc7
--- /dev/null
@@ -0,0 +1,115 @@
+<?
+include 'include/ldap_entry.inc';
+class ldap_manager {
+       var $entries;
+       var $result_identifier, $search_filter, $base_dn;
+       var $ldap_action, $host;
+       var $link_identifier;
+       var $entriesCount;
+
+       function connect($host) {
+               $this->link_identifier = ldap_connect($host);
+               if ($this->link_identifier) return 1;
+               return 0;
+       }
+
+       function disconnect() {
+               ldap_close($this->link_identifier);
+       }
+
+       function ldapTakeAction($a = "search") {
+               $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;
+       }
+       
+       cfunction getEntries() {
+               $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);
+       }
+
+       cfunction displayEntries() {
+               echo $this->formatHTMLEntries();
+       }
+
+       cfunction formatHTMLBaseDN($dn) {
+               global $FILE, $host;
+               $string = "";
+               $attribs = ldap_explode_dn($dn, 0);
+               $names = ldap_explode_dn($dn, 1);
+               for ($i=0; $i<$attribs["count"]; $i++) {
+                       $s = $attribs[$i];
+                       for ($j=$i+1; $j<$attribs["count"]; $j++) {
+                               $s .= ",".$attribs[$j];
+                       }
+                       if (($s[0] == "c") && ($s[1] == "n")) {
+                               $string .= "<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/php3-tool/include/preferences.inc b/contrib/php3-tool/include/preferences.inc
new file mode 100644 (file)
index 0000000..11ca8f0
--- /dev/null
@@ -0,0 +1,155 @@
+<?
+class preferences {
+       var $name;
+       var $sections = array();
+       var $base_dn;
+       var $host;
+       var $attribute_names = array();
+
+       cfunction getSection($s) {
+       ////    echo "getSection(".$s.")<br>";
+               $sect = array();
+               for ($i=0; $i<count($this->sections); $i++) {
+                       $sect = $this->sections[$i];
+       //              echo $sect[0]."<br>";
+                       if ($sect[0] == $s) {
+       //                      echo "Found ".$sect[0]."<br>";
+                               return $sect[1];
+                       }       
+               }
+       //      echo "Didn't find ".$s."<br>";
+       }
+       cfunction get($s) {
+               $class = explode(".", $s);
+               $sect = $this->getSection($class[0]);
+               $values = array();
+               $values = $sect[1];
+               for ($i=0; $i<count($sect); $i++) {
+                       $values = $sect[$i];
+       //              echo $values[0]."<br>";
+                       if ($values[0] == $class[1]) {
+       //                      echo "Found ".$values[0]."<br>";
+                               return $values[1];
+                       }
+               }
+       //      echo "Didn't find ".$class[1]."<br>";
+       }
+       cfunction getName($s) {
+               $n = trim(strtok($s, "{"));
+               return $n;
+       }
+       cfunction getBody($s) {
+               $i = strpos($s, "{") + 1;
+               $j = strpos($s, "}") - 1;
+               $tok = substr($s, $i, $j-$i);
+               return $tok;
+       }
+       cfunction getValues($b) {
+               $t = '" ","\" ","\n"';
+               $av_pairs = array();
+               $pairs = array();
+               $av_pair = array();
+               $pairs = explode(";", $b);
+               for ($i=0; $i<count($pairs)-1; $i++) {
+                       $av_pair = explode(":", $pairs[$i]);
+                       $av_pair[0] = trim($av_pair[0]);
+                       $av_pair[1] = trim($this->stripString($av_pair[1], $t));
+       //              echo "<li>".$av_pair[0].":".$av_pair[1];
+                       $av_pairs[$i] = $av_pair;
+               }
+               return $av_pairs;
+       }
+       cfunction getStatements($s) {
+               $i = 0;
+               $end = strpos($s, "}");
+               while($end != FALSE) {
+                       $tok = substr($s, 0, $end+1);
+                       $s = substr($s, $end+1, strlen($s));
+       //              echo "<ul>";
+                       $this->sections[$i] = $this->getStatement($tok);
+       //              echo "</ul>\n";
+                       $end = strpos($s, "}");
+                       $i++;
+               }
+       //      echo count($this->sections)." sections<br>";
+       }
+       cfunction getStatement($s) {
+               $values[0] = $this->getName($s);
+//             echo "<li>Name ".$values[0];
+               $body = $this->getBody($s);
+//             echo "<li>Values<ul>";
+               $values[1] = $this->getValues($body);
+//             echo "</ul></li>";
+               return $values;
+       }
+       cfunction loadPreferences() {
+               if (count($preferences) != 0) {
+                       echo "I have got ".count($this->sections)." preferences here<br>\n";
+               }
+               else {
+                       $fp = fopen("php3tool.conf", "r");
+                       $i = 0;
+                       $string = "";
+                       while (!feof($fp)) {
+                               $string .= fgets($fp, 80);
+                       }
+                       fclose($fp);
+                       $this->getStatements($string);
+               }
+               $this->loadAttributeNames($this->get("PATH.attributes"));
+       }
+
+       cfunction loadAttributeNames($s = "at.conf") {
+       //      global $attribute_names;
+               if (count($this->attribute_names) != 0) {
+                       //This is bullshit here..how do we make php3
+                       //preserve an array in memory between re-loads?
+                       //And no, I'm not going to send it every time
+                       //I make a subsequent request..
+                       //If we don't fix these things it won't run
+                       //on anything smaller than a StarFire 10000
+                       //EVEN THOUGH this stuff is suprisingly fast.
+                       echo "I have got attribute_names here<br>\n";
+               }
+               else {
+                       //echo "I dont have attribute_names here<br>\n";
+                       $fp = fopen($s, "r");
+                       $i = 0;
+                       while (!feof($fp)) {
+                               $string = "";
+                               $foo = "";
+                               $string = fgets($fp, 80);
+                               $foo = strtok($string, ",");
+                               $this->attribute_names[$i][0] = $foo;
+                               $foo = strtok(",");
+                               $this->attribute_names[$i][1] = $foo;
+                               $foo = strtok("\n");
+                               $this->attribute_names[$i][2] = $foo;
+                               $i++;
+                       }
+               }
+       //      echo "Hello world:<b>".count($this->attribute_names)."</b>\n";
+       //      for ($i=0; $i<count($this->attribute_names)-1; $i++) {
+       //              echo $this->attribute_names[$i][0]." - <strong>".$this->attribute_names[$i][1]."</strong> - ".$this->attribute_names[$i][2]."<br>\n";
+       //      }       
+               return $this->attribute_names;
+       }
+
+       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/php3-tool/include/query_manager.inc b/contrib/php3-tool/include/query_manager.inc
new file mode 100644 (file)
index 0000000..a5a4021
--- /dev/null
@@ -0,0 +1,141 @@
+<?
+class query_manager {
+       function get_action() {
+               global $ldap_action;
+               if (isset ($ldap_action)) {
+                       $ldap_action = urldecode ($ldap_action);
+               }
+               else {
+                       $ldap_action = "read";
+               }
+               return $ldap_action;
+       }
+       function get_base_dn() {
+               global $base_dn;
+               if (isset ($base_dn)) {
+                       $base_dn = urldecode ($base_dn);
+               }
+               else {
+                       $base_dn = "o=University of Michigan, c=US";
+               //      $base_dn = "o=Balorda and Balorda, c=UK";
+               }
+               return $base_dn;
+       }
+
+       function get_host() {
+               global $host;
+               if (isset ($host)) {
+                       $host = urldecode($host);
+               }
+               else {
+                       $host = "localhost";
+               }
+               return $host;
+       }
+
+       function get_search_filter() {
+               global $objectclass, $attrib, $precision, $search_string;
+//             global $search_filter;
+//             if (isset ($search_filter)) {
+//                     $search_filter = urldecode($search_filter);
+//             }
+//             else {
+                       $search_filter = "(objectclass=";
+                       switch(urldecode($objectclass)) {
+                               case "People": $search_filter .= "person)";break;
+                               case "Groups": $search_filter .= "organizationalUnit)"; break;
+                               case "Joinable Groups": $search_filter .= "joinableGroup)"; break;
+                               case "Organisations": $search_filter .= "organization)"; break;
+                               default: $search_filter .= "*)"; break;
+                       }
+                       switch(urldecode($attrib)) {
+                               case "Common Name": $search_filter .= "(cn"; break;
+                               case "Surname": $search_filter .= "(sn"; break;
+                               case "Business Phone": $search_filter .= "(telephone"; break;
+                               case "E-mail Address": $search_filter .= "(mail"; break;
+                               case "Title": $search_filter .= "(title"; break;
+                               case "Distinguished Name": $search_filter .="(dn"; break;
+                               case "Location": $search_filter .="(l"; break;
+                               default: break;
+                       }
+                       switch(urldecode($precision)) {
+                               case "exactly matches": $search_filter .= "=".$search_string.")"; break;
+                               case "starts with": $search_filter .= "=".$search_string."*)"; break;
+                               case "ends with": $search_filter .= "=*".$search_string.")"; break;
+                               case "approximates": $search_filter .= "~=".$search_string.")"; break;
+                               case "contains": $search_filter .= "=*".$search_string."*)"; break;
+                               default: break;
+                       }
+                       $search_filter = "(&".$search_filter.")";
+               //      echo $search_filter;
+//             }
+               return $search_filter;
+       }
+
+       cfunction get_mode() {
+               global $mode;
+               if (isset ($mode)) {
+                       $mode = urldecode($mode);
+               }
+               else {
+                       $mode = "tree";
+               }
+               return $mode;
+       }
+
+       function display_form() {
+               global $lm, $FILE;
+?>             <form method=get action=<? echo $FILE; ?>>
+               <input type=text name=search_filter size=25 value="<? echo $lm->search_filter; ?>"><br>
+               <input type=hidden name=ldap_action value=search>
+               <input type=submit value="Search">
+               <input type=reset value="Clear">
+               </form>
+<?
+       }
+
+       cfunction makeForm($s) {
+               global $FILE;
+               echo "<table border=0 cellspacing=2 cellpadding=2 bgcolor=gray>\n";
+               for ($i=0; $i<count($s); $i++) {
+               $parameter = $s[$i];
+               echo "<form method=get action=".$FILE.">\n";
+               echo "<tr>\n\t<td colspan=2 align=left bgcolor=lightgrey>\n";
+               echo $parameter[0];
+               echo "\t\t</td>\n\t</tr>";
+               echo "<tr>\n\t<td align=left bgcolor=white>\n";
+               echo "\t\t<input type=submit width=80 height=30 value=".$parameter[1].">\n";
+               echo "\t\t</td>\n\t<td align=left bgcolor=lightyellow>\n";
+               echo "\t\t<input type=text size=25 name=".$parameter[2].">\n";
+               echo "\t\t</td>\n\t</tr>\n</form>\n";
+               }
+               echo "</table>\n";
+       }
+
+       cfunction display_console() {
+               echo '<table width="100%" border=0 cellspacing=2 cellpadding=2 bgcolor=gray><tr>';
+               echo '<td colspan=2 align=center valign=middle bgcolor=white><h2>LDAP Console</h2></td></tr><tr>';
+               echo '<td align=center valign=middle>';
+               $things = array(
+                       0 => array("Bind (authenticate) to the directory.", "bind", "who"),
+                       1 => array("Change the search base.", "cb", "where"),
+                       2 => array("Change information associated with an entry","change","entry"),
+                       3 => array("Create a new group entry","create","group"),
+                       4 => array("Edit a complete Directory entry","vedit","entry"),
+                       5 => array("Find an entry in the directory.","find","entry")
+               );
+               $this->makeForm($things);
+               echo '</td><td align=center valign=middle>';
+               $things = array(
+                       0 => array("Change the group base.","groupbase","where"),
+                       1 => array("Display detailed help for a function","help","command"),
+                       2 => array("Subscribe to a group.","join","group"),
+                       3 => array("List the groups owned by someone","list","who"),
+                       4 => array("List out the groups in which someone is a member.", "memberships", "who"),
+                       5 => array("Remove obsolete entries from a group.", "purge", "group")
+               );
+               $this->makeForm($things);
+               echo '</td></tr></table>';
+       }
+}
+?>
diff --git a/contrib/php3-tool/include/search_form.inc b/contrib/php3-tool/include/search_form.inc
new file mode 100644 (file)
index 0000000..6dee433
--- /dev/null
@@ -0,0 +1,80 @@
+<?
+function display_options($string) {
+?>
+       <select name="precision">
+               <option>exactly matches</option>
+               <option selected>approximates</option>
+               <option>starts with</option>
+               <option>ends with</option>
+               <option>contains</option>
+               </select>
+<?
+}
+function display_items($string) {
+?>
+       <select name="objectclass">
+               <option selected>People</option>
+               <option>Groups</option>
+               <option>Joinable Groups</option>
+               <option>Services</option>
+               <option>Organisations</option>
+               <option>Documents</option>
+               </select>
+<?
+}
+function display_attribs($string) {
+?>
+       <select name="attrib">
+               <option selected>Common Name</option>
+               <option>Surname</option>
+               <option>Business Phone</option>
+               <option>E-mail Address</option>
+               <option>Distinguished Name</option>
+               <option>Title</option>
+               <option>Location</option>
+               </select>
+<?
+}
+
+function display_base_dn($string) {
+?>
+       <select name="base_dn">
+               <option value="c=US">US</option>
+               <option value="o=University of Michigan, c=US" selected>University of Michigan</option>
+               <option value="o=Balorda and Balorda, c=UK">Balorda and Balorda</option>
+               </select>
+<?
+}
+               
+function display_simple_form() {
+       global $lm, $FILE;
+?>     <form method=form action=<? echo $FILE; ?>>
+       <input type=text name=search_filter size=25 value="<? echo $lm->search_filter; ?>"><br>
+       <input type=hidden name=ldap_action value=search>
+       <input type=submit value="Search"><input type=reset value="Clear">
+       </form><?
+}
+
+function display_advanced_form() {
+       global $lm, $FILE;
+?>
+       <table width="100%" border=1 cellspacing=0 cellpadding=0>
+       <tr>
+               <td colspan=2 bgcolor="lightyellow"> <!bgcolor=#9380DB>
+                       <p class=form>
+                       <form method=get action=<? echo $FILE; ?>>
+                       Find <?display_items("objectclass")?>
+                       within <?display_base_dn("base_dn")?>
+                       whose <?display_attribs("attrib")?><br>
+                       <?display_options("precision")?>
+                       <input type=text name=search_string size=25 value="">
+                       <input type=hidden name=ldap_action value=search>
+                       <input type=submit value="Search">
+                       </form>
+                       </p>
+                       </td>
+               </tr>
+       </table>
+<?
+}
+?>
diff --git a/contrib/php3-tool/javascript/expandable-outlines.js b/contrib/php3-tool/javascript/expandable-outlines.js
new file mode 100644 (file)
index 0000000..83c1c93
--- /dev/null
@@ -0,0 +1,133 @@
+       var bV=parseInt(navigator.appVersion);
+       NS4=(document.layers) ? true : false;
+       IE4=((document.all)&&(bV>=4))?true:false;
+       ver4 = (NS4 || IE4) ? true : false;
+       function expandIt(){return}
+       function expandAll(){return}
+       isExpanded = false;
+
+       function getIndex(el) {
+               ind = null;
+               for (i=0; i<document.layers.length; i++) {
+                       whichEl = document.layers[i];
+                       if (whichEl.id == el) {
+                               ind = i;
+                               break;
+                       }
+               }
+               return ind;
+       }
+
+       function arrange() {
+               nextY = document.layers[firstInd].pageY + document.layers[firstInd].document.height;
+               for (i=firstInd+1; i<document.layers.length; i++) {
+                       whichEl = document.layers[i];
+                       if (whichEl.visibility != "hide") {
+                               whichEl.pageY = nextY;
+                               nextY += whichEl.document.height;
+                       }
+               }
+       }
+
+       function initIt(){
+               if (NS4) {
+                       for (i=0; i<document.layers.length; i++) {
+                               whichEl = document.layers[i];
+                               if (whichEl.id.indexOf("Child") != -1) whichEl.visibility = "hide";
+                       }
+                       arrange();
+               }
+               else {
+                       tempColl = document.all.tags("div");
+                       for (i=0; i<tempColl.length; i++) {
+                               if (tempColl(i).className == "child") tempColl(i).style.display = "none";
+                       }
+               }
+       }
+
+       function expandIt(el) {
+               if (!ver4) return;
+               if (IE4) {expandIE(el)} else {expandNS(el)}
+       }
+
+       function expandIE(el) { 
+               whichEl = eval(el + "Child");
+               whichIm = event.srcElement;
+               if (whichEl.style.display == "none") {
+                       whichEl.style.display = "block";
+                       whichIm.src = "true.gif";               
+               }
+               else {
+                       whichEl.style.display = "none";
+                       whichIm.src = "false.gif";
+               }
+       }
+
+       function expandNS(el) {
+               whichEl = eval("document." + el + "Child");
+               whichIm = eval("document." + el + "Parent.document.images['imEx']");
+               if (whichEl.visibility == "hide") {
+                       whichEl.visibility = "show";
+                       whichIm.src = "true.gif";
+               }
+               else {
+                       whichEl.visibility = "hide";
+                       whichIm.src = "false.gif";
+               }
+               arrange();
+       }
+
+       function showAll() {
+               for (i=firstInd; i<document.layers.length; i++) {
+                       whichEl = document.layers[i];
+                       whichEl.visibility = "show";
+               }
+       }
+
+       function expandAll(isBot) {
+               newSrc = (isExpanded) ? "false.gif" : "true.gif";
+       
+               if (NS4) {
+               document.images["imEx"].src = newSrc;
+                       for (i=firstInd; i<document.layers.length; i++) {
+                               whichEl = document.layers[i];
+                               if (whichEl.id.indexOf("Parent") != -1) {
+                                       whichEl.document.images["imEx"].src = newSrc;
+                               }
+                               if (whichEl.id.indexOf("Child") != -1) {
+                                       whichEl.visibility = (isExpanded) ? "hide" : "show";
+                               }
+                       }
+       
+                       arrange();
+                       if (isBot && isExpanded) scrollTo(0,document.layers[firstInd].pageY);
+               }
+               else {
+                       divColl = document.all.tags("div");
+                       for (i=0; i<divColl.length; i++) {
+                               if (divColl(i).className == "child") {
+                                       divColl(i).style.display = (isExpanded) ? "none" : "block";
+                               }
+                       }
+                       imColl = document.images.item("imEx");
+                       for (i=0; i<imColl.length; i++) {
+                               imColl(i).src = newSrc;
+                       }
+               }
+       
+               isExpanded = !isExpanded;
+       }
+
+with (document) {
+       write("<style type='text/css'>");
+       if (NS4) {
+               write(".parent {position:absolute; visibility:hidden}");
+               write(".child {position:absolute; visibility:hidden}");
+               write(".regular {position:absolute; visibility:hidden}")
+       }
+       else {
+               write(".child {display:none}")
+       }
+       write("</style>\n");
+}
+onload = initIt;
diff --git a/contrib/php3-tool/javascript/resize.js b/contrib/php3-tool/javascript/resize.js
new file mode 100644 (file)
index 0000000..01dfc1b
--- /dev/null
@@ -0,0 +1,21 @@
+/**
+ * resize.js 0.3 970811
+ * by gary smith
+ * js component for "reloading page onResize"
+ */
+
+if(!window.saveInnerWidth) {
+  window.onresize = resize;
+  window.saveInnerWidth = window.innerWidth;
+  window.saveInnerHeight = window.innerHeight;
+}
+
+function resize() {
+    if (saveInnerWidth < window.innerWidth || 
+        saveInnerWidth > window.innerWidth || 
+        saveInnerHeight > window.innerHeight || 
+        saveInnerHeight < window.innerHeight ) 
+    {
+        window.history.go(0);
+    }
+}
diff --git a/contrib/php3-tool/php3tool.conf b/contrib/php3-tool/php3tool.conf
new file mode 100644 (file)
index 0000000..a71123c
--- /dev/null
@@ -0,0 +1,10 @@
+PATH {
+       attributes: "at.conf";
+       photo: "ldap-photo.php3";
+}
+
+BASE {
+       basedn: "o=University of Michigan, c=US";
+       other: "o=Balorda and Balorda, c=UK";
+       other: "o=Simpson Family, c=ES";
+}
diff --git a/contrib/php3-tool/style.css b/contrib/php3-tool/style.css
new file mode 100644 (file)
index 0000000..f27247c
--- /dev/null
@@ -0,0 +1,24 @@
+       BODY,B,P,H2,H1 {
+               font-family: lucida sans unicode;
+       }
+       BODY,P {
+               font-weight: bold;
+               font-size: 12pt;
+       }
+       .form {
+               font-size: 10pt;
+               color: #003333;
+       }
+       H3 {
+               font-family: Verdana,Arial,Helvetica;
+               font-size: 12pt;
+               font-weight: bold;
+       }
+       .head {
+               font-size: 13pt;
+               color: #003333;
+       }
+       .subsection {
+               font-size: 12pt;
+               color: #003333;
+       }