~ubuntu-branches/debian/stretch/alpine/stretch

« back to all changes in this revision

Viewing changes to web/cgi/alpine/queryquit.tcl

  • Committer: Bazaar Package Importer
  • Author(s): Asheesh Laroia
  • Date: 2010-10-03 15:31:55 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20101003153155-2exypc96j1e8tw0p
Tags: 2.02-1
* New upstream release, based on re-alpine project
* Updated debian/copyright to reflect this fact
* re-alpine removed the non-free from the tarball, so now
  we do not repack the upstream tarball. (Yay!)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!./tclsh
2
 
# $Id: queryquit.tcl 864 2007-12-11 20:21:47Z mikes@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
 
#  queryquit.tcl
15
 
#
16
 
#  Purpose:  CGI script to generate html form used to confirm quitting
17
 
#            webpine while offering to expunge deleted
18
 
 
19
 
#  Input:
20
 
#     conftext : 
21
 
#     params : array of key/value pairs to submit with form
22
 
#     oncancel : url to reference should user cancel confirmation
23
 
set quit_vars {
24
 
  {cid  "Command ID"}
25
 
}
26
 
 
27
 
#  Output:
28
 
#
29
 
#       HTML/Javascript/CSS data representing the message specified
30
 
#       by the 'uid' argument
31
 
 
32
 
# inherit global config
33
 
source ./alpine.tcl
34
 
source cmdfunc.tcl
35
 
 
36
 
set query_menu {
37
 
  {
38
 
    {}
39
 
    {
40
 
      {
41
 
        # * * * * OK * * * *
42
 
        cgi_image_button quit=[WPimg but_create] border=0 alt="Create"
43
 
      }
44
 
    }
45
 
  }
46
 
  {
47
 
    {}
48
 
    {
49
 
      {
50
 
        # * * * * CANCEL * * * *
51
 
        cgi_puts [cgi_url [cgi_img [WPimg but_cancel] border=0 alt="Cancel"] wp.tcl?${oncancel}]
52
 
      }
53
 
    }
54
 
  }
55
 
}
56
 
 
57
 
WPEval $quit_vars {
58
 
 
59
 
  if {$cid != [WPCmd PEInfo key]} {
60
 
    error "Invalid Command ID"
61
 
  }
62
 
 
63
 
  catch {WPCmd PEInfo expungecheck quit} prompts
64
 
 
65
 
  set qhid ""
66
 
  set delsexist 0
67
 
  set askinbox 1
68
 
  set askcurrent 1
69
 
  set ewc [WPCmd PEInfo feature expunge-without-confirm]
70
 
  set ewce [WPCmd PEInfo feature expunge-without-confirm-everywhere]
71
 
 
72
 
  foreach prompt $prompts {
73
 
    if {[lindex $prompt 1] > 0} {
74
 
      set delsexist 1
75
 
    }
76
 
    if {[lindex $prompt 1] > 0 && ($ewc || $ewce) && [lindex $prompt 2] == 1} {
77
 
      set askinbox 0
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))} {
80
 
      set askcurrent 0
81
 
      lappend qhid [cgi_buffer {cgi_text expcurrent=1 type=hidden notab}]
82
 
    }
83
 
  }
84
 
 
85
 
  cgi_http_head {
86
 
    WPStdHttpHdrs
87
 
  }
88
 
 
89
 
  cgi_html {
90
 
    cgi_head {
91
 
      WPStdHtmlHdr "Quitting Web Alpine"
92
 
      WPStdScripts
93
 
      WPStyleSheets
94
 
      cgi_put  "<style type='text/css'>"
95
 
      cgi_put  ".expungebox { background-color:AntiqueWhite }"
96
 
      cgi_put  ".clickit { cursor: pointer }"
97
 
      cgi_puts "</style>"
98
 
    }
99
 
 
100
 
    cgi_body BGCOLOR="$_wp(bordercolor)" {
101
 
 
102
 
      #catch {WPCmd PEInfo set help_context quit}
103
 
      cgi_table width=100% height=100% cellspacing=0 cellpadding=0 {
104
 
        cgi_table_row {
105
 
          cgi_table_data width=112 bgcolor=$_wp(bordercolor) {
106
 
            cgi_put [cgi_img [WPimg dot2]]
107
 
          }
108
 
 
109
 
          cgi_table_data align=center valign=top bgcolor="$_wp(dialogcolor)" {
110
 
 
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
114
 
              foreach q $qhid {
115
 
                cgi_puts $q
116
 
              }
117
 
 
118
 
              cgi_table border=0 cellspacing=0 cellpadding=10 width="70%" class=dialog "style=padding-top:12%" {
119
 
                cgi_table_row {
120
 
                  cgi_table_data valign=top {
121
 
                    cgi_puts [cgi_font size=+1 "Really Quit WebPine?"]
122
 
                  }
123
 
                }
124
 
                cgi_table_row {
125
 
                  cgi_table_data valign=top {
126
 
                    cgi_table cellpadding=10 border=0 {
127
 
                      if {$delsexist} {
128
 
                        cgi_table_row {
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]"
132
 
                            } else {
133
 
                              set ftext "[lindex [lindex $prompts 0] 0]"
134
 
                            }
135
 
 
136
 
                            cgi_put "This is a good opportunity to permanently remove from ${ftext} all of the messages you have marked for deletion."
137
 
                            cgi_br
138
 
                            cgi_br
139
 
                            cgi_table border=0 cellpadding=4 {
140
 
                              set expiexists 0
141
 
                              set expcexists 0
142
 
                              set inbhit 0
143
 
                              set curhit 0
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]
149
 
                                if {$inboxflag} {
150
 
                                  incr inbhit
151
 
                                } else {
152
 
                                  incr curhit
153
 
                                }
154
 
                                if {$numdels && (($askinbox && $inboxflag) || ($askcurrent && $inboxflag == 0))} {
155
 
                                  cgi_table_row {
156
 
                                    set cbn "cb[expr {$inbhit + $curhit}]"
157
 
                                    cgi_table_data align=right valign=top {
158
 
                                      if {$inboxflag} {
159
 
                                        cgi_checkbox "expinbox" class=expungebox id=$cbn checked
160
 
                                        incr expiexists
161
 
                                      } else {
162
 
                                        cgi_checkbox "expcurrent" class=expungebox id=$cbn checked
163
 
                                        incr expcexists
164
 
                                      }
165
 
                                    }
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]
169
 
                                    }
170
 
                                  }
171
 
                                }
172
 
                              }
173
 
                            }
174
 
                          }
175
 
                        }
176
 
                      }
177
 
                    }
178
 
                  }
179
 
                }
180
 
 
181
 
                cgi_table_row {
182
 
                  cgi_table_data align=center valign=middle {
183
 
                    cgi_br
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]"
187
 
                  }
188
 
                }
189
 
              }
190
 
            }
191
 
          }
192
 
        }
193
 
      }
194
 
    }
195
 
  }
196
 
}