liquid_feedback_frontend
diff app/main/registration_admin/verification.lua @ 1309:32cc544d5a5b
Cumulative patch for upcoming frontend version 4
author | bsw/jbe |
---|---|
date | Sun Jul 15 14:07:29 2018 +0200 (2018-07-15) |
parents | |
children | 7e328a78da93 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/app/main/registration_admin/verification.lua Sun Jul 15 14:07:29 2018 +0200 1.3 @@ -0,0 +1,167 @@ 1.4 +local verification = Verification:by_id(param.get_id()) 1.5 +local data = verification.verification_data or verification.request_data 1.6 + 1.7 +local identification = config.self_registration.identification_func(data) 1.8 +local member 1.9 +if verification.verified_member_id then 1.10 + member = Member:by_id(verification.verified_member_id) 1.11 + identification = member.identification 1.12 +end 1.13 + 1.14 +local group, title, view 1.15 +if verification.verified_member_id then 1.16 + if member.deleted then 1.17 + group = _"Cancelled accounts" 1.18 + title = _"Cancelled account" 1.19 + view = "verification_cancelled" 1.20 + else 1.21 + group = _"Accredited users" 1.22 + title = member.identification 1.23 + view = "verification_accredited" 1.24 + end 1.25 +elseif verification.denied then 1.26 + group = "Rejected requests" 1.27 + title = _"Rejected request" 1.28 + view = "verification_rejected" 1.29 +else 1.30 + group = "Open requests" 1.31 + title = _"Open request" 1.32 + view = "verification_requests" 1.33 +end 1.34 + 1.35 + 1.36 +ui.title(function() 1.37 + ui.link { module = "registration_admin", view = "index", content = _"Usermanagement" } 1.38 + slot.put ( " » " ) 1.39 + ui.link { module = "registration_admin", view = view, content = group } 1.40 + slot.put ( " » " ) 1.41 + ui.tag { tag = "span", content = title } 1.42 +end) 1.43 +app.html_title.title = _"Usermanagement" 1.44 + 1.45 +ui.container{ attr = { class = "mdl-grid" }, content = function() 1.46 + ui.container{ attr = { class = "mdl-cell mdl-cell--12-col" }, content = function() 1.47 + ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function() 1.48 + ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function() 1.49 + ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = title } 1.50 + end } 1.51 + 1.52 + 1.53 + ui.form{ 1.54 + module = "registration_admin", action = "update_verification", id = verification.id, 1.55 + routing = { ok = { mode = "redirect", module = "registration_admin", view = view } }, 1.56 + record = data, 1.57 + content = function() 1.58 + 1.59 + if not verification.verified_member_id then 1.60 + ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function() 1.61 + ui.container{ content = verification.comment and verification.comment:gsub("///", " / ") or ""} 1.62 + end } 1.63 + end 1.64 + 1.65 + ui.container{ attr = { class = "mdl-card__content" }, content = function() 1.66 + 1.67 + for i, field in ipairs(config.self_registration.fields) do 1.68 + ui.container{ content = function() 1.69 + ui.field.text{ 1.70 + container_attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label" }, 1.71 + attr = { id = "lf-register__data_" .. field.name, class = "mdl-textfield__input" }, 1.72 + label_attr = { class = "mdl-textfield__label", ["for"] = "lf-register__data" .. field.name }, 1.73 + label = field.label, 1.74 + name = field.name 1.75 + } 1.76 + 1.77 + ui.tag{ content = verification.request_data[field.name] } 1.78 + end } 1.79 + end 1.80 + 1.81 + ui.field.text{ 1.82 + container_attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label", style = "width: 30em;" }, 1.83 + attr = { id = "lf-register__data_identification", class = "mdl-textfield__input" }, 1.84 + label_attr = { class = "mdl-textfield__label", ["for"] = "lf-register__data_identification" }, 1.85 + label = "Identification", 1.86 + name = "identification", 1.87 + value = identification 1.88 + } 1.89 + 1.90 + end } 1.91 + 1.92 + ui.container{ attr = { class = "mdl-card__actions mdl-card--border" }, content = function() 1.93 + 1.94 + if verification.denied then 1.95 + ui.link{ attr = { class = "mdl-button mdl-js-button mdl-button--raised" }, module = "registration_admin", view = view, content = "Back" } 1.96 + elseif verification.verified_member_id then 1.97 + ui.submit{ attr = { class = "mdl-button mdl-js-button mdl-button--raised" }, value = "Save personal data" } 1.98 + slot.put(" ") 1.99 + if not member.activated then 1.100 + ui.submit{ name = "invite", attr = { class = "mdl-button mdl-js-button mdl-button--raised" }, value = "Send email invitation again" } 1.101 + slot.put(" ") 1.102 + end 1.103 + ui.link{ attr = { class = "mdl-button mdl-js-button mdl-button--raised" }, module = "registration_admin", view = view, content = "Back" } 1.104 + slot.put(" ") 1.105 + ui.submit{ name = "cancel", attr = { class = "mdl-button mdl-js-button" }, value = _"Delete account" } 1.106 + else 1.107 + ui.submit{ name = "accredit", attr = { class = "mdl-button mdl-js-button mdl-button--raised" }, value = "Accredit user" } 1.108 + slot.put(" ") 1.109 + ui.submit{ attr = { class = "mdl-button mdl-js-button mdl-button--raised" }, value = "Save personal data" } 1.110 + slot.put(" ") 1.111 + ui.link{ attr = { class = "mdl-button mdl-js-button mdl-button--raised" }, module = "registration_admin", view = view, content = "Back" } 1.112 + slot.put(" ") 1.113 + ui.submit{ name = "drop", attr = { class = "mdl-button mdl-js-button" }, value = "Reject request" } 1.114 + end 1.115 + end } 1.116 + 1.117 + end 1.118 + } 1.119 + end } 1.120 + 1.121 + local verifications = Verification:new_selector() 1.122 + :join("member", nil, "member.id = verification.verified_member_id") 1.123 + :add_where{ "member.identification = ?", identification } 1.124 + :add_where{ "verification.id <> ?", verification.id } 1.125 + :exec() 1.126 + 1.127 + if #verifications > 0 then 1.128 + 1.129 + ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function() 1.130 + ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function() 1.131 + ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = function() 1.132 + ui.tag{ content = _"Same identification" } 1.133 + end } 1.134 + end } 1.135 + ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function() 1.136 + execute.view{ module = "registration_admin", view = "_verification_list", params = { verifications = verifications } } 1.137 + end } 1.138 + end } 1.139 + end 1.140 + 1.141 + for i, field_name in ipairs(config.self_registration.match_fields) do 1.142 + local field 1.143 + for j, f in ipairs(config.self_registration.fields) do 1.144 + if f.name == field_name then 1.145 + field = f 1.146 + end 1.147 + end 1.148 + local verifications = Verification:new_selector() 1.149 + :add_where("verified_member_id NOTNULL") 1.150 + :add_where{ "lower(request_data->>'" .. field.name .. "') = lower(?)", data[field.name] } 1.151 + :add_where{ "verification.id <> ?", verification.id } 1.152 + :exec() 1.153 + 1.154 + if #verifications > 0 then 1.155 + ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function() 1.156 + ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function() 1.157 + ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = function() 1.158 + ui.tag{ content = _"Same " .. field.label } 1.159 + end } 1.160 + end } 1.161 + ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function() 1.162 + execute.view{ module = "registration_admin", view = "_verification_list", params = { verifications = verifications } } 1.163 + end } 1.164 + end } 1.165 + end 1.166 + end 1.167 + 1.168 + end } 1.169 +end } 1.170 +