liquid_feedback_frontend

annotate app/main/index/document.lua @ 728:f49cdfb72567

Migration of extos calls from os.* to extos.* comleted
author bsw
date Thu Jun 28 16:31:02 2012 +0200 (2012-06-28)
parents a42bc1f0ed45
children 701a5cf6b067
rev   line source
bsw@401 1 if not config.document_dir then
bsw@401 2 error("feature not enabled")
bsw@401 3 end
bsw@401 4
bsw@401 5 slot.put_into("title", _"Download documents")
bsw@401 6
bsw@401 7 slot.select("actions", function()
bsw@401 8 ui.link{
bsw@401 9 content = function()
bsw@401 10 ui.image{ static = "icons/16/cancel.png" }
bsw@401 11 slot.put(_"Cancel")
bsw@401 12 end,
bsw@401 13 module = "index",
bsw@401 14 view = "index"
bsw@401 15 }
bsw@401 16 end)
bsw@401 17
bsw@401 18 util.help("index.document", _"Download documents")
bsw@401 19
bsw@728 20 local file_list = extos.listdir(config.document_dir)
bsw@401 21
bsw@401 22 local tmp = {}
bsw@401 23 for i, filename in ipairs(file_list) do
bsw@401 24 if not filename:find("^%.") then
bsw@401 25 tmp[#tmp+1] = filename
bsw@401 26 end
bsw@401 27 end
bsw@401 28
bsw@401 29 local file_list = tmp
bsw@401 30
bsw@401 31 table.sort(file_list, function(a, b) return a > b end)
bsw@401 32
bsw@401 33 ui.list{
bsw@401 34 records = file_list,
bsw@401 35 columns = {
bsw@401 36 {
bsw@401 37 content = function(filename)
bsw@401 38 slot.put(encode.html(filename))
bsw@401 39 end
bsw@401 40 },
bsw@401 41 {
bsw@401 42 content = function(filename)
bsw@401 43 ui.link{
bsw@401 44 content = _"Download",
bsw@401 45 module = "index",
bsw@401 46 view = "document_file",
bsw@401 47 params = { filename = filename }
bsw@401 48 }
bsw@402 49 slot.put(" ")
bsw@402 50 ui.link{
bsw@402 51 content = _"Show",
bsw@402 52 module = "index",
bsw@402 53 view = "document_file",
bsw@402 54 params = { filename = filename, inline = true }
bsw@402 55 }
bsw@401 56 end
bsw@401 57 }
bsw@401 58 }
bsw@401 59 }

Impressum / About Us