luci-0.11: merge r9559 - r9569
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 25 Dec 2012 02:45:42 +0000 (02:45 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 25 Dec 2012 02:45:42 +0000 (02:45 +0000)
15 files changed:
applications/luci-pbx/root/etc/init.d/pbx-asterisk
applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua
applications/luci-upnp/luasrc/model/cbi/upnp/upnp.lua
build/cbi2uvl.lua [deleted file]
build/i18n-lua2po.pl [deleted file]
libs/core/luasrc/util.lua
libs/core/root/sbin/luci-reload
libs/web/luasrc/view/cbi/network_ifacelist.htm
modules/admin-full/luasrc/controller/admin/system.lua
modules/admin-full/luasrc/view/admin_network/iface_overview.htm
modules/admin-mini/luasrc/controller/mini/system.lua
modules/failsafe/luasrc/controller/failsafe/failsafe.lua
modules/niu/luasrc/controller/niu/system.lua
po/zh_CN/transmission.po
themes/bootstrap/htdocs/luci-static/bootstrap/cascade.css

index 0c41833..99663a9 100755 (executable)
@@ -17,7 +17,7 @@
 #    You should have received a copy of the GNU General Public License
 #    along with luci-pbx.  If not, see <http://www.gnu.org/licenses/>.
 
 #    You should have received a copy of the GNU General Public License
 #    along with luci-pbx.  If not, see <http://www.gnu.org/licenses/>.
 
-. /etc/functions.sh
+. /lib/functions.sh
 
 START=60
 
 
 START=60
 
index 869384c..d69b68e 100644 (file)
@@ -2,6 +2,7 @@
 
 Luci statistics - statistics controller module
 (c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net>
 
 Luci statistics - statistics controller module
 (c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net>
+(c) 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.
 
 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
 
 
         http://www.apache.org/licenses/LICENSE-2.0
 
-$Id$
-
 ]]--
 
 module("luci.controller.luci_statistics.luci_statistics", package.seeall)
 ]]--
 
 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
        -- 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
        entry({"admin", "statistics", "collectd"}, cbi("luci_statistics/collectd"), _("Collectd"), 10).subindex = true
-       
+
 
        -- populate collectd plugin menu
        local index = 1
 
        -- populate collectd plugin menu
        local index = 1
@@ -106,7 +105,8 @@ function index()
        -- get rrd data tree
        local tree = luci.statistics.datatree.Instance(host)
 
        -- 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 )
 
                -- get plugin instances
                local instances = tree:plugin_instances( plugin )
@@ -114,16 +114,17 @@ function index()
                -- plugin menu entry
                entry(
                        { "admin", "statistics", "graph", plugin },
                -- 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
                ).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 },
                                -- 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
                                ).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 hosts = graph.tree:host_instances()
 
        local is_index = false
+       local i, p, inst, idx
 
        -- deliver image
        if vars.img then
 
        -- deliver image
        if vars.img then
@@ -186,8 +188,8 @@ function statistics_render()
 
 
        -- render graphs
 
 
        -- 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
                        table.insert( images, graph:strippngpath( img ) )
                        images[images[#images]] = inst
                end
index de38afc..3d98d66 100644 (file)
@@ -13,7 +13,7 @@ You may obtain a copy of the License at
 $Id$
 ]]--
 
 $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"
        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 (executable)
