liquid_feedback_frontend
annotate app/main/member/_action/update.lua @ 1340:346fe202e51c
Fixed image display part 2
author | bsw |
---|---|
date | Fri Aug 03 17:34:47 2018 +0200 (2018-08-03) |
parents | 32cc544d5a5b |
children | 757a87af4c83 |
rev | line source |
---|---|
bsw/jbe@1309 | 1 local profile = app.session.member.profile |
bsw@286 | 2 |
bsw/jbe@1309 | 3 for i, field in ipairs(config.member_profile_fields) do |
bsw/jbe@1309 | 4 if not util.is_profile_field_locked(app.session.member, field.id) then |
bsw/jbe@1309 | 5 local value = param.get(field.id) |
bsw/jbe@1309 | 6 if value == "" then |
bsw/jbe@1309 | 7 value = null |
bsw/jbe@1309 | 8 end |
bsw/jbe@1309 | 9 profile.profile[field.id] = value |
bsw@286 | 10 end |
bsw@286 | 11 end |
bsw@286 | 12 |
bsw/jbe@1309 | 13 if not util.is_profile_field_locked(profile, "statement") then |
bsw@1045 | 14 local formatting_engine = param.get("formatting_engine") or config.enforce_formatting_engine |
bsw@931 | 15 |
bsw@931 | 16 local formatting_engine_valid = false |
bsw@1045 | 17 for i, fe in pairs(config.formatting_engines) do |
bsw@1045 | 18 if formatting_engine == fe.id then |
bsw@931 | 19 formatting_engine_valid = true |
bsw@931 | 20 end |
bsw@931 | 21 end |
bsw@931 | 22 if not formatting_engine_valid then |
bsw@931 | 23 error("invalid formatting engine!") |
bsw@931 | 24 end |
bsw@931 | 25 |
bsw@931 | 26 |
bsw@397 | 27 local statement = param.get("statement") |
bsw@931 | 28 |
bsw/jbe@1309 | 29 if statement ~= profile.statement or |
bsw/jbe@1309 | 30 formatting_engine ~= profile.formatting_engine then |
bsw/jbe@1309 | 31 profile.formatting_engine = formatting_engine |
bsw/jbe@1309 | 32 profile.statement = statement |
bsw/jbe@1309 | 33 profile:render_content(true) |
bsw@397 | 34 end |
bsw@931 | 35 |
bsw@397 | 36 end |
bsw@397 | 37 |
bsw/jbe@1309 | 38 if not util.is_profile_field_locked(profile, "birthday") then |
bsw/jbe@1309 | 39 if tostring(profile.birthday) == "invalid_date" then |
bsw/jbe@1309 | 40 profile.birthday = nil |
bsw@286 | 41 slot.put_into("error", _"Date format is not valid. Please use following format: YYYY-MM-DD") |
bsw@286 | 42 return false |
bsw@286 | 43 end |
bsw@75 | 44 end |
bsw@75 | 45 |
bsw/jbe@1309 | 46 local search_strings = {} |
bsw/jbe@1309 | 47 for i, field in ipairs(config.member_profile_fields) do |
bsw/jbe@1309 | 48 if field.index and profile.profile[field.id] and #(profile.profile[field.id]) > 0 then |
bsw/jbe@1309 | 49 search_strings[#search_strings+1] = profile.profile[field.id] |
bsw/jbe@1309 | 50 end |
bsw/jbe@1309 | 51 end |
bsw/jbe@1309 | 52 |
bsw/jbe@1309 | 53 if profile.statement and #(profile.statement) > 0 then |
bsw/jbe@1309 | 54 search_strings[#search_strings+1] = profile.statement |
bsw/jbe@1309 | 55 end |
bsw/jbe@1309 | 56 |
bsw/jbe@1309 | 57 profile.profile_text_data = table.concat(search_strings, " ") |
bsw/jbe@1309 | 58 |
bsw/jbe@1309 | 59 profile:save() |
bsw/jbe@0 | 60 |
bsw/jbe@0 | 61 |
bsw@931 | 62 slot.put_into("notice", _"Your page has been updated") |