liquid_feedback_frontend
view app/main/index/document.lua @ 1366:378c20a2e6f0
Update privilege of requested member
| author | bsw | 
|---|---|
| date | Mon Aug 06 14:18:15 2018 +0200 (2018-08-06) | 
| parents | 32cc544d5a5b | 
| children | dcbe505ddf24 | 
 line source
     1 if not config.document_dir then
     2   return execute.view { module = "index", view = "404" }
     3 end
     5 slot.put_into("title", _"Download documents")
     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 local file_list = extos.listdir(config.document_dir)
    20 local tmp = {}
    21 for i, filename in ipairs(file_list) do
    22   if not filename:find("^%.") then
    23     tmp[#tmp+1] = filename
    24   end
    25 end
    27 local file_list = tmp
    29 table.sort(file_list, function(a, b) return a > b end)
    31 ui.list{
    32   records = file_list,
    33   columns = {
    34     {
    35       content = function(filename)
    36         slot.put(encode.html(filename))
    37       end
    38     },
    39     {
    40       content = function(filename)
    41         ui.link{
    42           content = _"Download",
    43           module = "index",
    44           view = "document_file",
    45           params = { filename = filename }
    46         }
    47         slot.put(" ")
    48         ui.link{
    49           content = _"Show",
    50           module = "index",
    51           view = "document_file",
    52           params = { filename = filename, inline = true }
    53         }
    54       end
    55     }
    56   }
    57 }
