From: Jo-Philipp Wich Date: Wed, 29 Oct 2008 19:54:59 +0000 (+0000) Subject: * luci-0.8: merge further changes X-Git-Tag: 0.8.2~67 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d951b66b452a634e6267e4a620410635f5a511ae;p=oweals%2Fluci.git * luci-0.8: merge further changes --- diff --git a/libs/httpd/luasrc/httpd/handler/luci.lua b/libs/httpd/luasrc/httpd/handler/luci.lua index c3720ff87..6e9c6778d 100644 --- a/libs/httpd/luasrc/httpd/handler/luci.lua +++ b/libs/httpd/luasrc/httpd/handler/luci.lua @@ -27,7 +27,7 @@ function Luci.__init__(self, limit) luci.httpd.module.Handler.__init__(self) self.limit = limit or 5 self.running = {} - setmetatable(self.running, {__mode = "v"}) + setmetatable(self.running, {__mode = "k"}) end function Luci.handle_head(self, ...) @@ -40,19 +40,31 @@ function Luci.handle_post(self, ...) end function Luci.handle_get(self, request, sourcein, sinkerr) - if self.limit and #self.running >= self.limit then + local reaped = false + local running = 0 + + for _, v in pairs(self.running) do + if v then running = running + 1 end + end + + if self.limit and running >= self.limit then for k, v in ipairs(self.running) do - if coroutine.status(v) == "dead" then - collectgarbage() - break + if coroutine.status(k) == "dead" then + self.running[k] = nil + running = running - 1 + reaped = true end end - if #self.running >= self.limit then - return self:failure(503, "Overload") + + if reaped then collectgarbage() end + + if running >= self.limit then + return self:failure(503, "Overload %i/%i" % { running, self.limit } ) end end - table.insert(self.running, coroutine.running()) - + + self.running[coroutine.running()] = true + local r = luci.http.Request( request.env, sourcein, diff --git a/libs/sys/luasrc/sys.lua b/libs/sys/luasrc/sys.lua index b4d3d2f1b..e8b5e2c3a 100644 --- a/libs/sys/luasrc/sys.lua +++ b/libs/sys/luasrc/sys.lua @@ -591,7 +591,8 @@ function init.names() end --- Test whether the given init script is enabled --- @return Boolean indicating whether init is enabled +-- @param name Name of the init script +-- @return Boolean indicating whether init is enabled function init.enabled(name) if luci.fs.access(init.dir..name) then return ( call(init.dir..name.." enabled") == 0 ) @@ -600,7 +601,8 @@ function init.enabled(name) end --- Get the index of he given init script --- @return Numeric index value +-- @param name Name of the init script +-- @return Numeric index value function init.index(name) if luci.fs.access(init.dir..name) then return call("source "..init.dir..name.."; exit $START") @@ -608,7 +610,8 @@ function init.index(name) end --- Enable the given init script --- @return Boolean indicating success +-- @param name Name of the init script +-- @return Boolean indicating success function init.enable(name) if luci.fs.access(init.dir..name) then return ( call(init.dir..name.." enable") == 1 ) @@ -616,7 +619,8 @@ function init.enable(name) end --- Disable the given init script --- @return Boolean indicating success +-- @param name Name of the init script +-- @return Boolean indicating success function init.disable(name) if luci.fs.access(init.dir..name) then return ( call(init.dir..name.." disable") == 0 ) diff --git a/modules/admin-core/luasrc/view/footer.htm b/modules/admin-core/luasrc/view/footer.htm index 8428e8906..6c6d21421 100644 --- a/modules/admin-core/luasrc/view/footer.htm +++ b/modules/admin-core/luasrc/view/footer.htm @@ -12,4 +12,4 @@ You may obtain a copy of the License at $Id$ -%> -<% include("themes/" .. luci.fs.basename(media) .. "/footer") %> \ No newline at end of file +<% include("themes/" .. theme .. "/footer") %> \ No newline at end of file diff --git a/modules/admin-mini/luasrc/controller/mini/uci.lua b/modules/admin-mini/luasrc/controller/mini/uci.lua index 4e920563a..4687c839d 100644 --- a/modules/admin-mini/luasrc/controller/mini/uci.lua +++ b/modules/admin-mini/luasrc/controller/mini/uci.lua @@ -16,11 +16,13 @@ module("luci.controller.mini.uci", package.seeall) function index() local i18n = luci.i18n.translate + local redir = luci.http.formvalue("redir", true) or + luci.dispatcher.build_url(unpack(luci.dispatcher.context.request)) entry({"mini", "uci"}, nil, i18n("config")) - entry({"mini", "uci", "changes"}, call("action_changes"), i18n("changes"), 30) - entry({"mini", "uci", "revert"}, call("action_revert"), i18n("revert"), 20) - entry({"mini", "uci", "saveapply"}, call("action_apply"), i18n("saveapply"), 10) + entry({"mini", "uci", "changes"}, call("action_changes"), i18n("changes"), 30).query = {redir=redir} + entry({"mini", "uci", "revert"}, call("action_revert"), i18n("revert"), 20).query = {redir=redir} + entry({"mini", "uci", "saveapply"}, call("action_apply"), i18n("saveapply"), 10).query = {redir=redir} end function convert_changes(changes) diff --git a/modules/admin-mini/luasrc/model/cbi/mini/luci.lua b/modules/admin-mini/luasrc/model/cbi/mini/luci.lua index 1b0f3b102..f9365c906 100644 --- a/modules/admin-mini/luasrc/model/cbi/mini/luci.lua +++ b/modules/admin-mini/luasrc/model/cbi/mini/luci.lua @@ -15,13 +15,20 @@ $Id$ require("luci.config") m = Map("luci", translate("webui"), translate("a_i_luci1")) +-- force reload of global luci config namespace to reflect the changes +function m.commit_handler(self) + package.loaded["luci.config"] = nil + require("luci.config") +end + + c = m:section(NamedSection, "main", "core", translate("general")) l = c:option(ListValue, "lang", translate("language")) local i18ndir = luci.i18n.i18ndir .. "default." for k, v in pairs(luci.config.languages) do - if k:sub(1, 1) ~= "." and luci.fs.isfile(i18ndir .. k .. ".lua") then + if k:sub(1, 1) ~= "." and luci.fs.isfile(i18ndir .. k:gsub("_", "-") .. ".lua") then l:value(k, v) end end @@ -33,4 +40,4 @@ for k, v in pairs(luci.config.themes) do end end -return m \ No newline at end of file +return m diff --git a/modules/admin-mini/luasrc/view/mini/uci_apply.htm b/modules/admin-mini/luasrc/view/mini/uci_apply.htm index 8aa09c641..a908b6a8b 100644 --- a/modules/admin-mini/luasrc/view/mini/uci_apply.htm +++ b/modules/admin-mini/luasrc/view/mini/uci_apply.htm @@ -13,6 +13,11 @@ $Id$ -%> <%+header%> +
+"><< <%:back%> +
+
+

