~ubuntu-branches/debian/squeeze/alpine/squeeze

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Asheesh Laroia
  • Date: 2007-02-17 13:17:42 UTC
  • Revision ID: james.westby@ubuntu.com-20070217131742-99x5c6cpg1pbkdhw
Tags: upstream-0.82+dfsg
ImportĀ upstreamĀ versionĀ 0.82+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!./tclsh
 
2
# $Id: queryprune.tcl 391 2007-01-25 03:53:59Z 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
# queryprune.tcl
 
15
#
 
16
# After we've already determined that it's the 
 
17
# beginning of the month (logon.tcl), we check
 
18
# what folders need pruning and offer them to
 
19
# the user.  Currently doesn't do automatic
 
20
# reload.
 
21
 
 
22
# Input:
 
23
set prunetime_vars {
 
24
  {cid  "Missing Command ID"}
 
25
  {start "Missing Start Page"}
 
26
  {nojs ""                      0}
 
27
}
 
28
 
 
29
#  Output:
 
30
#
 
31
 
 
32
# inherit global config
 
33
source ./alpine.tcl
 
34
source cmdfunc.tcl
 
35
 
 
36
set prune_menu {
 
37
  {
 
38
    {}
 
39
    {
 
40
      {
 
41
        # * * * * DONE * * * *
 
42
        cgi_submit_button prune=Continue
 
43
      }
 
44
    }
 
45
  }
 
46
}
 
47
 
 
48
 
 
49
WPEval $prunetime_vars {
 
50
  catch {WPCmd PEInfo prunetime} prunefldrs
 
51
  set allclean 1
 
52
  set delstuff 0
 
53
  set askstuff 0
 
54
  foreach prunefldr $prunefldrs {
 
55
    if {[llength [lindex $prunefldr 1]] > 0 || [llength [lindex $prunefldr 2]] > 0} {
 
56
      set allclean 0
 
57
    }
 
58
  }
 
59
 
 
60
  cgi_http_head {
 
61
    WPStdHttpHdrs
 
62
  }
 
63
 
 
64
  cgi_html {
 
65
    cgi_head {
 
66
      WPStdHtmlHdr "Monthly Folder Pruning"
 
67
      WPStdScripts
 
68
    }
 
69
 
 
70
    cgi_body BGCOLOR="$_wp(bordercolor)" {
 
71
 
 
72
      cgi_form [file join $_wp(appdir) wp] method=post name=pruneit target=_top {
 
73
 
 
74
        cgi_table border=0 cellspacing=0 cellpadding=2 width="100%" height="100%" {
 
75
          
 
76
          cgi_table_row {
 
77
            # next comes the menu down the left side
 
78
            eval {
 
79
              cgi_table_data $_wp(menuargs) {
 
80
                WPTFCommandMenu prune_menu {}
 
81
              }
 
82
            }
 
83
 
 
84
            cgi_table_data valign=top align=center class=dialog "style=\"padding: 20\"" {
 
85
 
 
86
              if {$allclean == 1} {
 
87
                catch {WPCmd PEInfo statmsg "Pruning Failed: $prunefldrs"}
 
88
                cgi_puts "No folders appear to need cleaning up this month."
 
89
                cgi_br
 
90
                cgi_puts "Please click [cgi_url "here" $start target=_top] to continue your session."
 
91
              } else {
 
92
                cgi_puts "At the beginning of every month, you are asked if you would like to clean up your sent-mail folder(s).  Please answer the following questions and click [cgi_italic Continue]."
 
93
                cgi_text "sessid=$_wp(sessid)" type=hidden notab
 
94
                cgi_text "op=pruneit" type=hidden notab
 
95
                cgi_text "cid=${cid}" type=hidden notab
 
96
                cgi_text "page=prune" type=hidden notab
 
97
                set cnt 0
 
98
                foreach prunefldr $prunefldrs {
 
99
                  set type [lindex $prunefldr 0]
 
100
                  set mv [lindex $prunefldr 1]
 
101
                  set dellist [lindex $prunefldr 2]
 
102
 
 
103
                  cgi_table border=0 cellpadding=8 cellspacing=0 "style=\"padding-top: 8\"" {
 
104
                    if {[llength $mv] > 1} {
 
105
                      cgi_table_row {
 
106
                        cgi_table_data {
 
107
                          cgi_puts [cgi_bold "Move current "[lindex $mv 0]" to "[lindex $mv 1]"?"]
 
108
                        }
 
109
                      }
 
110
                      cgi_table_row {
 
111
                        cgi_table_data {
 
112
                          cgi_table "style=\"padding-left: 20\"" {
 
113
                            cgi_table_data {
 
114
                              cgi_radio_button "mv${cnt}=mv [lindex $mv 0] [lindex $mv 1]" checked class=body
 
115
                            }
 
116
                            cgi_table_data {
 
117
                              cgi_puts "Yes"
 
118
                            }
 
119
                            cgi_table_data {
 
120
                              cgi_radio_button "mv${cnt}=" class=body
 
121
                            }
 
122
                            cgi_table_data {
 
123
                              cgi_puts "No"
 
124
                            }
 
125
                          }
 
126
                        }
 
127
                      }
 
128
                      incr cnt
 
129
                    }
 
130
                    if {[llength $dellist] > 0} {
 
131
                      cgi_table_row {
 
132
                        cgi_table_data {
 
133
                          set plurtxt ""
 
134
                          set typetxt ""
 
135
                          if {[llength $dellist] > 1} {
 
136
                            set plurtxt "s"
 
137
                          }
 
138
                          if {[string compare $type ""] != 0} {
 
139
                            set typetxt "[string toupper $type] "
 
140
                          }
 
141
                          cgi_puts "[cgi_bold "To save disk space, delete the following ${typetxt}mail folder${plurtxt}:"] (Check to delete)"
 
142
                        }
 
143
                      }
 
144
 
 
145
                      cgi_table_row {
 
146
                        cgi_table_data {
 
147
                          cgi_table "style=\"padding-left: 20\"" {
 
148
                            foreach del $dellist {
 
149
                              cgi_table_row {
 
150
                                cgi_table_data {
 
151
                                  cgi_checkbox "delList=$del" "style=\"background-color: #FFFFFF; padding-right: 8\""
 
152
                                  cgi_puts "$del "
 
153
                                }
 
154
                              }
 
155
                            }
 
156
                          }
 
157
                        }
 
158
                      }
 
159
                    }
 
160
                  }
 
161
                }
 
162
                cgi_text "mvcnt=${cnt}" type=hidden notab
 
163
              }
 
164
            }
 
165
          }
 
166
        }
 
167
      }
 
168
    }
 
169
  }
 
170
}