1#!./tclsh
2# $Id: ldapquery.tcl 1204 2009-02-02 19:54:23Z hubert@u.washington.edu $
3# ========================================================================
4# Copyright 2006 University of Washington
5#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10#     http://www.apache.org/licenses/LICENSE-2.0
11#
12# ========================================================================
13
14#  ldapquery.tcl
15#
16#  Purpose:  CGI script to handle ldap query
17
18#  Input:
19set ldap_vars {
20  {dir		"Missing Directory Index"}
21  {srchstr	{}	""}
22  {field	{}	""}
23  {op		{}	""}
24  {searchtype	{}	""}
25}
26
27#  Output:
28#
29#	HTML/Javascript/CSS data representing the message specified
30#	by the 'uid' argument
31
32# inherit global config
33source ./alpine.tcl
34source cmdfunc.tcl
35
36
37set ldap_menu {
38}
39
40set common_menu {
41  {
42    {}
43    {
44      {
45	# * * * * Ubiquitous INBOX link * * * *
46	if {[string compare inbox [string tolower [WPCmd PEMailbox mailboxname]]]} {
47	  cgi_put [cgi_url INBOX open.tcl?folder=INBOX&colid=0&cid=[WPCmd PEInfo key] target=_top class=navbar]
48	} else {
49	  cgi_put [cgi_url INBOX fr_main.tcl target=_top class=navbar]
50	}
51      }
52    }
53  }
54  {
55    {}
56    {
57      {
58	# * * * * FOLDER LIST * * * *
59	cgi_puts [cgi_url "Folder List" "wp.tcl?page=folders&cid=[WPCmd PEInfo key]" target=_top class=navbar]
60      }
61    }
62  }
63  {
64    {}
65    {
66      {
67	# * * * * COMPOSE * * * *
68	cgi_puts [cgi_url Compose wp.tcl?page=compose&oncancel=addrbook&cid=[WPCmd PEInfo key] target=_top class=navbar]
69      }
70    }
71  }
72  {
73    {}
74    {
75      {
76	# * * * * RESUME * * * *
77	cgi_puts [cgi_url Resume wp.tcl?page=resume&oncancel=addrbook&cid=[WPCmd PEInfo key] class=navbar]
78      }
79    }
80  }
81  {
82    {}
83    {
84      {
85	# * * * * Addr books * * * *
86	cgi_puts [cgi_url "Address Book" wp.tcl?page=addrbook&oncancel=main.tcl target=_top class=navbar]
87      }
88    }
89  }
90  {{cgi_puts [cgi_nbspace]}}
91  {
92    {}
93    {
94      {
95	# * * * * HELP * * * *
96	cgi_puts [cgi_url "Get Help" "wp.tcl?page=help&oncancel=addrbook" target=_top class=navbar]
97      }
98    }
99  }
100  {{cgi_puts [cgi_nbspace]}}
101  {
102    {}
103    {
104      {
105	# * * * * QUIT * * * *
106	cgi_puts [cgi_url "Quit Web Alpine" "$_wp(serverpath)/session/logout.tcl?cid=[WPCmd PEInfo key]&sessid=$sessid class=navbar" target=_top class=navbar]
107      }
108    }
109  }
110}
111
112
113WPEval $ldap_vars {
114  cgi_http_head {
115    WPStdHttpHdrs
116  }
117
118  cgi_html {
119    cgi_head {
120      cgi_http_equiv Refresh "0; url=$_wp(serverpath)/$_wp(appdir)/$_wp(ui1dir)/ldapresult.tcl?dir=${dir}&srchstr=[WPPercentQuote ${srchstr}]&field=${field}&op=${op}&searchtype=${searchtype}&sessid=${sessid}"
121    }
122
123    cgi_body BGCOLOR="$_wp(bordercolor)" {
124
125      cgi_table border=0 cellspacing=0 cellpadding=2 width="100%" height="100%" {
126	cgi_table_row {
127	  cgi_table_data valign=top rclass=navbar {
128	    WPTFCommandMenu {} {}
129	  }
130
131	  cgi_table_data valign=top bgcolor=#ffffff width=100% {
132	    cgi_table border=0 width=500 cellpadding=3 {
133	      cgi_table_row {
134		cgi_table_data align=center "style=\"padding-top:120px\"" {
135		  cgi_put "[cgi_font "style=\"font-family: arial, sans-serif; font-size:18pt; font-weight: bold\"" "Searching Directory "][cgi_img [WPimg dotblink]]"
136		}
137	      }
138	    }
139	  }
140	}
141      }
142    }
143  }
144}
145