From a365d626c295dfc8109c9f34df64054d5c264c99 Mon Sep 17 00:00:00 2001 From: Nils Schneider <nils@nilsschneider.net> Date: Sun, 9 Feb 2014 23:20:38 +0100 Subject: [PATCH] gluon-luci-core: replacing luci-mod-admin-core This commit adds gluon-luci-core, a package both gluon-config-mode and gluon-luci-admin will depend on. gluon-luci-core itself will depends on gluon-luci-theme, gluon-core and most importantly luci-lib-web. It also copies a few files from luci-mod-admin-core but leaves out everyting we do not use. At a later point I plan to move functionality from luci-lib-web into this package, too. luci-lib-web contains most parts of luci including hardcoded templates for CBI, which I intend to replace. --- package/gluon-config-mode/Makefile | 2 +- package/gluon-luci-admin/Makefile | 2 +- package/gluon-luci-core/Makefile | 39 ++++++++++++++ .../files/usr/lib/lua/luci/view/error404.htm | 19 +++++++ .../files/usr/lib/lua/luci/view/error500.htm | 19 +++++++ .../files/usr/lib/lua/luci/view/footer.htm | 15 ++++++ .../files/usr/lib/lua/luci/view/header.htm | 21 ++++++++ .../files/usr/lib/lua/luci/view/sysauth.htm | 54 +++++++++++++++++++ 8 files changed, 169 insertions(+), 2 deletions(-) create mode 100644 package/gluon-luci-core/Makefile create mode 100644 package/gluon-luci-core/files/usr/lib/lua/luci/view/error404.htm create mode 100644 package/gluon-luci-core/files/usr/lib/lua/luci/view/error500.htm create mode 100644 package/gluon-luci-core/files/usr/lib/lua/luci/view/footer.htm create mode 100644 package/gluon-luci-core/files/usr/lib/lua/luci/view/header.htm create mode 100644 package/gluon-luci-core/files/usr/lib/lua/luci/view/sysauth.htm diff --git a/package/gluon-config-mode/Makefile b/package/gluon-config-mode/Makefile index dfd252eff..4d52bd29b 100644 --- a/package/gluon-config-mode/Makefile +++ b/package/gluon-config-mode/Makefile @@ -15,7 +15,7 @@ define Package/gluon-config-mode SECTION:=gluon CATEGORY:=Gluon TITLE:=Luci based config mode for user friendly setup of new meshnodes - DEPENDS:=+gluon-core +gluon-lock-password +gluon-location +gluon-simple-tc +gluon-luci-theme +uhttpd +dnsmasq +luci-mod-admin-core +ip + DEPENDS:=+gluon-luci-core +gluon-lock-password +gluon-location +gluon-simple-tc +uhttpd +dnsmasq +ip endef define Package/gluon-config-mode/description diff --git a/package/gluon-luci-admin/Makefile b/package/gluon-luci-admin/Makefile index d9d963814..16dc0cbfa 100644 --- a/package/gluon-luci-admin/Makefile +++ b/package/gluon-luci-admin/Makefile @@ -15,7 +15,7 @@ define Package/gluon-luci-admin SECTION:=gluon CATEGORY:=Gluon TITLE:=Luci based simple administration interface for mesh nodes - DEPENDS:=+gluon-core +gluon-luci-theme +luci-mod-admin-core + DEPENDS:=+gluon-luci-core +gluon-config-mode endef define Package/gluon-luci-admin/description diff --git a/package/gluon-luci-core/Makefile b/package/gluon-luci-core/Makefile new file mode 100644 index 000000000..2cee38618 --- /dev/null +++ b/package/gluon-luci-core/Makefile @@ -0,0 +1,39 @@ +# Copyright (C) 2013 Nils Schneider <nils at nilsschneider.net> +# This is free software, licensed under the Apache 2.0 license. + +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-luci-core +PKG_VERSION:=0.1 +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-luci-core + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Luci code shared by configmode and expertmode + DEPENDS:=+gluon-core +gluon-luci-theme +luci-lib-web +endef + +define Package/gluon-luci-core/description + Luci code shared by various gluon packages +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-luci-core/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-luci-core)) diff --git a/package/gluon-luci-core/files/usr/lib/lua/luci/view/error404.htm b/package/gluon-luci-core/files/usr/lib/lua/luci/view/error404.htm new file mode 100644 index 000000000..813604d12 --- /dev/null +++ b/package/gluon-luci-core/files/usr/lib/lua/luci/view/error404.htm @@ -0,0 +1,19 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth <steven@midlink.org> +Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> + +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$ + +-%> +<%+header%> +<h2><a id="content" name="content">404 <%:Not Found%></a></h2> +<p><%:Sorry, the object you requested was not found.%></p> +<tt><%:Unable to dispatch%>: <%=luci.http.request.env.PATH_INFO%></tt> +<%+footer%> diff --git a/package/gluon-luci-core/files/usr/lib/lua/luci/view/error500.htm b/package/gluon-luci-core/files/usr/lib/lua/luci/view/error500.htm new file mode 100644 index 000000000..14ba0410a --- /dev/null +++ b/package/gluon-luci-core/files/usr/lib/lua/luci/view/error500.htm @@ -0,0 +1,19 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth <steven@midlink.org> +Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> + +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$ + +-%> +<%+header%> +<h2><a id="content" name="content">500 <%:Internal Server Error%></a></h2> +<p><%:Sorry, the server encountered an unexpected error.%></p> +<pre class="error500"><%=message%></pre> +<%+footer%> diff --git a/package/gluon-luci-core/files/usr/lib/lua/luci/view/footer.htm b/package/gluon-luci-core/files/usr/lib/lua/luci/view/footer.htm new file mode 100644 index 000000000..6c6d21421 --- /dev/null +++ b/package/gluon-luci-core/files/usr/lib/lua/luci/view/footer.htm @@ -0,0 +1,15 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth <steven@midlink.org> +Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> + +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$ + +-%> +<% include("themes/" .. theme .. "/footer") %> \ No newline at end of file diff --git a/package/gluon-luci-core/files/usr/lib/lua/luci/view/header.htm b/package/gluon-luci-core/files/usr/lib/lua/luci/view/header.htm new file mode 100644 index 000000000..77018b117 --- /dev/null +++ b/package/gluon-luci-core/files/usr/lib/lua/luci/view/header.htm @@ -0,0 +1,21 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth <steven@midlink.org> +Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> + +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$ + +-%> + +<% + if not luci.dispatcher.context.template_header_sent then + include("themes/" .. theme .. "/header") + luci.dispatcher.context.template_header_sent = true + end +%> diff --git a/package/gluon-luci-core/files/usr/lib/lua/luci/view/sysauth.htm b/package/gluon-luci-core/files/usr/lib/lua/luci/view/sysauth.htm new file mode 100644 index 000000000..8c4b19c7c --- /dev/null +++ b/package/gluon-luci-core/files/usr/lib/lua/luci/view/sysauth.htm @@ -0,0 +1,54 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth <steven@midlink.org> +Copyright 2008-2012 Jo-Philipp Wich <xm@subsignal.org> + +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$ + +-%> + +<%+header%> + +<form method="post" action="<%=pcdata(luci.http.getenv("REQUEST_URI"))%>"> + <div class="cbi-map"> + <h2><a id="content" name="content"><%:Authorization Required%></a></h2> + <div class="cbi-map-descr"> + <%:Please enter your username and password.%> + <%- if fuser then %> + <div class="error"><%:Invalid username and/or password! Please try again.%></div> + <br /> + <% end -%> + </div> + <fieldset class="cbi-section"><fieldset class="cbi-section-node"> + <div class="cbi-value"> + <label class="cbi-value-title"><%:Username%></label> + <div class="cbi-value-field"> + <input class="cbi-input-user" type="text" name="username" value="<%=duser%>" /> + </div> + </div> + <div class="cbi-value cbi-value-last"> + <label class="cbi-value-title"><%:Password%></label> + <div class="cbi-value-field"> + <input id="focus_password" class="cbi-input-password" type="password" name="password" /> + </div> + </div> + </fieldset></fieldset> + </div> + + <div> + <input type="submit" value="<%:Login%>" class="cbi-button cbi-button-apply" /> + <input type="reset" value="<%:Reset%>" class="cbi-button cbi-button-reset" /> + </div> +</form> +<script type="text/javascript">//<![CDATA[ + var input = document.getElementById('focus_password'); + if (input) + input.focus(); +//]]></script> +<%+footer%> -- GitLab