<%:config%>

<%:uci_applied%>:

<%=(changes or "-")%> @@ -26,4 +31,9 @@ while line do end fp:close() %> +
+"><< <%:back%> +
+
+
<%+footer%> \ No newline at end of file diff --git a/modules/admin-mini/luasrc/view/mini/uci_changes.htm b/modules/admin-mini/luasrc/view/mini/uci_changes.htm index 591ae6998..89df99dab 100644 --- a/modules/admin-mini/luasrc/view/mini/uci_changes.htm +++ b/modules/admin-mini/luasrc/view/mini/uci_changes.htm @@ -13,14 +13,27 @@ $Id$ -%> <%+header%> +
+"><< <%:back%> +
+
+

<%:config%>

<%:changes%>

<%=changes%>

-
+
-
+ + +
+
-<%+footer%> + +
+
+"><< <%:back%> +
+<%+footer%> \ No newline at end of file diff --git a/modules/admin-mini/luasrc/view/mini/uci_revert.htm b/modules/admin-mini/luasrc/view/mini/uci_revert.htm index 553ec7454..e8515dc41 100644 --- a/modules/admin-mini/luasrc/view/mini/uci_revert.htm +++ b/modules/admin-mini/luasrc/view/mini/uci_revert.htm @@ -13,7 +13,17 @@ $Id$ -%> <%+header%> +
+"><< <%:back%> +
+
+

<%:config%>

<%:uci_reverted%>:

<%=(changes or "-")%> +
+"><< <%:back%> +
+
+
<%+footer%> \ No newline at end of file diff --git a/themes/fledermaus/htdocs/luci-static/fledermaus/cascade.css b/themes/fledermaus/htdocs/luci-static/fledermaus/cascade.css index 70132fd5a..590e06298 100644 --- a/themes/fledermaus/htdocs/luci-static/fledermaus/cascade.css +++ b/themes/fledermaus/htdocs/luci-static/fledermaus/cascade.css @@ -16,7 +16,7 @@ code { white-space: pre; } -div#content ul { +div#maincontent ul { margin-left: 2em; } @@ -164,7 +164,7 @@ div#content ul { float: right; } -#content { +#maincontent { clear: both; width: 90%; margin: 0 auto; @@ -174,20 +174,20 @@ div#content ul { font-size: 80%; } -#content h1 { +#maincontent h2 { margin: 0.25em 0 0.5em 0; font-size: 150%; font-weight: normal; } -#content h2 { +#maincontent h3 { margin: 0.5em 0; font-size: 120%; font-weight: normal; text-decoration: underline; } -#content p { +#maincontent p { margin-bottom: 1em; } @@ -277,7 +277,7 @@ input.cbi-input-user { padding-left: 17px; } -input.cbi-input-key { +input.cbi-input-password { background: url('../resources/cbi/key.gif') no-repeat scroll 1px center; background-color: inherit; padding-left: 17px; @@ -433,6 +433,7 @@ div.cbi-value:hover div.cbi-value-field > div.cbi-value-description { div.cbi-section-create { clear: left; + white-space: nowrap; } div.cbi-map-descr { @@ -578,7 +579,7 @@ ul.cbi-apply { width: 200% !important; } -* html div#content { +* html div#maincontent { margin-left: -80% !important; width: 160% !important; } diff --git a/themes/fledermaus/luasrc/view/themes/fledermaus/header.htm b/themes/fledermaus/luasrc/view/themes/fledermaus/header.htm index d93d9aee3..f31478b6e 100644 --- a/themes/fledermaus/luasrc/view/themes/fledermaus/header.htm +++ b/themes/fledermaus/luasrc/view/themes/fledermaus/header.htm @@ -177,4 +177,4 @@ end
-
+