bsw@194: local policy = Policy:by_id(param.get_id()) or Policy:new() bsw@194: bsw@1045: local hint = not policy.id bsw@1045: bsw@1184: ui.titleAdmin(_"Policy") bsw@1045: bsw@1045: ui.section( function() bsw@194: bsw@1045: ui.sectionHead( function() bsw@1184: ui.heading { level = 1, content = policy and policy.name or _"New policy" } bsw@1045: end ) bsw@1045: ui.sectionRow( function() bsw@1045: ui.form{ bsw@1045: attr = { class = "vertical" }, bsw@1045: record = policy, bsw@194: module = "admin", bsw@1045: action = "policy_update", bsw@1045: routing = { bsw@1045: default = { bsw@1045: mode = "redirect", bsw@1045: module = "admin", bsw@1045: view = "index" bsw@1045: } bsw@1045: }, bsw@1045: id = policy.id, bsw@1045: content = function() bsw@194: bsw@1045: ui.field.text{ label = _"Index", name = "index", value = hint and "1" or nil } bsw@194: bsw@1045: ui.field.text{ label = _"Name", name = "name" } bsw@1045: ui.field.text{ label = _"Description", name = "description", multiline = true } bsw@1045: ui.field.text{ label = _"Hint", readonly = true, bsw@1045: value = _"Interval format:" .. " 3 mons 2 weeks 1 day 10:30:15" } bsw@194: bsw@1234: ui.field.text{ label = _"Minimum admission time", name = "min_admission_time", value = hint and "0" or nil } bsw@1236: ui.field.text{ label = _"Maximum admission time", name = "max_admission_time", value = hint and "30 days" or nil } bsw@1045: ui.field.text{ label = _"Discussion time", name = "discussion_time", value = hint and "30 days" or nil } bsw@1045: ui.field.text{ label = _"Verification time", name = "verification_time", value = hint and "15 days" or nil } bsw@1045: ui.field.text{ label = _"Voting time", name = "voting_time", value = hint and "15 days" or nil } bsw@194: bsw@1045: ui.field.text{ label = _"Issue quorum numerator", name = "issue_quorum_num", value = hint and "10" or nil } bsw@1045: ui.field.text{ label = _"Issue quorum denominator", name = "issue_quorum_den", value = hint and "100" or nil } bsw@1045: bsw@1045: ui.field.text{ label = _"Initiative quorum numerator", name = "initiative_quorum_num", value = hint and "10" or nil } bsw@1045: ui.field.text{ label = _"Initiative quorum denominator", name = "initiative_quorum_den", value = hint and "100" or nil } bsw@194: bsw@1045: ui.field.text{ label = _"Direct majority numerator", name = "direct_majority_num", value = hint and "50" or nil } bsw@1045: ui.field.text{ label = _"Direct majority denominator", name = "direct_majority_den", value = hint and "100" or nil } bsw@1045: ui.field.boolean{ label = _"Strict direct majority", name = "direct_majority_strict", value = hint and true or nil } bsw@1045: ui.field.text{ label = _"Direct majority positive", name = "direct_majority_positive", value = hint and "0" or nil } bsw@1045: ui.field.text{ label = _"Direct majority non negative", name = "direct_majority_non_negative", value = hint and "0" or nil } bsw@194: bsw@1045: ui.field.text{ label = _"Indirect majority numerator", name = "indirect_majority_num", value = hint and "50" or nil } bsw@1045: ui.field.text{ label = _"Indirect majority denominator", name = "indirect_majority_den", value = hint and "100" or nil } bsw@1045: ui.field.boolean{ label = _"Strict indirect majority", name = "indirect_majority_strict", value = hint and true or nil } bsw@1045: ui.field.text{ label = _"Indirect majority positive", name = "indirect_majority_positive", value = hint and "0" or nil } bsw@1045: ui.field.text{ label = _"Indirect majority non negative", name = "indirect_majority_non_negative", value = hint and "0" or nil } bsw@282: bsw@1045: ui.field.boolean{ label = _"No reverse beat path", name = "no_reverse_beat_path", value = hint and false or nil } bsw@1045: ui.field.boolean{ label = _"No multistage majority", name = "no_multistage_majority", value = hint and false or nil } bsw@1045: ui.field.boolean{ label = _"Polling mode", name = "polling", value = hint and false or nil } bsw@282: bsw@194: bsw@1045: ui.field.boolean{ label = _"Active?", name = "active", value = hint and true or nil } bsw@194: bsw@1045: ui.submit{ text = _"update policy" } bsw@1045: slot.put(" ") bsw@1045: ui.link { module = "admin", view = "index", content = _"cancel" } bsw@1045: end bsw@1045: } bsw@1045: end ) bsw@1236: end )