annotate app/main/member/_action/update.lua @ 707:74e9dc5bdce8
Fixed not shown buttons in area listing
 | author | 
 bsw | 
 | date | 
 Tue Jun 26 22:33:26 2012 +0200 (2012-06-26) | 
 | parents | 
 6cfdb2e5d3d4  | 
 | children | 
 6ef34f6a128e  | 
 
 | 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@397
 | 
    14   "external_posts"
 | 
| 
bsw@286
 | 
    15 }
 | 
| 
bsw@286
 | 
    16 
 | 
| 
bsw@286
 | 
    17 local update_args = { app.session.member }
 | 
| 
bsw/jbe@0
 | 
    18 
 | 
| 
bsw@286
 | 
    19 for i, field in ipairs(fields) do
 | 
| 
bsw@286
 | 
    20   if not config.locked_profile_fields[field] then
 | 
| 
bsw@286
 | 
    21     param.update(app.session.member, field)
 | 
| 
bsw@286
 | 
    22   end
 | 
| 
bsw@286
 | 
    23 end
 | 
| 
bsw@286
 | 
    24 
 | 
| 
bsw@397
 | 
    25 if not config.locked_profile_fields.statement then
 | 
| 
bsw@397
 | 
    26   local statement = param.get("statement")
 | 
| 
bsw@397
 | 
    27   if statement ~= app.session.member.statement then
 | 
| 
bsw@397
 | 
    28     app.session.member.statement = statement
 | 
| 
bsw@397
 | 
    29     app.session.member:render_content(true)
 | 
| 
bsw@397
 | 
    30   end
 | 
| 
bsw@397
 | 
    31 end
 | 
| 
bsw@397
 | 
    32 
 | 
| 
bsw@286
 | 
    33 if not config.locked_profile_fields.birthday then
 | 
| 
bsw@286
 | 
    34   if tostring(app.session.member.birthday) == "invalid_date" then
 | 
| 
bsw@286
 | 
    35     app.session.member.birthday = nil
 | 
| 
bsw@286
 | 
    36     slot.put_into("error", _"Date format is not valid. Please use following format: YYYY-MM-DD")
 | 
| 
bsw@286
 | 
    37     return false
 | 
| 
bsw@286
 | 
    38   end
 | 
| 
bsw@75
 | 
    39 end
 | 
| 
bsw@75
 | 
    40 
 | 
| 
bsw/jbe@0
 | 
    41 app.session.member:save()
 | 
| 
bsw/jbe@0
 | 
    42 
 | 
| 
bsw/jbe@0
 | 
    43 
 | 
| 
bsw/jbe@0
 | 
    44 slot.put_into("notice", _"Your page has been updated") |