diff options
19 files changed, 102 insertions, 18 deletions
diff --git a/i18n/english/luasrc/i18n/default.en.lua b/i18n/english/luasrc/i18n/default.en.lua index 666b7a312..d923a88fc 100644 --- a/i18n/english/luasrc/i18n/default.en.lua +++ b/i18n/english/luasrc/i18n/default.en.lua @@ -27,6 +27,7 @@ device = 'Device' devices = 'Devices' disable = 'disable' distance = 'Distance' +dmesg = 'Kernel Log' dnsserver = '<abbr title="Domain Name System">DNS</abbr>-Server' edit = 'Edit' enable = 'enable' diff --git a/i18n/english/luasrc/i18n/default.en.xml b/i18n/english/luasrc/i18n/default.en.xml index 3c0f270c2..e499dbb39 100644 --- a/i18n/english/luasrc/i18n/default.en.xml +++ b/i18n/english/luasrc/i18n/default.en.xml @@ -32,6 +32,7 @@ <i18n:msg xml:id="devices">Devices</i18n:msg> <i18n:msg xml:id="disable">disable</i18n:msg> <i18n:msg xml:id="distance">Distance</i18n:msg> +<i18n:msg xml:id="dmesg">Kernel Log</i18n:msg> <i18n:msg xml:id="dnsserver"><abbr title="Domain Name System">DNS</abbr>-Server</i18n:msg> <i18n:msg xml:id="edit">Edit</i18n:msg> <i18n:msg xml:id="enable">enable</i18n:msg> diff --git a/i18n/french/luasrc/i18n/default.fr.lua b/i18n/french/luasrc/i18n/default.fr.lua index 60cba3438..808abea94 100644 --- a/i18n/french/luasrc/i18n/default.fr.lua +++ b/i18n/french/luasrc/i18n/default.fr.lua @@ -27,6 +27,7 @@ device = 'Equipement' devices = 'Equipements' disable = 'désactiver' distance = 'Distance' +dmesg = 'Journal du noyau' dnsserver = 'Serveur DNS' edit = 'Editer' enable = 'activer' diff --git a/i18n/french/luasrc/i18n/default.fr.xml b/i18n/french/luasrc/i18n/default.fr.xml index d91f5e287..f17ef92c9 100644 --- a/i18n/french/luasrc/i18n/default.fr.xml +++ b/i18n/french/luasrc/i18n/default.fr.xml @@ -32,6 +32,7 @@ <i18n:msg xml:id="devices">Equipements</i18n:msg> <i18n:msg xml:id="disable">désactiver</i18n:msg> <i18n:msg xml:id="distance">Distance</i18n:msg> +<i18n:msg xml:id="dmesg">Journal du noyau</i18n:msg> <i18n:msg xml:id="dnsserver">Serveur DNS</i18n:msg> <i18n:msg xml:id="edit">Editer</i18n:msg> <i18n:msg xml:id="enable">activer</i18n:msg> diff --git a/i18n/german/luasrc/i18n/default.de.lua b/i18n/german/luasrc/i18n/default.de.lua index 24c37eaa9..238cba56e 100644 --- a/i18n/german/luasrc/i18n/default.de.lua +++ b/i18n/german/luasrc/i18n/default.de.lua @@ -27,6 +27,7 @@ device = 'Gerät' devices = 'Geräte' disable = 'deaktivieren' distance = 'Distanz' +dmesg = 'Kernelprotokoll' dnsserver = 'DNS-Server' edit = 'Bearbeiten' enable = 'aktivieren' diff --git a/i18n/german/luasrc/i18n/default.de.xml b/i18n/german/luasrc/i18n/default.de.xml index e9c4ca2c0..fb1348d11 100644 --- a/i18n/german/luasrc/i18n/default.de.xml +++ b/i18n/german/luasrc/i18n/default.de.xml @@ -36,6 +36,7 @@ <i18n:msg xml:id="devices">Geräte</i18n:msg> <i18n:msg xml:id="disable">deaktivieren</i18n:msg> <i18n:msg xml:id="distance">Distanz</i18n:msg> +<i18n:msg xml:id="dmesg">Kernelprotokoll</i18n:msg> <i18n:msg xml:id="dnsserver">DNS-Server</i18n:msg> <i18n:msg xml:id="edit">Bearbeiten</i18n:msg> diff --git a/i18n/portuguese_brazilian/luasrc/i18n/default.pt-br.lua b/i18n/portuguese_brazilian/luasrc/i18n/default.pt-br.lua index 3e17c478b..26672bdf9 100644 --- a/i18n/portuguese_brazilian/luasrc/i18n/default.pt-br.lua +++ b/i18n/portuguese_brazilian/luasrc/i18n/default.pt-br.lua @@ -28,6 +28,7 @@ device = 'Dispositivo' devices = 'Dispositivos' disable = 'desativar' distance = 'Distância' +dmesg = 'Log do Kernel' dnsserver = 'Servidor-<abbr title="Sistema de Nomes de Domínios">DNS</abbr>' edit = 'Editar' enable = 'ativar' diff --git a/i18n/portuguese_brazilian/luasrc/i18n/default.pt-br.xml b/i18n/portuguese_brazilian/luasrc/i18n/default.pt-br.xml index fbce7fbb6..ac90be3ba 100644 --- a/i18n/portuguese_brazilian/luasrc/i18n/default.pt-br.xml +++ b/i18n/portuguese_brazilian/luasrc/i18n/default.pt-br.xml @@ -28,11 +28,12 @@ <i18n:msg xml:id="delete">Apagar</i18n:msg> <i18n:msg xml:id="descr">Descrição</i18n:msg> <i18n:msg xml:id="design">Tema</i18n:msg> -<i18n:msg xml:id="destination">Destino</i18n:msg> +<i18n:msg xml:id="destination">Destino</i18n:msg> <i18n:msg xml:id="device">Dispositivo</i18n:msg> <i18n:msg xml:id="devices">Dispositivos</i18n:msg> <i18n:msg xml:id="disable">desativar</i18n:msg> <i18n:msg xml:id="distance">Distância</i18n:msg> +<i18n:msg xml:id="dmesg">Log do Kernel</i18n:msg> <i18n:msg xml:id="dnsserver">Servidor-<abbr title="Sistema de Nomes de Domínios">DNS</abbr></i18n:msg> <i18n:msg xml:id="edit">Editar</i18n:msg> <i18n:msg xml:id="enable">ativar</i18n:msg> @@ -87,7 +88,7 @@ <i18n:msg xml:id="services">Serviços</i18n:msg> <i18n:msg xml:id="settings">Configurações</i18n:msg> <i18n:msg xml:id="size">Tamanho</i18n:msg> -<i18n:msg xml:id="source">Origem</i18n:msg> +<i18n:msg xml:id="source">Origem</i18n:msg> <i18n:msg xml:id="start">Início</i18n:msg> <i18n:msg xml:id="static">estático</i18n:msg> <i18n:msg xml:id="status">Status</i18n:msg> diff --git a/i18n/russian/luasrc/i18n/default.ru.lua b/i18n/russian/luasrc/i18n/default.ru.lua index efdac7bc0..fe59e45a1 100644 --- a/i18n/russian/luasrc/i18n/default.ru.lua +++ b/i18n/russian/luasrc/i18n/default.ru.lua @@ -22,6 +22,7 @@ device = 'Устройство' devices = 'Устройства' disable = 'выключено' distance = 'Расстояние' +dmesg = 'Kernel log' dnsserver = '<abbr title="Служба Доменных Имён">DNS</abbr>-Сервер' edit = 'Редактировать' enable = 'включено' diff --git a/i18n/russian/luasrc/i18n/default.ru.xml b/i18n/russian/luasrc/i18n/default.ru.xml index f3be7c7fb..69f092ac3 100644 --- a/i18n/russian/luasrc/i18n/default.ru.xml +++ b/i18n/russian/luasrc/i18n/default.ru.xml @@ -26,6 +26,7 @@ <i18n:msg xml:id="devices">Устройства</i18n:msg> <i18n:msg xml:id="disable">выключено</i18n:msg> <i18n:msg xml:id="distance">Расстояние</i18n:msg> +<i18n:msg xml:id="dmesg">Kernel log</i18n:msg> <i18n:msg xml:id="dnsserver"><abbr title="Служба Доменных Имён">DNS</abbr>-Сервер</i18n:msg> <i18n:msg xml:id="edit">Редактировать</i18n:msg> <i18n:msg xml:id="enable">включено</i18n:msg> diff --git a/libs/core/luasrc/util.lua b/libs/core/luasrc/util.lua index 109ccab28..ea1fccbc1 100644 --- a/libs/core/luasrc/util.lua +++ b/libs/core/luasrc/util.lua @@ -261,6 +261,16 @@ function trim(str) return (str:gsub("^%s*(.-)%s*$", "%1")) end +--- Count the occurences of given substring in given string. +-- @param str String to search in +-- @param pattern String containing pattern to find +-- @return Number of found occurences +function cmatch(str, pat) + local count = 0 + for _ in str:gmatch(pat) do count = count + 1 end + return count +end + --- Parse certain units from the given string and return the canonical integer -- value or 0 if the unit is unknown. Upper- or lower case is irrelevant. -- Recognized units are: @@ -320,6 +330,16 @@ function parse_units(ustr) return val end +-- also register functions above in the central string class for convenience +string.escape = escape +string.pcdata = pcdata +string.striptags = striptags +string.split = split +string.trim = trim +string.cmatch = cmatch +string.parse_units = parse_units + + --- Appends numerically indexed tables or single objects to a given table. -- @param src Target table -- @param ... Objects to insert diff --git a/libs/sys/luasrc/sys.lua b/libs/sys/luasrc/sys.lua index 413aa4c11..52ed0c36d 100644 --- a/libs/sys/luasrc/sys.lua +++ b/libs/sys/luasrc/sys.lua @@ -204,6 +204,12 @@ function syslog() return luci.util.exec("logread") end +--- Retrieves the output of the "dmesg" command. +-- @return String containing the current log buffer +function dmesg() + return luci.util.exec("dmesg") +end + --- Generates a random id with specified length. -- @param bytes Number of bytes for the unique id -- @return String containing hex encoded id diff --git a/modules/admin-full/luasrc/controller/admin/status.lua b/modules/admin-full/luasrc/controller/admin/status.lua index addc3ca74..09e7766c1 100644 --- a/modules/admin-full/luasrc/controller/admin/status.lua +++ b/modules/admin-full/luasrc/controller/admin/status.lua @@ -18,10 +18,16 @@ function index() local i18n = luci.i18n.translate entry({"admin", "status"}, template("admin_status/index"), i18n("status", "Status"), 20).index = true - entry({"admin", "status", "syslog"}, call("action_syslog"), i18n("syslog", "Systemprotokoll")) + entry({"admin", "status", "syslog"}, call("action_syslog"), i18n("syslog", "Systemprotokoll"), 1) + entry({"admin", "status", "dmesg"}, call("action_dmesg"), i18n("dmesg", "Kernelprotokoll"), 2) end function action_syslog() local syslog = luci.sys.syslog() luci.template.render("admin_status/syslog", {syslog=syslog}) -end
\ No newline at end of file +end + +function action_dmesg() + local dmesg = luci.sys.dmesg() + luci.template.render("admin_status/dmesg", {dmesg=dmesg}) +end diff --git a/modules/admin-full/luasrc/view/admin_status/dmesg.htm b/modules/admin-full/luasrc/view/admin_status/dmesg.htm new file mode 100644 index 000000000..4fa867397 --- /dev/null +++ b/modules/admin-full/luasrc/view/admin_status/dmesg.htm @@ -0,0 +1,20 @@ +<%# +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: syslog.htm 3622 2008-10-23 16:05:55Z jow $ + +-%> +<%+header%> +<h2><a id="content" name="content"><%:dmesg%></a></h2> +<div id="content_syslog"> +<textarea readonly="readonly" wrap="off" rows="<%=dmesg:cmatch("\n")+2%>" id="syslog"><%=dmesg:pcdata()%></textarea> +</div> +<%+footer%> diff --git a/modules/admin-full/luasrc/view/admin_status/syslog.htm b/modules/admin-full/luasrc/view/admin_status/syslog.htm index d5bf5d65a..2e172cfbf 100644 --- a/modules/admin-full/luasrc/view/admin_status/syslog.htm +++ b/modules/admin-full/luasrc/view/admin_status/syslog.htm @@ -13,9 +13,8 @@ $Id$ -%> <%+header%> -<h2><a id="content" name="content"><%:status%></a></h2> -<h3><%:syslog%></h3> +<h2><a id="content" name="content"><%:syslog%></a></h2> <div id="content_syslog"> -<textarea readonly="readonly" wrap="off" id="syslog"><%=luci.util.pcdata(syslog)%></textarea> +<textarea readonly="readonly" wrap="off" rows="<%=syslog:cmatch("\n")+2%>" id="syslog"><%=syslog:pcdata()%></textarea> </div> <%+footer%> diff --git a/themes/fledermaus/htdocs/luci-static/fledermaus/cascade.css b/themes/fledermaus/htdocs/luci-static/fledermaus/cascade.css index 590e06298..f9adadee8 100644 --- a/themes/fledermaus/htdocs/luci-static/fledermaus/cascade.css +++ b/themes/fledermaus/htdocs/luci-static/fledermaus/cascade.css @@ -191,6 +191,14 @@ div#maincontent ul { margin-bottom: 1em; } +textarea#syslog { + width: 98%; + min-height: 500px; + border: 3px solid #cccccc; + padding: 5px; + font-family: monospace; +} + .cbi-section { margin-bottom: 0.5em; padding: 0.5em 1em; diff --git a/themes/openwrt-light/htdocs/luci-static/openwrt-light/cascade.css b/themes/openwrt-light/htdocs/luci-static/openwrt-light/cascade.css index 6c0e282c5..a26e66222 100644 --- a/themes/openwrt-light/htdocs/luci-static/openwrt-light/cascade.css +++ b/themes/openwrt-light/htdocs/luci-static/openwrt-light/cascade.css @@ -356,6 +356,14 @@ html #menubar a:visited.warning { margin-bottom: 1em; } +textarea#syslog { + width: 98%; + min-height: 500px; + border: 3px solid #cccccc; + padding: 5px; + font-family: monospace; +} + .cbi-section { margin-bottom: 0.5em; padding: 0.5em 1em; diff --git a/themes/openwrt.org/htdocs/luci-static/openwrt.org/cascade.css b/themes/openwrt.org/htdocs/luci-static/openwrt.org/cascade.css index 2c0004cbb..8aea90999 100644 --- a/themes/openwrt.org/htdocs/luci-static/openwrt.org/cascade.css +++ b/themes/openwrt.org/htdocs/luci-static/openwrt.org/cascade.css @@ -335,11 +335,10 @@ html #menubar a:visited.warning { textarea#syslog { width: 98%; - height: 450px; + min-height: 500px; border: 3px solid #cccccc; padding: 5px; font-family: monospace; - overflow: auto; } #maincontent { diff --git a/themes/oxygen/htdocs/luci-static/oxygen/cascade.css b/themes/oxygen/htdocs/luci-static/oxygen/cascade.css index 5bf14d2f9..585c9700a 100644 --- a/themes/oxygen/htdocs/luci-static/oxygen/cascade.css +++ b/themes/oxygen/htdocs/luci-static/oxygen/cascade.css @@ -1,16 +1,16 @@ @charset "utf-8"; @media all { - + html, body { height: 100%; } - + body { font-family: Verdana, Arial, sans-serif; font-size: 101%; line-height: 100%; - background: #557788 url(bg.png) no-repeat; + background: #557788 url(bg.png) no-repeat; } div#screen { @@ -110,13 +110,13 @@ code { color: #ffffff; width: 80%; font-size: 0.8em; - + margin: 0.5em auto; - + padding: 0.25em; padding-left: 0.5em; padding-right: 0.5em; - + border: 1px solid #000000; border-radius: 0.8em; -khtml-border-radius: 0.8em; @@ -136,9 +136,9 @@ html .menubar a:visited { text-decoration: none; font-weight: bold; } - + html .menubar a.menulink { - margin-left: 1em; + margin-left: 1em; } @@ -186,7 +186,7 @@ html .menubar a:visited.warning { color: #000000; border-width: 1px solid #444444; font-size: 80%; - + border-radius: 1em; -khtml-border-radius: 1em; -moz-border-radius: 1em; @@ -211,6 +211,14 @@ html .menubar a:visited.warning { margin-bottom: 1em; } +textarea#syslog { + width: 98%; + min-height: 500px; + border: 3px solid #cccccc; + padding: 5px; + font-family: monospace; +} + .cbi-section { margin-bottom: 0.5em; padding: 0.5em 1em; |