From: Jo-Philipp Wich Date: Tue, 25 Dec 2012 02:45:42 +0000 (+0000) Subject: luci-0.11: merge r9559 - r9569 X-Git-Tag: 0.11.0~4 X-Git-Url: http://git.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=60b81d978aa8fb6e2291d7f3127f119e4068d310 luci-0.11: merge r9559 - r9569 --- diff --git a/applications/luci-pbx/root/etc/init.d/pbx-asterisk b/applications/luci-pbx/root/etc/init.d/pbx-asterisk index 0c41833cfc..99663a971a 100755 --- a/applications/luci-pbx/root/etc/init.d/pbx-asterisk +++ b/applications/luci-pbx/root/etc/init.d/pbx-asterisk @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # along with luci-pbx. If not, see . -. /etc/functions.sh +. /lib/functions.sh START=60 diff --git a/applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua b/applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua index 869384c0a6..d69b68e17a 100644 --- a/applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua +++ b/applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua @@ -2,6 +2,7 @@ Luci statistics - statistics controller module (c) 2008 Freifunk Leipzig / Jo-Philipp Wich +(c) 2012 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. @@ -9,8 +10,6 @@ You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -$Id$ - ]]-- module("luci.controller.luci_statistics.luci_statistics", package.seeall) @@ -69,9 +68,9 @@ function index() -- create toplevel menu nodes local st = entry({"admin", "statistics"}, template("admin_statistics/index"), _("Statistics"), 80) st.index = true - + entry({"admin", "statistics", "collectd"}, cbi("luci_statistics/collectd"), _("Collectd"), 10).subindex = true - + -- populate collectd plugin menu local index = 1 @@ -106,7 +105,8 @@ function index() -- get rrd data tree local tree = luci.statistics.datatree.Instance(host) - for i, plugin in luci.util.vspairs( tree:plugins() ) do + local _, plugin, idx + for _, plugin, idx in luci.util.vspairs( tree:plugins() ) do -- get plugin instances local instances = tree:plugin_instances( plugin ) @@ -114,16 +114,17 @@ function index() -- plugin menu entry entry( { "admin", "statistics", "graph", plugin }, - call("statistics_render"), labels[plugin], i + call("statistics_render"), labels[plugin], idx ).query = { timespan = span , host = host } -- if more then one instance is found then generate submenu if #instances > 1 then - for j, inst in luci.util.vspairs(instances) do + local _, inst, idx2 + for _, inst, idx2 in luci.util.vspairs(instances) do -- instance menu entry entry( { "admin", "statistics", "graph", plugin, inst }, - call("statistics_render"), inst, j + call("statistics_render"), inst, idx2 ).query = { timespan = span , host = host } end end @@ -148,6 +149,7 @@ function statistics_render() local hosts = graph.tree:host_instances() local is_index = false + local i, p, inst, idx -- deliver image if vars.img then @@ -186,8 +188,8 @@ function statistics_render() -- render graphs - for i, inst in ipairs( instances ) do - for i, img in ipairs( graph:render( plugin, inst, is_index ) ) do + for i, inst in luci.util.vspairs( instances ) do + for i, img in luci.util.vspairs( graph:render( plugin, inst, is_index ) ) do table.insert( images, graph:strippngpath( img ) ) images[images[#images]] = inst end diff --git a/applications/luci-upnp/luasrc/model/cbi/upnp/upnp.lua b/applications/luci-upnp/luasrc/model/cbi/upnp/upnp.lua index de38afc712..3d98d6682f 100644 --- a/applications/luci-upnp/luasrc/model/cbi/upnp/upnp.lua +++ b/applications/luci-upnp/luasrc/model/cbi/upnp/upnp.lua @@ -13,7 +13,7 @@ You may obtain a copy of the License at $Id$ ]]-- -m = Map("upnpd", translate("Universal Plug & Play"), +m = Map("upnpd", luci.util.pcdata(translate("Universal Plug & Play")), translate("UPnP allows clients in the local network to automatically configure the router.")) m:section(SimpleSection).template = "upnp_status" diff --git a/build/cbi2uvl.lua b/build/cbi2uvl.lua deleted file mode 100755 index 7fe8ef5744..0000000000 --- a/build/cbi2uvl.lua +++ /dev/null @@ -1,133 +0,0 @@ -#!/usr/bin/lua ---[[ -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: index.lua 3548 2008-10-09 20:28:07Z Cyrus $ -]]-- - -local cbi = require "luci.cbi" -local i18n = require "luci.i18n" -local util = require "luci.util" - -if not arg[1] then - util.perror("Usage %s path/to/cbi/model.lua [i18nfilename]" % arg[0]) - os.exit(1) -end - -i18n.load("base", "en") - -if arg[2] then - i18n.load(arg[2], "en") -end - -if arg[3] then - pcall(function() - require "uci" - require "luci.model.uci".cursor = function(config, save) - return uci.cursor(config or arg[3] .. "/etc/config", save or arg[3] .. "/tmp/.uci") - end - end) -end - -local map = cbi.load(arg[1])[1] -assert(map) - -print ("package "..map.config) -print ("\nconfig package") - -if #map.title > 0 then - print (" option title '%s'" % util.striptags(map.title)) -end - -if #map.description > 0 then - print (" option description '%s'" % util.striptags(map.description)) -end - -for i, sec in pairs(map.children) do if util.instanceof(sec, cbi.AbstractSection) then - print ("\nconfig section") - print (" option name '%s'" % sec.sectiontype) - print (" option package '%s'" % map.config) - - if #sec.title > 0 then - print (" option title '%s'" % util.striptags(sec.title)) - end - - if #sec.description > 0 then - print (" option description '%s'" % util.striptags(sec.description)) - end - - if not sec.addremove then - print (" option unique true") - print (" option required true") - end - - if not sec.anonymous then - print (" option named true") - end - - if sec.dynamic then - print (" option dynamic true") - end - - for j, opt in ipairs(sec.children) do - if opt.option:sub(1,1) ~= "_" or util.instanceof(opt, cbi.Value) then - print ("\nconfig variable") - print (" option name '%s'" % opt.option) - print (" option section '%s.%s'" % {map.config, sec.sectiontype}) - if #opt.title > 0 then - print (" option title '%s'" % util.striptags(opt.title)) - end - - if #opt.description > 0 then - print (" option description '%s'" % util.striptags(opt.description)) - end - - if not opt.rmempty and not opt.optional then - print (" option required true") - end - - if util.instanceof(opt, cbi.Flag) then - print (" option datatype boolean") - elseif util.instanceof(opt, cbi.DynamicList) then - print (" option type list") - elseif util.instanceof(opt, cbi.ListValue) then - print (" option type enum") - util.perror("*** Warning: Please verify '%s.%s.%s' ***" % - {map.config, sec.sectiontype, opt.option} ) - end - - for i, dep in ipairs(opt.deps) do - if not dep.add or dep.add == "" then - local depstring - for k, v in pairs(dep.deps) do - depstring = (depstring and depstring .. "," or "") .. "%s=%s" % {k, v} - end - print (" list depends '%s'" % depstring) - else - util.perror("*** Warning: Unable to decode dependency '%s' in '%s.%s.%s[%s]' ***" % - {util.serialize_data(dep.deps), map.config, sec.sectiontype, opt.option, dep.add}) - end - end - - if util.instanceof(opt, cbi.ListValue) then - for k, key in ipairs(opt.keylist) do - print ("\nconfig enum") - print (" option variable '%s.%s.%s'" % {map.config, sec.sectiontype, opt.option}) - print (" option value '%s'" % key) - if opt.vallist[k] and opt.vallist[k] ~= opt.keylist[k] then - print (" option title '%s'" % util.striptags(opt.vallist[k])) - end - end - end - end - end -end end diff --git a/build/i18n-lua2po.pl b/build/i18n-lua2po.pl deleted file mode 100755 index d72d2e9755..0000000000 --- a/build/i18n-lua2po.pl +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/perl - -@ARGV >= 2 || die "Usage: $0 []\n"; - -my $source_dir = shift @ARGV; -my $target_dir = shift @ARGV; -my $target_lang = shift @ARGV; -my $master_lang = "en"; - - -if( ! -d "$target_dir/" . ( $target_lang || 'templates' ) ) -{ - system('mkdir', '-p', "$target_dir/" . ( $target_lang || 'templates' )); -} - - -my %target_strings; - -if( $target_lang && open F, "find $source_dir -path '*/luasrc/i18n/*' -name '*.$target_lang.lua' |" ) -{ - while( chomp( my $file = readline F ) ) - { - if( open L, "< $file" ) - { - my ( $basename ) = $file =~ m{.+/([^/]+)\.[\w\-]+\.lua$}; - $target_strings{$basename} = { }; - - while( chomp( my $entry = readline L ) ) - { - my ( $k, $v ); - if( $entry =~ /^\s*(\w+)\s*=\s*\[\[(.+)\]\]/ ) - { - ( $k, $v ) = ( $1, $2 ); - } - elsif( $entry =~ /^\s*(\w+)\s*=\s*'(.+)'/ ) - { - ( $k, $v ) = ( $1, $2 ); - } - elsif( $entry =~ /^\s*(\w+)\s*=\s*"(.+)"/ ) - { - ( $k, $v ) = ( $1, $2 ); - } - - if( $k && $v ) - { - $v =~ s/"/\\"/g; - $v =~ s/\\\\"/\\"/g; - $target_strings{$basename}{$k} = $v; - } - } - - close L; - } - } - - close F; -} - - -if( open F, "find . -path '*/luasrc/i18n/*' -name '*.$master_lang.lua' |" ) -{ - my $destfile = sprintf '%s/%s/%%s.%s', - $target_dir, - $target_lang || 'templates', - $target_lang ? 'po' : 'pot' - ; - - while( chomp( my $file = readline F ) ) - { - if( open L, "< $file" ) - { - my ( $basename ) = $file =~ m{.+/([^/]+)\.\w+\.lua$}; - my $filename = sprintf $destfile, $basename; - - if( open T, "> $filename" ) - { - printf "Generating %-40s ", $filename; - - printf T "# %s.%s\n# generated from %s\n\nmsgid \"\"\n" . - "msgstr \"Content-Type: text/plain; charset=UTF-8\"\n\n", - $basename, $target_lang ? 'po' : 'pot', $file; - - while( chomp( my $entry = readline L ) ) - { - my ( $k, $v ); - if( $entry =~ /^\s*(\w+)\s*=\s*\[\[(.+)\]\]/ ) - { - ( $k, $v ) = ( $1, $2 ); - } - elsif( $entry =~ /^\s*(\w+)\s*=\s*'(.+)'/ ) - { - ( $k, $v ) = ( $1, $2 ); - } - elsif( $entry =~ /^\s*(\w+)\s*=\s*"(.+)"/ ) - { - ( $k, $v ) = ( $1, $2 ); - } - - if( $k && $v ) - { - $v =~ s/"/\\"/g; - $v =~ s/\\\\"/\\"/g; - printf T "#: %s:%d\n#. %s\nmsgid \"%s\"\nmsgstr \"%s\"\n\n", - $file, $., $v, $k, - ( $target_strings{$basename} && $target_strings{$basename}{$k} ) - ? $target_strings{$basename}{$k} : ""; - } - } - - close T; - - print "done\n"; - } - - close L; - } - } - - close F; -} diff --git a/libs/core/luasrc/util.lua b/libs/core/luasrc/util.lua index e285777c31..da761e219a 100644 --- a/libs/core/luasrc/util.lua +++ b/libs/core/luasrc/util.lua @@ -4,9 +4,6 @@ LuCI - Utility library Description: Several common useful Lua functions -FileId: -$Id$ - License: Copyright 2008 Steven Barth @@ -609,6 +606,7 @@ end function _sortiter( t, f ) local keys = { } + local k, v for k, v in pairs(t) do keys[#keys+1] = k end @@ -620,7 +618,7 @@ function _sortiter( t, f ) return function() _pos = _pos + 1 if _pos <= #keys then - return keys[_pos], t[keys[_pos]] + return keys[_pos], t[keys[_pos]], _pos end end end diff --git a/libs/core/root/sbin/luci-reload b/libs/core/root/sbin/luci-reload index 4bcac045b3..cc41da2bb7 100755 --- a/libs/core/root/sbin/luci-reload +++ b/libs/core/root/sbin/luci-reload @@ -1,5 +1,5 @@ #!/bin/sh -. /etc/functions.sh +. /lib/functions.sh apply_config() { config_get init "$1" init diff --git a/libs/web/luasrc/view/cbi/network_ifacelist.htm b/libs/web/luasrc/view/cbi/network_ifacelist.htm index 727b0a4a66..643d849a50 100644 --- a/libs/web/luasrc/view/cbi/network_ifacelist.htm +++ b/libs/web/luasrc/view/cbi/network_ifacelist.htm @@ -49,7 +49,7 @@ %> />   > <% if link then -%><% end -%> - .png" /> + style="width:16px; height:16px; vertical-align:middle" src="<%=resource%>/icons/<%=iface:type()%><%=iface:is_up() and "" or "_disabled"%>.png" /> <% if link then -%><% end -%> <%=pcdata(iface:get_i18n())%> <% local ns = iface:get_networks(); if #ns > 0 then %>( diff --git a/modules/admin-full/luasrc/controller/admin/system.lua b/modules/admin-full/luasrc/controller/admin/system.lua index 1087cf8db6..55ad01ca48 100644 --- a/modules/admin-full/luasrc/controller/admin/system.lua +++ b/modules/admin-full/luasrc/controller/admin/system.lua @@ -189,7 +189,7 @@ function action_flashops() local function image_supported() -- XXX: yay... return ( 0 == os.execute( - ". /etc/functions.sh; " .. + ". /lib/functions.sh; " .. "include /lib/upgrade; " .. "platform_check_image %q >/dev/null" % image_tmp diff --git a/modules/admin-full/luasrc/view/admin_network/iface_overview.htm b/modules/admin-full/luasrc/view/admin_network/iface_overview.htm index 1312b4c16d..4be062985a 100644 --- a/modules/admin-full/luasrc/view/admin_network/iface_overview.htm +++ b/modules/admin-full/luasrc/view/admin_network/iface_overview.htm @@ -176,14 +176,6 @@ You may obtain a copy of the License at d.innerHTML = html; } - else if (d && !ifc.ifname) - { - d.innerHTML = String.format( - '<%:Network without interfaces.%>
' + - '?tab.network.%s=physical"><%:Assign interfaces...%>', - ifc.name, ifc.name - ); - } else if (d && !ifc.proto) { var e = document.getElementById(ifc.id + '-ifc-edit'); @@ -196,6 +188,14 @@ You may obtain a copy of the License at '<%=luci.dispatcher.build_url("admin/system/packages")%>?query=luci-proto&display=available' ); } + else if (d && !ifc.ifname) + { + d.innerHTML = String.format( + '<%:Network without interfaces.%>
' + + '?tab.network.%s=physical"><%:Assign interfaces...%>', + ifc.name, ifc.name + ); + } else if (d) { d.innerHTML = '<%:Interface not present or not connected yet.%>'; diff --git a/modules/admin-mini/luasrc/controller/mini/system.lua b/modules/admin-mini/luasrc/controller/mini/system.lua index 519c15bc63..71b5b63519 100644 --- a/modules/admin-mini/luasrc/controller/mini/system.lua +++ b/modules/admin-mini/luasrc/controller/mini/system.lua @@ -81,7 +81,7 @@ function action_upgrade() local function image_supported() -- XXX: yay... return ( 0 == os.execute( - ". /etc/functions.sh; " .. + ". /lib/functions.sh; " .. "include /lib/upgrade; " .. "platform_check_image %q >/dev/null" % tmpfile diff --git a/modules/failsafe/luasrc/controller/failsafe/failsafe.lua b/modules/failsafe/luasrc/controller/failsafe/failsafe.lua index c37fef597c..1da3438f8f 100644 --- a/modules/failsafe/luasrc/controller/failsafe/failsafe.lua +++ b/modules/failsafe/luasrc/controller/failsafe/failsafe.lua @@ -53,7 +53,7 @@ function action_flashops() local function image_supported() -- XXX: yay... return ( 0 == os.execute( - ". /etc/functions.sh; " .. + ". /lib/functions.sh; " .. "include /lib/upgrade; " .. "platform_check_image %q >/dev/null" % image_tmp diff --git a/modules/niu/luasrc/controller/niu/system.lua b/modules/niu/luasrc/controller/niu/system.lua index 593a448839..127a311c57 100644 --- a/modules/niu/luasrc/controller/niu/system.lua +++ b/modules/niu/luasrc/controller/niu/system.lua @@ -127,7 +127,7 @@ function upgrade() local function image_supported() -- XXX: yay... return ( 0 == os.execute( - ". /etc/functions.sh; " .. + ". /lib/functions.sh; " .. "include /lib/upgrade; " .. "platform_check_image %q >/dev/null" % tmpfile @@ -262,4 +262,4 @@ function upgrade() keepconfig=(keep_avail and http.formvalue("keepcfg") == "1") } ) end -end \ No newline at end of file +end diff --git a/po/zh_CN/transmission.po b/po/zh_CN/transmission.po index 3125fc2751..2537a5bf25 100644 --- a/po/zh_CN/transmission.po +++ b/po/zh_CN/transmission.po @@ -274,7 +274,7 @@ msgid "in minutes from midnight" msgstr "" msgid "preallocation" -msgstr "" +msgstr "磁盘预分配" msgid "uTP enabled" msgstr "" diff --git a/themes/bootstrap/htdocs/luci-static/bootstrap/cascade.css b/themes/bootstrap/htdocs/luci-static/bootstrap/cascade.css index 26f2bbb2e1..e529129e08 100644 --- a/themes/bootstrap/htdocs/luci-static/bootstrap/cascade.css +++ b/themes/bootstrap/htdocs/luci-static/bootstrap/cascade.css @@ -541,7 +541,7 @@ textarea { cursor: not-allowed; } -:-moz-placeholder { +::-moz-placeholder { color: #bfbfbf; } @@ -744,7 +744,7 @@ header { right: 0; z-index: 10000; overflow: visible; - color: #BFBFBF + color: #BFBFBF; } header a { @@ -1556,7 +1556,7 @@ footer { } :root .alert-message, :root .btn { - border-radius: 0 \0; + border-radius: 0 0; } button.btn::-moz-focus-inner, input[type=submit].btn::-moz-focus-inner {