summaryrefslogtreecommitdiff
path: root/web/cgi/alpine/1.0/resume.tcl
blob: 7a45333a7a265d097bd1a11d10bd824370c18dd5 (plain)
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
#!./tclsh
# $Id: resume.tcl 1204 2009-02-02 19:54:23Z hubert@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
#
# ========================================================================

#  resume.tcl
#
#  Purpose:  CGI script to browse postponed messages

#  Input:
set resume_vars {
  {oncancel "" main.tcl}
}

#  Output:
#

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


set resume_cmds {
  {
    {}
    {
      {
	cgi_puts [cgi_url "Get Help" wp.tcl?page=help&oncancel=resume target=_top class=navbar]
      }
    }
  }
}

WPEval $resume_vars {

  if {![info exists oncancel]} {
    WPLoadCGIVarAs oncancel oncancel
  }

  if {[catch {WPCmd PEPostpone list} postponed]} {
    error [list _action Resume $postponed "Click Back button to try again."]
  }

  set charset [lindex $postponed 1]

  cgi_http_head {
    WPStdHttpHdrs "text/html; charset=\"$charset\""
  }

  cgi_html {
    cgi_head {
      cgi_http_equiv Content-Type "text/html; charset=$charset"
      WPStdHtmlHdr "Postponed Messages"
      WPStyleSheets
      cgi_puts  "<style type='text/css'>"
      cgi_puts  ".gradient	{ background-image: url('[WPimg indexhdr]') ; background-repeat: repeat-x }"
      cgi_puts  "</style>"
    }

    cgi_body BGCOLOR="$_wp(bordercolor)" {

      catch {WPCmd PEInfo set help_context resume}

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

	  cgi_table_data width=100% valign=top class=dialog {

	    cgi_table border=0 cellspacing=0 cellpadding=0 width=100% {

	      cgi_form $_wp(appdir)/$_wp(ui1dir)/wp method=post target=_top {
		cgi_text "page=compose" type=hidden notab
		cgi_text "style=Postponed" type=hidden notab
		cgi_text "cid=[WPCmd PEInfo key]" type=hidden notab
		cgi_text "oncancel=$oncancel" type=hidden notab


		set n 1
		set fmt {{to Recipient} {date Date} {subj Subject}}
		cgi_table_row class=\"gradient\" {
		  cgi_table_data class=indexhdr height=$_wp(indexheight) {
		    cgi_puts [cgi_nbspace]
		  }

		  foreach i $fmt {
		    cgi_table_data class=indexhdr {
		      cgi_puts [lindex $i 1]
		    }
		  }
		}

		set checked ""
		set last [llength [lindex $postponed 0]]
		for {set i 0} {$i < $last} {incr i} {

		  #	cgi_html_comment [lindex [lindex $postponed 0] $i]
		  array set pa [join [lindex [lindex $postponed 0] $i]]

		  if {[info exists pa(uid)] == 0} {
		    continue;
		  }

		  if {$i % 2} {
		    set bgcolor #EEEEEE
		  } else {
		    set bgcolor #FFFFFF
		  }

		  if {[expr $i + 1] == $last} {
		    set checked checked
		  }

		  cgi_table_row bgcolor=$bgcolor {
		    cgi_table_data valign=top nowrap bgcolor=$bgcolor {
		      cgi_radio_button "uid=$pa(uid)" style="background-color:$bgcolor" $checked
		    }

		    foreach j $fmt {
		      cgi_table_data bgcolor=$bgcolor {
			if {[info exists pa([lindex $j 0])]} {
			  cgi_puts $pa([lindex $j 0])
			} else {
			  cgi_puts [cgi_nbspace]
			}
		      }
		    }
		  }

		  set checked ""
		}

		cgi_table_row {
		  cgi_table_data align=center colspan=24 {
		    cgi_br
		    cgi_submit_button "resume=Resume Chosen Message"
		  }
		}
	      }

	      cgi_table_row {
		cgi_table_data align=center colspan=24 {
		  cgi_form $_wp(appdir)/$_wp(ui1dir)/wp method=get target=_top {
		    cgi_text "page=$oncancel" type=hidden notab
		    cgi_br
		    cgi_submit_button "cancel=Cancel"
		  }
		}
	      }
	    }
	  }
	}
      }
    }
  }
}