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

« back to all changes in this revision

Viewing changes to web/cgi/alpine/exporting.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
 
# $Id: exporting.tcl 391 2007-01-25 03:53:59Z mikes@u.washington.edu $
2
 
# ========================================================================
3
 
# Copyright 2006 University of Washington
4
 
#
5
 
# Licensed under the Apache License, Version 2.0 (the "License");
6
 
# you may not use this file except in compliance with the License.
7
 
# You may obtain a copy of the License at
8
 
#
9
 
#     http://www.apache.org/licenses/LICENSE-2.0
10
 
#
11
 
# ========================================================================
12
 
 
13
 
#  exporting.tcl
14
 
#
15
 
#  Purpose:  CGI script to generate html output associated with folder
16
 
#            exporting explanation text
17
 
#
18
 
#  Input:
19
 
set export_vars {
20
 
  {fid          "Missing Collection ID"}
21
 
  {cid          "Missing Command ID"}
22
 
}
23
 
 
24
 
#  Output:
25
 
#
26
 
#       HTML/Javascript/CSS data representing the message specified
27
 
#       by the 'uid' argument
28
 
 
29
 
# Command Menu definition for Message View Screen
30
 
set export_menu {
31
 
}
32
 
 
33
 
set common_menu {
34
 
  {
35
 
    {}
36
 
    {
37
 
      {
38
 
        # * * * * Cancel * * * *
39
 
        cgi_put [cgi_url "Folder List" wp.tcl?page=folders&cid=[WPCmd PEInfo key] target=_top class=navbar]
40
 
      }
41
 
    }
42
 
  }
43
 
}
44
 
 
45
 
## read vars
46
 
foreach item $export_vars {
47
 
  if {[catch {cgi_import [lindex $item 0].x}]} {
48
 
    if {[catch {eval WPImport $item} errstr]} {
49
 
      error [list _action "Impart Variable" $errstr]
50
 
    }
51
 
  } else {
52
 
    set [lindex $item 0] 1
53
 
  }
54
 
}
55
 
 
56
 
if {[catch {WPCmd PEInfo key} key]} {
57
 
  error [list _action "command ID" $key]
58
 
}
59
 
 
60
 
# massage fid, strip leading "f_"
61
 
set fid [string range [lindex $fid 0] 2 end]
62
 
set digfid [cgi_unquote_input $fid]
63
 
set colid [lindex $digfid 0]
64
 
if {[set l [llength $digfid]] > 2} {
65
 
  set fpath [eval "file join [lrange $digfid 1 [expr {[llength $digfid] - 1}]]"]
66
 
} else {
67
 
  set fpath ""
68
 
}
69
 
set fldr [lindex $digfid end]
70
 
 
71
 
# paint the page
72
 
cgi_http_head {
73
 
  WPStdHttpHdrs text/html
74
 
}
75
 
 
76
 
