diff 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
line wrap: on
line diff
--- a/src/monoize.sml	Fri Aug 15 18:25:56 2014 -0400
+++ b/src/monoize.sml	Sun Aug 10 13:40:53 2014 -0400
@@ -3276,14 +3276,14 @@
                                                     (rest, SOME value)
                                                   | _ => (attrs, NONE))
                                              | _ => (attrs, NONE)
-                                       
+
 
                 val (class, fm) = monoExp (env, st, fm) class
                 val (dynClass, fm) = monoExp (env, st, fm) dynClass
                 val (style, fm) = monoExp (env, st, fm) style
                 val (dynStyle, fm) = monoExp (env, st, fm) dynStyle
 
-                val dynamics = ["dyn", "ctextbox", "ccheckbox", "cselect", "coption", "ctextarea", "active", "script"]
+                val dynamics = ["dyn", "ctextbox", "cpassword", "ccheckbox", "cselect", "coption", "ctextarea", "active", "script"]
 
                 fun isSome (e, _) =
                     case e of
@@ -3736,6 +3736,29 @@
 				  fm)
                              end)
 
+                      | "cpassword" =>
+			(case List.find (fn ("Source", _, _) => true | _ => false) attrs of
+                             NONE =>
+                             let
+				 val (ts, fm) = tagStart "input"
+                             in
+				 ((L'.EStrcat (ts,
+                                               strH " type=\"password\" />"),
+                                   loc), fm)
+                             end
+                           | SOME (_, src, _) =>
+                             let
+				 val sc = strcat [str "password(exec(",
+						  (L'.EJavaScript (L'.Script, src), loc),
+						  str "))"]
+				 val sc = setAttrs sc
+                             in
+				 (strcat [str "<script type=\"text/javascript\">",
+					  sc,
+					  str "</script>"],
+				  fm)
+                             end)
+
                       | "ccheckbox" =>
 			(case List.find (fn ("Source", _, _) => true | _ => false) attrs of
                              NONE =>
@@ -4477,7 +4500,7 @@
                             (L'.TFfi ("Basis", "int"), loc)
                         else
                             un
-                            
+
                 val e2 = (L'.EAbs ("$x", t, (L'.TFun (un, un), loc),
                                    (L'.EAbs ("$y", un, un,
                                              (L'.EApp (