From d1fc1dbadafd66eb56448f3cf474fd3a95853d4b Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 17 Jun 2011 11:00:38 +0000 Subject: [PATCH] luci-0.10: merge r7161, r7162, r7163, r7164, r7165 and r7166 --- .../luasrc/model/cbi/luci_fw/zone.lua | 4 +- .../root/usr/lib/luci-splash/splashtext.html | 2 +- libs/web/htdocs/luci-static/resources/cbi.js | 32 ++++- libs/web/luasrc/cbi/datatypes.lua | 29 ++++ .../freifunk/root/etc/config/profile_gadow | 14 ++ .../luci-static/freifunk-generic/mobile.css | 135 ++++++++++++++++++ .../view/themes/freifunk-generic/header.htm | 2 + 7 files changed, 214 insertions(+), 4 deletions(-) create mode 100644 modules/freifunk/root/etc/config/profile_gadow create mode 100644 themes/freifunk-generic/htdocs/luci-static/freifunk-generic/mobile.css diff --git a/applications/luci-firewall/luasrc/model/cbi/luci_fw/zone.lua b/applications/luci-firewall/luasrc/model/cbi/luci_fw/zone.lua index 30dc0084b..2bcb9a980 100644 --- a/applications/luci-firewall/luasrc/model/cbi/luci_fw/zone.lua +++ b/applications/luci-firewall/luasrc/model/cbi/luci_fw/zone.lua @@ -129,7 +129,7 @@ msrc = s:taboption("advanced", DynamicList, "masq_src", translate("Restrict Masquerading to given source subnets")) msrc.optional = true -msrc.datatype = "host" -- XXX: ipaddr & uciname +msrc.datatype = "neg_network_ip4addr" msrc.placeholder = "0.0.0.0/0" msrc:depends("family", "") msrc:depends("family", "ipv4") @@ -138,7 +138,7 @@ mdest = s:taboption("advanced", DynamicList, "masq_dest", translate("Restrict Masquerading to given destination subnets")) mdest.optional = true -mdest.datatype = "host" -- XXX: ipaddr & uciname +mdest.datatype = "neg_network_ip4addr" mdest.placeholder = "0.0.0.0/0" mdest:depends("family", "") mdest:depends("family", "ipv4") diff --git a/applications/luci-splash/root/usr/lib/luci-splash/splashtext.html b/applications/luci-splash/root/usr/lib/luci-splash/splashtext.html index 811c8a8af..8075393e7 100644 --- a/applications/luci-splash/root/usr/lib/luci-splash/splashtext.html +++ b/applications/luci-splash/root/usr/lib/luci-splash/splashtext.html @@ -18,7 +18,7 @@ Wenn Du unsere Idee gut findest und das Netz regelmässig benutzt, dann bitten w

