liquid_feedback_frontend

view app/main/admin/_action/area_update.lua @ 193:46351752814f

Admin module refactored
author bsw
date Mon Nov 08 15:04:44 2010 +0100 (2010-11-08)
parents 36aedac3e4bf
children f42d16567c5d
line source
1 local area = Area:by_id(param.get_id()) or Area:new()
3 param.update(area, "name", "description", "active")
5 area:save()
7 param.update_relationship{
8 param_name = "allowed_policies",
9 id = area.id,
10 connecting_model = AllowedPolicy,
11 own_reference = "area_id",
12 foreign_reference = "policy_id"
13 }
15 -- we have to update the default flag because update_relationship can't handle it
16 old_default = AllowedPolicy:new_selector()
17 :add_where{ "allowed_policy.area_id = ? AND allowed_policy.default_policy = 't'", area.id }
18 :optional_object_mode()
19 :exec()
21 if old_default then
22 old_default.default_policy = false;
23 old_default:save()
24 end
26 default_policy_id = param.get("default_policy", atom.integer)
28 if default_policy_id and default_policy_id ~= -1 then
29 pol = AllowedPolicy:new_selector()
30 :add_where{ "allowed_policy.area_id = ? AND allowed_policy.policy_id = ?", area.id, default_policy_id }
31 :optional_object_mode()
32 :exec()
33 if pol then
34 pol.default_policy = true;
35 pol:save()
36 end
37 end
39 slot.put_into("notice", _"Area successfully updated")

Impressum / About Us