Changeset 413 for trunk/gui/scripts/filexfer.tcl
- Timestamp:
- Apr 26, 2006, 6:42:46 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/filexfer.tcl
r213 r413 27 27 namespace eval Rappture::filexfer { 28 28 variable enabled 0 ;# set to 1 when this is running 29 variable port 9001;# start server on this port29 variable port 0 ;# start server on this port 30 30 variable cookie "" ;# magic cookie for applet auth 31 31 variable restrictClientAddress "" ;# allow clients only from this addr … … 75 75 } 76 76 77 # 78 # Set up a safe interpreter for loading filexfer options... 79 # 80 variable optionParser [interp create -safe] 81 foreach cmd [$optionParser eval {info commands}] { 82 $optionParser hide $cmd 83 } 84 # this lets us ignore unrecognized commands in the file: 85 $optionParser invokehidden proc unknown {args} {} 86 87 $optionParser alias filexfer_port Rappture::filexfer::option_port 88 $optionParser alias filexfer_cookie Rappture::filexfer::option_cookie 89 $optionParser alias filexfer_sitelogo Rappture::filexfer::option_sitelogo 90 $optionParser alias filexfer_stylesheet Rappture::filexfer::option_stylesheet 77 } 78 79 # must use this name -- plugs into Rappture::resources::load 80 proc filexfer_init_resources {} { 81 Rappture::resources::register \ 82 filexfer_port Rappture::filexfer::option_port \ 83 filexfer_cookie Rappture::filexfer::option_cookie \ 84 filexfer_sitelogo Rappture::filexfer::option_sitelogo \ 85 filexfer_stylesheet Rappture::filexfer::option_stylesheet 91 86 } 92 87 … … 99 94 # ---------------------------------------------------------------------- 100 95 proc Rappture::filexfer::init {} { 101 global env102 variable optionParser103 96 variable enabled 104 97 variable port … … 109 102 110 103 # 111 # Look for a $SESSION variable and a file called 112 # ~/data/sessions/$SESSION/resources. If found, then 113 # load the settings from that file and start a server 114 # for filexfer. 115 # 116 if {[info exists env(SESSION)]} { 117 set file ~/data/sessions/$env(SESSION)/resources 118 if {![file exists $file]} { 119 return 0 120 } 121 if {[catch { 122 set fid [open $file r] 123 set info [read $fid] 124 close $fid 125 $optionParser eval $info 126 } result]} { 127 after 1 [list tk_messageBox -title Error -icon error -message "Error in resources file:\n$reslt"] 128 return 0 129 } 130 104 # The port setting should have been set properly in the 105 # "resources" file loaded at the beginning of the app. 106 # If it wasn't, then don't do any filexfer. 107 # 108 if {$port > 0} { 131 109 # 132 110 # If the prescribed port is busy, then exit with a special
Note: See TracChangeset
for help on using the changeset viewer.