index 7fe8ef5..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-#!/usr/bin/lua
---[[
-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: 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 (executable)
index d72d2e9..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-#!/usr/bin/perl
-
-@ARGV >= 2 || die "Usage: $0 <source-dir> <dest-dir> [<target-language>]\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;
-}
index e285777..da761e2 100644 (file)
@@ -4,9 +4,6 @@ LuCI - Utility library
 Description:
 Several common useful Lua functions
 
 Description:
 Several common useful Lua functions
 
-FileId:
-$Id$
-
 License:
 Copyright 2008 Steven Barth <steven@midlink.org>
 
 License:
 Copyright 2008 Steven Barth <steven@midlink.org>
 
@@ -609,6 +606,7 @@ end
 function _sortiter( t, f )
        local keys = { }
 
 function _sortiter( t, f )
        local keys = { }
 
+       local k, v
        for k, v in pairs(t) do
                keys[#keys+1] = k
        end
        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 function()
                _pos = _pos + 1
                if _pos <= #keys then
-                       return keys[_pos], t[keys[_pos]]
+                       return keys[_pos], t[keys[_pos]], _pos
                end
        end
 end
                end
        end
 end
index 4bcac04..cc41da2 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
 #!/bin/sh
-. /etc/functions.sh
+. /lib/functions.sh
 
 apply_config() {
        config_get init "$1" init
 
 apply_config() {
        config_get init "$1" init
index 727b0a4..643d849 100644 (file)
@@ -49,7 +49,7 @@
                %> /> &#160;
                <label<%=attr("for", cbid .. "." .. iface:name())%>>
                        <% if link then -%><a href="<%=link%>"><% end -%>
                %> /> &#160;
                <label<%=attr("for", cbid .. "." .. iface:name())%>>
                        <% if link then -%><a href="<%=link%>"><% end -%>
-                       <img title="<%=iface:get_type_i18n()%>" style="width:16px; height:16px; vertical-align:middle" src="<%=resource%>/icons/<%=iface:type()%><%=iface:is_up() and "" or "_disabled"%>.png" />
+                       <img<%=attr("title", iface:get_i18n())%> style="width:16px; height:16px; vertical-align:middle" src="<%=resource%>/icons/<%=iface:type()%><%=iface:is_up() and "" or "_disabled"%>.png" />
                        <% if link then -%></a><% end -%>
                        <%=pcdata(iface:get_i18n())%>
                        <% local ns = iface:get_networks(); if #ns > 0 then %>(
                        <% if link then -%></a><% end -%>
                        <%=pcdata(iface:get_i18n())%>
                        <% local ns = iface:get_networks(); if #ns > 0 then %>(
index 1087cf8..55ad01c 100644 (file)
@@ -189,7 +189,7 @@ function action_flashops()
        local function image_supported()
                -- XXX: yay...
                return ( 0 == os.execute(
        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
                        "include /lib/upgrade; " ..
                        "platform_check_image %q >/dev/null"
                                % image_tmp
index 1312b4c..4be0629 100644 (file)
@@ -176,14 +176,6 @@ You may obtain a copy of the License at
 
                                                d.innerHTML = html;
                                        }
 
                                                d.innerHTML = html;
                                        }
-                                       else if (d && !ifc.ifname)
-                                       {
-                                               d.innerHTML = String.format(
-                                                       '<em><%:Network without interfaces.%></em><br />' +
-                                                       '<a href="<%=luci.dispatcher.build_url("admin/network/network/%s")%>?tab.network.%s=physical"><%:Assign interfaces...%></a>',
-                                                               ifc.name, ifc.name
-                                               );
-                                       }
                                        else if (d && !ifc.proto)
                                        {
                                                var e = document.getElementById(ifc.id + '-ifc-edit');
                                        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'
                                                );
                                        }
                                                                '<%=luci.dispatcher.build_url("admin/system/packages")%>?query=luci-proto&display=available'
                                                );
                                        }
+                                       else if (d && !ifc.ifname)
+                                       {
+                                               d.innerHTML = String.format(
+                                                       '<em><%:Network without interfaces.%></em><br />' +
+                                                       '<a href="<%=luci.dispatcher.build_url("admin/network/network/%s")%>?tab.network.%s=physical"><%:Assign interfaces...%></a>',
+                                                               ifc.name, ifc.name
+                                               );
+                                       }
                                        else if (d)
                                        {
                                                d.innerHTML = '<em><%:Interface not present or not connected yet.%></em>';
                                        else if (d)
                                        {
                                                d.innerHTML = '<em><%:Interface not present or not connected yet.%></em>';
index 519c15b..71b5b63 100644 (file)
@@ -81,7 +81,7 @@ function action_upgrade()
        local function image_supported()
                -- XXX: yay...
                return ( 0 == os.execute(
        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
                        "include /lib/upgrade; " ..
                        "platform_check_image %q >/dev/null"
                                % tmpfile
index c37fef5..1da3438 100644 (file)
@@ -53,7 +53,7 @@ function action_flashops()
        local function image_supported()
                -- XXX: yay...
                return ( 0 == os.execute(
        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
                        "include /lib/upgrade; " ..
                        "platform_check_image %q >/dev/null"
                                % image_tmp
index 593a448..127a311 100644 (file)
@@ -127,7 +127,7 @@ function upgrade()
        local function image_supported()
                -- XXX: yay...
                return ( 0 == os.execute(
        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
                        "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     
                        keepconfig=(keep_avail and http.formvalue("keepcfg") == "1")
                } )
        end     
-end
\ No newline at end of file
+end
index 3125fc2..2537a5b 100644 (file)
@@ -274,7 +274,7 @@ msgid "in minutes from midnight"
 msgstr ""
 
 msgid "preallocation"
 msgstr ""
 
 msgid "preallocation"
-msgstr ""
+msgstr "磁盘预分配"
 
 msgid "uTP enabled"
 msgstr ""
 
 msgid "uTP enabled"
 msgstr ""
index 26f2bbb..e529129 100644 (file)
@@ -541,7 +541,7 @@ textarea {
        cursor: not-allowed;
 }
 
        cursor: not-allowed;
 }
 
-:-moz-placeholder {
+::-moz-placeholder {
        color: #bfbfbf;
 }
 
        color: #bfbfbf;
 }
 
@@ -744,7 +744,7 @@ header {
        right: 0;
        z-index: 10000;
        overflow: visible;
        right: 0;
        z-index: 10000;
        overflow: visible;
-       color: #BFBFBF
+       color: #BFBFBF;
 }
 
 header a {
 }
 
 header a {
@@ -1556,7 +1556,7 @@ footer {
 }
 
 :root .alert-message, :root .btn {
 }
 
 :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 {
 }
 
 button.btn::-moz-focus-inner, input[type=submit].btn::-moz-focus-inner {