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 )
)
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 )
)
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
)
local upldir = "/lib/uci/upload/"
local cbidir = luci.util.libpath() .. "/model/cbi/"
-
- 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")
+ local func, err
+
+ 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")
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
self.defaultpath = {}
self.pageaction = false
self.readinput = true
+ self.allow_reset = false
self.allow_back = false
self.allow_finish = false
self.template = "cbi/delegator"
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
<% 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 %>
tostring(translate("mem_buffered", "")),
100 * memfree / memtotal,
tostring(translate("mem_free", ""))
+)
s:option(DummyValue, "_systime", translate("m_i_systemtime")).value =
os.date("%c")
tostring(translate("mem_buffered", "")),
100 * memfree / memtotal,
tostring(translate("mem_free", ""))
+)
s:option(DummyValue, "_systime", translate("m_i_systemtime")).value =
os.date("%c")