view tests/utest.ur @ 55:1ceea714b3b5

Merge from upstream.
author Karn Kallio <kkallio@eka>
date Tue, 19 Jul 2011 11:03:29 -0430
parents df258dbf4739
children 9f392276d614
line wrap: on
line source
style inputs

structure U = OpenidUser.Make(struct
                                  con cols = [Nam = string]

                                  val sessionLifetime = 3600
                                  val afterLogout = bless "/main"
                                  val secureCookies = False
                                  val association = Openid.Stateful {AssociationType = Openid.HMAC_SHA256,
                                                                     AssociationSessionType = Openid.NoEncryption}
                                  val realm = None

                                  val creationState =
                                      n <- source "";
                                      return {Nam = n}
                                      
                                  fun render r = <xml>
                                    <tr> <th class={inputs}>Name:</th> <td><ctextbox source={r.Nam}/></td> </tr>
                                  </xml>

                                  fun ready _ = return True

                                  fun tabulate r =
                                      n <- signal r.Nam;
                                      return {Nam = n}

                                  fun choose _ r = return (OpenidUser.Success r)

                                  val formClass = inputs

                                  val fakeId = None

                                  structure CtlDisplay = OpenidUser.DefaultDisplay
                              end)

fun wrap title body =
    userStuff <- U.main wrap;
    return <xml><head>
      <title>{[title]}</title>
    </head><body>
      {userStuff.Status}<br/>
      {userStuff.Other.Xml}

      <h1>{[title]}</h1>

      {body}
    </body></xml>

fun main () =
    whoami <- U.current;
    wrap "Main page" (case whoami of
                          None => <xml>I don't think you're logged in.</xml>
                        | Some whoami => <xml>Apparently you are <b>{[whoami]}</b>!</xml>)