Commit 49aaa6ddf0386e388fd3548a480b29e5b57c8e82

Authored by totoro
1 parent 62698969

add missing text() with integer for HMTL_In_Form

add get_Int_list() from web arg
web/CXM_making_a_web_site.anubis
@@ -1181,7 +1181,6 @@ public type HTML_Partial_Content: @@ -1181,7 +1181,6 @@ public type HTML_Partial_Content:
1181 List(HTML_Head_Tag), 1181 List(HTML_Head_Tag),
1182 HTML_Off_Form 1182 HTML_Off_Form
1183 ). 1183 ).
1184 -  
1185 1184
1186 public define List(HTML_Head_Tag) 1185 public define List(HTML_Head_Tag)
1187 to_HTML_Head_Tag 1186 to_HTML_Head_Tag
@@ -1252,6 +1251,7 @@ public type HTML_In_Form: @@ -1252,6 +1251,7 @@ public type HTML_In_Form:
1252 'HTML_In_Form' defines all the elements you may put within a form. We define a 1251 'HTML_In_Form' defines all the elements you may put within a form. We define a
1253 convenience function: 1252 convenience function:
1254 1253
  1254 +
1255 public define HTML_In_Form text_input(HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width) = text_input([], label, id, name, init, width). 1255 public define HTML_In_Form text_input(HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width) = text_input([], label, id, name, init, width).
1256 1256
1257 public define HTML_In_Form literal(Printable_tree t) = literal_pt(t). 1257 public define HTML_In_Form literal(Printable_tree t) = literal_pt(t).
@@ -1369,7 +1369,22 @@ public define HTML_In_Form @@ -1369,7 +1369,22 @@ public define HTML_In_Form
1369 String s 1369 String s
1370 ) = 1370 ) =
1371 text([],s). 1371 text([],s).
1372 - 1372 +
  1373 +public define HTML_In_Form
  1374 + text
  1375 + (
  1376 + List(Text_Option) lto,
  1377 + Int i
  1378 + ) =
  1379 + text(lto, to_decimal(i)).
  1380 +
  1381 +public define HTML_In_Form
  1382 + text
  1383 + (
  1384 + Int i
  1385 + ) =
  1386 + text([],i).
  1387 +
1373 public define HTML_In_Form 1388 public define HTML_In_Form
1374 radio_button (List(CoreAttrs) options, HTML_Label label, WebArgName n, WebArgValue value, Bool checked) 1389 radio_button (List(CoreAttrs) options, HTML_Label label, WebArgName n, WebArgValue value, Bool checked)
1375 = radio_button (options, label, html_Id(n.name), n, value, checked). 1390 = radio_button (options, label, html_Id(n.name), n, value, checked).
web/CXM_web_arg_utils.anubis
@@ -190,7 +190,33 @@ public define Int @@ -190,7 +190,33 @@ public define Int
190 failure then default_value, 190 failure then default_value,
191 success(value) then value 191 success(value) then value
192 }. 192 }.
193 - 193 +
  194 +public define List(Int)
  195 + get_Int_list
  196 + (
  197 + List(Web_arg) l,
  198 + String name
  199 + ) =
  200 + if l is
  201 + {
  202 + [] then [],
  203 + [h . t] then
  204 + if h is web_arg(n, v) then
  205 + if n = name then
  206 + //println("matching int name "+name+" value "+v);
  207 + if decimal_scan(v) is
  208 + {
  209 + failure then get_Int_list(t, name),
  210 + success(value) then
  211 + [ value . get_Int_list(t, name)]
  212 + }
  213 + else
  214 + get_Int_list(t, name)
  215 + else
  216 + get_Int_list(t, name)
  217 + }
  218 +.
  219 +
194 public define Maybe(Word32) 220 public define Maybe(Word32)
195 get_Word32 221 get_Word32
196 ( 222 (