2
# $Id: common.tcl 391 2007-01-25 03:53:59Z mikes@u.washington.edu $
3
# ========================================================================
4
# Copyright 2006 University of Washington
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
10
# http://www.apache.org/licenses/LICENSE-2.0
12
# ========================================================================
16
# Purpose: CGI script snippet to generate html output associated
17
# with the WebPine message view/index ops frame
24
# inherit global config
31
# Command Menu definition for Message View Screen
41
# * * * * UBIQUITOUS INBOX LINK * * * *
42
if {[string compare inbox [string tolower [WPCmd PEMailbox mailboxname]]]} {
43
cgi_put [cgi_url INBOX open.tcl?folder=INBOX&colid=0&cid=[WPCmd PEInfo key] target=_top class=navbar]
45
cgi_put [cgi_url INBOX fr_index.tcl target=spec class=navbar]
54
# * * * * FOLDER LIST * * * *
55
cgi_puts [cgi_url "Folder List" "wp.tcl?page=folders&cid=[WPCmd PEInfo key]" target=_top class=navbar]
63
# * * * * COMPOSE * * * *
64
cgi_puts [cgi_url Compose wp.tcl?page=compose&oncancel=main.tcl&cid=[WPCmd PEInfo key] target=_top class=navbar]
72
# * * * * RESUME * * * *
73
cgi_puts [cgi_url Resume wp.tcl?page=resume&oncancel=main.tcl&cid=[WPCmd PEInfo key] target=_top class=navbar]
81
# * * * * Addr books * * * *
82
cgi_puts [cgi_url "Address Book" wp.tcl?page=addrbook&oncancel=main.tcl target=_top class=navbar]
96
if {[info exists _wp(exitonclose)]} {
97
WPExitOnClose top.spec.body
101
cgi_script type="text/javascript" language="JavaScript" {
102
cgi_puts "function flip(n){"
103
cgi_put " var d = top.spec.body.document;"
104
cgi_put " var f = d.index;"
105
cgi_put " if(f && document.implementation){"
106
cgi_put " var e = d.createElement('input');"
107
cgi_put " var ver = navigator.appVersion;"
108
cgi_put " if(!((ver.indexOf('MSIE')+1) && (ver.indexOf('Macintosh')+1))) e.type = 'hidden';"
109
cgi_put " e.name = 'bod_'+n;"
110
cgi_put " e.value = '1';"
111
cgi_put " f.appendChild(e);"
112
cgi_put " f.submit();"
113
cgi_put " return false;"
115
cgi_puts " return true;"
119
if {$_wp(keybindings)} {
121
{{l} {top.location = 'wp.tcl?page=folders'}}
122
{{a} {top.location = 'wp.tcl?page=addrbook'}}
123
{{?} {top.location = 'wp.tcl?page=help'}}
124
{{n} {if(flip('next')) top.spec.body.location = 'wp.tcl?page=body&bod_next=1'}}
125
{{p} {if(flip('prev')) top.spec.body.location = 'wp.tcl?page=body&bod_prev=1'}}
126
{{i} {if(top.spec.cmds) top.spec.location = 'fr_index.tcl'}}
127
{{s} {if(top.spec.cmds) top.spec.cmds.document.saveform.f_name.focus()}}
128
{{d} {if(top.spec.cmds) top.spec.cmds.document.delform.op[0].click()}}
129
{{u} {if(top.spec.cmds) top.spec.cmds.document.delform.op[1].click()}}
130
{{r} {if(top.spec.cmds) top.spec.cmds.document.replform.op.click()}}
131
{{f} {if(top.spec.cmds) top.spec.cmds.document.forwform.op.click()}}
132
{{ } {if(top.spec.body.document.index && flip('next')) top.spec.body.location = 'wp.tcl?page=body&bod_next=1'}}
133
{{-} {if(top.spec.body.document.index && flip('prev')) top.spec.body.location = 'wp.tcl?page=body&bod_prev=1'}}
134
{{z} {if(top.spec.body.document.index && top.spec.body.document.index.zoom) top.spec.body.document.index.zoom.click()}}
137
lappend kequiv [list {c} "top.location = 'wp.tcl?page=compose&oncancel=main.tcl&cid=[WPCmd PEInfo key]'"]
139
if {[WPCmd PEInfo feature enable-full-header-cmd]} {
140
lappend kequiv [list {h} "if(top.spec.cmds.document.saveform) top.spec.body.location = 'wp.tcl?page=view&fullhdr=flip'"]
143
set onload "onLoad=[WPTFKeyEquiv $kequiv {} top.spec.body] top.gen.focus();"
147
cgi_body bgcolor=$_wp(bordercolor) $onload {
149
cgi_put [cgi_url [cgi_imglink smalllogo] wp.tcl?page=help&topic=about class=navbar target=_top]
153
cgi_division class=navbar "style=\"background-color: $_wp(menucolor)\"" {
154
cgi_division "style=\"padding: 8px 0 2px $padleft\"" {
155
cgi_puts [cgi_span "style=font-weight: bold" "Current Folder"]
158
set mbn [WPCmd PEMailbox mailboxname]
159
if {[string length $mbn] > 16} {
160
set mbn "[string range $mbn 0 14]..."
163
cgi_division align=center {
164
cgi_put [cgi_url $mbn fr_index.tcl target=spec class=navbar]
166
switch -exact -- [WPCmd PEMailbox state] {
169
cgi_put [cgi_span "style=color: yellow; font-weight: bold" "(Read Only)"]
173
cgi_put [cgi_span "style=color: yellow; font-weight: bold" "(Closed)"]
180
cgi_hr "width=75%" "style=\"margin-top:8px\""
182
# Common Navigation controls
183
cgi_division align=center "style=\"padding-bottom: 4px\"" {
184
cgi_put [cgi_img [WPimg but_rnd_block] border=0 "usemap=#nav" "alt=Navigation Controls"]
186
cgi_area shape=rect coords=0,0,37,38 "href=wp.tcl?page=body&bod_prev=1" target=body "onClick=\"return flip('prev')\"" "alt=Previous"
187
cgi_area shape=rect coords=0,40,32,74 "href=wp.tcl?page=body&bod_next=1" target=body "onClick=\"return flip('next')\"" "alt=Next"
188
cgi_area shape=rect coords=50,0,82,38 "href=wp.tcl?page=body&bod_first=1" target=body "onClick=\"return flip('first')\"" "alt=First"
189
cgi_area shape=rect coords=50,40,82,74 "href=wp.tcl?page=body&bod_last=1" target=body "onClick=\"return flip('last')\"" "alt=Last"
193
if {[WPCmd PEInfo feature enable-jump-cmd]} {
195
cgi_form $_wp(appdir)/wp method=get target=body name=goform "style=margin-top:6" {
196
cgi_text "page=body" type=hidden notab
197
cgi_text gonum= class=navtext size=4 maxlength=6 "onClick=this.select()"
200
cgi_submit_button "goto=Jump to Msg \#" class=navtext "style=margin-right:2;margin-top:6"
202
cgi_submit_button "goto=Jump" class=navtext "style=margin-right:2"
210
cgi_division "style=\"padding: 0 0 6px $padleft\"" {
211
cgi_puts [cgi_span "style=font-weight: bold" "Folders"]
212
cgi_division "style=\"padding-left: 4px\"" {
213
# UBIQUITOUS INBOX LINK
214
if {[string compare inbox [string tolower [WPCmd PEMailbox mailboxname]]]} {
215
cgi_put [cgi_url INBOX open.tcl?folder=INBOX&colid=0&cid=[WPCmd PEInfo key] target=_top class=navbar]
217
cgi_put [cgi_url INBOX fr_index.tcl target=spec class=navbar]
221
set fc [WPTFGetFolderCache]
222
for {set i 0} {$i < [llength $fc]} {incr i} {
223
set f [lindex $fc $i]
225
if {0 == [catch {WPCmd PEFolder exists [lindex $f 0] [lindex $f 1]} result] && $result} {
229
if {[string length $fn] > 15} {
230
set fn "...[string range $fn end-15 end]"
233
if {[string compare [lindex $f 1] [WPCmd PEMailbox mailboxname]]} {
234
cgi_put [cgi_url $fn "open.tcl?folder=[lindex $f 1]&colid=[lindex $f 0]&cid=[WPCmd PEInfo key]" target=_top class=navbar]
236
cgi_put [cgi_url $fn fr_index.tcl target=spec class=navbar]
239
if {[incr n] >= $_wp(fldr_cache_max)} {
246
cgi_puts [cgi_url "More Folders..." "wp.tcl?page=folders&cid=[WPCmd PEInfo key]" target=_top class=navbar]
253
cgi_division "style=\"padding: 0 0 0 $padleft\"" {
254
# * * * * COMPOSE * * * *
255
cgi_puts [cgi_url Compose wp.tcl?page=compose&oncancel=main.tcl&cid=[WPCmd PEInfo key] target=_top class=navbar]
257
# * * * * RESUME * * * *
258
cgi_puts [cgi_url Resume wp.tcl?page=resume&oncancel=main.tcl&cid=[WPCmd PEInfo key] target=_top class=navbar]
260
# * * * * Addr books * * * *
261
cgi_puts [cgi_url "Address Book" wp.tcl?page=addrbook&oncancel=main.tcl target=_top class=navbar]
264
cgi_division "style=\"padding: 12px 0 0 $padleft\"" {
265
cgi_put [cgi_url "Configure" wp.tcl?page=conf_process&newconf=1&oncancel=main.tcl&cid=[WPCmd PEInfo key] class=navbar target=_top]
267
cgi_put [cgi_url "Get Help" wp.tcl?page=help class=navbar target=_top]
270
cgi_division "style=\"padding: 12px 0 10px $padleft\"" {
271
if {[WPCmd PEInfo feature quit-without-confirm]} {
272
cgi_puts [cgi_url "Quit $_wp(appname)" $_wp(serverpath)/session/logout.tcl?cid=[WPCmd PEInfo key]&sessid=$sessid target=_top class=navbar]
274
cgi_puts [cgi_url "Quit $_wp(appname)" wp.tcl?page=quit&cid=[WPCmd PEInfo key] target=_top class=navbar]