liquid_feedback_frontend

view app/main/admin/_action/area_update.lua @ 159:5d797c6706d5

implement quorum display

show the initiative quorum as a small 1px line in bargraph
allow to update your support on the diff page
better linked title in diff page
show absolute quorum numbers in detail pages of issue and initiative
author Daniel Poelzleithner <poelzi@poelzi.org>
date Sat Oct 09 03:42:48 2010 +0200 (2010-10-09)
parents 36aedac3e4bf
children 46351752814f
line source
1 if not app.session.member.admin then
2 error()
3 end
5 local id = param.get_id()
7 local area
8 if id then
9 area = Area:new_selector():add_where{ "id = ?", id }:single_object_mode():exec()
10 else
11 area = Area:new()
12 end
15 param.update(area, "name", "description", "active")
17 area:save()
19 param.update_relationship{
20 param_name = "allowed_policies",
21 id = area.id,
22 connecting_model = AllowedPolicy,
23 own_reference = "area_id",
24 foreign_reference = "policy_id"
25 }
27 -- we have to update the default flag because update_relationship can't handle it
28 old_default = AllowedPolicy:new_selector()
29 :add_where{ "allowed_policy.area_id = ? AND allowed_policy.default_policy = 't'", area.id }
30 :optional_object_mode()
31 :exec()
33 if old_default then
34 old_default.default_policy = false;
35 old_default:save()
36 end
38 default_policy_id = param.get("default_policy", atom.integer)
40 if default_policy_id and default_policy_id ~= -1 then
41 pol = AllowedPolicy:new_selector()
42 :add_where{ "allowed_policy.area_id = ? AND allowed_policy.policy_id = ?", area.id, default_policy_id }
43 :optional_object_mode()
44 :exec()
45 if pol then
46 pol.default_policy = true;
47 pol:save()
48 end
49 end
51 slot.put_into("notice", _"Area successfully updated")

Impressum / About Us