bsw@31: function link_area(area)
bsw@31:   ui.link{
bsw@31:     external = "",
bsw@31:     attr = {
bsw@31:       onclick =
bsw@31:         "openEl('area_" .. tostring(area.id) .. "');" ..
bsw@31:         "return(false);"
bsw@31:     },
bsw@31:     content = function()
bsw@31:       ui.heading{
bsw@31:         content = area.name
bsw@31:       }
bsw@31:     end
bsw@31:   }
bsw@31: end
bsw@31: 
bsw@31: slot.set_layout("report")
bsw@31: 
bsw@34: slot.put("
")
bsw@34: 
bsw@34: ui.container{
bsw@31:   attr = {
bsw@34:     class = "nav",
bsw@34:     style = "text-align: center;"
bsw@31:   },
bsw@31:   content = function()
bsw@34: 
bsw@34: 
bsw@34:     ui.container{
bsw@34:       attr = { 
bsw@34:         class = "left",
bsw@34:       },
bsw@34:       content = function()
bsw@34:         ui.link{
bsw@34:           external = "",
bsw@34:           attr = {
bsw@34:             onclick = "undo(); return(false);"
bsw@34:           },
bsw@34:           content = function()
bsw@34:             ui.image{ static = "icons/16/cancel.png" }
bsw@34:             slot.put(" ")
bsw@34:             slot.put(_"Back")
bsw@34:           end
bsw@34:         }
bsw@34:       end
bsw@31:     }
bsw@34: 
bsw@34:     ui.form{
bsw@31:       attr = {
bsw@34:         style = "float: right;",
bsw@34:         onsubmit = "openElDirect(); return(false);"
bsw@34:       },
bsw@34:       content = function()
bsw@34:         slot.put("#")
bsw@34:         ui.tag{
bsw@34:           tag = "input",
bsw@34:           attr = {
bsw@34:             id = "input_issue",
bsw@34:             type = "text",
bsw@34:             style = "width: 4em;"
bsw@34:           }
bsw@34:         }
bsw@34:         slot.put(".")
bsw@34:         ui.tag{
bsw@34:           tag = "input",
bsw@34:           attr = {
bsw@34:             id = "input_initiative",
bsw@34:             type = "text",
bsw@34:             style = "width: 4em;"
bsw@34:           }
bsw@34:         }
bsw@34:         slot.put(" ")
bsw@34:         ui.tag{
bsw@34:           tag = "input",
bsw@34:           attr = {
bsw@34:             type = "submit",
bsw@34:             value = "OK",
bsw@34:           }
bsw@34:         }
bsw@34:       end
bsw@34:     }
bsw@34: 
bsw@34: 
bsw@34:     ui.link{
bsw@34:       external = "",
bsw@34:       attr = {
bsw@34:         onclick = "openPrevIssue(); return(false);"
bsw@34:       },
bsw@34:       content = function()
bsw@34:         ui.image{ static = "icons/16/resultset_previous_double.png" }
bsw@34:         slot.put(" ")
bsw@34:         slot.put(_"Previous issue")
bsw@34:       end
bsw@31:     }
bsw@34: 
bsw@34:     ui.link{
bsw@34:       external = "",
bsw@34:       attr = {
bsw@34:         onclick = "openPrevInitiative(); return(false);"
bsw@34:       },
bsw@34:       content = function()
bsw@34:         ui.image{ static = "icons/16/resultset_previous.png" }
bsw@34:         slot.put(" ")
bsw@34:         slot.put(_"Previous initiative")
bsw@34:       end
bsw@34:     }
bsw@34: 
bsw@34:     ui.link{
bsw@34:       external = "",
bsw@31:       attr = {
bsw@34:         onclick = "openParent(); return(false);"
bsw@34:       },
bsw@34:       content = function()
bsw@34:         ui.image{ static = "icons/16/go_up.png" }
bsw@34:         slot.put(" ")
bsw@34:         slot.put(_"Go up")
bsw@34:       end
bsw@34:     }
bsw@34: 
bsw@34:     ui.link{
bsw@34:       external = "",
bsw@34:       attr = {
bsw@34:         onclick = "openNextInitiative(); return(false);"
bsw@34:       },
bsw@34:       content = function()
bsw@34:         ui.image{ static = "icons/16/resultset_next.png" }
bsw@34:         slot.put(" ")
bsw@34:         slot.put(_"Next initiative")
bsw@34:       end
bsw@34:     }
bsw@34: 
bsw@34:     ui.link{
bsw@34:       external = "",
bsw@34:       attr = {
bsw@34:         onclick = "openNextIssue(); return(false);"
bsw@34:       },
bsw@34:       content = function()
bsw@34:         ui.image{ static = "icons/16/resultset_next_double.png" }
bsw@34:         slot.put(" ")
bsw@34:         slot.put(_"Next issue")
bsw@34:       end
bsw@31:     }
bsw@31:   end
bsw@31: }
bsw@31: 
bsw@34: slot.put("
")
bsw@31: 
bsw@34: local areas = Area:new_selector():add_order_by("name"):exec()
bsw@31: 
bsw@31: 
bsw@31: ui.container{
bsw@31:   attr = { id = "areas" },
bsw@31:   content = function()
bsw@31:     for i, area in ipairs(areas) do
bsw@31:       link_area(area)
bsw@31:     end
bsw@34:     slot.put("
")
bsw@34:     slot.put(_"This report can be saved (use 'save complete website') and used offline.")  end
bsw@31: }
bsw@31: 
bsw@31: ui.script{ script = "openEl('areas')" }
bsw@31: 
bsw@31: for i, area in ipairs(areas) do
bsw@31:   execute.view{
bsw@31:     module = "report",
bsw@31:     view = "area",
bsw@31:     params = { area = area }
bsw@31:   }
bsw@34: end
bsw@34: