liquid_feedback_frontend

changeset 402:a42bc1f0ed45

Support to show documents inline instead of downloading
author bsw
date Wed Mar 07 19:30:52 2012 +0100 (2012-03-07)
parents 08ba83dd47c0
children 203eac3d267d
files app/main/index/document.lua app/main/index/document_file.lua
line diff
     1.1 --- a/app/main/index/document.lua	Wed Mar 07 19:07:20 2012 +0100
     1.2 +++ b/app/main/index/document.lua	Wed Mar 07 19:30:52 2012 +0100
     1.3 @@ -46,6 +46,13 @@
     1.4            view = "document_file",
     1.5            params = { filename = filename }
     1.6          }
     1.7 +        slot.put(" ")
     1.8 +        ui.link{
     1.9 +          content = _"Show",
    1.10 +          module = "index",
    1.11 +          view = "document_file",
    1.12 +          params = { filename = filename, inline = true }
    1.13 +        }
    1.14        end
    1.15      }
    1.16    }
     2.1 --- a/app/main/index/document_file.lua	Wed Mar 07 19:07:20 2012 +0100
     2.2 +++ b/app/main/index/document_file.lua	Wed Mar 07 19:30:52 2012 +0100
     2.3 @@ -6,8 +6,11 @@
     2.4  
     2.5  local file = assert(io.open(encode.file_path(config.document_dir, filename)), "file not found")
     2.6  
     2.7 -print('Content-type: application/octet-stream')
     2.8 -print('Content-disposition: attachment; filename=' .. filename)
     2.9 +if param.get("inline") then
    2.10 +  print('Content-disposition: inline; filename=' .. filename)
    2.11 +else
    2.12 +  print('Content-disposition: attachment; filename=' .. filename)
    2.13 +end
    2.14  print('')
    2.15  
    2.16  io.stdout:write(file:read("*a"))

Impressum / About Us