teal-src/util/dataforms.d.tl
changeset 12983 fbbf4f0db8f0
parent 12982 088d278c75b5
child 12984 6ebad8e16b3b
equal deleted inserted replaced
12982:088d278c75b5 12983:fbbf4f0db8f0
     1 local stanza_t = require "util.stanza".stanza_t
       
     2 
       
     3 local record lib
       
     4 	record dataform
       
     5 		title : string
       
     6 		instructions : string
       
     7 
       
     8 		record form_field
       
     9 
       
    10 			enum field_type
       
    11 				"boolean"
       
    12 				"fixed"
       
    13 				"hidden"
       
    14 				"jid-multi"
       
    15 				"jid-single"
       
    16 				"list-multi"
       
    17 				"list-single"
       
    18 				"text-multi"
       
    19 				"text-private"
       
    20 				"text-single"
       
    21 			end
       
    22 
       
    23 			type : field_type
       
    24 			var : string -- protocol name
       
    25 			name :  string -- internal name
       
    26 
       
    27 			label : string
       
    28 			desc : string
       
    29 
       
    30 			datatype : string
       
    31 			range_min : number
       
    32 			range_max : number
       
    33 
       
    34 			value : any -- depends on field_type
       
    35 			options : table
       
    36 		end
       
    37 
       
    38 		{ form_field }
       
    39 
       
    40 		enum form_type
       
    41 			"form"
       
    42 			"submit"
       
    43 			"cancel"
       
    44 			"result"
       
    45 		end
       
    46 
       
    47 		form : function ( dataform, { string : any }, form_type ) : stanza_t
       
    48 		data : function ( dataform, stanza_t ) : { string : any }
       
    49 	end
       
    50 
       
    51 	new : function ( dataform ) : dataform
       
    52 end
       
    53 
       
    54 return lib