summaryrefslogtreecommitdiffhomepage
path: root/modules/base/luasrc/view
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2014-06-11 13:29:05 +0000
committerJo-Philipp Wich <jow@openwrt.org>2014-06-11 13:29:05 +0000
commit7043c30e0e55bbbfacdddf97619b6bae96d20ddb (patch)
treeece3254350b3ba01ba3135caed2364cc7ca7804c /modules/base/luasrc/view
parentbbb44cf245c11bc0c1d59e836007c9e8c3bfa209 (diff)
build: introduce luci-base
Merges libs/core, libs/ipkg, libs/web, libs/sys, libs/sgi-cgi, libs/sgi-uhttpd, modules/admin-core, themes/base and protcols/core into modules/base and renames luci-lib-core to luci-base.
Diffstat (limited to 'modules/base/luasrc/view')
-rw-r--r--modules/base/luasrc/view/error404.htm19
-rw-r--r--modules/base/luasrc/view/error500.htm19
-rw-r--r--modules/base/luasrc/view/footer.htm15
-rw-r--r--modules/base/luasrc/view/header.htm21
-rw-r--r--modules/base/luasrc/view/indexer.htm15
-rw-r--r--modules/base/luasrc/view/sysauth.htm80
6 files changed, 169 insertions, 0 deletions
diff --git a/modules/base/luasrc/view/error404.htm b/modules/base/luasrc/view/error404.htm
new file mode 100644
index 0000000000..813604d12c
--- /dev/null
+++ b/modules/base/luasrc/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/modules/base/luasrc/view/error500.htm b/modules/base/luasrc/view/error500.htm
new file mode 100644
index 0000000000..14ba0410a4
--- /dev/null
+++ b/modules/base/luasrc/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/modules/base/luasrc/view/footer.htm b/modules/base/luasrc/view/footer.htm
new file mode 100644
index 0000000000..6c6d214210
--- /dev/null
+++ b/modules/base/luasrc/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/modules/base/luasrc/view/header.htm b/modules/base/luasrc/view/header.htm
new file mode 100644
index 0000000000..77018b1173
--- /dev/null
+++ b/modules/base/luasrc/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/modules/base/luasrc/view/indexer.htm b/modules/base/luasrc/view/indexer.htm
new file mode 100644
index 0000000000..c628289711
--- /dev/null
+++ b/modules/base/luasrc/view/indexer.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 .. "/indexer") %> \ No newline at end of file
diff --git a/modules/base/luasrc/view/sysauth.htm b/modules/base/luasrc/view/sysauth.htm
new file mode 100644
index 0000000000..7c39f0da51
--- /dev/null
+++ b/modules/base/luasrc/view/sysauth.htm
@@ -0,0 +1,80 @@
+<%#
+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
+
+-%>
+
+<%+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>
+
+<%
+local uci = require "luci.model.uci".cursor()
+local fs = require "nixio.fs"
+local https_key = uci:get("uhttpd", "main", "key")
+local https_port = uci:get("uhttpd", "main", "listen_https")
+if type(https_port) == "table" then
+ https_port = https_port[1]
+end
+
+if https_port and fs.access(https_key) then
+ https_port = https_port:match("(%d+)$")
+%>
+
+<script type="text/javascript">//<![CDATA[
+ if (document.location.protocol != 'https:') {
+ var url = 'https://' + window.location.hostname + ':' + '<%=https_port%>' + window.location.pathname;
+ var img=new Image;
+ img.onload=function(){window.location = url};
+ img.src='https://' + window.location.hostname + ':' + '<%=https_port%>' + '<%=resource%>/cbi/up.gif?' + Math.random();;
+ setTimeout(function(){
+ img.src=''
+ }, 5000);
+ }
+//]]></script>
+
+<% end %>
+
+<%+footer%>