Changeset 5965
- Timestamp:
- 03/28/10 00:20:14 (3 years ago)
- Location:
- luci/branches/luci-0.9/applications/luci-statistics/luasrc
- Files:
-
- 2 modified
-
controller/luci_statistics/luci_statistics.lua (modified) (1 diff)
-
view/public_statistics/graph.htm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
luci/branches/luci-0.9/applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua
r5703 r5965 162 162 local graph = luci.statistics.rrdtool.Graph( luci.util.parse_units( span ) ) 163 163 164 -- deliver image 165 if vars.img then 166 local l12 = require "luci.ltn12" 167 local png = io.open(graph.opts.imgpath .. "/" .. vars.img:gsub("%.+", "."), "r") 168 if png then 169 luci.http.prepare_content("image/png") 170 l12.pump.all(l12.source.file(png), luci.http.write) 171 png:close() 172 end 173 return 174 end 175 164 176 local plugin, instances 165 177 local images = { } 166 178 167 179 -- find requested plugin and instance 168 for i, p in ipairs( luci.dispatcher.context.path ) do 169 if luci.dispatcher.context.path[i] == "graph" then 170 plugin = luci.dispatcher.context.path[i+1] 171 instances = { luci.dispatcher.context.path[i+2] } 172 end 180 for i, p in ipairs( luci.dispatcher.context.path ) do 181 if luci.dispatcher.context.path[i] == "graph" then 182 plugin = luci.dispatcher.context.path[i+1] 183 instances = { luci.dispatcher.context.path[i+2] } 173 184 end 185 end 174 186 175 187 -- no instance requested, find all instances -
luci/branches/luci-0.9/applications/luci-statistics/luasrc/view/public_statistics/graph.htm
r3529 r5965 32 32 <div style="text-align: center"> 33 33 <% for i, img in ipairs(images) do %> 34 <img src=" /rrdimg/<%=img%>" />34 <img src="<%=REQUEST_URI%>?img=<%=img%>" /> 35 35 <br /> 36 36 <% end %>
