blob: 4a4852664c2338165cf50912f63753b56368f127 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# $Id: ldappick.tcl 1204 2009-02-02 19:54:23Z hubert@u.washington.edu $
# ========================================================================
# Copyright 2006 University of Washington
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ========================================================================
# ldappick.tcl
#
# Purpose: CGI script to handle LDAP result choices from the
# via the LDAP result browser generated form
# Input:
set pick_vars {
{cid "Missing Command ID"}
{field "Missing Field Name"}
{ldapquery "Missing LDAP Query"}
{ldapList "" ""}
{addresses "" ""}
{addrop {} ""}
{cancel {} 0}
}
# Output:
#
# read vars
foreach item $pick_vars {
if {[catch {cgi_import [lindex $item 0].x}]} {
if {[catch {eval WPImport $item} result]} {
error [list _action "Impart Variable" $result]
}
} else {
set [lindex $item 0] 1
}
}
if {$cid != [WPCmd PEInfo key]} {
catch {WPCmd PEInfo statmsg "Invalid Command ID"}
}
if {$cancel != 1 && !([string compare cancel [string tolower $cancel]] == 0 || [string compare cancel [string tolower $addrop]] == 0) && [string length $ldapList] > 0} {
set ldapListStr [join $ldapList ","]
if {[catch {WPCmd PELdap setaddrs $ldapquery $ldapListStr $addresses 0} newaddrlist]} {
WPCmd PEInfo statmsg "LDAP Error: $newaddrlist"
} else {
regsub -all "'" $newaddrlist "\\'" newaddrs
if {[catch {WPCmd PEInfo set suspended_composition} msgdata]} {
WPCmd PEInfo statmsg "Cannot read message data: $msgdata"
} else {
if {[info exists newaddrs]} {
for {set i 0} {$i < [llength $msgdata]} {incr i} {
set orig_field [lindex [lindex $msgdata $i] 0]
regsub -all -- - [string tolower $orig_field] _ fn
if {[string compare $fn $field] == 0} {
set msgdata [lreplace $msgdata $i $i [list $orig_field $newaddrs]]
break
}
}
if {[catch {WPCmd PEInfo set suspended_composition $msgdata} result]} {
WPCmd PEInfo statmsg "Cannot Update $field field: $result"
}
}
}
}
}
source [WPTFScript compose]
|