Changeset 213


Ignore:
Timestamp:
Feb 23, 2006 9:06:49 AM (18 years ago)
Author:
mmc
Message:
  • Fixed up the tool tips for upload to remind the user about allowing pop ups, and to catch errors when the user uploads nothing.
  • Added a protocol version number to the filexfer applet, so Rappture can warn when the applet is out-of-date with respect to the application. (Thanks, Rick!)
Location:
trunk/gui
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/filexfer/monitor.java

    r171 r213  
    1919
    2020public class monitor extends Thread {
     21    private String protocol = "1.0";
     22
    2123    private filexfer parent;
    2224    private String hostName;
     
    136138
    137139        try {
    138             ostream.println("REGISTER "+user+" "+ipAddr+" "+cookie+" RAPPTURE");
     140            ostream.println("REGISTER "+user+" "+ipAddr+" "+cookie+" RAPPTURE/"+protocol);
    139141            ostream.println("ACTIVATE RAPPTURE");
    140142            parent.status.append("Connected\n");
  • trunk/gui/scripts/analyzer.tcl

    r210 r213  
    619619                            Rappture::Tooltip::cue $widget "Can't download this result.  Looks like you might be having trouble with the version of Java installed for your browser."
    620620                        }
     621                    } elseif {"old client" == $result} {
     622                        if {"" != $widget} {
     623                            Rappture::Tooltip::cue $widget "For this to work properly, you must first restart your Web browser.  You don't need to close down this session.  Simply shut down all windows for your Web browser, then restart the browser and navigate back to this page.  You'll find it on \"my nanoHUB\" listed under \"my sessions\".  Once the browser is restarted, the download should work properly."
     624                        }
     625                    } elseif {"old clients" == $result} {
     626                        if {"" != $widget} {
     627                            Rappture::Tooltip::cue $widget "There are multiple browser pages connected to this session, and one of them has browser that needs to be restarted.\n\nWhoever didn't get the download should restart their Web browser.  You don't need to close down this session.  Simply shut down all windows for the Web browser, then restart the browser and navigate back to this page.  You'll find it on \"my nanoHUB\" listed under \"my sessions\".  Once the browser is restarted, the download should work properly."
     628                        }
    621629                    } else {
    622630                        error $result "    (while spooling result \"$title\")"
  • trunk/gui/scripts/filexfer.tcl

    r210 r213  
    4545    }
    4646
     47    # maps client socket => socket protocol
     48    # if it doesn't match, we warn user to restart the browser
     49    variable protocol
     50    set protocol(current) "1.0"
     51
    4752    #
    4853    # Translates mime type => file extension
     
    182187    variable enabled
    183188    variable clients
     189    variable protocol
    184190    variable access
    185191
     
    214220
    215221        set sent 0
     222        set protoproblems 0
    216223        set access($filename) [bakeCookie]
    217224        foreach cid $clients(order) {
    218225            if {[info exists clients($cid)] && $clients($cid)} {
     226                if {![string equal $protocol($cid) $protocol(current)]} {
     227                    incr protoproblems
     228                }
    219229                catch {
    220230                    puts $cid [format "url /spool/%s/%s?access=%s" \
     
    226236        if {!$sent} {
    227237            error "no clients"
     238        }
     239        if {$protoproblems == 1} {
     240            error "old client"
     241        } elseif {$protoproblems > 1} {
     242            error "old clients"
    228243        }
    229244    }
     
    351366            }
    352367            # blank line -- process below...
    353         } elseif {[regexp { +RAPPTURE$} $line]} {
     368        } elseif {[regexp { +RAPPTURE(/[0-9\.]+)?$} $line]} {
    354369            set buffer($cid) $line
    355370            # special Rappture request -- process below...
     
    373388        set lines [lrange $lines 1 end]
    374389        if {![regexp {^ *([A-Z]+) +([^ ]+) +(HTTP/1\.[01])$} $line \
    375               match type url protocol]
    376             && ![regexp { +(RAPPTURE)$} $line match protocol]} {
     390              match type url proto]
     391            && ![regexp { +(RAPPTURE(/[0-9\.]+)?)$} $line match proto]} {
    377392            set errmsg "Malformed request: $line"
    378393        }
    379394
    380         if {[string match HTTP/* $protocol]} {
     395        if {[string match HTTP/* $proto]} {
    381396            #
    382397            # HANDLE HTTP/1.x REQUESTS...
     
    425440                shutdown $cid
    426441            }
    427         } elseif {$protocol == "RAPPTURE"} {
     442        } elseif {[string match RAPPTURE* $proto]} {
    428443            #
    429444            # HANDLE SPECIAL RAPPTURE REQUESTS...
    430445            #
    431             if {[regexp {^ *(REGISTER) +([^ ]+) +([^ ]+) +([^ ]+) +RAPPTURE$} \
    432                   $line match type user addr cookie]} {
    433                 request_REGISTER $cid $user $addr $cookie
     446            set vers "0.0"
     447            if {[regexp {^ *(REGISTER) +([^ ]+) +([^ ]+) +([^ ]+) +RAPPTURE(/[0-9\.]+)?$} \
     448                  $line match type user addr cookie vers]} {
     449                  set vers [string trimleft $vers /]
     450                request_REGISTER $cid $user $addr $cookie $vers
    434451            } elseif {[regexp {^ *UNREGISTER +RAPPTURE$} $line]} {
    435452                request_UNREGISTER $cid
     
    684701              && [info exists uploadcmds($post(callback))]} {
    685702            # get the data -- either text or file
    686             set data $post($post(which))
     703            set dlist [list which $post(which)]
     704            lappend dlist data $post($post(which))
    687705
    688706            # get the upload callback command
    689707            set cmd $uploadcmds($post(callback))
    690             if {[catch "$cmd [list $data]" result]} {
     708            if {[catch "$cmd $dlist" result]} {
    691709                bgerror $result
    692710            }
     
    732750
    733751# ----------------------------------------------------------------------
    734 # USAGE: request_REGISTER <clientId> <user> <address> <cookie>
     752# USAGE: request_REGISTER <clientId> <user> <address> <cookie> <protocol>
    735753#
    736754# Used internally to handle REGISTER requests on this server.  A client
    737755# sends REGISTER requests when it wants to be notified of file transfer
    738756# operations.  The <cookie> must match the one for this server, so
    739 # we know we can trust the client.
    740 # ----------------------------------------------------------------------
    741 proc Rappture::filexfer::request_REGISTER {cid user addr clientCookie} {
     757# we know we can trust the client.  The <protocol> tells us what version
     758# of filexfer client we're talking to.  If the protocol doesn't match
     759# the current version, we warn the user to restart his browser.
     760# ----------------------------------------------------------------------
     761proc Rappture::filexfer::request_REGISTER {cid user addr clientCookie proto} {
    742762    variable clients
    743763    variable cookie
     764    variable protocol
    744765
    745766    if {![string equal $cookie $clientCookie]} {
     
    749770        # add this client to the known listeners
    750771        set clients($cid) 0
     772        set protocol($cid) $proto
    751773    }
    752774}
  • trunk/gui/scripts/loader.tcl

    r210 r213  
    286286            if {$status == 0} {
    287287                Rappture::Tooltip::cue $itk_component(combo) \
    288                     "Upload starting...\nA web browser page should pop up on your desktop.  Use that form to handle the upload operation."
     288                    "Upload starting...\nA web browser page should pop up on your desktop.  Use that form to handle the upload operation.\n\nIf the upload form doesn't pop up, make sure that you're allowing pop ups from this site.  If it still doesn't pop up, you may be having trouble with the version of Java installed for your browser.  See our Support area for details.\n\nClick anywhere to dismiss this message."
    289289            } else {
    290290                if {$result == "no clients"} {
    291291                    Rappture::Tooltip::cue $itk_component(combo) \
    292292                        "Can't upload files.  Looks like you might be having trouble with the version of Java installed for your browser."
     293                } elseif {"old client" == $result} {
     294                    Rappture::Tooltip::cue $itk_component(combo) "For this to work properly, you must first restart your Web browser.  You don't need to close down this session.  Simply shut down all windows for your Web browser, then restart the browser and navigate back to this page.  You'll find it on \"my nanoHUB\" listed under \"my sessions\".  Once the browser is restarted, the upload should work properly."
     295                } elseif {"old clients" == $result} {
     296                    Rappture::Tooltip::cue $itk_component(combo) "There are multiple browser pages connected to this session, and one of them has browser that needs to be restarted.\n\nWhoever didn't get the upload form should restart their Web browser.  You don't need to close down this session.  Simply shut down all windows for the Web browser, then restart the browser and navigate back to this page.  You'll find it on \"my nanoHUB\" listed under \"my sessions\".  Once the browser is restarted, the upload should work properly."
    293297                } else {
    294298                    bgerror $result
     
    314318                    Rappture::Tooltip::cue $itk_component(combo) \
    315319                        "Can't download data.  Looks like you might be having trouble with the version of Java installed for your browser."
     320                } elseif {"old client" == $result} {
     321                    Rappture::Tooltip::cue $itk_component(combo) "For this to work properly, you must first restart your Web browser.  You don't need to close down this session.  Simply shut down all windows for your Web browser, then restart the browser and navigate back to this page.  You'll find it on \"my nanoHUB\" listed under \"my sessions\".  Once the browser is restarted, the download should work properly."
     322                } elseif {"old clients" == $result} {
     323                    Rappture::Tooltip::cue $itk_component(combo) "There are multiple browser pages connected to this session, and one of them has browser that needs to be restarted.\n\nWhoever didn't get the download should restart their Web browser.  You don't need to close down this session.  Simply shut down all windows for the Web browser, then restart the browser and navigate back to this page.  You'll find it on \"my nanoHUB\" listed under \"my sessions\".  Once the browser is restarted, the download should work properly."
    316324                } else {
    317325                    bgerror $result
     
    380388
    381389# ----------------------------------------------------------------------
    382 # USAGE: _uploadValue
     390# USAGE: _uploadValue ?<key> <value> <key> <value> ...?
    383391#
    384392# Invoked automatically whenever the user has uploaded data from
     
    386394# argument) and loads into the destination widget.
    387395# ----------------------------------------------------------------------
    388 itcl::body Rappture::Loader::_uploadValue {string} {
     396itcl::body Rappture::Loader::_uploadValue {args} {
    389397    Rappture::Tooltip::cue hide  ;# take down the note about the popup window
     398
     399    array set data $args
     400
     401    if {[string length [string trim $data(data)]] == 0} {
     402        switch -- $data(which) {
     403            file {
     404                set mesg "You indicated that you were uploading a file, but y"
     405            }
     406            text {
     407                set mesg "You indicated that you were uploading text, but y"
     408            }
     409            default {
     410                set mesg "Y"
     411            }
     412        }
     413        Rappture::Tooltip::cue $itk_component(combo) \
     414            "${mesg}ou didn't fill in any data on the upload form."
     415        return
     416    }
     417
    390418    #
    391419    # BE CAREFUL:  This string may have binary characters that
     
    394422    #   done with it.
    395423    #
     424    set string $data(data)
    396425    regsub -all {[\000-\010\013\014\016-\037\177-\377]} $string {} string
    397426    regsub -all "\r" $string "\n" string
  • trunk/gui/scripts/tooltip.tcl

    r115 r213  
    145145    }
    146146    set pos 0
    147     ::for {set i 0} {$pos >= 0 && $i < 5} {incr i} {
     147    ::for {set i 0} {$pos >= 0 && $i < 20} {incr i} {
    148148        incr pos
    149149        set pos [string first \n $mesg $pos]
Note: See TracChangeset for help on using the changeset viewer.