Sourcecode für Umfrage-Workshop in rebol#

Für einen funktionierenden Mailbutton ist die Einrichtung der Netzwerkkonfiguration über set-user an der rebol-Konsole möglich bzw. erforderlich:

  • rebol bzw. (rebol.exe in Windows) starten
  • Console-Icon links in der Navigationsspalte aktivieren
  • auf der rebol-Konsole mit "set-user" (ohne Anführungszeichen) über den zweiten Reiter die "Email settings" (Einstellungen) eintragen.
  • "save"
  • desktop am Prompt führt zurück zur rebol-GUI
Hier nun der Sourcecode für survey.r:
REBOL [
	Title: "Survey"
	Author: "Gregg Irwin"
	Email: greggirwin(at)acm(punkt)org
	Web: http://onlamp.com/pub/a/onlamp/2003/10/30/rebol.html
	Date: 18/12/2012
	File: %mysql-protocol.r
	Version: 1.2.1
	Purpose: "Programming Survey"
]

; Where we want the responses sent. You can decide if you
; want to put the address in directly, do a slight tweak to
; confuse harvesters, or use full-blown encryption.

;address: head reverse gro.mca@niwriggerg
address: head reverse ed.rk-gul@ofni

; Our sample surveys deal with programming languages,
; so we'll define a list of them for later use.

languages: [
    REBOL Java VB Perl Python Ruby Tcl PHP C C++ C-sharp
    Delphi Smalltalk Lisp COBOL
]

; This is the function that actually sends us the reply.

reply: func [address survey-name data] [
    if error? set/any 'err try [
        send/subject
            address
            data
            join survey-name " survey response!"
        return true
    ][
        alert mold disarm err
        return false
    ]
]

; VIEW-DATA is mainly for testing, but if you want to
; let the users preview what's being sent back, you can
; include it for them as well.

view-data: does [
    view/new layout [
        area 500 mold gather-data
        button "Close" [unview]
    ]
]

; We need to give our survey a name so we can identify
; responses for it.

survey-name: "Static GUI Survey"

; This gathers information from the screen.

gather-data: does [
    reduce [lang-list/picked comments/text]
]

view layout [
    H3 400 {
        Just a little informal survey to see what
        languages you use and how you feel about them.
    }
    text 400 brick {
        Select the languages you use below (ctrl+click),
        enter comments in the text box, and press Send.
    } guide
    lang-list: text-list 85x245 data languages
    return guide
    comments: area 310
    text 310 navy {
        Comments can be things such as: "I like lang-x",
        "I have to use lang-x", "lang-x is insanely
        great!", "lang-x is really the best", or "I love
        lang-x"
    } return
    across
    pad 0x5
    button "Send" [reply address survey-name gather-data]
    button "Quit" [quit]
    button "View Data" [view-data]
]


Tags:  Rebol

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-2) was last changed on 22-Dec-2012 13:36 by Peter Hormanns