# HG changeset patch # User Adam Chlipala # Date 1256225878 14400 # Node ID d3af9e54c8282fef4c6828df3e2bf9924d20c50a # Parent 5a0f6ec208ceca0493d3daa6f11f476dd1e25447 Title and abstract diff -r 5a0f6ec208ce -r d3af9e54c828 demo/more/conference.ur --- a/demo/more/conference.ur Thu Oct 22 11:15:37 2009 -0400 +++ b/demo/more/conference.ur Thu Oct 22 11:37:58 2009 -0400 @@ -2,8 +2,9 @@ functor Make(M : sig con paper :: {(Type * Type)} - constraint [Id, Title] ~ paper + constraint [Id] ~ paper val paper : $(map meta paper) + val paperFolder : folder paper con review :: {(Type * Type)} constraint [Paper, User] ~ review @@ -17,7 +18,7 @@ CONSTRAINT Nam UNIQUE Nam sequence userId - con paper = [Id = int, Title = string] ++ map fst M.paper + con paper = [Id = int] ++ map fst M.paper table paper : paper PRIMARY KEY Id sequence paperId @@ -122,7 +123,7 @@ } {if now < M.submissionDeadline then -
  • Submit
  • +
  • Submit
  • else } } @@ -132,4 +133,12 @@ m <- main' (); return {m} + and submit () = return +

    Submit a Paper

    + +
    + {allWidgets M.paper M.paperFolder} +
    +
    + end diff -r 5a0f6ec208ce -r d3af9e54c828 demo/more/conference.urp --- a/demo/more/conference.urp Thu Oct 22 11:15:37 2009 -0400 +++ b/demo/more/conference.urp Thu Oct 22 11:37:58 2009 -0400 @@ -4,3 +4,4 @@ meta bulkEdit conference +conferenceFields diff -r 5a0f6ec208ce -r d3af9e54c828 demo/more/conference.urs --- a/demo/more/conference.urs Thu Oct 22 11:15:37 2009 -0400 +++ b/demo/more/conference.urs Thu Oct 22 11:37:58 2009 -0400 @@ -1,7 +1,8 @@ functor Make(M : sig con paper :: {(Type * Type)} - constraint [Id, Title] ~ paper + constraint [Id] ~ paper val paper : $(map Meta.meta paper) + val paperFolder : folder paper con review :: {(Type * Type)} constraint [Paper, User] ~ review diff -r 5a0f6ec208ce -r d3af9e54c828 demo/more/conference1.ur --- a/demo/more/conference1.ur Thu Oct 22 11:15:37 2009 -0400 +++ b/demo/more/conference1.ur Thu Oct 22 11:37:58 2009 -0400 @@ -1,5 +1,8 @@ +open ConferenceFields + open Conference.Make(struct - val paper = {} + val paper = {Title = title, + Abstract = abstract} val review = {} val submissionDeadline = readError "2009-10-22 23:59:59" diff -r 5a0f6ec208ce -r d3af9e54c828 demo/more/conferenceFields.ur --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/demo/more/conferenceFields.ur Thu Oct 22 11:37:58 2009 -0400 @@ -0,0 +1,7 @@ +open Meta + +con title = (string, string) +val title = string "Title" + +con abstract = (string, string) +val abstract = textarea "Abstract" diff -r 5a0f6ec208ce -r d3af9e54c828 demo/more/conferenceFields.urs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/demo/more/conferenceFields.urs Thu Oct 22 11:37:58 2009 -0400 @@ -0,0 +1,5 @@ +con title :: (Type * Type) +val title : Meta.meta title + +con abstract :: (Type * Type) +val abstract : Meta.meta abstract diff -r 5a0f6ec208ce -r d3af9e54c828 demo/more/meta.ur --- a/demo/more/meta.ur Thu Oct 22 11:15:37 2009 -0400 +++ b/demo/more/meta.ur Thu Oct 22 11:37:58 2009 -0400 @@ -25,3 +25,22 @@ , Parse = fn x => x, Inject = _} + +fun textarea name = {Nam = name, + Show = cdata, + Widget = fn [nm :: Name] =>
    , + WidgetPopulated = fn [nm :: Name] s =>
    + {[s]} +
    , + Parse = fn s => s, + Inject = _} + +fun allWidgets [ts ::: {(Type * Type)}] (r : $(map meta ts)) (fl : folder ts) = + foldR [meta] [fn ts :: {(Type * Type)} => xml form [] (map snd ts)] + (fn [nm :: Name] [t :: (Type * Type)] [rest :: {(Type * Type)}] + [[nm] ~ rest] (col : meta t) (acc : xml form [] (map snd rest)) => + {[col.Nam]}: {col.Widget [nm]}
    + {useMore acc} +
    ) + + [_] fl r diff -r 5a0f6ec208ce -r d3af9e54c828 demo/more/meta.urs --- a/demo/more/meta.urs Thu Oct 22 11:15:37 2009 -0400 +++ b/demo/more/meta.urs Thu Oct 22 11:37:58 2009 -0400 @@ -10,3 +10,8 @@ val float : string -> meta (float, string) val string : string -> meta (string, string) val bool : string -> meta (bool, bool) + +val textarea : string -> meta (string, string) + +val allWidgets : ts ::: {(Type * Type)} -> $(map meta ts) -> folder ts + -> xml form [] (map snd ts)