webmcp
view demo-app/app/main/media_type/_action/update.lua @ 2:72860d232f32
Version 1.0.2
Fixed bug with explicit garbage collection (requests > 256kB caused an error)
Views prefixed with an underscore can't be called externally
ui.paginate now displays the last page, if the selected page number is too high.
Fixed bug with explicit garbage collection (requests > 256kB caused an error)
Views prefixed with an underscore can't be called externally
ui.paginate now displays the last page, if the selected page number is too high.
author | jbe/bsw |
---|---|
date | Thu Dec 10 12:00:00 2009 +0100 (2009-12-10) |
parents | 9fdfb27f8e67 |
children |
line source
1 local media_type
2 local id = param.get_id()
3 if id then
4 media_type = MediaType:by_id(id)
5 else
6 media_type = MediaType:new()
7 end
9 if param.get("delete", atom.boolean) then
10 local name = media_type.name
11 media_type:destroy()
12 slot.put_into("notice", _("Media type '#{name}' deleted", {name = name}))
13 return
14 end
16 param.update(media_type, "name", "description")
18 media_type:save()
20 if id then
21 slot.put_into("notice", _("Media type '#{name}' updated", {name = media_type.name}))
22 else
23 slot.put_into("notice", _("Media type '#{name}' created", {name = media_type.name}))
24 end