diff options
Diffstat (limited to 'applications/luci-app-freifunk-widgets/luasrc/model/cbi')
7 files changed, 0 insertions, 205 deletions
diff --git a/applications/luci-app-freifunk-widgets/luasrc/model/cbi/freifunk/widgets/heightwidth.lua b/applications/luci-app-freifunk-widgets/luasrc/model/cbi/freifunk/widgets/heightwidth.lua deleted file mode 100644 index fc23f4bdb..000000000 --- a/applications/luci-app-freifunk-widgets/luasrc/model/cbi/freifunk/widgets/heightwidth.lua +++ /dev/null @@ -1,16 +0,0 @@ --- Copyright 2012 Manuel Munz <freifunk at somakoma dot de> --- Licensed to the public under the Apache License 2.0. - -local map, section = ... - -local width = wdg:option(Value, "width", translate("Width")) -width.rmempty = true - ---[[ -local height = wdg:option(Value, "height", translate("Height")) -height.rmempty = true -height.optional = true -]]-- - -local pr = wdg:option(Value, "paddingright", translate("Padding right")) -pr.rmempty = true diff --git a/applications/luci-app-freifunk-widgets/luasrc/model/cbi/freifunk/widgets/html.lua b/applications/luci-app-freifunk-widgets/luasrc/model/cbi/freifunk/widgets/html.lua deleted file mode 100644 index adeffa965..000000000 --- a/applications/luci-app-freifunk-widgets/luasrc/model/cbi/freifunk/widgets/html.lua +++ /dev/null @@ -1,31 +0,0 @@ --- Copyright 2012 Manuel Munz <freifunk at somakoma dot de> --- Licensed to the public under the Apache License 2.0. - -local map, section = ... -local utl = require "luci.util" -local fs = require "nixio.fs" -local file = "/usr/share/customtext/" .. arg[1] .. ".html" - -local form, ferr = loadfile(utl.libpath() .. "/model/cbi/freifunk/widgets/heightwidth.lua") -if form then - setfenv(form, getfenv(1))(m, wdg) -end - -t = wdg:option(TextValue, "_text") -t.rmempty = true -t.rows = 20 - - -function t.cfgvalue() - return fs.readfile(file) or "" -end - -function t.write(self, section, value) - return fs.writefile(file, value) -end - -function t.remove(self, section) - return fs.unlink(file) -end - - diff --git a/applications/luci-app-freifunk-widgets/luasrc/model/cbi/freifunk/widgets/iframe.lua b/applications/luci-app-freifunk-widgets/luasrc/model/cbi/freifunk/widgets/iframe.lua deleted file mode 100644 index 68ab06d88..000000000 --- a/applications/luci-app-freifunk-widgets/luasrc/model/cbi/freifunk/widgets/iframe.lua +++ /dev/null @@ -1,13 +0,0 @@ --- Copyright 2012 Manuel Munz <freifunk at somakoma dot de> --- Licensed to the public under the Apache License 2.0. - -local map, section = ... -local utl = require "luci.util" - -local form, ferr = loadfile(utl.libpath() .. "/model/cbi/freifunk/widgets/heightwidth.lua") -if form then - setfenv(form, getfenv(1))(m, wdg) -end - -local url = wdg:option(Value, "url", translate("URL")) -url.default = "http://www.freifunk.net" diff --git a/applications/luci-app-freifunk-widgets/luasrc/model/cbi/freifunk/widgets/rssfeed.lua b/applications/luci-app-freifunk-widgets/luasrc/model/cbi/freifunk/widgets/rssfeed.lua deleted file mode 100644 index 68fa3be7b..000000000 --- a/applications/luci-app-freifunk-widgets/luasrc/model/cbi/freifunk/widgets/rssfeed.lua +++ /dev/null @@ -1,25 +0,0 @@ --- Copyright 2012 Manuel Munz <freifunk at somakoma dot de> --- Licensed to the public under the Apache License 2.0. - -local map, section = ... -local utl = require "luci.util" - -local form, ferr = loadfile(utl.libpath() .. "/model/cbi/freifunk/widgets/heightwidth.lua") -if form then - setfenv(form, getfenv(1))(m, wdg) -end - -local url = wdg:option(Value, "url", translate("URL")) -url.default = "http://global.freifunk.net/rss/all/rss.xml" - -local max = wdg:option(Value, "max", translate("Maximal entries to show")) -max.rmempty = true -max.default = "10" -max.datatype = "integer" - -local cache = wdg:option(Value, "cache", translate("Cache Time"), translate("Cache downloaded feed for that many seconds.")) -cache.rmempty = true -cache.default = "3600" -cache.datatype = "integer" - - diff --git a/applications/luci-app-freifunk-widgets/luasrc/model/cbi/freifunk/widgets/search.lua b/applications/luci-app-freifunk-widgets/luasrc/model/cbi/freifunk/widgets/search.lua deleted file mode 100644 index a02748924..000000000 --- a/applications/luci-app-freifunk-widgets/luasrc/model/cbi/freifunk/widgets/search.lua +++ /dev/null @@ -1,15 +0,0 @@ --- Copyright 2012 Manuel Munz <freifunk at somakoma dot de> --- Licensed to the public under the Apache License 2.0. - -local map, section = ... -local utl = require "luci.util" - -local form, ferr = loadfile(utl.libpath() .. "/model/cbi/freifunk/widgets/heightwidth.lua") -if form then - setfenv(form, getfenv(1))(m, wdg) -end - -local engine = wdg:option(DynamicList, "engine", translate("Search Engine"), - translate("Use the form Name|URL, where URL must be a full URL to the search engine " .. - "including the query GET parameter, e.g. 'Google|http://www.google.de/search?q='") - ) diff --git a/applications/luci-app-freifunk-widgets/luasrc/model/cbi/freifunk/widgets/widget.lua b/applications/luci-app-freifunk-widgets/luasrc/model/cbi/freifunk/widgets/widget.lua deleted file mode 100644 index 7b6cd8996..000000000 --- a/applications/luci-app-freifunk-widgets/luasrc/model/cbi/freifunk/widgets/widget.lua +++ /dev/null @@ -1,37 +0,0 @@ --- Copyright 2012 Manuel Munz <freifunk at somakoma dot de> --- Licensed to the public under the Apache License 2.0. - -local uci = require "luci.model.uci".cursor() -local dsp = require "luci.dispatcher" -local utl = require "luci.util" -local widget = uci:get("freifunk-widgets", arg[1], "template") -local title = uci:get("freifunk-widgets", arg[1], "title") or "" - -m = Map("freifunk-widgets", translate("Widget")) -m.redirect = luci.dispatcher.build_url("admin/freifunk/widgets") - -if not arg[1] or m.uci:get("freifunk-widgets", arg[1]) ~= "widget" then - luci.http.redirect(m.redirect) - return -end - -wdg = m:section(NamedSection, arg[1], "widget", translate("Widget") .. " " .. title) -wdg.anonymous = true -wdg.addremove = false - -local en = wdg:option(Flag, "enabled", translate("Enable")) -en.rmempty = false - -local title = wdg:option(Value, "title", translate("Title")) -title.rmempty = true - -local form = loadfile( - utl.libpath() .. "/model/cbi/freifunk/widgets/%s.lua" % widget -) - -if form then - setfenv(form, getfenv(1))(m, wdg) -end - -return m - diff --git a/applications/luci-app-freifunk-widgets/luasrc/model/cbi/freifunk/widgets/widgets_overview.lua b/applications/luci-app-freifunk-widgets/luasrc/model/cbi/freifunk/widgets/widgets_overview.lua deleted file mode 100644 index 076d8e08c..000000000 --- a/applications/luci-app-freifunk-widgets/luasrc/model/cbi/freifunk/widgets/widgets_overview.lua +++ /dev/null @@ -1,68 +0,0 @@ --- Copyright 2012 Manuel Munz <freifunk at somakoma dot de> --- Licensed to the public under the Apache License 2.0. - -local uci = require "luci.model.uci".cursor() -local fs = require "nixio.fs" -local utl = require "luci.util" -m = Map("freifunk-widgets", translate("Widgets"), - translate("Configure installed widgets.")) - -wdg = m:section(TypedSection, "widget", translate("Widgets")) -wdg.addremove = true -wdg.extedit = luci.dispatcher.build_url("admin/freifunk/widgets/widget/%s") -wdg.template = "cbi/tblsection" -wdg.sortable = true - ---[[ -function wdg.create(...) - local sid = TypedSection.create(...) - luci.http.redirect(wdg.extedit % sid) -end -]]-- - -local en = wdg:option(Flag, "enabled", translate("Enable")) -en.rmempty = false ---en.default = "0" -function en.cfgvalue(self, section) - return Flag.cfgvalue(self, section) or "0" -end - -local tmpl = wdg:option(ListValue, "template", translate("Template")) -local file -for file in fs.dir("/usr/lib/lua/luci/view/freifunk/widgets/") do - if file ~= "." and file ~= ".." then - tmpl:value(file) - end -end - -local title = wdg:option(Value, "title", translate("Title")) -title.rmempty = true - -local width = wdg:option(Value, "width", translate("Width")) -width.rmempty = true - -local height = wdg:option(Value, "height", translate("Height")) -height.rmempty = true - -local pr = wdg:option(Value, "paddingright", translate("Padding right")) -pr.rmempty = true - -function m.on_commit(self) - -- clean custom text files whose config has been deleted - local dir = "/usr/share/customtext/" - local active = {} - uci:foreach("freifunk-widgets", "widget", function(s) - if s["template"] == "html" then - table.insert(active, s[".name"]) - end - end ) - local file - for file in fs.dir(dir) do - local filename = string.gsub(file, ".html", "") - if not utl.contains(active, filename) then - fs.unlink(dir .. file) - end - end -end - -return m |