projects
/
project
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
03e1168
)
cbi: Increare responsiveness of "Save & Apply"
author
Steven Barth
<steven@midlink.org>
Sat, 6 Sep 2008 14:59:48 +0000
(14:59 +0000)
committer
Steven Barth
<steven@midlink.org>
Sat, 6 Sep 2008 14:59:48 +0000
(14:59 +0000)
i18n/english/luasrc/i18n/cbi.en.lua
patch
|
blob
|
history
i18n/english/luasrc/i18n/cbi.en.xml
patch
|
blob
|
history
i18n/german/luasrc/i18n/cbi.de.lua
patch
|
blob
|
history
i18n/german/luasrc/i18n/cbi.de.xml
patch
|
blob
|
history
libs/cbi/luasrc/cbi.lua
patch
|
blob
|
history
libs/cbi/luasrc/view/cbi/map.htm
patch
|
blob
|
history
diff --git
a/i18n/english/luasrc/i18n/cbi.en.lua
b/i18n/english/luasrc/i18n/cbi.en.lua
index
d302ee5
..
42f93d4
100644
(file)
--- a/
i18n/english/luasrc/i18n/cbi.en.lua
+++ b/
i18n/english/luasrc/i18n/cbi.en.lua
@@
-11,3
+11,4
@@
cbi_sectempty = 'This section contains no values yet'
cbi_manual = '-- custom --'
cbi_select = '-- Please choose --'
cbi_gorel = 'Go to relevant configuration page'
cbi_manual = '-- custom --'
cbi_select = '-- Please choose --'
cbi_gorel = 'Go to relevant configuration page'
+cbi_applying = 'Applying changes'
diff --git
a/i18n/english/luasrc/i18n/cbi.en.xml
b/i18n/english/luasrc/i18n/cbi.en.xml
index
89484e4
..
4766ad1
100644
(file)
--- a/
i18n/english/luasrc/i18n/cbi.en.xml
+++ b/
i18n/english/luasrc/i18n/cbi.en.xml
@@
-15,5
+15,6
@@
<i18n:msg xml:id="cbi_manual">-- custom --</i18n:msg>
<i18n:msg xml:id="cbi_select">-- Please choose --</i18n:msg>
<i18n:msg xml:id="cbi_gorel">Go to relevant configuration page</i18n:msg>
<i18n:msg xml:id="cbi_manual">-- custom --</i18n:msg>
<i18n:msg xml:id="cbi_select">-- Please choose --</i18n:msg>
<i18n:msg xml:id="cbi_gorel">Go to relevant configuration page</i18n:msg>
+<i18n:msg xml:id="cbi_applying">Applying changes</i18n:msg>
</i18n:msgs>
</i18n:msgs>
diff --git
a/i18n/german/luasrc/i18n/cbi.de.lua
b/i18n/german/luasrc/i18n/cbi.de.lua
index
a8d6824
..
9e69075
100644
(file)
--- a/
i18n/german/luasrc/i18n/cbi.de.lua
+++ b/
i18n/german/luasrc/i18n/cbi.de.lua
@@
-10,3
+10,4
@@
cbi_sectempty = 'Diese Sektion enthält noch keine Einträge'
cbi_manual = '-- benutzerdefiniert --'
cbi_select = '-- Bitte auswählen --'
cbi_gorel = 'Gehe zu relevanter Konfigurationsseite'
cbi_manual = '-- benutzerdefiniert --'
cbi_select = '-- Bitte auswählen --'
cbi_gorel = 'Gehe zu relevanter Konfigurationsseite'
+cbi_applying = 'Änderungen werden angewandt'
diff --git
a/i18n/german/luasrc/i18n/cbi.de.xml
b/i18n/german/luasrc/i18n/cbi.de.xml
index
dd37f2f
..
c989f8d
100644
(file)
--- a/
i18n/german/luasrc/i18n/cbi.de.xml
+++ b/
i18n/german/luasrc/i18n/cbi.de.xml
@@
-14,4
+14,6
@@
<i18n:msg xml:id="cbi_manual">-- benutzerdefiniert --</i18n:msg>
<i18n:msg xml:id="cbi_select">-- Bitte auswählen --</i18n:msg>
<i18n:msg xml:id="cbi_gorel">Gehe zu relevanter Konfigurationsseite</i18n:msg>
<i18n:msg xml:id="cbi_manual">-- benutzerdefiniert --</i18n:msg>
<i18n:msg xml:id="cbi_select">-- Bitte auswählen --</i18n:msg>
<i18n:msg xml:id="cbi_gorel">Gehe zu relevanter Konfigurationsseite</i18n:msg>
+<i18n:msg xml:id="cbi_applying">Änderungen werden angewandt</i18n:msg>
+
</i18n:msgs>
</i18n:msgs>
diff --git
a/libs/cbi/luasrc/cbi.lua
b/libs/cbi/luasrc/cbi.lua
index
b00ccf8
..
09ba553
100644
(file)
--- a/
libs/cbi/luasrc/cbi.lua
+++ b/
libs/cbi/luasrc/cbi.lua
@@
-211,6
+211,7
@@
function Map.__init__(self, config, ...)
self.config = config
self.parsechain = {self.config}
self.template = "cbi/map"
self.config = config
self.parsechain = {self.config}
self.template = "cbi/map"
+ self.apply_on_parse = nil
self.uci = uci.cursor()
self.save = true
if not self.uci:load(self.config) then
self.uci = uci.cursor()
self.save = true
if not self.uci:load(self.config) then
@@
-252,7
+253,14
@@
function Map.parse(self, ...)
-- Refresh data because commit changes section names
self.uci:load(config)
end
-- Refresh data because commit changes section names
self.uci:load(config)
end
- self.uci:apply(self.parsechain)
+ if self.apply_on_parse then
+ self.uci:apply(self.parsechain)
+ else
+ self._apply = function()
+ local cmd = self.uci:apply(self.parsechain, true)
+ return io.popen(cmd)
+ end
+ end
-- Reparse sections
Node.parse(self, ...)
-- Reparse sections
Node.parse(self, ...)
@@
-264,6
+272,15
@@
function Map.parse(self, ...)
end
end
end
end
+function Map.render(self, ...)
+ Node.render(self, ...)
+ if self._apply then
+ local fp = self._apply()
+ fp:read("*a")
+ fp:close()
+ end
+end
+
-- Creates a child section
function Map.section(self, class, ...)
if instanceof(class, AbstractSection) then
-- Creates a child section
function Map.section(self, class, ...)
if instanceof(class, AbstractSection) then
diff --git
a/libs/cbi/luasrc/view/cbi/map.htm
b/libs/cbi/luasrc/view/cbi/map.htm
index
e29b4fc
..
e61f854
100644
(file)
--- a/
libs/cbi/luasrc/view/cbi/map.htm
+++ b/
libs/cbi/luasrc/view/cbi/map.htm
@@
-16,6
+16,19
@@
$Id$
<div class="cbi-map" id="cbi-<%=self.config%>">
<h1><%=self.title%></h1>
<div class="cbi-map-descr"><%=self.description%></div>
<div class="cbi-map" id="cbi-<%=self.config%>">
<h1><%=self.title%></h1>
<div class="cbi-map-descr"><%=self.description%></div>
+ <%- if self._apply then -%><code><%:cbi_applying%>:
+
+ <%
+ local fp = self._apply()
+ self._apply = nil
+ local line = fp:read()
+ while line do
+ write(line)
+ line = fp:read()
+ end
+ fp:close()
+ -%>
+ </code><%- end -%>
<%- self:render_children() %>
<br />
</div>
<%- self:render_children() %>
<br />
</div>