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

« back to all changes in this revision

Viewing changes to web/cgi/alpine/1.0/seldate.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: seldate.tcl 1204 2009-02-02 19:54:23Z hubert@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
#  seldate.tcl
 
15
#
 
16
#  Purpose:  CGI script to generate html form used to gather info
 
17
#            for date selection
 
18
 
 
19
#  Input:
 
20
set select_vars {
 
21
  {uid          ""      0}
 
22
}
 
23
 
 
24
#  Output:
 
25
#
 
26
#       HTML/CSS data representing form for date select input
 
27
 
 
28
# inherit global config
 
29
source ./alpine.tcl
 
30
source cmdfunc.tcl
 
31
 
 
32
WPEval $select_vars {
 
33
 
 
34
  if {$uid} {
 
35
    if {[catch {WPCmd PEMessage $uid number} thisnum]} {
 
36
      set uid 0
 
37
    }
 
38
  } else {
 
39
    set thisnum ""
 
40
  }
 
41
 
 
42
  cgi_http_head {
 
43
    WPStdHttpHdrs
 
44
  }
 
45
 
 
46
  cgi_html {
 
47
    cgi_head {
 
48
      WPStdHtmlHdr "Search By Date"
 
49
      WPStyleSheets
 
50
    }
 
51
 
 
52
    cgi_body BGCOLOR="$_wp(bordercolor)" {
 
53
 
 
54
      catch {WPCmd PEInfo set wp_index_script fr_seldate.tcl}
 
55
      catch {WPCmd PEInfo set help_context seldate}
 
56
 
 
57
      cgi_form $_wp(appdir)/$_wp(ui1dir)/wp method=get name=auth target=body {
 
58
        cgi_text page=index type=hidden notab
 
59
        cgi_text doselect=1 type=hidden notab
 
60
        cgi_text by=date type=hidden notab
 
61
        if {![WPCmd PEMailbox selected]} {
 
62
          cgi_text result=broad type=hidden notab
 
63
        }
 
64
 
 
65
        cgi_table border=0 cellspacing=0 cellpadding=2 width="100%" height="100%" {
 
66
          cgi_table_row {
 
67
            cgi_table_data align=center valign=top class=dialog {
 
68
              cgi_table width="80%" {
 
69
                cgi_table_row {
 
70
                  cgi_table_data {
 
71
                    cgi_center {
 
72
                      cgi_puts "[cgi_nl]This page provides a way to search for messages in [cgi_bold [WPCmd PEMailbox mailboxname]] based on arrival time."
 
73
                      cgi_puts "[cgi_nl][cgi_nl]Messages arriving [cgi_italic On] the date entered below will be marked with a check in the box next to their line in the Message List.  Choosing [cgi_italic Since] marks messages arriving between today and the giving date (including the given date).  Choosing [cgi_italic Before] marks messages arriving before (but not on) the given date."
 
74
                      cgi_puts "[cgi_nl][cgi_nl]Choose a date below and click 'Search' to choose messages, or 'Cancel' to return to the Message List.[cgi_nl][cgi_nl]"
 
75
                    }
 
76
                  }
 
77
                }
 
78
                
 
79
                if {[WPCmd PEMailbox selected]} {
 
80
                  cgi_table_row class=dialog {
 
81
                    cgi_table_data colspan=2 align=center valign=middle class=dialog {
 
82
                      cgi_put [cgi_font face=tahoma,verdana,geneva "Since some messages are already marked, choose whether criteria specified here should "]
 
83
                      cgi_select result {
 
84
                        cgi_option "search all messages in '[WPCmd PEMailbox mailboxname]'" value=broad selected
 
85
                        cgi_option "search within marked messages only." value=narrow
 
86
                        cgi_option "discard previous marks and search anew." value=new
 
87
                      }
 
88
 
 
89
                      cgi_br
 
90
                      cgi_br
 
91
                      cgi_br
 
92
                    }
 
93
                  }
 
94
                }
 
95
                
 
96
                cgi_table_row class=dialog {
 
97
                  cgi_table_data valign=top align=center class=dialog {
 
98
                    cgi_put [cgi_font face=tahoma,verdana,geneva "Messages dated "]
 
99
 
 
100
                    cgi_select datecase {
 
101
                      foreach i {On Since Before} {
 
102
                        cgi_option $i value=[string tolower $i]
 
103
                      }
 
104
                    }
 
105
 
 
106
                    cgi_br
 
107
                    cgi_br
 
108
 
 
109
                    cgi_select datemon {
 
110
                      if {$uid} {
 
111
                        set today [string tolower [WPCmd PEMessage $uid date month]]
 
112
                      } else {
 
113
                        set today [string tolower [clock format [clock seconds] -format %b]]
 
114
                      }
 
115
 
 
116
                      set months {
 
117
                        January jan
 
118
                        February feb
 
119
                        March mar
 
120
                        April Apr
 
121
                        May may
 
122
                        June jun
 
123
                        July jul
 
124
                        August aug
 
125
                        September sep
 
126
                        October oct
 
127
                        November nov
 
128
                        December dec
 
129
                      }
 
130
 
 
131
                      foreach {x y} $months {
 
132
                        if {$y == $today} {
 
133
                          cgi_option $x value=$y selected
 
134
                        } else {
 
135
                          cgi_option $x value=$y
 
136
                        }
 
137
                      }
 
138
                    }
 
139
 
 
140
                    cgi_select dateday {
 
141
                      if {$uid} {
 
142
                        set today [WPCmd PEMessage $uid date day]
 
143
                      } else {
 
144
                        set today [clock format [clock seconds] -format %d]
 
145
                      }
 
146
 
 
147
                      for {set i 1} {$i <= 31} {incr i} {
 
148
                        set v [format "%.2d" $i]
 
149
                        if {$v == $today} {
 
150
                          cgi_option $i value=$v selected
 
151
                        } else {
 
152
                          cgi_option $i value=$v
 
153
                        }
 
154
                      }
 
155
                    }
 
156
 
 
157
                    cgi_put ",[cgi_nbspace]"
 
158
                    cgi_select dateyear {
 
159
                      if {$uid} {
 
160
                        set now [WPCmd PEMessage $uid date year]
 
161
                      } else {
 
162
                        set now [clock format [clock seconds] -format "%Y"]
 
163
                      }
 
164
 
 
165
                      cgi_option $now value=$now selected
 
166
                      for {set n [expr $now - 1]} {$n >= 1970} {incr n -1} {
 
167
                        cgi_option $n value=$n
 
168
                      }
 
169
                    }
 
170
                  }
 
171
                }
 
172
 
 
173
                cgi_table_row {
 
174
                  cgi_table_data align=center {
 
175
                    cgi_br
 
176
                    cgi_submit_button ok=Search
 
177
                    cgi_submit_button cancel=Cancel
 
178
                  }
 
179
                }
 
180
 
 
181
                cgi_table_row class=dialog {
 
182
                  cgi_table_data valign=top align=center class=dialog {
 
183
                    cgi_puts [cgi_nl][cgi_nl][cgi_font size=-1 "Note, if the number of messages in this folder is larger than the number of lines in the Message List, then some matching messages may not be visible without paging/scrolling."]
 
184
                  }
 
185
                }
 
186
              }
 
187
            }
 
188
          }
 
189
        }
 
190
      }
 
191
    }
 
192
  }
 
193
}