Ignore:
Timestamp:
Oct 22, 2010, 4:06:10 PM (14 years ago)
Author:
gah
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/bugreport.tcl

    r1912 r1929  
    7373    if {"@SHOWDETAILS" == $err} {
    7474        pack propagate .bugreport yes
    75         pack forget .bugreport.expl
    76         pack forget .bugreport.xmit
    77         pack forget .bugreport.done
     75        pack forget .bugreport.expl
     76        pack forget .bugreport.xmit
     77        pack forget .bugreport.done
    7878        pack forget .bugreport.cntls.show
    79         pack .bugreport.cntls -after .bugreport.banner -side bottom -fill x
    80         pack .bugreport.details -after .bugreport.banner \
    81             -expand yes -fill both -padx 8 -pady 8
    82         pack .bugreport.comments -after .bugreport.details \
    83             -expand yes -fill both -padx 8 -pady {0 8}
     79        pack .bugreport.cntls -after .bugreport.banner -side bottom -fill x
     80        pack .bugreport.details -after .bugreport.banner \
     81            -expand yes -fill both -padx 8 -pady 8
     82        pack .bugreport.comments -after .bugreport.details \
     83            -expand yes -fill both -padx 8 -pady {0 8}
    8484
    8585        update idletasks
     
    9393        wm geometry .bugreport $x$y
    9494        raise .bugreport
    95         return
     95        return
    9696    }
    9797
     
    119119        .bugreport.expl insert end "Something went wrong with this tool.  Help us understand what happened by submitting a trouble report, so we can fix the problem.  If you continue having trouble with this tool, please close it and restart."
    120120        .bugreport.cntls.send configure -state normal
    121         focus .bugreport.cntls.send
     121        focus .bugreport.cntls.send
    122122    } else {
    123123        .bugreport.expl insert end "Something went wrong with this tool.  We would ask you to submit a trouble report about the error, but we can't tell what hub it should be submitted to.  If you continue having trouble with this tool, please close it and restart."
    124124        pack forget .bugreport.comments
    125125        .bugreport.cntls.send configure -state disabled
    126         focus .bugreport.cntls.ok
     126        focus .bugreport.cntls.ok
    127127    }
    128128    fixTextHeight .bugreport.expl
     
    294294    # handle the result
    295295    if {$status != 0} {
    296         # add error to the details field, so we can see it with magic clicks
    297         .bugreport.details.info.text configure -state normal
    298         .bugreport.details.info.text insert 1.0 "Ticket submission failed:\n$result\n-----\n"
    299         .bugreport.details.info.text configure -state disabled
    300 
    301         .bugreport.expl insert end "Oops! Ticket submission failed:\n$result\n\nIf you want to report the original problem, you can file your own trouble report by going to the web site and clicking on the \"Help\" or \"Support\" link on the main navigation bar.  If you continue having trouble with this tool, please close it and restart."
     296        # add error to the details field, so we can see it with magic clicks
     297        .bugreport.details.info.text configure -state normal
     298        .bugreport.details.info.text insert 1.0 "Ticket submission failed:\n$result\n-----\n"
     299        .bugreport.details.info.text configure -state disabled
     300
     301        .bugreport.expl insert end "Oops! Ticket submission failed:\n$result\n\nIf you want to report the original problem, you can file your own trouble report by going to the web site and clicking on the \"Help\" or \"Support\" link on the main navigation bar.  If you continue having trouble with this tool, please close it and restart."
    302302    } elseif {[regexp {Ticket #([0-9]*) +\((.*?)\) +([0-9]+) +times} $result match ticket extra times]} {
    303         .bugreport.expl insert end "This problem has been reported as " "" "Ticket #$ticket" bold " in our system." ""
    304         if {[string is integer $times] && $times > 1} {
    305             .bugreport.expl insert end "  This particular problem has been reported $times times."
    306         }
    307         .bugreport.expl insert end "\n\nIf you continue having trouble with this tool, please close it and restart.  Thanks for reporting the problem and helping us improve things!"
     303        .bugreport.expl insert end "This problem has been reported as " "" "Ticket #$ticket" bold " in our system." ""
     304        if {[string is integer $times] && $times > 1} {
     305            .bugreport.expl insert end "  This particular problem has been reported $times times."
     306        }
     307        .bugreport.expl insert end "\n\nIf you continue having trouble with this tool, please close it and restart.  Thanks for reporting the problem and helping us improve things!"
    308308    } else {
    309         .bugreport.expl insert end "This problem has been reported.  Here is the response from the hub, which may contain information about your ticket:\n" "" $result bold "\n\nIf you continue having trouble with this tool, please close it and restart.  Thanks for reporting the problem and helping us improve things!" ""
     309        .bugreport.expl insert end "This problem has been reported.  Here is the response from the hub, which may contain information about your ticket:\n" "" $result bold "\n\nIf you continue having trouble with this tool, please close it and restart.  Thanks for reporting the problem and helping us improve things!" ""
    310310    }
    311311    fixTextHeight .bugreport.expl
     
    335335    set stackTrace "$err\n---------\n$errorInfo\n---------\n$extraInfo"
    336336    if {![regexp {^([^\n]+)\n} $stackTrace match summary]} {
    337         if {[string length $stackTrace] == 0} {
    338             set summary "Unexpected error from Rappture"
    339         } else {
    340             set summary $stackTrace
    341         }
     337        if {[string length $stackTrace] == 0} {
     338            set summary "Unexpected error from Rappture"
     339        } else {
     340            set summary $stackTrace
     341        }
    342342    }
    343343    if {[string length $summary] > 200} {
    344         set summary "[string range $summary 0 200]..."
     344        set summary "[string range $summary 0 200]..."
    345345    }
    346346    if {[string match {Problem launching job*} $summary]} {
    347         append summary " (in tool \"[Rappture::Tool::resources -appname]\")"
    348         set category "Tools"
     347        append summary " (in tool \"[Rappture::Tool::resources -appname]\")"
     348        set category "Tools"
    349349    } else {
    350         set category $settings(category)
     350        set category $settings(category)
    351351    }
    352352
     
    354354    set toolong 20000
    355355    if {[string length $stackTrace] > $toolong} {
    356         #
    357         # If this came from "Problem launching job", then it will have
    358         # a "== RAPPTURE INPUT ==" part somewhere in the middle.  Try
    359         # to show the first part, this middle part, and the very last
    360         # part, cutting out whatever we have to in the middle.
    361         #
    362         if {[regexp -indices {\n== RAPPTURE INPUT ==\n} $stackTrace match]} {
    363             foreach {smid0 smid1} $match break
    364             set quarter [expr {$toolong/4}]
    365             set s0 $quarter
    366             set smid0 [expr {$smid0-$quarter}]
    367             set smid1 [expr {$smid1+$quarter}]
    368             set s1 [expr {[string length $stackTrace]-$quarter}]
    369 
    370             if {$smid0 < $s0} {
    371                 # first part is short -- truncate last part
    372                 set stackTrace "[string range $stackTrace 0 $smid1]\n...\n[string range $stackTrace [expr {[string length $stackTrace]-($toolong-$smid1)}] end]"
    373             } elseif {$smid1 > $s1} {
    374                 # last part is short -- truncate first part
    375                 set tailsize [expr {[string length $stackTrace]-$smid0}]
    376                 set stackTrace "[string range $stackTrace 0 [expr {$toolong-$tailsize}]]\n...\n[string range $stackTrace $smid0 end]"
    377             } else {
    378                 # rappture input line is right about in the middle
    379                 set stackTrace "[string range $stackTrace 0 $s0]\n...\n[string range $stackTrace $smid0 $smid1]\n...\n[string range $stackTrace $s1 end]"
    380             }
    381         } else {
    382             # no Rappture input -- just show first part and last part
    383             set half [expr {$toolong/2}]
    384             set stackTrace "[string range $stackTrace 0 $half]\n...\n[string range $stackTrace [expr {[string length $stackTrace]-$half}] end]"
    385         }
     356        #
     357        # If this came from "Problem launching job", then it will have
     358        # a "== RAPPTURE INPUT ==" part somewhere in the middle.  Try
     359        # to show the first part, this middle part, and the very last
     360        # part, cutting out whatever we have to in the middle.
     361        #
     362        if {[regexp -indices {\n== RAPPTURE INPUT ==\n} $stackTrace match]} {
     363            foreach {smid0 smid1} $match break
     364            set quarter [expr {$toolong/4}]
     365            set s0 $quarter
     366            set smid0 [expr {$smid0-$quarter}]
     367            set smid1 [expr {$smid1+$quarter}]
     368            set s1 [expr {[string length $stackTrace]-$quarter}]
     369
     370            if {$smid0 < $s0} {
     371                # first part is short -- truncate last part
     372                set stackTrace "[string range $stackTrace 0 $smid1]\n...\n[string range $stackTrace [expr {[string length $stackTrace]-($toolong-$smid1)}] end]"
     373            } elseif {$smid1 > $s1} {
     374                # last part is short -- truncate first part
     375                set tailsize [expr {[string length $stackTrace]-$smid0}]
     376                set stackTrace "[string range $stackTrace 0 [expr {$toolong-$tailsize}]]\n...\n[string range $stackTrace $smid0 end]"
     377            } else {
     378                # rappture input line is right about in the middle
     379                set stackTrace "[string range $stackTrace 0 $s0]\n...\n[string range $stackTrace $smid0 $smid1]\n...\n[string range $stackTrace $s1 end]"
     380            }
     381        } else {
     382            # no Rappture input -- just show first part and last part
     383            set half [expr {$toolong/2}]
     384            set stackTrace "[string range $stackTrace 0 $half]\n...\n[string range $stackTrace [expr {[string length $stackTrace]-$half}] end]"
     385        }
    386386    }
    387387
     
    419419
    420420    set query [http::formatQuery \
    421         option com_support \
    422         task create \
    423         no_html 1 \
    424         report $report \
    425         sesstoken $details(session) \
    426         hostname $details(hostname) \
    427         os $details(platform) \
    428         category $details(category) \
    429         summary $details(summary) \
    430         referrer $details(referrer) \
    431         login $settings(user) \
    432         group $settings(group) \
    433         type $settings(type) \
     421        option com_support \
     422        task create \
     423        no_html 1 \
     424        report $report \
     425        sesstoken $details(session) \
     426        hostname $details(hostname) \
     427        os $details(platform) \
     428        category $details(category) \
     429        summary $details(summary) \
     430        referrer $details(referrer) \
     431        login $settings(user) \
     432        group $settings(group) \
     433        type $settings(type) \
    434434    ]
    435435   
    436436    set url [Rappture::Tool::resources -huburl]
    437437    if {[string index $url end] == "/"} {
    438         append url "index.php"
     438        append url "index.php"
    439439    } else {
    440         append url "/index.php"
     440        append url "/index.php"
    441441    }
    442442
     
    444444
    445445    if {[http::ncode $token] != 200} {
    446         error [http::code $token]
     446        error [http::code $token]
    447447    }
    448448    upvar #0 $token rval
     
    451451
    452452    if {[regexp {Ticket #[0-9]* +\(.*?\) +[0-9]+ +times} $info match]} {
    453         return $match
     453        return $match
    454454    }
    455455    error "Report received, but ticket may not have been filed.  Here's the result...\n$info"
     
    472472    } else {
    473473        for {set h 1} {$h < 15} {incr h} {
    474             $widget configure -height $h
    475             $widget see 1.0
    476             update idletasks
    477             if {"" != [$widget bbox end-1char]} {
    478                 break
    479             }
     474            $widget configure -height $h
     475            $widget see 1.0
     476            update idletasks
     477            if {"" != [$widget bbox end-1char]} {
     478                break
     479            }
    480480        }
    481481    }
     
    497497
    498498    switch -- $option {
    499         jobfailures {
    500             variable reportJobFailures
    501             if {![string is boolean $value]} {
    502                 error "bad value \"$value\": should be boolean"
    503             }
    504             set reportJobFailures $value
    505         }
    506         for {
    507             # is it being run within a workspace?
    508             set appname [Rappture::Tool::resources -appname]
    509             if {[string match {[Ww]orkspace*} $appname]} {
    510                 return 0
    511             }
    512 
    513             # if this is a problem launching a job and the tool
    514             # expects this, then don't bother with automatic reports.
    515             variable reportJobFailures
    516             if {"jobs" == $value && !$reportJobFailures} {
    517                 return 0
    518             }
    519 
    520             # this is a real problem -- report it!
    521             return 1
    522         }
    523         default {
    524             error "bad option \"$option\": should be jobfailures or for"
    525         }
     499        jobfailures {
     500            variable reportJobFailures
     501            if {![string is boolean $value]} {
     502                error "bad value \"$value\": should be boolean"
     503            }
     504            set reportJobFailures $value
     505        }
     506        for {
     507            # is it being run within a workspace?
     508            set appname [Rappture::Tool::resources -appname]
     509            if {[string match {[Ww]orkspace*} $appname]} {
     510                return 0
     511            }
     512
     513            # if this is a problem launching a job and the tool
     514            # expects this, then don't bother with automatic reports.
     515            variable reportJobFailures
     516            if {"jobs" == $value && !$reportJobFailures} {
     517                return 0
     518            }
     519
     520            # this is a real problem -- report it!
     521            return 1
     522        }
     523        default {
     524            error "bad option \"$option\": should be jobfailures or for"
     525        }
    526526    }
    527527}
Note: See TracChangeset for help on using the changeset viewer.