comparison src/monoize.sml @ 2055:7c2229aa22fc

Adds AJAX-oriented widget cpassword.
author Ziv Scully <ziv@mit.edu>
date Sun, 10 Aug 2014 13:40:53 -0400
parents 4d64af730e35
children e48e09a1f583 365727ff68f4
comparison
equal deleted inserted replaced
2054:4ad46302f659 2055:7c2229aa22fc
3274 (case List.partition (fn (x, _, _) => x = "Value") attrs of 3274 (case List.partition (fn (x, _, _) => x = "Value") attrs of
3275 ([(_, value, _)], rest) => 3275 ([(_, value, _)], rest) =>
3276 (rest, SOME value) 3276 (rest, SOME value)
3277 | _ => (attrs, NONE)) 3277 | _ => (attrs, NONE))
3278 | _ => (attrs, NONE) 3278 | _ => (attrs, NONE)
3279 3279
3280 3280
3281 val (class, fm) = monoExp (env, st, fm) class 3281 val (class, fm) = monoExp (env, st, fm) class
3282 val (dynClass, fm) = monoExp (env, st, fm) dynClass 3282 val (dynClass, fm) = monoExp (env, st, fm) dynClass
3283 val (style, fm) = monoExp (env, st, fm) style 3283 val (style, fm) = monoExp (env, st, fm) style
3284 val (dynStyle, fm) = monoExp (env, st, fm) dynStyle 3284 val (dynStyle, fm) = monoExp (env, st, fm) dynStyle
3285 3285
3286 val dynamics = ["dyn", "ctextbox", "ccheckbox", "cselect", "coption", "ctextarea", "active", "script"] 3286 val dynamics = ["dyn", "ctextbox", "cpassword", "ccheckbox", "cselect", "coption", "ctextarea", "active", "script"]
3287 3287
3288 fun isSome (e, _) = 3288 fun isSome (e, _) =
3289 case e of 3289 case e of
3290 L'.ESome _ => true 3290 L'.ESome _ => true
3291 | _ => false 3291 | _ => false
3724 loc), fm) 3724 loc), fm)
3725 end 3725 end
3726 | SOME (_, src, _) => 3726 | SOME (_, src, _) =>
3727 let 3727 let
3728 val sc = strcat [str "inp(exec(", 3728 val sc = strcat [str "inp(exec(",
3729 (L'.EJavaScript (L'.Script, src), loc),
3730 str "))"]
3731 val sc = setAttrs sc
3732 in
3733 (strcat [str "<script type=\"text/javascript\">",
3734 sc,
3735 str "</script>"],
3736 fm)
3737 end)
3738
3739 | "cpassword" =>
3740 (case List.find (fn ("Source", _, _) => true | _ => false) attrs of
3741 NONE =>
3742 let
3743 val (ts, fm) = tagStart "input"
3744 in
3745 ((L'.EStrcat (ts,
3746 strH " type=\"password\" />"),
3747 loc), fm)
3748 end
3749 | SOME (_, src, _) =>
3750 let
3751 val sc = strcat [str "password(exec(",
3729 (L'.EJavaScript (L'.Script, src), loc), 3752 (L'.EJavaScript (L'.Script, src), loc),
3730 str "))"] 3753 str "))"]
3731 val sc = setAttrs sc 3754 val sc = setAttrs sc
3732 in 3755 in
3733 (strcat [str "<script type=\"text/javascript\">", 3756 (strcat [str "<script type=\"text/javascript\">",
4475 true) 4498 true)
4476 | _ => false} e1 then 4499 | _ => false} e1 then
4477 (L'.TFfi ("Basis", "int"), loc) 4500 (L'.TFfi ("Basis", "int"), loc)
4478 else 4501 else
4479 un 4502 un
4480 4503
4481 val e2 = (L'.EAbs ("$x", t, (L'.TFun (un, un), loc), 4504 val e2 = (L'.EAbs ("$x", t, (L'.TFun (un, un), loc),
4482 (L'.EAbs ("$y", un, un, 4505 (L'.EAbs ("$y", un, un,
4483 (L'.EApp ( 4506 (L'.EApp (
4484 (L'.EApp (e2, (L'.ERel 1, loc)), loc), 4507 (L'.EApp (e2, (L'.ERel 1, loc)), loc),
4485 (L'.ERel 0, loc)), loc)), loc)), loc) 4508 (L'.ERel 0, loc)), loc)), loc)), loc)