| rev | line source | 
| bsw@1184 | 1 local inactive = param.get("inactive", atom.boolean) | 
| bsw@1184 | 2 | 
| bsw@1184 | 3 local units = Unit:get_flattened_tree{ include_inactive = inactive } | 
| bsw@1184 | 4 | 
| bsw@1045 | 5 local policies = Policy:build_selector{}:add_order_by("index"):exec() | 
| bsw@1045 | 6 | 
| bsw@1184 | 7 ui.titleAdmin() | 
| bsw/jbe@0 | 8 | 
| bsw@1045 | 9 ui.sidebar( "tab-members", function() | 
| bsw@1045 | 10   ui.sidebarHead( function() | 
| bsw@1045 | 11     ui.heading { level = 2, content = _"Members" } | 
| bsw@1045 | 12   end ) | 
| bsw@1045 | 13 | 
| bsw@1045 | 14   ui.sidebarSection( function() | 
| bsw@1045 | 15     ui.tag { tag = "ul", attr = { class = "ul" }, content = function() | 
| bsw@1045 | 16       ui.tag { tag = "li", content = function() | 
| bsw@1045 | 17         ui.form{ | 
| bsw@1045 | 18           module = "admin", view = "member_list", | 
| bsw@1045 | 19           content = function() | 
| bsw@1045 | 20 | 
| bsw@1045 | 21             ui.field.text{ label = _"search", name = "search" } | 
| bsw@1045 | 22 | 
| bsw@1045 | 23             ui.submit{ value = _"search" } | 
| bsw@1045 | 24 | 
| bsw@1045 | 25           end | 
| bsw@1045 | 26         } | 
| bsw@1045 | 27       end } | 
| bsw@1045 | 28     end } | 
| bsw@1045 | 29   end ) | 
| bsw@1045 | 30   ui.sidebarSection( "moreLink", function() | 
| bsw@1045 | 31     ui.link{ | 
| bsw@1045 | 32       text = _"Register new member", | 
| bsw@1045 | 33       module = "admin", | 
| bsw@1045 | 34       view = "member_edit" | 
| bsw@1045 | 35     } | 
| bsw@1045 | 36   end ) | 
| bsw@1045 | 37 end ) | 
| bsw/jbe@0 | 38 | 
| bsw@1045 | 39 ui.sidebar( "tab-whatcanido", function() | 
| bsw@1045 | 40   ui.sidebarHead( function() | 
| bsw@1045 | 41     ui.heading { level = 2, content = _"Cancel issue" } | 
| bsw@1045 | 42   end ) | 
| bsw@1045 | 43 | 
| bsw@1045 | 44   ui.sidebarSection( function() | 
| bsw@1045 | 45     ui.form{ | 
| bsw@1045 | 46       module = "admin", | 
| bsw@1045 | 47       view = "cancel_issue", | 
| bsw@1045 | 48       content = function() | 
| bsw@1045 | 49         ui.tag { tag = "ul", attr = { class = "ul" }, content = function() | 
| bsw@1045 | 50           ui.tag { tag = "li", content = function() | 
| bsw@1045 | 51             ui.field.text{ label = _"Issue #", name = "id" } | 
| bsw@1045 | 52             ui.submit{ text = _"cancel issue" } | 
| bsw@1045 | 53           end } | 
| bsw@1045 | 54         end } | 
| bsw@1045 | 55       end | 
| bsw@1045 | 56     } | 
| bsw@1045 | 57   end ) | 
| bsw@1045 | 58 end ) | 
| bsw@1045 | 59 | 
| bsw@1045 | 60 ui.sidebar("tab-whatcanido", function() | 
| bsw@1045 | 61   ui.sidebarHead( function() | 
| bsw@1045 | 62     ui.heading { level = 2, content = _"Policies" } | 
| bsw@1045 | 63   end ) | 
| bsw@1045 | 64 | 
| bsw@1045 | 65   ui.sidebarSection( function() | 
| bsw@1045 | 66     ui.tag { tag = "ul", attr = { class = "ul" }, content = function() | 
| bsw@1045 | 67       for i, policy in ipairs(policies) do | 
| bsw@1045 | 68         ui.tag { tag = "li", content = function() | 
| bsw@1045 | 69           ui.link{ | 
| bsw@1045 | 70             content = policy.name, | 
| bsw@1045 | 71             module = "admin", | 
| bsw@1045 | 72             view = "policy_show", | 
| bsw@1045 | 73             id = policy.id | 
| bsw@1045 | 74           } | 
| bsw@1045 | 75         end } | 
| bsw@1045 | 76       end | 
| bsw@1045 | 77     end } | 
| bsw@1045 | 78   end ) | 
| bsw@1045 | 79   ui.sidebarSection( "moreLink", function() | 
| bsw@371 | 80     ui.link{ | 
| bsw@1045 | 81       text = _"Create new policy", | 
| bsw@1045 | 82       module = "admin", | 
| bsw@1045 | 83       view = "policy_show" | 
| bsw@1045 | 84     } | 
| bsw@1045 | 85   end ) | 
| bsw@1045 | 86   ui.sidebarSection( "moreLink", function() | 
| bsw@1045 | 87     ui.link{ | 
| bsw@1045 | 88       text = _"Show policies not in use", | 
| bsw@371 | 89       module = "admin", | 
| bsw@371 | 90       view = "policy_list", | 
| bsw@1045 | 91       params = { show_not_in_use = true } | 
| bsw@371 | 92     } | 
| bsw@1045 | 93   end ) | 
| bsw@1045 | 94 end ) | 
| bsw@1045 | 95 | 
| bsw@1045 | 96 | 
| bsw@1045 | 97 ui.section( function() | 
| bsw@1045 | 98   ui.sectionHead( function() | 
| bsw@1045 | 99     ui.heading { level = 1, content = _"Organizational units and subject areas" } | 
| bsw@1045 | 100   end ) | 
| bsw@1045 | 101   ui.sectionRow( function() | 
| bsw@1007 | 102 | 
| bsw@1045 | 103     for i_unit, unit in ipairs(units) do | 
| bsw@1045 | 104       ui.container { | 
| bsw@1045 | 105         attr = { style = "margin-left: " .. ((unit.depth - 1)* 2) .. "em;" }, | 
| bsw@1045 | 106         content = function () | 
| bsw@1045 | 107           ui.heading { level = 1, content = function () | 
| bsw@1184 | 108             local class | 
| bsw@1184 | 109             if unit.active == false then | 
| bsw@1184 | 110               class = "inactive" | 
| bsw@1184 | 111             end | 
| bsw@1184 | 112             ui.link{ attr = { class = class }, text = unit.name, module = "admin", view = "unit_edit", id = unit.id } | 
| bsw@1045 | 113           end } | 
| bsw@1045 | 114           ui.tag { tag = "ul", attr = { class = "ul" }, content = function () | 
| bsw@1184 | 115             local areas | 
| bsw@1184 | 116             if not inactive then | 
| bsw@1184 | 117               areas = unit:get_reference_selector("areas"):add_order_by("name"):add_where("active"):exec() | 
| bsw@1184 | 118             else | 
| bsw@1184 | 119               areas = unit:get_reference_selector("areas"):add_order_by("name"):exec() | 
| bsw@1184 | 120             end | 
| bsw@1184 | 121             for i, area in ipairs(areas) do | 
| bsw@1045 | 122               ui.tag { tag = "li", content = function () | 
| bsw@1184 | 123                 local class | 
| bsw@1184 | 124                 if area.active == false then | 
| bsw@1184 | 125                   class = "inactive" | 
| bsw@1184 | 126                 end | 
| bsw@1184 | 127                 ui.link{ attr = { class = class }, text = area.name, module = "admin", view = "area_show", id = area.id } | 
| bsw@1045 | 128               end } | 
| bsw@1045 | 129             end | 
| bsw@1045 | 130             ui.tag { tag = "li", content = function () | 
| bsw@1045 | 131               ui.link { module = "admin", view = "area_show", params = { unit_id = unit.id }, content = _"+ add new subject area" } | 
| bsw@1045 | 132             end } | 
| bsw@1045 | 133             slot.put("<br />") | 
| bsw@1045 | 134           end } | 
| bsw@1045 | 135         end | 
| bsw@1045 | 136       } | 
| bsw@1045 | 137     end | 
| bsw@1045 | 138 | 
| bsw@1045 | 139     slot.put("<br />") | 
| bsw@1185 | 140     ui.link { module = "admin", view = "unit_edit", content = _"Create new unit" } | 
| bsw@1184 | 141     slot.put("<br />") | 
| bsw@1184 | 142     slot.put("<br />") | 
| bsw@1184 | 143 | 
| bsw@1184 | 144     if (not inactive) then | 
| bsw@1184 | 145       ui.link { module = "admin", view = "index", params = { inactive = true }, content = _"Show inactive" } | 
| bsw@1184 | 146     else | 
| bsw@1184 | 147       ui.link { module = "admin", view = "index", content = _"Hide inactive" } | 
| bsw@1184 | 148     end | 
| bsw@1045 | 149 | 
| bsw@1045 | 150   end) | 
| bsw@1045 | 151 end) |