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

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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#!./tclsh
# $Id: queryprune.tcl 391 2007-01-25 03:53:59Z mikes@u.washington.edu $
# ========================================================================
# Copyright 2006 University of Washington
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# ========================================================================

# queryprune.tcl
#
# After we've already determined that it's the 
# beginning of the month (logon.tcl), we check
# what folders need pruning and offer them to
# the user.  Currently doesn't do automatic
# reload.

# Input:
set prunetime_vars {
  {cid	"Missing Command ID"}
  {start "Missing Start Page"}
  {nojs	""			0}
}

#  Output:
#

# inherit global config
source ./alpine.tcl
source cmdfunc.tcl

set prune_menu {
  {
    {}
    {
      {
	# * * * * DONE * * * *
	cgi_submit_button prune=Continue
      }
    }
  }
}


WPEval $prunetime_vars {
  catch {WPCmd PEInfo prunetime} prunefldrs
  set allclean 1
  set delstuff 0
  set askstuff 0
  foreach prunefldr $prunefldrs {
    if {[llength [lindex $prunefldr 1]] > 0 || [llength [lindex $prunefldr 2]] > 0} {
      set allclean 0
    }
  }

  cgi_http_head {
    WPStdHttpHdrs
  }

  cgi_html {
    cgi_head {
      WPStdHtmlHdr "Monthly Folder Pruning"
      WPStdScripts
    }

    cgi_body BGCOLOR="$_wp(bordercolor)" {

      cgi_form [file join $_wp(appdir) wp] method=post name=pruneit target=_top {

	cgi_table border=0 cellspacing=0 cellpadding=2 width="100%" height="100%" {
	  
	  cgi_table_row {
	    # next comes the menu down the left side
	    eval {
	      cgi_table_data $_wp(menuargs) {
		WPTFCommandMenu prune_menu {}
	      }
	    }

	    cgi_table_data valign=top align=center class=dialog "style=\"padding: 20\"" {

	      if {$allclean == 1} {
		catch {WPCmd PEInfo statmsg "Pruning Failed: $prunefldrs"}
		cgi_puts "No folders appear to need cleaning up this month."
		cgi_br
		cgi_puts "Please click [cgi_url "here" $start target=_top] to continue your session."
	      } else {
		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]."
		cgi_text "sessid=$_wp(sessid)" type=hidden notab
		cgi_text "op=pruneit" type=hidden notab
		cgi_text "cid=${cid}" type=hidden notab
		cgi_text "page=prune" type=hidden notab
		set cnt 0
		foreach prunefldr $prunefldrs {
		  set type [lindex $prunefldr 0]
		  set mv [lindex $prunefldr 1]
		  set dellist [lindex $prunefldr 2]

		  cgi_table border=0 cellpadding=8 cellspacing=0 "style=\"padding-top: 8\"" {
		    if {[llength $mv] > 1} {
		      cgi_table_row {
			cgi_table_data {
			  cgi_puts [cgi_bold "Move current "[lindex $mv 0]" to "[lindex $mv 1]"?"]
			}
		      }
		      cgi_table_row {
			cgi_table_data {
			  cgi_table "style=\"padding-left: 20\"" {
			    cgi_table_data {
			      cgi_radio_button "mv${cnt}=mv [lindex $mv 0] [lindex $mv 1]" checked class=body
			    }
			    cgi_table_data {
			      cgi_puts "Yes"
			    }
			    cgi_table_data {
			      cgi_radio_button "mv${cnt}=" class=body
			    }
			    cgi_table_data {
			      cgi_puts "No"
			    }
			  }
			}
		      }
		      incr cnt
		    }
		    if {[llength $dellist] > 0} {
		      cgi_table_row {
			cgi_table_data {
			  set plurtxt ""
			  set typetxt ""
			  if {[llength $dellist] > 1} {
			    set plurtxt "s"
			  }
			  if {[string compare $type ""] != 0} {
			    set typetxt "[string toupper $type] "
			  }
			  cgi_puts "[cgi_bold "To save disk space, delete the following ${typetxt}mail folder${plurtxt}:"] (Check to delete)"
			}
		      }

		      cgi_table_row {
			cgi_table_data {
			  cgi_table "style=\"padding-left: 20\"" {
			    foreach del $dellist {
			      cgi_table_row {
				cgi_table_data {
				  cgi_checkbox "delList=$del" "style=\"background-color: #FFFFFF; padding-right: 8\""
				  cgi_puts "$del "
				}
			      }
			    }
			  }
			}
		      }
		    }
		  }
		}
		cgi_text "mvcnt=${cnt}" type=hidden notab
	      }
	    }
	  }
	}
      }
    }
  }
}