/
sellib.tcl
140 lines (85 loc) · 3.35 KB
/
sellib.tcl
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
####################################################
# Sguil procs that deal with selection and #
# Multi-selection of events #
####################################################
# $Id: sellib.tcl,v 1.7 2006/06/02 20:53:14 bamm Exp $
#
# ReSetMotion: Reset Motion Vars on a button release
#
proc SelectNextEvent { paneName index } {
global ACTIVE_EVENT
set listSize [$paneName size]
if { $listSize == 0 } { set ACTIVE_EVENT 0; return }
if { $index < $listSize } {
$paneName selection set $index
SelectEventPane $paneName EVENT EVENT
} elseif { $index > 0 } {
$paneName selection set [expr $index - 1]
SelectEventPane $paneName EVENT EVENT
}
}
proc SelectUp {} {
global CUR_SEL_PANE
set listSize [$CUR_SEL_PANE(name) size]
if { $listSize == 0 } { set ACTIVE_EVENT 0; return }
set selectedIndex [$CUR_SEL_PANE(name) curselection]
# Can't move up
if { $selectedIndex == 0 } { return }
set nIndex [expr $selectedIndex - 1]
$CUR_SEL_PANE(name) selection clear $selectedIndex
$CUR_SEL_PANE(name) selection set $nIndex
$CUR_SEL_PANE(name) see $nIndex
if { $CUR_SEL_PANE(type) == "EVENT" } {
SelectEventPane $CUR_SEL_PANE(name) EVENT EVENT
} elseif { $CUR_SEL_PANE(type) == "SANCP" } {
SelectSessionPane $CUR_SEL_PANE(name) SANCP SSN
} elseif { $CUR_SEL_PANE(type) == "PADS" } {
SelectPadsPane $CUR_SEL_PANE(name) PADS PADS
}
}
proc SelectDown {} {
global CUR_SEL_PANE
set listSize [$CUR_SEL_PANE(name) size]
if { $listSize == 0 } { set ACTIVE_EVENT 0; return }
set selectedIndex [$CUR_SEL_PANE(name) curselection]
set nIndex [expr $selectedIndex + 1]
# Can't move down
if { $nIndex == $listSize } { return }
$CUR_SEL_PANE(name) selection clear $selectedIndex
$CUR_SEL_PANE(name) selection set $nIndex
$CUR_SEL_PANE(name) see $nIndex
if { $CUR_SEL_PANE(type) == "EVENT" } {
SelectEventPane $CUR_SEL_PANE(name) EVENT EVENT
} elseif { $CUR_SEL_PANE(type) == "SANCP" } {
SelectSessionPane $CUR_SEL_PANE(name) SANCP SSN
} elseif { $CUR_SEL_PANE(type) == "PADS" } {
SelectPadsPane $CUR_SEL_PANE(name) PADS PADS
}
}
proc UserSelectedEvent { eventID uid } {
global rtPaneArray
# Loop through each pane until we find the matching eventID (sid.alert)
foreach rtPane [array names rtPaneArray] {
# A list of eventIDs in this pane
set eidList [$rtPaneArray($rtPane) getcolumns alertID]
set ematch [lsearch -exact $eidList $eventID]
# Act on a match
if { $ematch >= 0 } {
# Update the status txt to be the user's uid
$rtPaneArray($rtPane) cellconfigure $ematch,status -window "EventStatusLabel [list white $uid]"
}
}
}
proc UserUnSelectedEvent { eventID uid } {
global rtPaneArray eventArray
foreach rtPane [array names rtPaneArray] {
set eidList [$rtPaneArray($rtPane) getcolumns alertID]
set ematch [lsearch -exact $eidList $eventID]
# Found the match
if { $ematch >= 0 } {
set priority [lindex $eventArray($eventID) 1]
set statusColor [GetColorByPriority $priority]
$rtPaneArray($rtPane) cellconfigure $ematch,status -window "EventStatusLabel [list $statusColor RT]"
}
}
}