| 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@1248
 | 
    41     ui.heading { level = 2, content = _"Newsletter" }
 | 
| 
bsw@1248
 | 
    42   end )
 | 
| 
bsw@1248
 | 
    43   
 | 
| 
bsw@1248
 | 
    44   ui.sidebarSection( "moreLink", function()
 | 
| 
bsw@1248
 | 
    45     ui.link{
 | 
| 
bsw@1248
 | 
    46       text = _"Create a newsletter",
 | 
| 
bsw@1248
 | 
    47       module = "admin",
 | 
| 
bsw@1248
 | 
    48       view = "newsletter_edit"
 | 
| 
bsw@1248
 | 
    49     }
 | 
| 
bsw@1248
 | 
    50   end )
 | 
| 
bsw@1248
 | 
    51   ui.sidebarSection( "moreLink", function()
 | 
| 
bsw@1248
 | 
    52     ui.link{
 | 
| 
bsw@1248
 | 
    53       text = _"Manage newsletters",
 | 
| 
bsw@1248
 | 
    54       module = "admin",
 | 
| 
bsw@1248
 | 
    55       view = "newsletter_list"
 | 
| 
bsw@1248
 | 
    56     }
 | 
| 
bsw@1248
 | 
    57   end )
 | 
| 
bsw@1248
 | 
    58 end )
 | 
| 
bsw@1248
 | 
    59 
 | 
| 
bsw@1248
 | 
    60 ui.sidebar( "tab-whatcanido", function()
 | 
| 
bsw@1248
 | 
    61   ui.sidebarHead( function()
 | 
| 
bsw@1045
 | 
    62     ui.heading { level = 2, content = _"Cancel issue" }
 | 
| 
bsw@1045
 | 
    63   end )
 | 
| 
bsw@1045
 | 
    64   
 | 
| 
bsw@1045
 | 
    65   ui.sidebarSection( function()
 | 
| 
bsw@1045
 | 
    66     ui.form{
 | 
| 
bsw@1045
 | 
    67       module = "admin",
 | 
| 
bsw@1045
 | 
    68       view = "cancel_issue",
 | 
| 
bsw@1045
 | 
    69       content = function()
 | 
| 
bsw@1045
 | 
    70         ui.tag { tag = "ul", attr = { class = "ul" }, content = function()
 | 
| 
bsw@1045
 | 
    71           ui.tag { tag = "li", content = function()
 | 
| 
bsw@1045
 | 
    72             ui.field.text{ label = _"Issue #", name = "id" }
 | 
| 
bsw@1045
 | 
    73             ui.submit{ text = _"cancel issue" }
 | 
| 
bsw@1045
 | 
    74           end }
 | 
| 
bsw@1045
 | 
    75         end }
 | 
| 
bsw@1045
 | 
    76       end
 | 
| 
bsw@1045
 | 
    77     }
 | 
| 
bsw@1045
 | 
    78   end )
 | 
| 
bsw@1045
 | 
    79 end )
 | 
| 
bsw@1045
 | 
    80 
 | 
| 
bsw@1045
 | 
    81 ui.sidebar("tab-whatcanido", function()
 | 
| 
bsw@1045
 | 
    82   ui.sidebarHead( function()
 | 
| 
bsw@1045
 | 
    83     ui.heading { level = 2, content = _"Policies" }
 | 
| 
bsw@1045
 | 
    84   end )
 | 
| 
bsw@1045
 | 
    85   
 | 
| 
bsw@1045
 | 
    86   ui.sidebarSection( function()
 | 
| 
bsw@1045
 | 
    87     ui.tag { tag = "ul", attr = { class = "ul" }, content = function()
 | 
| 
bsw@1045
 | 
    88       for i, policy in ipairs(policies) do
 | 
| 
bsw@1045
 | 
    89         ui.tag { tag = "li", content = function()
 | 
| 
bsw@1045
 | 
    90           ui.link{
 | 
| 
bsw@1045
 | 
    91             content = policy.name,
 | 
| 
bsw@1045
 | 
    92             module = "admin",
 | 
| 
bsw@1045
 | 
    93             view = "policy_show",
 | 
| 
bsw@1045
 | 
    94             id = policy.id
 | 
| 
bsw@1045
 | 
    95           }
 | 
| 
bsw@1045
 | 
    96         end }
 | 
| 
bsw@1045
 | 
    97       end
 | 
| 
bsw@1045
 | 
    98     end }
 | 
| 
bsw@1045
 | 
    99   end )
 | 
| 
bsw@1045
 | 
   100   ui.sidebarSection( "moreLink", function()
 | 
| 
bsw@371
 | 
   101     ui.link{
 | 
| 
bsw@1045
 | 
   102       text = _"Create new policy",
 | 
| 
bsw@1045
 | 
   103       module = "admin",
 | 
| 
bsw@1045
 | 
   104       view = "policy_show"
 | 
| 
bsw@1045
 | 
   105     }
 | 
| 
bsw@1045
 | 
   106   end )
 | 
| 
bsw@1045
 | 
   107   ui.sidebarSection( "moreLink", function()
 | 
| 
bsw@1045
 | 
   108     ui.link{
 | 
| 
bsw@1045
 | 
   109       text = _"Show policies not in use",
 | 
| 
bsw@371
 | 
   110       module = "admin",
 | 
| 
bsw@371
 | 
   111       view = "policy_list",
 | 
| 
bsw@1045
 | 
   112       params = { show_not_in_use = true }
 | 
| 
bsw@371
 | 
   113     }
 | 
| 
bsw@1045
 | 
   114   end )
 | 
| 
bsw@1045
 | 
   115 end )
 | 
