1
# $Id: exporting.tcl 391 2007-01-25 03:53:59Z mikes@u.washington.edu $
2
# ========================================================================
3
# Copyright 2006 University of Washington
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
9
# http://www.apache.org/licenses/LICENSE-2.0
11
# ========================================================================
15
# Purpose: CGI script to generate html output associated with folder
16
# exporting explanation text
20
{fid "Missing Collection ID"}
21
{cid "Missing Command ID"}
26
# HTML/Javascript/CSS data representing the message specified
27
# by the 'uid' argument
29
# Command Menu definition for Message View Screen
38
# * * * * Cancel * * * *
39
cgi_put [cgi_url "Folder List" wp.tcl?page=folders&cid=[WPCmd PEInfo key] target=_top class=navbar]
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]
52
set [lindex $item 0] 1
56
if {[catch {WPCmd PEInfo key} key]} {
57
error [list _action "command ID" $key]
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}]]"]
69
set fldr [lindex $digfid end]
73
WPStdHttpHdrs text/html
78
WPStdHtmlHdr "Folder Exporting"
80
cgi_http_equiv Refresh "0; url=$_wp(serverpath)/$_wp(appdir)/export.tcl?fid=${fid}&cid=$cid"
83
cgi_body bgcolor=$_wp(bordercolor) {
85
set mbox [WPCmd PEMailbox mailboxname]
87
WPTFTitle "Folder Export"
89
cgi_table border=0 cellspacing=0 cellpadding=2 width="100%" height="100%" {
92
cgi_table_data rowspan=2 valign=top class=navbar {
93
cgi_table bgcolor=$_wp(menucolor) border=0 cellspacing=0 cellpadding=2 {
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]
100
switch -exact -- [WPCmd PEMailbox state] {
103
cgi_put [cgi_span "style=color: pink; font-weight: bold" "(Read Only)"]
107
cgi_put [cgi_span "style=color: pink; font-weight: bold" "(Closed)"]
120
# next comes the menu down the left side, with suitable
123
cgi_table_data $_wp(menuargs) class=navbar style=padding-bottom:10 {
124
WPTFCommandMenu export_menu common_menu
131
# down the right side of the table is the window's contents
132
cgi_table_data width="100%" valign=top class=dialog {
134
cgi_division "style=\"margin-left: 12%; margin-right: 12%\"" {
136
cgi_division align=center "style=\"padding: 18; font-size: bigger \"" {
137
cgi_puts "Export Folder"
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."
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."
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."
157
cgi_puts "delete and expunge the messages from your INBOX."
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 "
169
cgi_puts "If your browser does not automatically return to the Folder List page after the download is complete, click the button below."
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
178
cgi_submit_button "done=Return to Folder List"