liquid_feedback_frontend
view app/main/index/download.lua @ 1054:13d827829f51
Going to version 3.0.1
| author | bsw | 
|---|---|
| date | Tue Jul 15 21:41:52 2014 +0200 (2014-07-15) | 
| parents | 701a5cf6b067 | 
| children | 3f52e99b444d | 
 line source
     1 if not config.download_dir then
     2   error("feature not enabled")
     3 end
     5 slot.put_into("title", _"Download database export")
     7 slot.select("actions", function()
     8   ui.link{
     9     content = function()
    10         ui.image{ static = "icons/16/cancel.png" }
    11         slot.put(_"Cancel")
    12     end,
    13     module = "index",
    14     view = "index"
    15   }
    16 end)
    18 ui.container{
    19   attr = { class = "wiki use_terms" },
    20   content = function()
    21     slot.put(config.download_use_terms)
    22   end
    23 }
    26 local file_list = extos.listdir(config.download_dir)
    28 local tmp = {}
    29 for i, filename in ipairs(file_list) do
    30   if not filename:find("^%.") then
    31     tmp[#tmp+1] = filename
    32   end
    33 end
    35 local file_list = tmp
    37 table.sort(file_list, function(a, b) return a > b end)
    39 ui.list{
    40   records = file_list,
    41   columns = {
    42     {
    43       content = function(filename)
    44         slot.put(encode.html(filename))
    45       end
    46     },
    47     {
    48       content = function(filename)
    49         ui.link{
    50           content = _"Download",
    51           module = "index",
    52           view = "download_file",
    53           params = { filename = filename }
    54         }
    55       end
    56     }
    57   }
    58 }
