annotate app/main/index/document.lua @ 1414:cd497eb8fd73
Added forced sleep at end of notification loops
author |
bsw |
date |
Sun Aug 26 13:40:28 2018 +0200 (2018-08-26) |
parents |
32cc544d5a5b |
children |
dcbe505ddf24 |
rev |
line source |
bsw@401
|
1 if not config.document_dir then
|
bsw/jbe@1309
|
2 return execute.view { module = "index", view = "404" }
|
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@728
|
18 local file_list = extos.listdir(config.document_dir)
|
bsw@401
|
19
|
bsw@401
|
20 local tmp = {}
|
bsw@401
|
21 for i, filename in ipairs(file_list) do
|
bsw@401
|
22 if not filename:find("^%.") then
|
bsw@401
|
23 tmp[#tmp+1] = filename
|
bsw@401
|
24 end
|
bsw@401
|
25 end
|
bsw@401
|
26
|
bsw@401
|
27 local file_list = tmp
|
bsw@401
|
28
|
bsw@401
|
29 table.sort(file_list, function(a, b) return a > b end)
|
bsw@401
|
30
|
bsw@401
|
31 ui.list{
|
bsw@401
|
32 records = file_list,
|
bsw@401
|
33 columns = {
|
bsw@401
|
34 {
|
bsw@401
|
35 content = function(filename)
|
bsw@401
|
36 slot.put(encode.html(filename))
|
bsw@401
|
37 end
|
bsw@401
|
38 },
|
bsw@401
|
39 {
|
bsw@401
|
40 content = function(filename)
|
bsw@401
|
41 ui.link{
|
bsw@401
|
42 content = _"Download",
|
bsw@401
|
43 module = "index",
|
bsw@401
|
44 view = "document_file",
|
bsw@401
|
45 params = { filename = filename }
|
bsw@401
|
46 }
|
bsw@402
|
47 slot.put(" ")
|
bsw@402
|
48 ui.link{
|
bsw@402
|
49 content = _"Show",
|
bsw@402
|
50 module = "index",
|
bsw@402
|
51 view = "document_file",
|
bsw@402
|
52 params = { filename = filename, inline = true }
|
bsw@402
|
53 }
|
bsw@401
|
54 end
|
bsw@401
|
55 }
|
bsw@401
|
56 }
|
bsw/jbe@1309
|
57 }
|