2
# $Id: select2.tcl 391 2007-01-25 03:53:59Z mikes@u.washington.edu $
3
# ========================================================================
4
# Copyright 2006 University of Washington
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
10
# http://www.apache.org/licenses/LICENSE-2.0
12
# ========================================================================
16
# Purpose: CGI script to generate html form used to gather info
17
# for message searching selection
25
# HTML/CSS data representing form for text select input
27
# coerce uid to zero since there's not method in WPL yet to initiate
28
# a search from a particular message.
32
# inherit global config
38
if {[catch {WPCmd PEMessage $uid number} thisnum]} {
52
WPStdHtmlHdr "Select By Text"
56
cgi_body BGCOLOR="$_wp(bordercolor)" {
58
catch {WPCmd PEInfo set wp_index_script fr_select.tcl}
59
catch {WPCmd PEInfo set help_context select}
61
cgi_form $_wp(appdir)/wp method=get name=auth target=body {
62
cgi_text "page=index" type=hidden notab
63
cgi_text "doselect=1" type=hidden notab
64
cgi_table border=0 cellspacing=0 cellpadding=2 width="100%" height="100%" {
66
cgi_table_data align=center valign=top class=dialog {
67
cgi_table width="80%" {
71
cgi_puts "[cgi_nl][cgi_nl]This page provides a way to search for specific messsages within the currently open folder, [cgi_bold [WPCmd PEMailbox mailboxname]]. Simply fill in the criteria below and click the assoicated [cgi_italic Search] button. All messages matching the criteria will be marked with a check in the box next to their line in the Message List.[cgi_nl][cgi_nl]"
72
cgi_puts "Click [cgi_italic Cancel] to return to the Message List without searching.[cgi_nl]"
77
if {[WPCmd PEMailbox selected]} {
78
cgi_table_row class=dialog {
79
cgi_table_data colspan=2 align=center valign=middle class=dialog {
80
cgi_put [cgi_font face=tahoma,verdana,geneva "Since some messages are already marked, choose whether criteria specified here should "]
82
cgi_option "search all messages in '[WPCmd PEMailbox mailboxname]'" value=broad selected
83
cgi_option "search within marked messages only." value=narrow
84
cgi_option "discard previous marks and search anew." value=new
92
cgi_text result=broad type=hidden notab
95
cgi_table_row class=dialog {
97
cgi_table width=100% border=2 cellpadding=8 {
99
cgi_table_data bgcolor=#CC9900 {
100
cgi_radio_button by=text
103
cgi_table_data valign=top align=center nowrap class=dialog {
104
cgi_put [cgi_bold "Search for Text in Message Headers or Body"]
107
cgi_put "Select messages with text "
108
cgi_select textcase {
109
cgi_option "in" value=ton
110
cgi_option "NOT in" value=not
116
cgi_put [cgi_font face=tahoma,verdana,geneva "the message's "]
118
set fromaddr [WPCmd PEMessage $uid fromaddr]
119
set deftext $fromaddr
125
{Subject: field} subj ""
126
{From: field} from selected
129
{recipient fields} recip ""
130
{participant fields} partic ""
131
{text, anywhere} any ""
135
foreach {x y z} $fields {
136
cgi_option $x value=$y $z
142
cgi_put [cgi_font face=tahoma,verdana,geneva "matching "]
143
cgi_text text=$deftext size=20 maxlength=256
146
set ft [WPJSQuote $fromaddr]
147
set tt [WPJSQuote [WPCmd PEMessage $uid toaddr]]
148
set st [WPJSQuote [WPCmd PEMessage $uid subject]]
149
if {[string length $ft] || [string length $tt] || [string length $st]} {
150
cgi_put "[cgi_nl]Using "
152
cgi_option "- Nothing -" ""
153
if {[string length $ft]} {
154
cgi_option "From Address" value=$ft selected
156
if {[string length $tt]} {
157
cgi_option "To Address" value=$tt
159
if {[string length $st]} {
160
cgi_option "Subject Text" value=$st
163
cgi_put " of message ${thisnum}"
169
cgi_table_row class=dialog {
170
cgi_table_data bgcolor=#CC9900 {
171
cgi_radio_button by=date
174
cgi_table_data valign=top align=center class=dialog {
175
cgi_put [cgi_bold "Search for Messages by Date"]
178
cgi_put "Messages dated "
180
cgi_select datecase {
181
foreach i {On Since Before} {
182
cgi_option $i value=[string tolower $i]
191
set today [string tolower [WPCmd PEMessage $uid date month]]
193
set today [string tolower [clock format [clock seconds] -format %b]]
211
foreach {x y} $months {
213
cgi_option $x value=$y selected
215
cgi_option $x value=$y
222
set today [WPCmd PEMessage $uid date day]
224
set today [clock format [clock seconds] -format %d]
227
for {set i 1} {$i <= 31} {incr i} {
228
set v [format "%.2d" $i]
230
cgi_option $i value=$v selected
232
cgi_option $i value=$v
237
cgi_put ",[cgi_nbspace]"
238
cgi_select dateyear {
240
set now [WPCmd PEMessage $uid date year]
242
set now [clock format [clock seconds] -format "%Y"]
245
cgi_option $now value=$now selected
246
for {set n [expr $now - 1]} {$n >= 1970} {incr n -1} {
247
cgi_option $n value=$n
253
cgi_table_row class=dialog {
254
cgi_table_data bgcolor=#CC9900 {
255
cgi_radio_button by=status
258
cgi_table_data class=dialog align=center {
259
cgi_put [cgi_bold "Search for Messages with Certain Flag Settings"]
262
cgi_puts [cgi_font face=tahoma,verdana,geneva "Messages "]
263
cgi_select statcase {
264
cgi_option "flagged" value=ton
265
cgi_option "NOT flagged" value=not
268
cgi_puts [cgi_font face=tahoma,verdana,geneva " :"]
278
foreach {x y} $statuses {
280
cgi_table_data align=right width="42%" {
281
cgi_radio_button flag=$y
284
cgi_table_data align=left {
296
cgi_table_row class=dialog {
297
cgi_table_data valign=top align=center nowrap class=dialog {
299
cgi_submit_button ok=Search
300
cgi_submit_button cancel=Cancel
304
cgi_table_row class=dialog {
305
cgi_table_data colspan=2 valign=top align=center class=dialog {
308
cgi_puts [cgi_nl][cgi_nl][cgi_font size=-1 "Note, if the number of messages in this folder is larger than the number of lines in the Message List, then some matching messages may not be visible without paging/scrolling."]