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