cgi_html {
77
 
  cgi_head {
78
 
    WPStdHtmlHdr "Folder Exporting"
79
 
    WPStyleSheets
80
 
    cgi_http_equiv Refresh "0; url=$_wp(serverpath)/$_wp(appdir)/export.tcl?fid=${fid}&cid=$cid"
81
 
  }
82
 
 
83
 
  cgi_body bgcolor=$_wp(bordercolor) {
84
 
 
85
 
    set mbox [WPCmd PEMailbox mailboxname]
86
 
 
87
 
    WPTFTitle "Folder Export"
88
 
 
89
 
    cgi_table border=0 cellspacing=0 cellpadding=2 width="100%" height="100%" {
90
 
 
91
 
      cgi_table_row {
92
 
        cgi_table_data rowspan=2 valign=top class=navbar {
93
 
          cgi_table bgcolor=$_wp(menucolor) border=0 cellspacing=0 cellpadding=2 {
94
 
            cgi_table_row {
95
 
              cgi_table_data class=navbar style=padding-top:6 {
96
 
                cgi_puts "Current Folder :"
97
 
                cgi_division align=center "style=margin-top:4;margin-bottom:4" {
98
 
                  cgi_put [cgi_url [WPCmd PEMailbox mailboxname] fr_main.tcl target=_top class=navbar]
99
 
 
100
 
                  switch -exact -- [WPCmd PEMailbox state] {
101
 
                    readonly {
102
 
                      cgi_br
103
 
                      cgi_put [cgi_span "style=color: pink; font-weight: bold" "(Read Only)"]
104
 
                    }
105
 
                    closed {
106
 
                      cgi_br
107
 
                      cgi_put [cgi_span "style=color: pink; font-weight: bold" "(Closed)"]
108
 
                    }
109
 
                    ok -
110
 
                    default {}
111
 
                  }
112
 
 
113
 
                  cgi_br
114
 
                }
115
 
 
116
 
                cgi_hr "width=75%"
117
 
              }
118
 
            }
119
 
 
120
 
            # next comes the menu down the left side, with suitable
121
 
            cgi_table_row {
122
 
              eval {
123
 
                cgi_table_data $_wp(menuargs) class=navbar style=padding-bottom:10 {
124
 
                  WPTFCommandMenu export_menu common_menu
125
 
                }
126
 
              }
127
 
            }
128
 
          }
129
 
        }
130
 
 
131
 
        # down the right side of the table is the window's contents
132
 
        cgi_table_data width="100%" valign=top class=dialog {
133
 
 
134
 
          cgi_division "style=\"margin-left: 12%; margin-right: 12%\"" {
135
 
 
136
 
              cgi_division align=center "style=\"padding: 18; font-size: bigger \"" {
137
 
                cgi_puts "Export Folder"
138
 
              }
139
 
 
140
 
              cgi_puts "WebPine is preparing the folder [cgi_bold $fldr] for download. "
141
 
              cgi_puts "You should see your browser's File Open Dialog appear any momment."
142
 
 
143
 
              cgi_p
144
 
 
145
 
              cgi_puts "The exported file will contain all of the messages in the folder separated "
146
 
              cgi_puts "by a traditional mail message delimiter, and should be recognizable by "
147
 
              cgi_puts "a variety of desktop mail programs."
148
 
 
149
 
              cgi_p
150
 
 
151
 
              cgi_puts "Be sure to pick a good name for the downloaded mail folder."
152
 
              cgi_puts "If you are sure the folder has been exported properly (that is, "
153
 
              cgi_puts "there were no error messages or other such problems, you can "
154
 
              if {[string compare inbox [string tolower $mbox]]} {
155
 
                cgi_puts "delete the folder from the collection."
156
 
              } else {
157
 
                cgi_puts "delete and expunge the messages from your INBOX."
158
 
              }
159
 
 
160
 
              cgi_p 
161
 
 
162
 
              cgi_puts "WebPine's [cgi_span "style=font-weight: bold; font-style: italic" Import] command, found to the right of each collection and "
163
 
              cgi_puts "directory entry in the folder list, can be used to transfer the exported "
164
 
              cgi_puts "mail folder from your computer back into a folder collection "
165
 
              cgi_puts "suitable for viewing within WebPine "
166
 
 
167
 
              cgi_p
168
 
 
169
 
              cgi_puts "If your browser does not automatically return to the Folder List page after the download is complete, click the button below."
170
 
 
171
 
              cgi_p
172
 
 
173
 
              cgi_division align=center {
174
 
                cgi_form $_wp(serverpath)/$_wp(appdir)/wp.tcl method=get {
175
 
                  cgi_text "page=folders" type=hidden notab
176
 
                  cgi_text "cid=[WPCmd PEInfo key]" type=hidden notab
177
 
 
178
 
                  cgi_submit_button "done=Return to Folder List"
179
 
                }
180
 
              }
181
 
            }
182
 
          }
183
 
        }
184
 
      }
185
 
    }
186
 
  }
187