luci-0.9: merge r5176-r5182
This commit is contained in:
parent
79fb9f138a
commit
92ca7f33c2
5 changed files with 38 additions and 22 deletions
|
@ -43,13 +43,13 @@ end
|
|||
|
||||
function Instance.title( self, plugin, pinst, dtype, dinst )
|
||||
|
||||
local title = self.i18n.translate(
|
||||
local title = self.i18n.string(
|
||||
string.format( "stat_dg_title_%s_%s_%s", plugin, pinst, dtype ),
|
||||
self.i18n.translate(
|
||||
self.i18n.string(
|
||||
string.format( "stat_dg_title_%s_%s", plugin, pinst ),
|
||||
self.i18n.translate(
|
||||
self.i18n.string(
|
||||
string.format( "stat_dg_title_%s__%s", plugin, dtype ),
|
||||
self.i18n.translate(
|
||||
self.i18n.string(
|
||||
string.format( "stat_dg_title_%s", plugin ),
|
||||
self.graph:_mkpath( plugin, pinst, dtype )
|
||||
)
|
||||
|
@ -68,13 +68,13 @@ end
|
|||
|
||||
function Instance.label( self, plugin, pinst, dtype, dinst )
|
||||
|
||||
local label = self.i18n.translate(
|
||||
local label = self.i18n.string(
|
||||
string.format( "stat_dg_label_%s_%s_%s", plugin, pinst, dtype ),
|
||||
self.i18n.translate(
|
||||
self.i18n.string(
|
||||
string.format( "stat_dg_label_%s_%s", plugin, pinst ),
|
||||
self.i18n.translate(
|
||||
self.i18n.string(
|
||||
string.format( "stat_dg_label_%s__%s", plugin, dtype ),
|
||||
self.i18n.translate(
|
||||
self.i18n.string(
|
||||
string.format( "stat_dg_label_%s", plugin ),
|
||||
self.graph:_mkpath( plugin, pinst, dtype )
|
||||
)
|
||||
|
@ -93,13 +93,13 @@ end
|
|||
|
||||
function Instance.ds( self, source )
|
||||
|
||||
local label = self.i18n.translate(
|
||||
local label = self.i18n.string(
|
||||
string.format( "stat_ds_%s_%s_%s", source.type, source.instance, source.ds ),
|
||||
self.i18n.translate(
|
||||
self.i18n.string(
|
||||
string.format( "stat_ds_%s_%s", source.type, source.instance ),
|
||||
self.i18n.translate(
|
||||
self.i18n.string(
|
||||
string.format( "stat_ds_label_%s__%s", source.type, source.ds ),
|
||||
self.i18n.translate(
|
||||
self.i18n.string(
|
||||
string.format( "stat_ds_%s", source.type ),
|
||||
source.type .. "_" .. source.instance:gsub("[^%w]","_") .. "_" .. source.ds
|
||||
)
|
||||
|
|
|
@ -60,17 +60,18 @@ function load(cbimap, ...)
|
|||
|
||||
local upldir = "/lib/uci/upload/"
|
||||
local cbidir = luci.util.libpath() .. "/model/cbi/"
|
||||
local func, err
|
||||
|
||||
assert(fs.stat(cbimap) or
|
||||
fs.stat(cbidir..cbimap..".lua") or
|
||||
fs.stat(cbidir..cbimap..".lua.gz"),
|
||||
"Model not found!")
|
||||
|
||||
local func, err = loadfile(cbimap)
|
||||
if not func then
|
||||
func, err = loadfile(cbidir..cbimap..".lua") or
|
||||
loadfile(cbidir..cbimap..".lua.gz")
|
||||
if fs.access(cbimap) then
|
||||
func, err = loadfile(cbimap)
|
||||
elseif fs.access(cbidir..cbimap..".lua") then
|
||||
func, err = loadfile(cbidir..cbimap..".lua")
|
||||
elseif fs.access(cbidir..cbimap..".lua.gz") then
|
||||
func, err = loadfile(cbidir..cbimap..".lua.gz")
|
||||
else
|
||||
func, err = nil, "Model '" .. cbimap .. "' not found!"
|
||||
end
|
||||
|
||||
assert(func, err)
|
||||
|
||||
luci.i18n.loadc("cbi")
|
||||
|
@ -286,6 +287,11 @@ function Template.render(self)
|
|||
luci.template.render(self.template, {self=self})
|
||||
end
|
||||
|
||||
function Template.parse(self, readinput)
|
||||
self.readinput = (readinput ~= false)
|
||||
return Map.formvalue(self, "cbi.submit") and FORM_DONE or FORM_NODATA
|
||||
end
|
||||
|
||||
|
||||
--[[
|
||||
Map - A map describing a configuration file
|
||||
|
@ -499,6 +505,7 @@ function Delegator.__init__(self, ...)
|
|||
self.defaultpath = {}
|
||||
self.pageaction = false
|
||||
self.readinput = true
|
||||
self.allow_reset = false
|
||||
self.allow_back = false
|
||||
self.allow_finish = false
|
||||
self.template = "cbi/delegator"
|
||||
|
@ -572,9 +579,14 @@ function Delegator.parse(self, ...)
|
|||
else
|
||||
newcurrent = self:get_next(self.current)
|
||||
end
|
||||
elseif stat < FORM_PROCEED then
|
||||
return stat
|
||||
end
|
||||
|
||||
|
||||
if not newcurrent or not self:get(newcurrent) then
|
||||
if not Map.formvalue(self, "cbi.submit") then
|
||||
return FORM_NODATA
|
||||
elseif not newcurrent or not self:get(newcurrent) then
|
||||
return FORM_DONE
|
||||
else
|
||||
self.current = newcurrent
|
||||
|
|
|
@ -20,7 +20,9 @@ $Id$
|
|||
<% if self.allow_back and self:get_prev(self.current) then %>
|
||||
<input class="cbi-button cbi-button-back" type="submit" name="cbi.delg.back" value="<%:cbi_back < Back%>" />
|
||||
<% end %>
|
||||
<% if self.allow_reset then %>
|
||||
<input class="cbi-button cbi-button-reset" type="reset" value="<%:reset%>" />
|
||||
<% end %>
|
||||
<% if self.allow_finish and not self:get_next(self.current) then %>
|
||||
<input class="cbi-button cbi-button-finish" type="submit" value="<%:cbi_finish Finish%>" />
|
||||
<% elseif self:get_next(self.current) then %>
|
||||
|
|
|
@ -40,6 +40,7 @@ s:option(DummyValue, "_memtotal", translate("m_i_memory")).value =
|
|||
tostring(translate("mem_buffered", "")),
|
||||
100 * memfree / memtotal,
|
||||
tostring(translate("mem_free", ""))
|
||||
)
|
||||
|
||||
s:option(DummyValue, "_systime", translate("m_i_systemtime")).value =
|
||||
os.date("%c")
|
||||
|
|
|
@ -43,6 +43,7 @@ s:option(DummyValue, "_memtotal", translate("m_i_memory")).value =
|
|||
tostring(translate("mem_buffered", "")),
|
||||
100 * memfree / memtotal,
|
||||
tostring(translate("mem_free", ""))
|
||||
)
|
||||
|
||||
s:option(DummyValue, "_systime", translate("m_i_systemtime")).value =
|
||||
os.date("%c")
|
||||
|
|
Loading…
Reference in a new issue