diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2014-12-03 15:17:05 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-01-08 16:26:20 +0100 |
commit | 1bb4822dca6113f73e3bc89e2acf15935e6f8e92 (patch) | |
tree | 35e16f100466e4e00657199b38bb3d87d52bf73f /modules/luci-mod-admin-full/luasrc/view/admin_system | |
parent | 9edd0e46c3f880727738ce8ca6ff1c8b85f99ef4 (diff) |
Rework LuCI build system
* Rename subdirectories to their repective OpenWrt package names
* Make each LuCI module its own standalone package
* Deploy a shared luci.mk which is used by each module Makefile
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'modules/luci-mod-admin-full/luasrc/view/admin_system')
8 files changed, 518 insertions, 0 deletions
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/applyreboot.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/applyreboot.htm new file mode 100644 index 0000000000..56721a6104 --- /dev/null +++ b/modules/luci-mod-admin-full/luasrc/view/admin_system/applyreboot.htm @@ -0,0 +1,50 @@ +<%# +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$ + +-%> + +<html> + <head> + <title><%=luci.sys.hostname()%> - <% if title then %><%=title%><% else %><%:Rebooting...%><% end %></title> + <link rel="stylesheet" type="text/css" media="screen" href="<%=media%>/cascade.css" /> + <script type="text/javascript" src="<%=resource%>/xhr.js"></script> + <script type="text/javascript">//<![CDATA[ + var interval = window.setInterval(function() { + var img = new Image(); + + img.onload = function() { + window.clearInterval(interval); + location.href = ('https:' == document.location.protocol ? 'https://' : 'http://') + '<%=addr or luci.http.getenv("SERVER_NAME")%>/'; + }; + + img.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + '<%=addr or luci.http.getenv("SERVER_NAME")%><%=resource%>/icons/loading.gif?' + Math.random(); + }, 5000); + //]]></script> + </head> + <body> + <div id="maincontainer"> + <div id="maincontent"> + <h2><a id="content" name="content"><%:System%> - <% if title then %><%=title%><% else %><%:Rebooting...%><% end %></a></h2> + <fieldset class="cbi-section"> + <p> + <% if msg then %><%=msg%><% else %><%:Changes applied.%><% end %> + </p> + <p> + <img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> + <%:Waiting for changes to be applied...%> + </p> + </fieldset> + </div> + </div> + </body> +</html> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/backupfiles.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/backupfiles.htm new file mode 100644 index 0000000000..38b5f03a14 --- /dev/null +++ b/modules/luci-mod-admin-full/luasrc/view/admin_system/backupfiles.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$ + +-%> + +<ul class="cbi-tabmenu"> + <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/system/flashops")%>"><%:Actions%></a></li> + <li class="cbi-tab"><a href="#"><%:Configuration%></a></li> +</ul> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/clock_status.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/clock_status.htm new file mode 100644 index 0000000000..84e151075f --- /dev/null +++ b/modules/luci-mod-admin-full/luasrc/view/admin_system/clock_status.htm @@ -0,0 +1,36 @@ +<%+cbi/valueheader%> + +<script type="text/javascript">//<![CDATA[ + XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "system", "clock_status")%>', null, + function(x, rv) + { + var s = document.getElementById('<%=self.option%>-clock-status'); + if (s) + { + s.innerHTML = rv.timestring || '?'; + } + } + ); + + function sync_clock(btn) + { + btn.disabled = true; + btn.value = '<%:Synchronizing...%>'; + + XHR.get('<%=luci.dispatcher.build_url("admin", "system", "clock_status")%>', + { set: Math.floor((new Date()).getTime() / 1000) }, + function() + { + btn.disabled = false; + btn.value = '<%:Sync with browser%>'; + } + ); + + return false; + } +//]]></script> + +<span id="<%=self.option%>-clock-status"><em><%:Collecting data...%></em></span> +<input type="button" class="cbi-button cbi-button-apply" value="<%:Sync with browser%>" onclick="return sync_clock(this)" /> + +<%+cbi/valuefooter%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/flashops.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/flashops.htm new file mode 100644 index 0000000000..debc796e89 --- /dev/null +++ b/modules/luci-mod-admin-full/luasrc/view/admin_system/flashops.htm @@ -0,0 +1,94 @@ +<%# +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"><%:Flash operations%></a></h2> + +<ul class="cbi-tabmenu"> + <li class="cbi-tab"><a href="#"><%:Actions%></a></li> + <li class="cbi-tab-disabled"><a href="<%=REQUEST_URI%>/backupfiles"><%:Configuration%></a></li> +</ul> + +<fieldset class="cbi-section"> + + <fieldset class="cbi-section"> + <legend><%:Backup / Restore%></legend> + <form method="post" action="<%=REQUEST_URI%>" enctype="multipart/form-data"> + <div class="cbi-section-descr"><%:Click "Generate archive" to download a tar archive of the current configuration files. To reset the firmware to its initial state, click "Perform reset" (only possible with squashfs images).%></div> + <div class="cbi-section-node"> + <div class="cbi-value<% if not reset_avail then %> cbi-value-last<% end %>"> + <label class="cbi-value-title" for="image"><%:Download backup%>:</label> + <div class="cbi-value-field"> + <input class="cbi-button cbi-button-apply" type="submit" name="backup" value="<%:Generate archive%>" /> + </div> + </div> + <% if reset_avail then %> + <div class="cbi-value cbi-value-last"> + <label class="cbi-value-title"><%:Reset to defaults%>:</label> + <div class="cbi-value-field"> + <input onclick="return confirm('<%:Really reset all changes?%>')" class="cbi-button cbi-button-reset" type="submit" name="reset" value="<%:Perform reset%>" /> + </div> + </div> + <% end %> + </div> + <br /> + <div class="cbi-section-descr"><%:To restore configuration files, you can upload a previously generated backup archive here.%></div> + <div class="cbi-section-node"> + <div class="cbi-value cbi-value-last"> + <label class="cbi-value-title" for="archive"><%:Restore backup%>:</label> + <div class="cbi-value-field"> + <input type="file" name="archive" id="archive" /> + <input type="submit" class="cbi-button cbi-input-apply" name="restore" value="<%:Upload archive...%>" /> + </div> + </div> + </div> + </form> + </fieldset> + + <br /> + + <fieldset class="cbi-section"> + <legend><%:Flash new firmware image%></legend> + <% if upgrade_avail then %> + <form method="post" action="<%=REQUEST_URI%>" enctype="multipart/form-data"> + <div class="cbi-section-descr"><%:Upload a sysupgrade-compatible image here to replace the running firmware. Check "Keep settings" to retain the current configuration (requires an OpenWrt compatible firmware image).%></div> + <div class="cbi-section-node"> + <div class="cbi-value"> + <label class="cbi-value-title" for="keep"><%:Keep settings%>:</label> + <div class="cbi-value-field"> + <input type="checkbox" name="keep" id="keep" checked="checked" /> + </div> + </div> + <div class="cbi-value cbi-value-last<% if image_invalid then %> cbi-value-error<% end %>"> + <label class="cbi-value-title" for="image"><%:Image%>:</label> + <div class="cbi-value-field"> + <input type="file" name="image" id="image" /> + <input type="submit" class="cbi-button cbi-input-apply" value="<%:Flash image...%>" /> + </div> + </div> + </div> + <% if image_invalid then %> + <div class="cbi-section-error"><%:The uploaded image file does not contain a supported format. Make sure that you choose the generic image format for your platform. %></div> + <% end %> + </form> + <% else %> + <div class="cbi-section-descr"><%:Sorry, there is no sysupgrade support present; a new firmware image must be flashed manually. Please refer to the OpenWrt wiki for device specific install instructions.%></div> + <% end %> + </fieldset> + +</fieldset> + +<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/ipkg.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/ipkg.htm new file mode 100644 index 0000000000..7f0956cfde --- /dev/null +++ b/modules/luci-mod-admin-full/luasrc/view/admin_system/ipkg.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$ + +-%> + +<ul class="cbi-tabmenu"> + <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/system/packages")%>"><%:Actions%></a></li> + <li class="cbi-tab"><a href="#"><%:Configuration%></a></li> +</ul> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/packages.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/packages.htm new file mode 100644 index 0000000000..00b4be4868 --- /dev/null +++ b/modules/luci-mod-admin-full/luasrc/view/admin_system/packages.htm @@ -0,0 +1,200 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth <steven@midlink.org> +Copyright 2008-2010 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 + +-%> +<%- +local bit = require "bit" +local opkg = require "luci.model.ipkg" +local fs = require "nixio.fs" +local wa = require "luci.tools.webadmin" +local rowcnt = 1 + +function rowstyle() + rowcnt = rowcnt + 1 + return (rowcnt % 2) + 1 +end + +local fstat = fs.statvfs(opkg.overlay_root()) +local space_total = fstat and fstat.blocks or 0 +local space_free = fstat and fstat.bfree or 0 +local space_used = space_total - space_free + +local used_perc = math.floor(0.5 + ((space_total > 0) and ((100 / space_total) * space_used) or 100)) +local free_byte = space_free * fstat.frsize + +local filter = { } + + +local opkg_list = luci.model.ipkg.list_all +local querypat +if query and #query > 0 then + querypat = '*%s*' % query + opkg_list = luci.model.ipkg.find +end + +local letterpat +if letter == 35 then + letterpat = "[^a-z]*" +else + letterpat = string.char(letter, 42) -- 'A' '*' +end + +-%> + +<%+header%> + +<h2><a id="content" name="content"><%:Software%></a></h2> + +<form method="post" action="<%=REQUEST_URI%>"> + <div class="cbi-map"> + + <ul class="cbi-tabmenu"> + <li class="cbi-tab"><a href="#"><%:Actions%></a></li> + <li class="cbi-tab-disabled"><a href="<%=REQUEST_URI%>/ipkg"><%:Configuration%></a></li> + </ul> + + <fieldset class="cbi-section"> + + + <fieldset class="cbi-section-node"> + <% if (install and next(install)) or (remove and next(remove)) or update or upgrade then %> + <div class="cbi-value"> + <% if #stdout > 0 then %><pre><%=pcdata(stdout)%></pre><% end %> + <% if #stderr > 0 then %><pre class="error"><%=pcdata(stderr)%></pre><% end %> + </div> + <% end %> + + <% if querypat then %> + <div class="cbi-value"> + <%:Displaying only packages containing%> <strong>"<%=pcdata(query)%>"</strong> + <input type="button" onclick="location.href='?display=<%=pcdata(display)%>'" href="#" class="cbi-button cbi-button-reset" style="margin-left:1em" value="<%:Reset%>" /> + <br style="clear:both" /> + </div> + <% end %> + + <% if no_lists or old_lists then %> + <div class="cbi-value"> + <% if old_lists then %> + <%:Package lists are older than 24 hours%> + <% else %> + <%:No package lists available%> + <% end %> + <input type="button" onclick="location.href='?update=1'" href="#" class="cbi-button cbi-button-apply" style="margin-left:3em" value="<%:Update lists%>" /> + </div> + <% end %> + + <div class="cbi-value cbi-value-last"> + <%:Free space%>: <strong><%=(100-used_perc)%>%</strong> (<strong><%=wa.byte_format(free_byte)%></strong>) + <div style="margin:3px 0; width:300px; height:10px; border:1px solid #000000; background-color:#80C080"> + <div style="background-color:#F08080; border-right:1px solid #000000; height:100%; width:<%=used_perc%>%"> </div> + </div> + </div> + </fieldset> + + <br /> + + <fieldset class="cbi-section-node"> + <input type="hidden" name="display" value="<%=pcdata(display)%>" /> + + <div class="cbi-value"> + <label class="cbi-value-title"><%:Download and install package%>:</label> + <div class="cbi-value-field"> + <input type="text" name="url" size="30" value="" /> + <input class="cbi-button cbi-input-save" type="submit" name="submit" value="<%:OK%>" /> + </div> + </div> + + <div class="cbi-value cbi-value-last"> + <label class="cbi-value-title"><%:Filter%>:</label> + <div class="cbi-value-field"> + <input type="text" name="query" size="20" value="<%=pcdata(query)%>" /> + <input type="submit" class="cbi-button cbi-input-find" name="search" value="<%:Find package%>" /> + </div> + </div> + </fieldset> + </fieldset> + <br /> + + <h3><%:Status%></h3> + + + <ul class="cbi-tabmenu"> + <li class="cbi-tab<% if display ~= "installed" then %>-disabled<% end %>"><a href="?display=installed&query=<%=pcdata(query)%>"><%:Installed packages%><% if query then %> (<%=pcdata(query)%>)<% end %></a></li> + <li class="cbi-tab<% if display ~= "available" then %>-disabled<% end %>"><a href="?display=available&query=<%=pcdata(query)%>"><%:Available packages%><% if query then %> (<%=pcdata(query)%>)<% end %></a></li> + </ul> + + <% if display ~= "available" then %> + <fieldset class="cbi-section"> + <table class="cbi-section-table" style="width:100%"> + <tr class="cbi-section-table-titles"> + <th class="cbi-section-table-cell" style="text-align:left"> </th> + <th class="cbi-section-table-cell" style="text-align:left"><%:Package name%></th> + <th class="cbi-section-table-cell" style="text-align:left"><%:Version%></th> + </tr> + <% local empty = true; luci.model.ipkg.list_installed(querypat, function(n, v, d) empty = false; filter[n] = true %> + <tr class="cbi-section-table-row cbi-rowstyle-<%=rowstyle()%>"> + <td style="text-align:left; width:10%"><a onclick="return window.confirm('<%:Remove%> "<%=luci.util.pcdata(n)%>" ?')" href="<%=REQUEST_URI%>?submit=1&remove=<%=luci.util.pcdata(n)%>"><%:Remove%></a></td> + <td style="text-align:left"><%=luci.util.pcdata(n)%></td> + <td style="text-align:left"><%=luci.util.pcdata(v)%></td> + </tr> + <% end) %> + <% if empty then %> + <tr class="cbi-section-table-row"> + <td style="text-align:left"> </td> + <td style="text-align:left"><em><%:none%></em></td> + <td style="text-align:left"><em><%:none%></em></td> + </tr> + <% end %> + </table> + </fieldset> + <% else %> + <fieldset class="cbi-section"> + <% if not querypat then %> + <ul class="cbi-tabmenu"> + <% local i; for i = 65, 90 do %> + <li class="cbi-tab<% if letter ~= i then %>-disabled<% end %>"><a href="?display=available&letter=<%=string.char(i)%>"><%=string.char(i)%></a></li> + <% end %> + <li class="cbi-tab<% if letter ~= 35 then %>-disabled<% end %>"><a href="?display=available&letter=%23">#</a></li> + </ul> + <div class="cbi-section-node"> + <% end %> + <table class="cbi-section-table" style="width:100%"> + <tr class="cbi-section-table-titles"> + <th class="cbi-section-table-cell" style="text-align:left"> </th> + <th class="cbi-section-table-cell" style="text-align:left"><%:Package name%></th> + <th class="cbi-section-table-cell" style="text-align:left"><%:Version%></th> + <th class="cbi-section-table-cell" style="text-align:left"><%:Description%></th> + </tr> + <% local empty = true; opkg_list(querypat or letterpat, function(n, v, d) if filter[n] then return end; empty = false %> + <tr class="cbi-section-table-row cbi-rowstyle-<%=rowstyle()%>"> + <td style="text-align:left; width:10%"><a onclick="return window.confirm('<%:Install%> "<%=luci.util.pcdata(n)%>" ?')" href="<%=REQUEST_URI%>?submit=1&install=<%=luci.util.pcdata(n)%>"><%:Install%></a></td> + <td style="text-align:left"><%=luci.util.pcdata(n)%></td> + <td style="text-align:left"><%=luci.util.pcdata(v)%></td> + <td style="text-align:left"><%=luci.util.pcdata(d)%></td> + </tr> + <% end) %> + <% if empty then %> + <tr class="cbi-section-table-row"> + <td style="text-align:left"> </td> + <td style="text-align:left"><em><%:none%></em></td> + <td style="text-align:left"><em><%:none%></em></td> + <td style="text-align:left"><em><%:none%></em></td> + </tr> + <% end %> + </table> + <% if not querypat then %> + </div> + <% end %> + </fieldset> + <% end %> + </div> +</form> +<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/reboot.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/reboot.htm new file mode 100644 index 0000000000..5f2912d925 --- /dev/null +++ b/modules/luci-mod-admin-full/luasrc/view/admin_system/reboot.htm @@ -0,0 +1,33 @@ +<%# +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"><%:System%></a></h2> +<h3><%:Reboot%></h3> +<p><%:Reboots the operating system of your device%></p> +<%- +local c = require("luci.model.uci").cursor():changes() +if c and next(c) then +-%> + <p class="warning"><%:Warning: There are unsaved changes that will be lost while rebooting!%></p> +<%- +end +if not reboot then +-%> +<p><a href="<%=controller%>/admin/system/reboot?reboot=1"><%:Perform reboot%></a></p> +<%- else -%> +<p><%:Please wait: Device rebooting...%></p> +<script type="text/javascript">setTimeout("location='<%=controller%>/admin'", 60000)</script> +<%- end -%> +<%+footer%>
\ No newline at end of file diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/upgrade.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/upgrade.htm new file mode 100644 index 0000000000..ce285332eb --- /dev/null +++ b/modules/luci-mod-admin-full/luasrc/view/admin_system/upgrade.htm @@ -0,0 +1,67 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth <steven@midlink.org> +Copyright 2008-2009 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%> + +<h2><a id="content" name="content"><%:Flash Firmware%> - <%:Verify%></a></h2> +<p> + <%_ The flash image was uploaded. + Below is the checksum and file size listed, + compare them with the original file to ensure data integrity.<br /> + Click "Proceed" below to start the flash procedure. %> + + <% if storage > 0 and size > storage then %> + <br /><br /> + <div class="error"><%:It appears that you are trying to + flash an image that does not fit into the flash memory, please verify + the image file! %></div> + <% end %> + +</p> + +<fieldset class="cbi-section"> + <ul> + <li><%:Checksum%>: <code><%=checksum%></code></li> + <li><%:Size%>: <% + local w = require "luci.tools.webadmin" + write(w.byte_format(size)) + + if storage > 0 then + write(luci.i18n.translatef( + " (%s available)", + w.byte_format(storage) + )) + end + %></li> + <li><% if keep then %> + <%:Configuration files will be kept.%> + <% else %> + <%:Note: Configuration files will be erased.%> + <% end %></li> + </ul> +</fieldset> + +<div class="cbi-page-actions right"> + <form style="display:inline" action="<%=REQUEST_URI%>" method="post"> + <input class="cbi-button cbi-button-reset" type="submit" value="<%:Cancel%>" /> + </form> + <form style="display:inline" action="<%=REQUEST_URI%>" method="post"> + <input type="hidden" name="step" value="2" /> + <input type="hidden" name="keep" value="<%=keep and "1" or ""%>" /> + <input class="cbi-button cbi-button-apply" type="submit" value="<%:Proceed%>" /> + </form> +</div> + +<%+footer%> |