From dfd3eedcf8c454d2a984efb36fd9e2420a0b752d Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 14 May 2014 13:23:15 +0200 Subject: [PATCH] gluon-config-mode: convert templates to use the new site config --- gluon/gluon-config-mode/Makefile | 4 +--- .../controller/gluon-config-mode/index.lua | 8 +++++-- .../view/gluon-config-mode/cbi/wizard.htm | 6 ++++- .../luci/view/gluon-config-mode/reboot.htm | 23 ++++--------------- 4 files changed, 16 insertions(+), 25 deletions(-) rename gluon/gluon-config-mode/{generate => files}/usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm (95%) rename gluon/gluon-config-mode/{generate => files}/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm (57%) diff --git a/gluon/gluon-config-mode/Makefile b/gluon/gluon-config-mode/Makefile index e5131e1..9a28d02 100644 --- a/gluon/gluon-config-mode/Makefile +++ b/gluon/gluon-config-mode/Makefile @@ -4,8 +4,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-config-mode -PKG_VERSION:=1 -PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION) +PKG_VERSION:=2 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) @@ -34,7 +33,6 @@ endef define Package/gluon-config-mode/install $(CP) ./files/* $(1)/ - $(GLUON_GENERATE) ./generate/* $(1)/ endef $(eval $(call BuildPackage,gluon-config-mode)) diff --git a/gluon/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua b/gluon/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua index afcc83f..8803dde 100644 --- a/gluon/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua +++ b/gluon/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua @@ -12,8 +12,12 @@ $Id$ module("luci.controller.gluon-config-mode.index", package.seeall) +local site = require 'gluon.site_config' + + local meshvpn_name = "mesh_vpn" + function index() local uci_state = luci.model.uci.cursor_state() @@ -56,11 +60,11 @@ function action_reboot() uci:save("gluon-config-mode") uci:commit("gluon-config-mode") - hostname = uci:get_first("system", "system", "hostname") + local hostname = uci:get_first("system", "system", "hostname") if nixio.fork() ~= 0 then luci.template.render("gluon-config-mode/reboot", - {pubkey=pubkey, hostname=hostname}) + {pubkey=pubkey, hostname=hostname, site=site}) else debug.setfenv(io.stdout, debug.getfenv(io.open '/dev/null')) io.stdout:close() diff --git a/gluon/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm b/gluon/gluon-config-mode/files/usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm similarity index 95% rename from gluon/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm rename to gluon/gluon-config-mode/files/usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm index c67257e..db5fe8b 100644 --- a/gluon/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm +++ b/gluon/gluon-config-mode/files/usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm @@ -1,6 +1,10 @@ +<%- + local site = require 'gluon.site_config' +-%> +

Willkommen!

- @config_mode.msg_welcome@ + <%= site.config_mode.msg_welcome %>

<% if not self.embedded then %> diff --git a/gluon/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm b/gluon/gluon-config-mode/files/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm similarity index 57% rename from gluon/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm rename to gluon/gluon-config-mode/files/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm index 26a09a2..fdf04d9 100644 --- a/gluon/gluon-config-mode/generate/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm +++ b/gluon/gluon-config-mode/files/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm @@ -1,18 +1,3 @@ -<%# -LuCI - Lua Configuration Interface -Copyright 2008 Steven Barth -Copyright 2008 Jo-Philipp Wich - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ - --%> - <%=hostname%> - <% if title then %><%=title%><% else %><%:Rebooting...%><% end %> @@ -25,17 +10,17 @@ $Id$ <% if pubkey then %>

- @config_mode.msg_pubkey@ + <%= site.config_mode.msg_pubkey %>

- # <%=hostname%> + # Hostname: <%= hostname %>
- <%=pubkey%> + <%= pubkey %>
<% end %>
- @config_mode.msg_reboot@ + <%= site.config_mode.msg_reboot %>