annotate app/main/member/_action/update.lua @ 304:c382f43d6c81
Change auth filter according to moving area/list to unit/show
 | author | 
 bsw | 
 | date | 
 Sun Feb 26 15:01:05 2012 +0100 (2012-02-26) | 
 | parents | 
 c587d8762e62  | 
 | children | 
 6cfdb2e5d3d4  | 
 
 | rev | 
   line source | 
| 
bsw@286
 | 
     1 local fields = {
 | 
| 
bsw@2
 | 
     2   "organizational_unit",
 | 
| 
bsw@2
 | 
     3   "internal_posts",
 | 
| 
bsw@2
 | 
     4   "realname",
 | 
| 
bsw@2
 | 
     5   "birthday",
 | 
| 
bsw@2
 | 
     6   "address",
 | 
| 
bsw@2
 | 
     7   "email",
 | 
| 
bsw@2
 | 
     8   "xmpp_address",
 | 
| 
bsw@2
 | 
     9   "website",
 | 
| 
bsw@2
 | 
    10   "phone",
 | 
| 
bsw@2
 | 
    11   "mobile_phone",
 | 
| 
bsw@2
 | 
    12   "profession",
 | 
| 
bsw@2
 | 
    13   "external_memberships",
 | 
| 
bsw@2
 | 
    14   "external_posts",
 | 
| 
bsw@2
 | 
    15   "statement"
 | 
| 
bsw@286
 | 
    16 }
 | 
| 
bsw@286
 | 
    17 
 | 
| 
bsw@286
 | 
    18 local update_args = { app.session.member }
 | 
| 
bsw/jbe@0
 | 
    19 
 | 
| 
bsw@286
 | 
    20 for i, field in ipairs(fields) do
 | 
| 
bsw@286
 | 
    21   if not config.locked_profile_fields[field] then
 | 
| 
bsw@286
 | 
    22     param.update(app.session.member, field)
 | 
| 
bsw@286
 | 
    23   end
 | 
| 
bsw@286
 | 
    24 end
 | 
| 
bsw@286
 | 
    25 
 | 
| 
bsw@286
 | 
    26 if not config.locked_profile_fields.birthday then
 | 
| 
bsw@286
 | 
    27   if tostring(app.session.member.birthday) == "invalid_date" then
 | 
| 
bsw@286
 | 
    28     app.session.member.birthday = nil
 | 
| 
bsw@286
 | 
    29     slot.put_into("error", _"Date format is not valid. Please use following format: YYYY-MM-DD")
 | 
| 
bsw@286
 | 
    30     return false
 | 
| 
bsw@286
 | 
    31   end
 | 
| 
bsw@75
 | 
    32 end
 | 
| 
bsw@75
 | 
    33 
 | 
| 
bsw/jbe@0
 | 
    34 app.session.member:save()
 | 
| 
bsw/jbe@0
 | 
    35 
 | 
| 
bsw/jbe@0
 | 
    36 
 | 
| 
bsw/jbe@0
 | 
    37 slot.put_into("notice", _"Your page has been updated") |