summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--i18n/english/luasrc/i18n/cbi.en.lua1
-rw-r--r--i18n/english/luasrc/i18n/cbi.en.xml1
-rw-r--r--i18n/german/luasrc/i18n/cbi.de.lua1
-rw-r--r--i18n/german/luasrc/i18n/cbi.de.xml2
-rw-r--r--libs/cbi/luasrc/cbi.lua19
-rw-r--r--libs/cbi/luasrc/view/cbi/map.htm13
6 files changed, 36 insertions, 1 deletions
diff --git a/i18n/english/luasrc/i18n/cbi.en.lua b/i18n/english/luasrc/i18n/cbi.en.lua
index d302ee52a..42f93d4cc 100644
--- 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_applying = 'Applying changes'
diff --git a/i18n/english/luasrc/i18n/cbi.en.xml b/i18n/english/luasrc/i18n/cbi.en.xml
index 89484e4ae..4766ad155 100644
--- 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_applying">Applying changes</i18n:msg>
</i18n:msgs>
diff --git a/i18n/german/luasrc/i18n/cbi.de.lua b/i18n/german/luasrc/i18n/cbi.de.lua
index a8d68244e..9e6907537 100644
--- 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_applying = 'Änderungen werden angewandt'
diff --git a/i18n/german/luasrc/i18n/cbi.de.xml b/i18n/german/luasrc/i18n/cbi.de.xml
index dd37f2f49..c989f8d8d 100644
--- 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_applying">Änderungen werden angewandt</i18n:msg>
+
</i18n:msgs>
diff --git a/libs/cbi/luasrc/cbi.lua b/libs/cbi/luasrc/cbi.lua
index b00ccf8d2..09ba553ec 100644
--- 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.apply_on_parse = nil
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
- 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, ...)
@@ -264,6 +272,15 @@ function Map.parse(self, ...)
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
diff --git a/libs/cbi/luasrc/view/cbi/map.htm b/libs/cbi/luasrc/view/cbi/map.htm
index e29b4fc74..e61f8543a 100644
--- 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>
+ <%- 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>