2
# $Id: queryquit.tcl 864 2007-12-11 20:21:47Z 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 confirm quitting
17
# webpine while offering to expunge deleted
21
# params : array of key/value pairs to submit with form
22
# oncancel : url to reference should user cancel confirmation
29
# HTML/Javascript/CSS data representing the message specified
30
# by the 'uid' argument
32
# inherit global config
42
cgi_image_button quit=[WPimg but_create] border=0 alt="Create"
50
# * * * * CANCEL * * * *
51
cgi_puts [cgi_url [cgi_img [WPimg but_cancel] border=0 alt="Cancel"] wp.tcl?${oncancel}]
59
if {$cid != [WPCmd PEInfo key]} {
60
error "Invalid Command ID"
63
catch {WPCmd PEInfo expungecheck quit} prompts
69
set ewc [WPCmd PEInfo feature expunge-without-confirm]
70
set ewce [WPCmd PEInfo feature expunge-without-confirm-everywhere]
72
foreach prompt $prompts {
73
if {[lindex $prompt 1] > 0} {
76
if {[lindex $prompt 1] > 0 && ($ewc || $ewce) && [lindex $prompt 2] == 1} {
78
lappend qhid [cgi_buffer {cgi_text expinbox=1 type=hidden notab}]
79
} elseif {[lindex $prompt 1] > 0 && [lindex $prompt 2] == 0 && ($ewce || ($ewc && [lindex $prompt 3] == 1))} {
81
lappend qhid [cgi_buffer {cgi_text expcurrent=1 type=hidden notab}]
91
WPStdHtmlHdr "Quitting Web Alpine"
94
cgi_put "<style type='text/css'>"
95
cgi_put ".expungebox { background-color:AntiqueWhite }"
96
cgi_put ".clickit { cursor: pointer }"
100
cgi_body BGCOLOR="$_wp(bordercolor)" {
102
#catch {WPCmd PEInfo set help_context quit}
103
cgi_table width=100% height=100% cellspacing=0 cellpadding=0 {
105
cgi_table_data width=112 bgcolor=$_wp(bordercolor) {
106
cgi_put [cgi_img [WPimg dot2]]
109
cgi_table_data align=center valign=top bgcolor="$_wp(dialogcolor)" {
111
cgi_form $_wp(appdir)/do_quit method=get id=quitting target=_top {
112
cgi_text cid=$cid type=hidden notab
113
cgi_text sessid=$sessid type=hidden notab
118
cgi_table border=0 cellspacing=0 cellpadding=10 width="70%" class=dialog "style=padding-top:12%" {
120
cgi_table_data valign=top {
121
cgi_puts [cgi_font size=+1 "Really Quit WebPine?"]
125
cgi_table_data valign=top {
126
cgi_table cellpadding=10 border=0 {
129
cgi_table_data valign=middle class=expungebox "style=\"border: 1px solid red\"" {
130
if {[llength $prompts] > 1} {
131
set ftext "[lindex [lindex $prompts 0] 0] and [lindex [lindex $prompts 1] 0]"
133
set ftext "[lindex [lindex $prompts 0] 0]"
136
cgi_put "This is a good opportunity to permanently remove from ${ftext} all of the messages you have marked for deletion."
139
cgi_table border=0 cellpadding=4 {
144
foreach prompt $prompts {
145
set numdels [lindex $prompt 1]
146
set fname [lindex $prompt 0]
147
set inboxflag [lindex $prompt 2]
148
set incflag [lindex $prompt 3]
154
if {$numdels && (($askinbox && $inboxflag) || ($askcurrent && $inboxflag == 0))} {
156
set cbn "cb[expr {$inbhit + $curhit}]"
157
cgi_table_data align=right valign=top {
159
cgi_checkbox "expinbox" class=expungebox id=$cbn checked
162
cgi_checkbox "expcurrent" class=expungebox id=$cbn checked
166
cgi_table_data align=left {
167
set t "Expunge ${numdels} deleted message[expr {($numdels > 1) ? "s" : ""}] from ${fname}."
168
cgi_put [cgi_span class=clickit onclick=\"flipCheck('$cbn')\" $t]
182
cgi_table_data align=center valign=middle {
184
cgi_submit_button "quit=Yes, Quit Now"
185
cgi_put [cgi_img [WPimg dot2] width=10]
186
cgi_submit_button "cancel=No, Return to [WPCmd PEMailbox mailboxname]"