File: input.rkt

package info (click to toggle)
racket 7.2%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 125,432 kB
  • sloc: ansic: 258,980; pascal: 59,975; sh: 33,650; asm: 13,558; lisp: 7,124; makefile: 3,329; cpp: 2,889; exp: 499; python: 274; xml: 11
file content (121 lines) | stat: -rw-r--r-- 6,674 bytes parent folder | download | duplicates (3)
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
#lang racket/base

(require racket/contract
         "unsafe/input.rkt"
         web-server/http
         web-server/private/xexpr
         (submod "lib.rkt" private)
         (only-in "lib.rkt"
                  xexpr-forest/c
                  formlet/c
                  pure
                  cross))

(provide (contract-out ; Low-level
          [make-input* (-> (-> string? pretty-xexpr/c)
                           (serial-formlet/c (listof binding?)))]
          [make-input (-> (-> string? pretty-xexpr/c)
                          (serial-formlet/c (or/c false/c binding?)))]
          ; HTML Spec
          [input (->* ()
                      (#:type string?
                       #:value (or/c false/c bytes? string?)
                       #:max-length (or/c false/c exact-nonnegative-integer?)
                       #:read-only? boolean?
                       #:attributes (listof (list/c symbol? string?)))
                      (serial-formlet/c (or/c false/c binding?)))]
          [text-input (->* () 
                           (#:value (or/c false/c bytes? string?)
                            #:size (or/c false/c exact-nonnegative-integer?)
                            #:max-length (or/c false/c exact-nonnegative-integer?)
                            #:read-only? boolean?
                            #:attributes (listof (list/c symbol? string?)))
                           (serial-formlet/c (or/c false/c binding?)))]
          [password-input (->* () 
                               (#:value (or/c false/c bytes? string?)
                                #:size (or/c false/c exact-nonnegative-integer?)
                                #:max-length (or/c false/c exact-nonnegative-integer?)
                                #:read-only? boolean?
                                #:attributes (listof (list/c symbol? string?)))
                               (serial-formlet/c (or/c false/c binding?)))]
          [checkbox (->* ((or/c bytes? string?) boolean?)
                         (#:attributes (listof (list/c symbol? string?)))
                         (serial-formlet/c (or/c false/c binding?)))]
          [radio (->* ((or/c bytes? string?) boolean?)
                      (#:attributes (listof (list/c symbol? string?)))
                      (serial-formlet/c (or/c false/c binding?)))]
          [radio-group (->* (sequence?)
                            (#:attributes 
                             (-> any/c (listof (list/c symbol? string?)))
                             #:checked? (any/c . -> . boolean?)
                             #:display (any/c . -> . pretty-xexpr/c)
                             #:wrap (any/c any/c . -> . xexpr-forest/c))
                            (serial-formlet/c any/c))]
          [checkbox-group (->* (sequence?)
                               (#:attributes 
                                (-> any/c (listof (list/c symbol? string?)))
                                #:checked? (any/c . -> . boolean?)
                                #:display (any/c . -> . pretty-xexpr/c))
                               (serial-formlet/c (listof any/c)))]
          [submit (->* ((or/c bytes? string?))
                       (#:attributes (listof (list/c symbol? string?)))
                       (serial-formlet/c (or/c false/c binding?)))]
          [reset (->* ((or/c bytes? string?))
                      (#:attributes (listof (list/c symbol? string?)))
                      (serial-formlet/c (or/c false/c binding?)))]
          [file-upload (->* ()
                            (#:attributes (listof (list/c symbol? string?)))
                            (serial-formlet/c (or/c false/c binding?)))]
          [hidden (->* ((or/c bytes? string?))
                       (#:attributes (listof (list/c symbol? string?)))
                       (serial-formlet/c (or/c false/c binding?)))]
          [img (->* ((or/c bytes? string?) (or/c bytes? string?))
                    (#:height (or/c false/c exact-nonnegative-integer?)
                     #:longdesc (or/c false/c (or/c bytes? string?))
                     #:usemap (or/c false/c (or/c bytes? string?))
                     #:width (or/c false/c exact-nonnegative-integer?)
                     #:attributes (listof (list/c symbol? string?)))
                    (serial-formlet/c (or/c false/c binding?)))]
          [button (->* ((or/c bytes? string?) (or/c bytes? string?))
                       (#:disabled
                        boolean?
                        #:value (or/c false/c (or/c bytes? string?))
                        #:attributes (listof (list/c symbol? string?)))
                       (serial-formlet/c (or/c false/c binding?)))]
          [multiselect-input (->* (sequence?)
                                  (#:attributes 
                                   (listof (list/c symbol? string?))
                                   #:multiple? boolean?
                                   #:selected? (any/c . -> . boolean?)
                                   #:display (any/c . -> . pretty-xexpr/c))
                                  (serial-formlet/c (listof any/c)))]
          [select-input (->* (sequence?)
                             (#:attributes 
                              (listof (list/c symbol? string?))
                              #:selected? (any/c . -> . boolean?)
                              #:display (any/c . -> . pretty-xexpr/c))
                             (serial-formlet/c any/c))]
          [textarea-input (->* ()
                               (#:attributes 
                                (listof (list/c symbol? string?))
                                #:value (or/c false/c (or/c bytes? string?))
                                #:rows number?
                                #:cols number?)
                               (serial-formlet/c (or/c false/c binding?)))]
          ; High-level
          [required (-> (formlet/c (or/c false/c binding?))
                        (serial-formlet/c bytes?))]
          [default (-> bytes? (formlet/c (or/c false/c binding?))
                       (serial-formlet/c bytes?))]
          [to-string (-> (formlet/c bytes?)
                         (serial-formlet/c string?))]
          [to-number (-> (formlet/c string?)
                         (serial-formlet/c number?))]
          [to-symbol (-> (formlet/c string?)
                         (serial-formlet/c symbol?))]
          [to-boolean (-> (formlet/c bytes?)
                          (serial-formlet/c boolean?))]
          ;OLD
          [input-string (serial-formlet/c string?)]
          [input-int (serial-formlet/c number?)]
          [input-symbol (serial-formlet/c symbol?)]))