let params_for_channel ch =
let ptitle = C.string
~help: "Mandatory title"
~f: (fun s -> ch.ch_title <- of_u8 s)
"Title:" (to_u8 ch.ch_title)
in
let plink = C.string
~help: "Mandatory link"
~f: (fun s -> ch.ch_link <- of_u8 s)
"Link:" (to_u8 ch.ch_link)
in
let pdesc = C.text
~help: "Mandatory description"
~f: (fun s -> ch.ch_desc <- of_u8 s)
"Description:" (to_u8 ch.ch_desc)
in
let plang = C.string
~f: (fun s -> ch.ch_language <- opt_of_string (of_u8 s))
"Language:" (to_u8 (string_of_opt ch.ch_language))
in
let pcopyr = C.text
~help: "Optional copyright note"
~f: (fun s -> ch.ch_copyright <- opt_of_string (of_u8 s))
"Copyright:" (to_u8 (string_of_opt ch.ch_copyright))
in
let pmngedit = C.string
~help: "Optional email of managing editor"
~f: (fun s -> ch.ch_managing_editor <- opt_of_string (of_u8 s))
"Managing editor:" (to_u8 (string_of_opt ch.ch_managing_editor))
in
let pwebmaster = C.string
~help: "Optional email of webmaster"
~f: (fun s -> ch.ch_webmaster <- opt_of_string (of_u8 s))
"Webmaster" (to_u8 (string_of_opt ch.ch_managing_editor))
in
let ppubdate = C.date
~help: "Publication date of the channel"
~f: (fun d -> ch.ch_pubdate <- Some (tuple_to_date d))
"Pubdate:"
(match ch.ch_pubdate with
None -> date_to_tuple today
| Some d -> date_to_tuple d
)
in
let pdocs = C.string
~help: "An optional url to a RSS reference"
~f: (fun s -> ch.ch_docs <- opt_of_string (of_u8 s))
"Docs:" (to_u8 (string_of_opt ch.ch_docs))
in
let pttl = C.string
~help: "Time to live, in minutes"
~f: (fun s -> ch.ch_ttl <- try map_opt int_of_string (opt_of_string (of_u8 s)) with _ -> ch.ch_ttl)
"Time to live:" (to_u8 (string_of_opt (map_opt string_of_int ch.ch_ttl)))
in
[ C.Section ("Mandatory information",
[ ptitle ; plink ; pdesc ;]) ;
C.Section ("Other information",
[
plang ;
pcopyr ;
pmngedit ;
pwebmaster ;
ppubdate ;
pdocs ;
pttl ;
] );
]