diff --git a/libs/web/htdocs/luci-static/resources/cbi.js b/libs/web/htdocs/luci-static/resources/cbi.js index a8814d451..1cd49bc65 100644 --- a/libs/web/htdocs/luci-static/resources/cbi.js +++ b/libs/web/htdocs/luci-static/resources/cbi.js @@ -2,7 +2,7 @@ LuCI - Lua Configuration Interface Copyright 2008 Steven Barth - Copyright 2008-2010 Jo-Philipp Wich + Copyright 2008-2011 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. @@ -153,6 +153,8 @@ var cbi_validators = { 'hostname': function(v) { if ( v.length <= 253 ) return (v.match(/^[a-zA-Z0-9][a-zA-Z0-9\-.]*[a-zA-Z0-9]$/) != null); + + return false; }, 'wpakey': function(v) @@ -179,6 +181,12 @@ var cbi_validators = { return (v.match(/^[a-zA-Z0-9_]+$/) != null); }, + 'neg_network_ip4addr': function(v) + { + v = v.replace(/^\s*!/, ""); + return cbi_validators.uciname(v) || cbi_validators.ip4addr(v); + }, + 'range': function(v, args) { var min = parseInt(args[0]); @@ -188,6 +196,28 @@ var cbi_validators = { if (!isNaN(min) && !isNaN(max) && !isNaN(val)) return ((val >= min) && (val <= max)); + return false; + }, + + 'min': function(v, args) + { + var min = parseInt(args[0]); + var val = parseInt(v); + + if (!isNaN(min) && !isNaN(val)) + return (val >= min); + + return false; + }, + + 'max': function(v, args) + { + var max = parseInt(args[0]); + var val = parseInt(v); + + if (!isNaN(max) && !isNaN(val)) + return (val <= max); + return false; } }; diff --git a/libs/web/luasrc/cbi/datatypes.lua b/libs/web/luasrc/cbi/datatypes.lua index d4603cf2a..6640db639 100644 --- a/libs/web/luasrc/cbi/datatypes.lua +++ b/libs/web/luasrc/cbi/datatypes.lua @@ -227,6 +227,13 @@ function uciname(val) return (val:match("^[a-zA-Z0-9_]+$") ~= nil) end +function neg_network_ip4addr(val) + if type(v) == "string" then + v = v:gsub("^%s*!", "") + return (uciname(v) or ip4addr(v)) + end +end + function range(val, min, max) val = tonumber(val) min = tonumber(min) @@ -238,3 +245,25 @@ function range(val, min, max) return false end + +function min(val, min) + val = tonumber(val) + min = tonumber(min) + + if val ~= nil and min ~= nil then + return (val >= min) + end + + return false +end + +function max(val, max) + val = tonumber(val) + max = tonumber(max) + + if val ~= nil and max ~= nil then + return (val <= max) + end + + return false +end diff --git a/modules/freifunk/root/etc/config/profile_gadow b/modules/freifunk/root/etc/config/profile_gadow new file mode 100644 index 000000000..5b963bcbf --- /dev/null +++ b/modules/freifunk/root/etc/config/profile_gadow @@ -0,0 +1,14 @@ +config 'community' 'profile' + option 'name' 'Freifunk Gadow' + option 'homepage' 'http://gadow.freifunk.net' + option 'ssid' 'leipzig.freifunk.net' + option 'mesh_network' '104.0.0.0/8' + option 'splash_network' '10.61.0.0/16' + option 'splash_prefix' '27' + option 'latitude' '53.11' + option 'longitude' '12.61' + +config 'defaults' 'interface' + option 'netmask' '255.0.0.0' + + diff --git a/themes/freifunk-generic/htdocs/luci-static/freifunk-generic/mobile.css b/themes/freifunk-generic/htdocs/luci-static/freifunk-generic/mobile.css new file mode 100644 index 000000000..8649b34ff --- /dev/null +++ b/themes/freifunk-generic/htdocs/luci-static/freifunk-generic/mobile.css @@ -0,0 +1,135 @@ +.high_res_only{ + display:none !important; +} + +#main_bg_pattern { + position:absolute; + background: url(images/PF_background_pattern.png) repeat-x; + top:0px; + left:0px; + width:980px; + z-index:0; +} + +#main_bg { + min-height:2000px; +} + +#heading{ + margin-left:285px !important; +} + +#header{ + padding-left:0px !important; + padding-bottom:24px; +} + +#menubar{ + font-size:35px; +} + + + #maincontent .multiColumn { + margin:1em 0px; + width:100%; + } + + #maincontent .multiColumn .first{ + width:100% !important; + float:none !important; + display:block !important; + padding-right:0px; + } + + #maincontent .multiColumn .second{ + width:100% !important; + float:none !important; + display:block !important; + padding-right:0px; + } + #maincontent .multiColumn .terminateMultiColumn{ + clear:both; + float:none; + display:block; + text-align:left !important; + padding-top:2em; + } + + #maincontent ul{ + margin-bottom:1em; + } + + + + + +#sidebar_container{ + display:none; +} + +#adbar_low_res_container{ + display:block !important; +} +#main_content_container{ + margin-top:50px !important; +} + +.lt_spec{ + padding:0px; + width:54px; + height:42px; + background:transparent url(images/lt_round.png) no-repeat 0% 0% !important; +} + +#content { + margin-left:0px !important; +} + +#maincontent{ + font-size:35px!important; + line-height:40px; +} + +input[type=submit], +.cbi-button, +.cbi-button-reset, +.cbi-button-save{ + display:inline !important; + float:none !important; + padding:10px 30px !important; + margin: 0px 10px !important; + font-size:45px !important; + font-family: impact, sans-serif !important; + background:#ff8800 none !important; + border-color:#000000 !important; +} + +.cbi-input-text, +.cbi-input-select, +.cbi-input-user, +.cbi-input-password{ + display:block !important; + font-size:35px !important; + margin: 0 !important; + padding:0 !important; +} + +.cbi-value-field{ + font-size:35px; + margin:0 !important; + margin-bottom: 1em !important; + width:100% !important; +} + +.cbi-section legend{ + white-space:normal !important; +} +.cbi-section code{ + font-size:24px; +} + +.cbi-value-title{ + font-size:35px; + font-weight:bold; + float:none !important; +} diff --git a/themes/freifunk-generic/luasrc/view/themes/freifunk-generic/header.htm b/themes/freifunk-generic/luasrc/view/themes/freifunk-generic/header.htm index 9dbcf9ff3..11c7de50e 100644 --- a/themes/freifunk-generic/luasrc/view/themes/freifunk-generic/header.htm +++ b/themes/freifunk-generic/luasrc/view/themes/freifunk-generic/header.htm @@ -68,6 +68,8 @@ require("luci.http").prepare_content("application/xhtml+xml") + + <% if node and node.css then %> <% end -%> -- 2.25.1