summaryrefslogtreecommitdiff
path: root/web/cgi/alpine/2.0/settings
blob: 1821c6dfd7f0518b9b5f23f9b4950b5eb5c37f08 (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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
#!./tclsh
# $Id: settings 1266 2009-07-14 18:39:12Z hubert@u.washington.edu $
# ========================================================================
# Copyright 2008 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
#
# ========================================================================

#  view.tcl
#
#  Purpose:  CGI script settings for Web Alpine 2.0 settings page
#
#  Input:    
#            
set settings_args {
}

# inherit global config
source ./alpine.tcl
source ./foldercache.tcl
source ./common.tcl

set script_base "$_wp(serverpath)/$_wp(appdir)/$_wp(ui2dir)/"

# TEST
proc cgi_suffix {args} {
  return ""
}

set labels 0
proc set_feature {feature desc} {
  global labels
  cgi_checkbox $feature=1 [set_checked [WPCmd PEInfo feature $feature]] id="label_[incr labels]"
  cgi_put " <label for=\"label_${labels}\">$desc</label>"
}

proc set_checked {checked {token checked}} {
  if {$checked > 0} {
    return $token
  }

  return ""
}

proc set_variable {var {desc ""}} {
  global labels
  if {[string length $desc]} {
    cgi_put "<label for=\"label_[incr labels]\">${desc}</label>"
  }
  cgi_text ${var}=[var_value $var] id="label_${labels}"
}


WPEval $settings_args {

  if {0 == [catch {WPCmd PEFolder current} curfold]} {
    set c [lindex $curfold 0]
    set f [lindex $curfold 1]
  } else {
    set c 0
    set f inbox
  }

  set charset "UTF-8"

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

  cgi_html {
    cgi_head {
      cgi_content_type "text/html; charset=$charset"
      cgi_title [wpPageTitle "Settings"]
      cgi_base "href=$script_base"
      cgi_stylesheet css/cbn/screen.css
      # Yahoo Styles
      cgi_stylesheet $_wp(yui)/build/container/assets/container-core.css
      cgi_stylesheet $_wp(yui)/build/menu/assets/skins/sam/menu.css
      cgi_stylesheet $_wp(yui)/build/button/assets/skins/sam/button.css
      # YahooUI libraries
      cgi_script type=text/javascript language="JavaScript" src="$_wp(yui)/build/utilities/utilities.js" {}
      cgi_script type=text/javascript language="JavaScript" src="$_wp(yui)/build/container/container-min.js" {}
      cgi_script type=text/javascript language="JavaScript" src="$_wp(yui)/build/datasource/datasource-min.js" {}
      cgi_script type=text/javascript language="JavaScript" src="$_wp(yui)/build/menu/menu-min.js" {}
      cgi_script type=text/javascript language="JavaScript" src="$_wp(yui)/build/button/button-min.js" {}
      # local libraries
      cgi_script language="JavaScript" src="lib/common.js" {}
      cgi_script language="JavaScript" src="lib/settings.js" {}
      cgi_javascript {
	cgi_puts "YAHOO.alpine.cgi_root = '$_wp(serverpath)';"
	cgi_puts "YAHOO.alpine.cgi_base = '$script_base';"
	cgi_puts "YAHOO.alpine.current.incoming = [WPCmd PEFolder isincoming $c];"
	cgi_puts "YAHOO.alpine.current.c = $c;"
	cgi_puts "YAHOO.alpine.current.f = \"$f\";"
	cgi_puts "function bodyOnLoad() {"
	cgi_puts " if(YAHOO.env.ua.gecko > 0){ sizeVPHeight(); window.onresize = resizeVPHeight; }"
	cgi_puts " setCheckMailFunction('gCheck', newMailCheck);"
	cgi_puts " setNewMailCheckInterval([WPCmd PEInfo inputtimeout]);"
        cgi_puts "}"
	cgi_puts "browserDetect();"
      }
    }

    cgi_body class=wap "onLoad=bodyOnLoad()" {
      cgi_puts {<iframe name="formResponse" id="formResponse" src="img/cbn/spritelib.gif"></iframe>}
      wpCommonPageLayout {settings {
	cgi_hr
	cgi_division {
	  cgi_put [cgi_url [cgi_span "class=sp splci tbi5" "Back to $f"] browse/$c/$f class=wap title="Return to $f without saving changes"]
	}
	cgi_hr
	cgi_division class="ftitle bld" {
	  cgi_put "Basic Settings"
	}
	cgi_division "class=\"bld sel\"" {
	  cgi_put [cgi_url [cgi_span "class=sp splcs splc12" "General Preferences"] # class=wap id=Page1 "onClick=return settingsPage(this);"]
	}
	cgi_division class=bld {
	  cgi_put [cgi_url [cgi_span "class=sp splcs splc12" "Personal Preferences"] # class=wap id=Page2 "onClick=return settingsPage(this);"]
	}
	cgi_division class=bld {
	  cgi_put [cgi_url [cgi_span "class=sp splcs splc12" "News and Weather"] # class=wap id=Page3 "onClick=return settingsPage(this);"]
	}
	cgi_division class="ftitle bld" "style=\"margin-top: 2em;\"" {
	  cgi_put [cgi_url "[cgi_img img/cbn/f_plus.gif class=wap]  Advanced Settings" # class=wap "onClick=return toggleAdvance(this);"]
	}
	cgi_division id=advancedSettings {
	  cgi_division class=bld {
	    cgi_put [cgi_url [cgi_span "class=sp splcs splc12" "Message List"] # class=wap id=Page4 "onClick=return settingsPage(this);"]
	  }
	  cgi_division class=bld {
	    cgi_put [cgi_url [cgi_span "class=sp splcs splc12" "Message View"] # class=wap id=Page5 "onClick=return settingsPage(this);"]
	  }
	  cgi_division class=bld {
	    cgi_put [cgi_url [cgi_span "class=sp splcs splc12" "Folders"] # class=wap id=Page8 "onClick=return settingsPage(this);"]
	  }
	  cgi_division class=bld {
	    cgi_put [cgi_url [cgi_span "class=sp splcs splc12" "Compose"] # class=wap id=Page6 "onClick=return settingsPage(this);"]
	  }
	  cgi_division class="ftitle bld" "style=\"margin-top: 2em;\"" {
	    cgi_put "Server Settings"
	  }
	  cgi_division class=bld {
	    cgi_put [cgi_url [cgi_span "class=sp splcs splc12" "Mail Servers"] # class=wap id=Page10 "onClick=return settingsPage(this);"]
	  }
	  cgi_division class=bld {
	    cgi_put [cgi_url [cgi_span "class=sp splcs splc12" "Directory Servers"] # class=wap id=Page9 "onClick=return settingsPage(this);"]
	  }
	}
	if {[info exists _wp(filter_link)] || [info exists _wp(vacation_link)]} {
	  cgi_division class="ftitle bld" "style=\"margin-top: 2em;\"" {
	    cgi_put "External Settings"
	  }
	}
	if {[info exists _wp(filter_link)]} {
	  cgi_division class=bld {
	    cgi_put [cgi_url [cgi_span "class=sp splcs splc12" "Message Filtering"] $_wp(filter_link) class=wap target=_blank]
	  }
	}
	if {[info exists _wp(vacation_link)]} {
	  cgi_division class=bld {
	    cgi_put [cgi_url [cgi_span "class=sp splcs splc12" "Vacation Auto-Reply"] $_wp(vacation_link) class=wap target=_blank]
	  }
	}
      }} "$c" "$f" 0 Settings \
	  [list [cgi_cgi "$_wp(appdir)/$_wp(ui2dir)/browse/${c}/${f}"] Settings 0 searchContent('settings','alpineContent')] "" {
	# CONTEXT COMMANDS
	cgi_division class=hdrBtns {
	  cgi_javascript {
	    cgi_put "if(window.print) document.write('[cgi_buffer {cgi_put [cgi_url "[cgi_span "class=sp hdrBtnImg hbi1" ""][cgi_span "class=hdrBtnText" Print]" "print" "onClick=return printContent()"]}]');"
	  }

	  cgi_put [cgi_url "[cgi_span "class=sp hdrBtnImg hbi3" ""][cgi_span "class=hdrBtnText" Help]" "javascript:openHelpWindow('settings.html');" class=wap]
	  cgi_put [cgi_url "[cgi_span "class=sp hdrBtnImg hbi4" ""][cgi_span "class=hdrBtnText" "Sign out"]" "../../session/logout.tcl?cid=[WPCmd PEInfo key]&sessid=${sessid}"]
	}
      } {
	# TOP MENUBAR
	cgi_anchor_name "toolbar"
	cgi_table  class="toolbarTbl" cellpadding="0" cellspacing="0" {
	  cgi_puts "<tbody>"
	  cgi_table_row  {
	    cgi_table_data {
	      cgi_table class="toolbarTbl" cellpadding="0" cellspacing="0" {
		cgi_puts "<tbody>"
		cgi_table_row {
		  cgi_table_data class="wap" {
		    cgi_put [cgi_url [cgi_span "class=sp spmbi spmb10" "Save Settings"] "#" title="Save Settings Changes" "onClick=return saveSettings();"]
		  }
		  cgi_table_data class="wap" {
		    cgi_put [cgi_url [cgi_span "class=sp spmbi spmb21" "Reset to Default Settings"] "#" "onClick=panelConfirm('Restoring default settings will erase all custom settings.<p>Are you sure you want to restore default settings?',{text:'Restore Defaults',fn:restoreDefaultSettings}); return false;" title="Reset to Default Settings"]
		  }
		  cgi_table_data class="wap" {
		    cgi_put [cgi_url [cgi_span "class=sp spmbi spmb12" "Cancel"] "browse/$c/$f" title="Cancel Settings Changes"]
		  }
		  cgi_table_data  width="100%" {
		    cgi_puts [cgi_nbspace]
		  }
		}
		cgi_puts "</tbody>"
	      }
	    }
	  }
	  cgi_puts "</tbody>"
	}
      } {
	cgi_form $_wp(appdir)/$_wp(ui2dir)/conduit/settings.tcl "enctype=multipart/form-data" id=settingsForm target=formResponse {
	  cgi_text "restore=false" id=restore type=hidden notab
	  cgi_table id=settingsPage1 "class=\"fields settings\"" cellpadding="0" cellspacing="0" {
	    cgi_puts "<tbody>"
	    cgi_puts "<tr><td class=title colspan=2><h2>General Preferences</h2></td></tr>"
	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_puts "Message Display"
		#[cgi_br]<a href="#" title="more info..." onClick="help_popup1.showPopup('anchor1');return false;" name="anchor1" id="anchor1"><img src="img/cbn/help_sm.gif"></a>
	      }
	      cgi_table_data class="body" {
		if {[info exists _wp(themes)]} {
		  cgi_put "Theme: "
		  cgi_select theme {
		    foreach theme $_wp(themes) {
		      cgi_option [lindex $theme 0] value=[lindex $theme 1]
		    }
		  }
		  cgi_br
		}
		cgi_put "Display "
		set n [var_value wp-indexlines]
		cgi_select wp-indexlines {
		  for {set i 10} {$i <= $_wp(indexlinesmax)} {incr i 5} {
		    cgi_option $i value=$i [set_checked [expr {$i == $n}] selected]
		  }
		}
		cgi_put " messages per page"
		cgi_br
		cgi_put "Wrap Plain Text message at "
		set n [WPCmd PEConfig columns]
		cgi_select wrapColumn {
		  for {set i 20} {$i < 130} {incr i 4} {
		    cgi_option $i value=$i [set_checked [expr {$i == $n}] selected]
		  }
		}
		cgi_put " characters"
	      }
	    }
	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "Folders"
		#[cgi_br]<a href="#" title="more info..."><img src="img/cbn/help_sm.gif"></a>
	      }
	      cgi_table_data class="body" {
		cgi_put "Display "
		if {[catch {WPSessionState left_column_folders} n]} {
		  set n $_wp(fldr_cache_def)
		}

		cgi_select folderCache {
		  for {set i 5} {$i <= $_wp(fldr_cache_max)} {incr i} {
		    cgi_option $i value=$i [set_checked [expr {$i == $n}] selected]
		  }
		}
		cgi_put " recent folders in left column"
	      }
	    }
	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "Reply[cgi_nbspace]Options"
		#[cgi_br]<a href="#" title="more info..."><img src="img/cbn/help_sm.gif"></a>
	      }
	      cgi_table_data class="body" {
		set_feature include-header-in-reply "Include headers in replies"
		cgi_br
		set_feature include-attachments-in-reply "Include attachments in replies"
		cgi_br
		set_feature signature-at-bottom "Append signature below reply text"
		cgi_br
		set_feature strip-from-sigdashes-on-reply "Strip signatures when replying"
	      }
	    }
	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "Forwarding[cgi_nbspace]Options"
		#[cgi_br]<a href="#" title="more info..."><img src="img/cbn/help_sm.gif"></a>
	      }
	      cgi_table_data class="body" {
		set as_attach [WPCmd PEInfo feature forward-as-attachment]
		cgi_radio_button forwardAs=inline id="forward_inline" [set_checked [expr {$as_attach == 0}]]
		cgi_put " <label for=forward_inline>Forward messages inline</label>"
		cgi_br
		cgi_radio_button forwardAs=attached id="forward_attachment" [set_checked $as_attach]
		cgi_put " <label for=forward_attachment>Forward messages as attachments</label>"
	      }
	    }
	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "Sent[cgi_nbspace]Message[cgi_nbspace]Options"
		cgi_put "<p><span class=tips><strong>Tip:</strong> Set folder blank to prevent saving of Sent messages</span>"
		#[cgi_br]<a href="#" title="more info..."><img src="img/cbn/help_sm.gif"></a>

	      }
	      cgi_table_data class="body" {
		set_variable default-fcc "Name of your Sent mail folder (also called \"Fcc\"): "
		cgi_br
		set_feature fcc-without-attachments "Save sent messages to Sent folder without attachments"
	      }
	    }
	    cgi_puts "</tbody>"
	  }
	  cgi_table id=settingsPage2 "class=\"fields settings\"" "style=\"display: none;\"" cellpadding="0" cellspacing="0" {
	    cgi_puts "<tbody>"
	    cgi_puts "<tr><td class=title colspan=2><h2>Personal[cgi_nbspace]Information</h2></td></tr>"
	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "Display[cgi_nbspace]Name"
		#<br><a href="#" title="more info..."><img src="img/cbn/help_sm.gif"></a>
	      }
	      cgi_table_data class="body" {
		set_variable personal-name
	      }
	    }
	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "User[cgi_nbspace]Domain"
		#<br><a href="#" title="more info..."><img src="img/cbn/help_sm.gif"></a>
	      }
	      cgi_table_data class="body" {
		set_variable user-domain
	      }
	    }
	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "Email[cgi_nbspace]Signature"
		#<br><a href="#" title="more info..."><img src="img/cbn/help_sm.gif"></a>
	      }
	      cgi_table_data class="body" {
		#<input name="signature" id="no_sig" type="radio" checked />
		#<label for="no_sig">No Signature</label><br>
		#<input name="signature" id="use_sig" type="radio" />
		#<label for="use_sig">Append Signature when composing messages</label><br>
		cgi_textarea signature=[join [WPCmd PEInfo rawsig] "\n"] cols="72" rows="5" title=Signature
	      }
	    }
	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "Alternate[cgi_nbspace]Addresses"
		cgi_put "<p><span class=tips><b>Tip:</b> List alternate email addresses "
		cgi_put "you use. Reply All will not include"
		cgi_put "these email addresses when replying.</span>"
		#<br><a href="#" title="more info..."><img src="img/cbn/help_sm.gif"></a>
	      }
	      cgi_table_data class="body" {
		cgi_put "Add/Remove Addresses: <input type=button name=addCH value=Add onClick=\"return listAdd('altAddrTable','altAddr');\"/>"
		set varval [WPCmd PEConfig varget alt-addresses]
		cgi_text "altAddrs=[llength [lindex $varval 0]]" id=altAddrs type=hidden notab
		cgi_table id=altAddrTable {
		  set n 0
		  foreach svr [lindex $varval 0] {
		    incr n
		    cgi_table_row {
		      cgi_table_data {
			cgi_text altAddr${n}=[string trim $svr] size="45"
			cgi_put [cgi_url [cgi_img img/cbn/remove.gif class=wap] # "onClick=return removeTableRow(this);"]
		      }
		    }
		  }
		}
	      }
	    }
	    cgi_puts "</tbody>"
	  }
	  cgi_table id=settingsPage3 "class=\"fields settings\"" "style=\"display: none;\"" cellpadding="0" cellspacing="0" {
	    cgi_puts "<tbody>"
	    cgi_puts "<tr><td class=title colspan=2><h2>News[cgi_nbspace]and[cgi_nbspace]Weather</h2></td></tr>"

	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "Headline[cgi_nbspace]News"
		#<br><a href="#" title="more info..."><img src="img/cbn/help_sm.gif"></a>
	      }
	      cgi_table_data class="body" {
		cgi_put "RSS URL: "
		cgi_text rss-news=[var_value rss-news] size="45"
	      }
	    }
	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "Weather[cgi_nbspace]Bar"
		#<br><a href="#" title="more info..."><img src="img/cbn/help_sm.gif"></a>
	      }
	      cgi_table_data class="body" {
		cgi_put "RSS URL: "
		cgi_text rss-weather=[var_value rss-weather] size="45"
	      }
	    }
	    cgi_puts "</tbody>"
	  }
	  cgi_table id=settingsPage4 "class=\"fields settings\"" "style=\"display: none;\"" cellpadding="0" cellspacing="0" {
	    cgi_puts "<tbody>"
	    cgi_puts "<tr><td class=title colspan=2><h2>Message[cgi_nbspace]List</h2></td></tr>"

	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "Message List"
	      }
	      cgi_table_data class="body" {
		cgi_table {
		  cgi_put "<tbody>"
		  cgi_table_row {
		    cgi_table_data {
		      cgi_put "Sort Order (default): "
		    }
		    cgi_table_data {
		      set val [WPCmd PEConfig varget sort-key]
		      cgi_select sort-key {
			foreach k [lindex $val 2] {
			  cgi_option $k value=$k [set_checked [expr {0 == [string compare -nocase $k [lindex $val 0]]}] selected]
			}
		      }
		    }
		  }
		  cgi_table_row {
		    cgi_table_data {
		      cgi_put "Start display at:"
		    }
		    cgi_table_data {
		      set val [WPCmd PEConfig varget incoming-startup-rule]
		      cgi_select incoming-startup-rule {
			foreach k [lindex $val 2] {
			  cgi_option $k value=$k [set_checked [expr {0 == [string compare -nocase $k [lindex $val 0]]}] selected]
			}
		      }
		    }
		  }
		  cgi_put "</tbody>"
		}
	      }
	    }
	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "Message[cgi_nbspace]Handling"
	      }
	      cgi_table_data class="body" {
		set_variable read-message-folder "Name of the folder to hold your read messages:  "
		cgi_br
		set_feature auto-move-read-msgs "Automatically Move Read Messages"
	      }
	    }
	    cgi_puts "</tbody>"
	  }
	  cgi_table id=settingsPage5 "class=\"fields settings\"" "style=\"display: none;\"" cellpadding="0" cellspacing="0" {
	    cgi_puts "<tbody>"
	    cgi_puts "<tr><td class=title colspan=2><h2>Message View</h2></td></tr>"

	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "Display[cgi_nbspace]Headers"
	      }
	      cgi_table_data class="body" {
		cgi_put "Add/Remove Header Names: <input type=button name=addCH value=Add onClick=\"return listAdd('viewerHdrsTable','viewerHdr');\"/>"
		set varval [WPCmd PEConfig varget viewer-hdrs]
		cgi_text "viewerHdrs=[llength [lindex $varval 0]]" id=viewerHdrs type=hidden notab
		cgi_table id=viewerHdrsTable {
		  set n 0
		  foreach svr [lindex $varval 0] {
		    incr n
		    cgi_table_row {
		      cgi_table_data {
			cgi_text viewerHdr${n}=[string trim $svr] size="45"
			cgi_put [cgi_url [cgi_img img/cbn/remove.gif class=wap] # "onClick=return removeTableRow(this);"]
		      }
		    }
		  }
		}
	      }
	    }

	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "Display[cgi_nbspace]Links[cgi_nbspace]in[cgi_nbspace]Messages"
		cgi_put "<p><span class=tips><b>Tip:</b> Applies only to plain text messages.</span>"
		#<br><a href="#" title="more info..."><img src="img/cbn/help_sm.gif"></a>
	      }
	      cgi_table_data class="body" {
		cgi_table {
		  cgi_put "<tbody>"
		  cgi_table_row {
		    cgi_table_data {
		      set_feature enable-msg-view-urls "Display complete URLs as links"
		    }
		  }
		  cgi_table_row {
		    cgi_table_data {
		      set_feature enable-msg-view-web-hostnames "Display hostnames and incomplete URLs as links"
		    }
		  }
		  cgi_table_row {
		    cgi_table_data {
		      set_feature enable-msg-view-addresses "Display Email addresses as links"
		    }
		  }
		  cgi_put "</tbody>"
		}
	      }
	    }
	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "Rich[cgi_nbspace]Text[cgi_nbspace]Display"
		#<br><a href="#" title="more info..."><img src="img/cbn/help_sm.gif"></a>
	      }
	      cgi_table_data class="body" {
		set_feature render-html-internally "Show rich text messages as plain text"
	      }
	    }
	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "Anti-phishing"
		cgi_put "<p><span class=tips><b>Tip:</b> This feature aids in identifying fake links.  Applies only when rich text shown as plain text.</span>"
		#<br><a href="#" title="more info..."><img src="img/cbn/help_sm.gif"></a>
	      }
	      cgi_table_data class="body" {
		set_feature quell-server-after-link-in-html "Hide appended real hostname after links"
	      }
	    }
	    cgi_puts "</tbody>"
	  }
	  cgi_table id=settingsPage6 "class=\"fields settings\"" "style=\"display: none;\"" cellpadding="0" cellspacing="0" {
	    cgi_puts "<tbody>"
	    cgi_puts "<tr><td class=title colspan=2><h2>Compose</h2></td></tr>"
	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "Compose[cgi_nbspace]Headers"
		cgi_put "<p><span class=tips><b>Tip:</b> Default header fields displayed in Compose</span>"
	      }
	      cgi_table_data class="body" {
		cgi_put "Add/Remove Header Names: <input type=button name=addCH value=Add onClick=\"return listAdd('composeHdrsTable','composeHdr');\"/>"
		set varval [WPCmd PEConfig varget default-composer-hdrs]
		cgi_text "composeHdrs=[llength [lindex $varval 0]]" id=composeHdrs type=hidden notab
		cgi_table id=composeHdrsTable {
		  set n 0
		  foreach svr [lindex $varval 0] {
		    incr n
		    cgi_table_row {
		      cgi_table_data {
			cgi_text composeHdr${n}=[string trim $svr] size="45"
			cgi_put [cgi_url [cgi_img img/cbn/remove.gif class=wap] # "onClick=return removeTableRow(this);"]
		      }
		    }
		  }
		}
	      }
	    }
	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "Custom[cgi_nbspace]Headers"
	      }
	      cgi_table_data class="body" {
		cgi_put "Add/Remove Headers: <input type=button name=addhdr value=Add onClick=\"return customHdrAdd('customHdrTbl');\"/>"
		set varval [WPCmd PEConfig varget customized-hdrs]
		cgi_text "customHdrFields=[llength [lindex $varval 0]]" id=customHdrFields type=hidden notab
		cgi_table id=customHdrTbl {
		  set nh 0
		  foreach hdr [lindex $varval 0] {
		    incr nh
		    cgi_table_row {
		      set n [string first {:} $hdr]
		      switch -- $n {
			-1 -
			0 -
			1 {
			  cgi_table_data colspan=2 {
			    cgi_text "customHdrField${nh}=[cgi_quote_html $hdr]" type=hidden notab
			    cgi_put "$hdr"
			  }
			}
			default {
			  cgi_table_data {
			    set field_name [string range $hdr 0 [expr {$n - 1}]]
			    cgi_put $field_name
			    cgi_text "customHdrField${nh}=[cgi_quote_html $field_name]" type=hidden notab
			  }
			  cgi_table_data {
			    cgi_text customHdrData${nh}=[string trim [string range $hdr [incr n] end]] size="45"
			    cgi_put [cgi_url [cgi_img img/cbn/remove.gif class=wap] # "onClick=return removeTableRow(this);"]
			  }
			}
		      }
		    }
		  }
		}
	      }
	    }
	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "Message[cgi_nbspace]Encoding"
		#[cgi_br]<a href="#" title="more info..."><img src="img/cbn/help_sm.gif"></a>
	      }
	      cgi_table_data class="body" {
		set_variable posting-character-set "Send messages using character encoding: "
	      }
	    }

	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "Reply[cgi_nbspace]Options"
		#[cgi_br]<a href="#" title="more info..."><img src="img/cbn/help_sm.gif"></a>
	      }
	      cgi_table_data class="body" {
		set_variable reply-leadin "Reply intro string: "
		cgi_br
		set_variable reply-indent-string "Reply prefix: "
	      }
	    }
	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "Flowed[cgi_nbspace]Text[cgi_nbspace]Handling"
		#[cgi_br]<a href="#" title="more info..."><img src="img/cbn/help_sm.gif"></a>
	      }
	      cgi_table_data class="body" {
		set_feature quell-flowed-text "Do not send text as Flowed Text"
	      }
	    }
	    cgi_puts "</tbody>"
	  }
	  cgi_table id=settingsPage7 "class=\"fields settings\"" "style=\"display: none;\"" cellpadding="0" cellspacing="0" {
	    cgi_puts "<tbody>"
	    cgi_puts "<tr><td class=title colspan=2><h2>Filters</h2></td></tr>"

	    cgi_puts "</tbody>"
	  }
	  cgi_table id=settingsPage8 "class=\"fields settings\"" "style=\"display: none;\"" cellpadding="0" cellspacing="0" {
	    cgi_puts "<tbody>"
	    cgi_puts "<tr><td class=title colspan=2><h2>Folders</h2></td></tr>"
	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "Draft[cgi_nbspace]Folder"
		#[cgi_br]<a href="#" title="more info..."><img src="img/cbn/help_sm.gif"></a>
	      }
	      cgi_table_data class="body" {
		set_variable postponed-folder
	      }
	    }
	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "Trash[cgi_nbspace]Folder"
		#[cgi_br]<a href="#" title="more info..."><img src="img/cbn/help_sm.gif"></a>
	      }
	      cgi_table_data class="body" {
		set_variable trash-folder
	      }
	    }
	    cgi_puts "</tbody>"
	  }
	  if {0 == [catch {WPCmd PEConfig varget ldap-servers} varval]} {
	    cgi_table id=settingsPage9 "class=\"fields settings\"" "style=\"display: none;\"" cellpadding="0" cellspacing="0" {
	      cgi_puts "<tbody>"
	      cgi_puts "<tr><td class=title colspan=2><h2>Directory[cgi_nbspace]Servers</h2></td></tr>"

	      cgi_table_row {
		cgi_table_data class="title" {
		  cgi_put "LDAP[cgi_nbspace]Server"
		}
		cgi_table_data class="body" {
		  cgi_put "Add/Remove Servers: <input type=button name=addldap value=Add onClick=\"return listAdd('ldapServerTable','ldapServer');\"/>"
		  cgi_text "ldapServers=[llength [lindex $varval 0]]" id=ldapServers type=hidden notab
		  cgi_table id=ldapServerTable {
		    set n 0
		    foreach svr [lindex $varval 0] {
		      incr n
		      cgi_table_row {
			cgi_table_data {
			  cgi_text ldapServer${n}=[string trim $svr] size="45"
			  cgi_put [cgi_url [cgi_img img/cbn/remove.gif class=wap] # "onClick=return removeTableRow(this);"]
			}
		      }
		    }
		  }
		}
	      }

	      cgi_puts "</tbody>"
	    }
	  }
	  cgi_table id=settingsPage10 "class=\"fields settings\"" "style=\"display: none;\"" cellpadding="0" cellspacing="0" {
	    cgi_puts "<tbody>"
	    cgi_puts "<tr><td class=title colspan=2><h2>Mail[cgi_nbspace]Servers</h2></td></tr>"
	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "Inbox[cgi_nbspace]Server"
		cgi_put "<p><span class=tips><b>Tip:</b> Server name inside brackets, folder name after</span>"
	      }
	      cgi_table_data class="body" {
		cgi_text inbox-path=[var_value inbox-path] size="45"
	      }
	    }

	    cgi_table_row {
	      cgi_table_data class="title" {
		cgi_put "SMTP[cgi_nbspace]Server"
	      }
	      cgi_table_data class="body" {
		cgi_put "Add/Remove Servers: <input type=button name=addsmtp value=Add onClick=\"return listAdd('smtpServerTable','smtpServer');\"/>"
		set varval [WPCmd PEConfig varget smtp-server]
		cgi_text "smtpServers=[llength [lindex $varval 0]]" id=smtpServers type=hidden notab
		cgi_table id=smtpServerTable {
		  set n 0
		  foreach svr [lindex $varval 0] {
		    incr n
		    cgi_table_row {
		      cgi_table_data {
			cgi_text smtpServer${n}=[string trim $svr] size="45"
			cgi_put [cgi_url [cgi_img img/cbn/remove.gif class=wap] # "onClick=return removeTableRow(this);"]
		      }
		    }
		  }
		}
	      }
	    }

	    cgi_puts "</tbody>"
	  }
	}
      } {
	# BOTTOM MENUBAR
	cgi_table class="wap toolbarTbl" cellpadding="0" cellspacing="0" {
	  cgi_puts "<tbody><tr><td>&nbsp;</td></tr></tbody>"
	}
      }
    }
  }
}