| 
bsw@1045
 | 
   116 
 | 
| 
bsw@1045
 | 
   117 
 | 
| 
bsw@1045
 | 
   118 ui.section( function()
 | 
| 
bsw@1045
 | 
   119   ui.sectionHead( function()
 | 
| 
bsw@1045
 | 
   120     ui.heading { level = 1, content = _"Organizational units and subject areas" }
 | 
| 
bsw@1045
 | 
   121   end )
 | 
| 
bsw@1045
 | 
   122   ui.sectionRow( function()
 | 
| 
bsw@1007
 | 
   123 
 | 
| 
bsw@1045
 | 
   124     for i_unit, unit in ipairs(units) do
 | 
| 
bsw@1045
 | 
   125       ui.container { 
 | 
| 
bsw@1045
 | 
   126         attr = { style = "margin-left: " .. ((unit.depth - 1)* 2) .. "em;" },
 | 
| 
bsw@1045
 | 
   127         content = function ()
 | 
| 
bsw@1045
 | 
   128           ui.heading { level = 1, content = function ()
 | 
| 
bsw@1184
 | 
   129             local class
 | 
| 
bsw@1184
 | 
   130             if unit.active == false then
 | 
| 
bsw@1184
 | 
   131               class = "inactive"
 | 
| 
bsw@1184
 | 
   132             end
 | 
| 
bsw@1184
 | 
   133             ui.link{ attr = { class = class }, text = unit.name, module = "admin", view = "unit_edit", id = unit.id }
 | 
| 
bsw@1045
 | 
   134           end }
 | 
| 
bsw@1045
 | 
   135           ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw@1184
 | 
   136             local areas
 | 
| 
bsw@1184
 | 
   137             if not inactive then
 | 
| 
bsw@1184
 | 
   138               areas = unit:get_reference_selector("areas"):add_order_by("name"):add_where("active"):exec()
 | 
| 
bsw@1184
 | 
   139             else
 | 
| 
bsw@1184
 | 
   140               areas = unit:get_reference_selector("areas"):add_order_by("name"):exec()
 | 
| 
bsw@1184
 | 
   141             end
 | 
| 
bsw@1184
 | 
   142             for i, area in ipairs(areas) do
 | 
| 
bsw@1045
 | 
   143               ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1184
 | 
   144                 local class
 | 
| 
bsw@1184
 | 
   145                 if area.active == false then
 | 
| 
bsw@1184
 | 
   146                   class = "inactive"
 | 
| 
bsw@1184
 | 
   147                 end
 | 
| 
bsw@1184
 | 
   148                 ui.link{ attr = { class = class }, text = area.name, module = "admin", view = "area_show", id = area.id }
 | 
| 
bsw@1045
 | 
   149               end }
 | 
| 
bsw@1045
 | 
   150             end
 | 
| 
bsw@1045
 | 
   151             ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1045
 | 
   152               ui.link { module = "admin", view = "area_show", params = { unit_id = unit.id }, content = _"+ add new subject area" }
 | 
| 
bsw@1045
 | 
   153             end }
 | 
| 
bsw@1045
 | 
   154             slot.put("<br />")
 | 
| 
bsw@1045
 | 
   155           end }
 | 
| 
bsw@1045
 | 
   156         end
 | 
| 
bsw@1045
 | 
   157       }
 | 
| 
bsw@1045
 | 
   158     end
 | 
| 
bsw@1045
 | 
   159     
 | 
| 
bsw@1045
 | 
   160     slot.put("<br />")
 | 
| 
bsw@1185
 | 
   161     ui.link { module = "admin", view = "unit_edit", content = _"Create new unit" }
 | 
| 
bsw@1184
 | 
   162     slot.put("<br />")
 | 
| 
bsw@1184
 | 
   163     slot.put("<br />")
 | 
| 
bsw@1184
 | 
   164     
 | 
| 
bsw@1184
 | 
   165     if (not inactive) then
 | 
| 
bsw@1184
 | 
   166       ui.link { module = "admin", view = "index", params = { inactive = true }, content = _"Show inactive" }
 | 
| 
bsw@1184
 | 
   167     else
 | 
| 
bsw@1184
 | 
   168       ui.link { module = "admin", view = "index", content = _"Hide inactive" }
 | 
| 
bsw@1184
 | 
   169     end
 | 
| 
bsw@1045
 | 
   170       
 | 
| 
bsw@1045
 | 
   171   end)
 | 
| 
bsw@1045
 | 
   172 end)
 |