* core: Fixed a bug in the dispatcher
authorSteven Barth <steven@midlink.org>
Sun, 25 May 2008 17:41:51 +0000 (17:41 +0000)
committerSteven Barth <steven@midlink.org>
Sun, 25 May 2008 17:41:51 +0000 (17:41 +0000)
* core: Move cbi.js to general resource directory
* core: Removed Freifunk references
* core: Updated Fledermaus theme

core/root/etc/config/luci
core/root/www/resources/cbi.js [new file with mode: 0644]
core/src/dispatcher.lua
core/src/sys.lua
core/src/view/cbi/header.htm
core/src/view/header.htm
themes/fledermaus/root/www/luci/fledermaus/cascade.css [new file with mode: 0644]
themes/fledermaus/root/www/luci/fledermaus/logo.png [new file with mode: 0644]
themes/fledermaus/root/www/luci/media/cascade.css [deleted file]
themes/fledermaus/root/www/luci/media/cbi.js [deleted file]
themes/fledermaus/root/www/luci/media/logo.png [deleted file]

index ded6578..87170a9 100644 (file)
@@ -1,35 +1,39 @@
 config core main
-    option lang de
-    option mediaurlbase /luci/media
-       option resourcebase /luci/images
-       option title            "Freifunk Kamikaze"
-       option subtitle         Fledermausedition
+       option lang de
+       option mediaurlbase /luci/fledermaus
+       option resourcebase /luci/resources
+       
+config core brand
+       option title            "OpenWRT Kamikaze"
+       option subtitle         Freifunkedition
+       option firmware         "OpenWRT Kamikaze"
+       option distro           "Freifunk Firmware 2.x"
                
 config extern flash_keep
-               option uci              "/etc/config"
-               option dropbear "/etc/dropbear"
-               option openvpn  "/etc/openvpn"
-               option passwd   "/etc/passwd"
-               option ipkg             "/etc/ipkg.conf"
-               option httpd    "/etc/httpd.conf"
-               option firewall "/etc/firewall.user"
+       option uci              "/etc/config"
+       option dropbear "/etc/dropbear"
+       option openvpn  "/etc/openvpn"
+       option passwd   "/etc/passwd"
+       option ipkg             "/etc/ipkg.conf"
+       option httpd    "/etc/httpd.conf"
+       option firewall "/etc/firewall.user"
 
 config event uci_oncommit
-        option network "/etc/init.d/network restart"
-        option wireless        "/etc/init.d/network restart"
-        option olsr            "/sbin/reboot"
-        option dhcp            "/etc/init.d/dnsmasq restart"
-        option luci_fw  "/etc/init.d/luci_fw restart"
-        option dropbear "/etc/init.d/dropbear restart"
-        option httpd   "/etc/init.d/httpd restart"
-        option fstab   "/etc/init.d/fstab restart"
-        option qos             "/etc/init.d/qos restart"
-        option luci_splash "/etc/init.d/luci_splash restart"
-        option freifunk "/etc/init.d/luci_freifunk restart"
+       option network  "/etc/init.d/network restart"
+       option wireless "/etc/init.d/network restart"
+       option olsr             "/sbin/reboot"
+       option dhcp             "/etc/init.d/dnsmasq restart"
+       option luci_fw  "/etc/init.d/luci_fw restart"
+       option dropbear "/etc/init.d/dropbear restart"
+       option httpd    "/etc/init.d/httpd restart"
+       option fstab    "/etc/init.d/fstab restart"
+       option qos              "/etc/init.d/qos restart"
+       option luci_splash "/etc/init.d/luci_splash restart"
+       option freifunk "/etc/init.d/luci_freifunk restart"
         
 config internal languages
-               option de "Deutsch"
-               option en "English"
+       option de "Deutsch"
+       option en "English"
                
 config internal themes
-               option Fledermaus "/luci/media"
+       option Fledermaus "/luci/fledermaus"
diff --git a/core/root/www/resources/cbi.js b/core/root/www/resources/cbi.js
new file mode 100644 (file)
index 0000000..a3a47aa
--- /dev/null
@@ -0,0 +1,42 @@
+var cbi_d = {};
+
+function cbi_d_add(field, target, value) {
+       if (!cbi_d[target]) {
+               cbi_d[target] = {};
+       }
+       if (!cbi_d[target][value]) {
+               cbi_d[target][value] = [];
+       }
+       cbi_d[target][value].push(field);
+}
+
+function cbi_d_update(target) {
+       if (!cbi_d[target]) {
+               return;
+       }
+       
+       for (var x in cbi_d[target]) {
+               for (var i=0; i<cbi_d[target][x].length; i++) { 
+                       var y = document.getElementById(cbi_d[target][x][i])    
+                       y.style.display = "none";
+               }
+       }
+       
+       var t = document.getElementById(target);
+       if (t && t.value && cbi_d[target][t.value]) {
+               for (var i=0; i<cbi_d[target][t.value].length; i++) {                   
+                       var y = document.getElementById(cbi_d[target][t.value][i])
+                       if (!y.value) { 
+                               y.style.display = "table-row";
+                       } else {
+                               y.style.display = "block";
+                       }
+               }
+       }
+}
+
+function cbi_d_init() {
+       for (var x in cbi_d) {
+               cbi_d_update(x);
+       }
+}
\ No newline at end of file
index daf975e..3e8b4d6 100644 (file)
@@ -128,8 +128,8 @@ function createindex()
        local suff = ".lua"
 
        local controllers = luci.util.combine(
-               luci.fs.glob(root .. "*" .. suff),
-               luci.fs.glob(root .. "*/*" .. suff)
+               luci.fs.glob(root .. "*" .. suff) or {},
+               luci.fs.glob(root .. "*/*" .. suff) or {}
        )
 
        for i,c in ipairs(controllers) do
index d174c8e..0399d0e 100644 (file)
@@ -28,12 +28,15 @@ module("luci.sys", package.seeall)
 require("posix")
 require("luci.bits")
 require("luci.util")
+require("luci.fs")
 
 -- Returns whether a system is bigendian
 function bigendian()
        local fp = io.open("/bin/sh")
        fp:seek("set", 5)
-       return (fp:read(1):byte() ~= 1)
+       local be = (fp:read(1):byte() ~= 1)
+       fp:close()
+       return be
 end
 
 -- Runs "command" and returns its output
index a66d28f..4229aaf 100644 (file)
@@ -1,7 +1,7 @@
 <%+header%>
                <form method="post" action="<%=luci.http.env.REQUEST_URI%>">
                        <div>
-                               <script type="text/javascript" src="<%=media%>/cbi.js"></script>
+                               <script type="text/javascript" src="<%=resource%>/cbi.js"></script>
                                <input type="hidden" name="cbi.submit" value="1" />
                                <input type="submit" value="<%:save Speichern%>" class="hidden" />
                        </div>
index 126eb36..1a09ad3 100644 (file)
@@ -31,16 +31,16 @@ require("luci.http").prepare_content("text/html")
 </head>
 <body>
 <div id="header">
-       <div class="headerlogo left"><img src="<%=media%>/logo.png" alt="Freifunk" /></div>
+       <div class="headerlogo left"><img src="<%=media%>/logo.png" alt="<%=luci.config.brand.title%>" /></div>
        <div class="whitetext smalltext right">
-       OpenWRT Kamikaze<br />
-       Freifunk Firmware 2.0-dev<br />
+       <%=luci.config.brand.firmware%><br />
+       <%=luci.config.brand.distribution%><br />
        <%:load Last%>: <%=load1%> <%=load5%> <%=load15%><br />
        <%:hostname Hostname%>: <%=luci.sys.hostname()%> 
        </div>
        <div>
-               <span class="headertitle"><%~luci.main.title%></span><br />
-               <span class="whitetext bold"><%~luci.main.subtitle%></span>
+               <span class="headertitle"><%=luci.config.brand.title%></span><br />
+               <span class="whitetext bold"><%=luci.config.brand.subtitle%></span>
        </div>
 </div>
 
diff --git a/themes/fledermaus/root/www/luci/fledermaus/cascade.css b/themes/fledermaus/root/www/luci/fledermaus/cascade.css
new file mode 100644 (file)
index 0000000..5920254
--- /dev/null
@@ -0,0 +1,303 @@
+@charset "utf-8";
+
+body {
+       font-family: Verdana, Arial, sans-serif;
+       background-color: #aaaaaa;
+}
+
+h1 {
+       margin: 0%;
+       font-size: 1.4em;
+       font-weight: bold;
+       margin-bottom: 0.5em;
+}
+
+h2 {
+       margin: 0%;
+       font-size: 1.2em;
+       font-weight: bold;
+}
+
+h3 {
+       margin: 0%;
+}
+
+#header {
+       padding: 0.2em;
+       height: 4.5em;
+       background-color: #262626;
+}
+
+#columns {
+       border-left: 10.1em solid #262626;
+       border-right: 10.1em solid #262626;
+       display: block;
+       background-color: white;
+       padding: 0.1em;
+}
+
+#columnswrapper {
+       display: block;
+       margin-left: -10em;
+       margin-right: -10em;
+}
+
+#content {
+       margin-left: 14em;
+       margin-right: 14em;
+       display: block;
+       position: relative;
+       padding: 2px;
+       font-size: 0.8em;
+}
+
+.headerlogo {
+       height: 4em;
+       padding: 5px;
+}
+
+.headerlogo img {
+       height: 100%;
+}
+
+.headertitle {
+       font-size: 2.4em;
+       color: gray;
+       letter-spacing: 0.5em;
+       text-transform: lowercase;
+}
+
+.separator {
+       padding-left: 0.25em;
+       font-weight: bold;
+       font-size: 0.8em;
+       line-height: 1.4em;
+}
+
+.whitetext {
+       color: white;
+}
+
+.yellowtext {
+       color: #ffcb05;
+}
+
+.magentatext {
+       color: #dc0065;
+}
+
+.inheritcolor {
+       color: inherit;
+}
+
+.smalltext {
+       font-size: 0.8em;
+}
+
+.yellow {
+       background-color: #ffcb05;
+}
+
+.magenta {
+       background-color: #dc0065;
+}
+
+.nodeco {
+       text-decoration: none;
+}
+
+.redhover:hover {
+       color: red;
+}
+
+.bold {
+       font-weight: bold;
+}
+
+.sidebar {
+       position: relative;
+       padding: 0.25em;
+       color: gray;
+       width: 9em;
+       font-weight: bold;
+}
+
+.separator a, .sidebar a {
+       color: inherit;
+       text-decoration: inherit;
+}
+
+.separator a:hover, .sidebar a:hover {
+       color: red;
+}
+
+.sidebar div {
+       padding-bottom: 0.5em;
+}
+
+.sidebar ul {
+       font-size: 0.8em;
+       color: white;
+       list-style-type: none;
+       padding-left: 1em;
+       margin-top: 0%;
+}
+
+.table {
+       display: table;
+}
+
+.table-row {
+       display: table-row;
+}
+
+.table-cell {
+       display: table-cell;
+}
+
+.left {
+       float: left;
+       text-align: left;
+}
+
+.right {
+       float: right;
+       text-align: right;
+}
+
+.clear {
+       clear: both;
+}
+
+.hidden {
+       display: none;
+}
+
+.inline {
+       display: inline;
+}
+
+.code {
+       background: #f7f7f7;
+       border: 1px solid #d7d7d7;
+       margin: 1em 1.75em;
+       padding: 1em;
+}
+
+code {
+       display: block;
+       background: #f7f7f7;
+       border: 1px solid #d7d7d7;
+       margin: 1em 1.75em;
+       padding: 1em;
+       overflow: auto;
+       white-space: pre;
+}
+
+table th, table, td {
+       vertical-align: top;
+       text-align: left;
+       border: 1px solid gray;
+}
+
+.cbi-section {
+       margin-top: 1em;
+}
+
+.cbi-section-remove {
+       text-align: right;
+}
+
+.cbi-value {
+       display: table-row;
+}
+
+.cbi-value-title {
+       display: table-cell;
+       line-height: 1.75em;
+       font-weight: bold;
+       padding: 0.25em;
+}
+
+.cbi-value-field {
+       display: table-cell;
+       text-align: left;
+       padding: 0.25em;
+       line-height: 1.75em;
+}
+
+.cbi-value-field input, .cbi-value-field select,
+.cbi-optionals select, .cbi-optionals input,
+.cbi-section-remove input, .cbi-section-create input  {
+       font-size: 0.8em;
+       margin: 0%;
+}
+
+.cbi-section-descr {
+       padding-bottom: 1em;
+}
+
+.cbi-value-description {
+       display: inline;
+       font-style: italic;
+       font-size: 0.8em; 
+       padding: 0.25em;
+       margin-bottom: 0.5em;
+}
+
+.cbi-form-separator {
+       margin-top: 1em;
+}
+
+.cbi-section-node {
+       display: table;
+       padding: 0.25em;
+       background: #f7f7f7;
+       border: 1px solid #d7d7d7;
+}
+
+.cbi-section-row {
+       display: table-row;
+}
+
+.cbi-section-row-head {
+       display: table-cell;
+       font-weight: bold;
+       padding: 0.25em;
+}
+
+.cbi-section-row-descr {
+       display: table-cell;
+       padding: 0.25em;
+       font-size: 0.8em;
+}
+
+.cbi-section-node h3 {
+       margin-bottom: 0.5em;
+}
+
+.cbi-error {
+       color: red;
+       font-weight: bold;
+       font-size: 0.8em;
+       margin-bottom: 0.75em;
+}
+
+.cbi-optionals {
+       margin-top: 1em;
+       display: table-cell;
+}
+
+.cbi-optionals option {
+       font-size: 0.8em;
+}
+
+.error {
+       color: red;
+       font-weight: bold;
+}
+
+.ok {
+       color: green;
+       font-weight: bold;
+}
\ No newline at end of file
diff --git a/themes/fledermaus/root/www/luci/fledermaus/logo.png b/themes/fledermaus/root/www/luci/fledermaus/logo.png
new file mode 100644 (file)
index 0000000..d4c5dd9
Binary files /dev/null and b/themes/fledermaus/root/www/luci/fledermaus/logo.png differ
diff --git a/themes/fledermaus/root/www/luci/media/cascade.css b/themes/fledermaus/root/www/luci/media/cascade.css
deleted file mode 100644 (file)
index 5920254..0000000
+++ /dev/null
@@ -1,303 +0,0 @@
-@charset "utf-8";
-
-body {
-       font-family: Verdana, Arial, sans-serif;
-       background-color: #aaaaaa;
-}
-
-h1 {
-       margin: 0%;
-       font-size: 1.4em;
-       font-weight: bold;
-       margin-bottom: 0.5em;
-}
-
-h2 {
-       margin: 0%;
-       font-size: 1.2em;
-       font-weight: bold;
-}
-
-h3 {
-       margin: 0%;
-}
-
-#header {
-       padding: 0.2em;
-       height: 4.5em;
-       background-color: #262626;
-}
-
-#columns {
-       border-left: 10.1em solid #262626;
-       border-right: 10.1em solid #262626;
-       display: block;
-       background-color: white;
-       padding: 0.1em;
-}
-
-#columnswrapper {
-       display: block;
-       margin-left: -10em;
-       margin-right: -10em;
-}
-
-#content {
-       margin-left: 14em;
-       margin-right: 14em;
-       display: block;
-       position: relative;
-       padding: 2px;
-       font-size: 0.8em;
-}
-
-.headerlogo {
-       height: 4em;
-       padding: 5px;
-}
-
-.headerlogo img {
-       height: 100%;
-}
-
-.headertitle {
-       font-size: 2.4em;
-       color: gray;
-       letter-spacing: 0.5em;
-       text-transform: lowercase;
-}
-
-.separator {
-       padding-left: 0.25em;
-       font-weight: bold;
-       font-size: 0.8em;
-       line-height: 1.4em;
-}
-
-.whitetext {
-       color: white;
-}
-
-.yellowtext {
-       color: #ffcb05;
-}
-
-.magentatext {
-       color: #dc0065;
-}
-
-.inheritcolor {
-       color: inherit;
-}
-
-.smalltext {
-       font-size: 0.8em;
-}
-
-.yellow {
-       background-color: #ffcb05;
-}
-
-.magenta {
-       background-color: #dc0065;
-}
-
-.nodeco {
-       text-decoration: none;
-}
-
-.redhover:hover {
-       color: red;
-}
-
-.bold {
-       font-weight: bold;
-}
-
-.sidebar {
-       position: relative;
-       padding: 0.25em;
-       color: gray;
-       width: 9em;
-       font-weight: bold;
-}
-
-.separator a, .sidebar a {
-       color: inherit;
-       text-decoration: inherit;
-}
-
-.separator a:hover, .sidebar a:hover {
-       color: red;
-}
-
-.sidebar div {
-       padding-bottom: 0.5em;
-}
-
-.sidebar ul {
-       font-size: 0.8em;
-       color: white;
-       list-style-type: none;
-       padding-left: 1em;
-       margin-top: 0%;
-}
-
-.table {
-       display: table;
-}
-
-.table-row {
-       display: table-row;
-}
-
-.table-cell {
-       display: table-cell;
-}
-
-.left {
-       float: left;
-       text-align: left;
-}
-
-.right {
-       float: right;
-       text-align: right;
-}
-
-.clear {
-       clear: both;
-}
-
-.hidden {
-       display: none;
-}
-
-.inline {
-       display: inline;
-}
-
-.code {
-       background: #f7f7f7;
-       border: 1px solid #d7d7d7;
-       margin: 1em 1.75em;
-       padding: 1em;
-}
-
-code {
-       display: block;
-       background: #f7f7f7;
-       border: 1px solid #d7d7d7;
-       margin: 1em 1.75em;
-       padding: 1em;
-       overflow: auto;
-       white-space: pre;
-}
-
-table th, table, td {
-       vertical-align: top;
-       text-align: left;
-       border: 1px solid gray;
-}
-
-.cbi-section {
-       margin-top: 1em;
-}
-
-.cbi-section-remove {
-       text-align: right;
-}
-
-.cbi-value {
-       display: table-row;
-}
-
-.cbi-value-title {
-       display: table-cell;
-       line-height: 1.75em;
-       font-weight: bold;
-       padding: 0.25em;
-}
-
-.cbi-value-field {
-       display: table-cell;
-       text-align: left;
-       padding: 0.25em;
-       line-height: 1.75em;
-}
-
-.cbi-value-field input, .cbi-value-field select,
-.cbi-optionals select, .cbi-optionals input,
-.cbi-section-remove input, .cbi-section-create input  {
-       font-size: 0.8em;
-       margin: 0%;
-}
-
-.cbi-section-descr {
-       padding-bottom: 1em;
-}
-
-.cbi-value-description {
-       display: inline;
-       font-style: italic;
-       font-size: 0.8em; 
-       padding: 0.25em;
-       margin-bottom: 0.5em;
-}
-
-.cbi-form-separator {
-       margin-top: 1em;
-}
-
-.cbi-section-node {
-       display: table;
-       padding: 0.25em;
-       background: #f7f7f7;
-       border: 1px solid #d7d7d7;
-}
-
-.cbi-section-row {
-       display: table-row;
-}
-
-.cbi-section-row-head {
-       display: table-cell;
-       font-weight: bold;
-       padding: 0.25em;
-}
-
-.cbi-section-row-descr {
-       display: table-cell;
-       padding: 0.25em;
-       font-size: 0.8em;
-}
-
-.cbi-section-node h3 {
-       margin-bottom: 0.5em;
-}
-
-.cbi-error {
-       color: red;
-       font-weight: bold;
-       font-size: 0.8em;
-       margin-bottom: 0.75em;
-}
-
-.cbi-optionals {
-       margin-top: 1em;
-       display: table-cell;
-}
-
-.cbi-optionals option {
-       font-size: 0.8em;
-}
-
-.error {
-       color: red;
-       font-weight: bold;
-}
-
-.ok {
-       color: green;
-       font-weight: bold;
-}
\ No newline at end of file
diff --git a/themes/fledermaus/root/www/luci/media/cbi.js b/themes/fledermaus/root/www/luci/media/cbi.js
deleted file mode 100644 (file)
index a3a47aa..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-var cbi_d = {};
-
-function cbi_d_add(field, target, value) {
-       if (!cbi_d[target]) {
-               cbi_d[target] = {};
-       }
-       if (!cbi_d[target][value]) {
-               cbi_d[target][value] = [];
-       }
-       cbi_d[target][value].push(field);
-}
-
-function cbi_d_update(target) {
-       if (!cbi_d[target]) {
-               return;
-       }
-       
-       for (var x in cbi_d[target]) {
-               for (var i=0; i<cbi_d[target][x].length; i++) { 
-                       var y = document.getElementById(cbi_d[target][x][i])    
-                       y.style.display = "none";
-               }
-       }
-       
-       var t = document.getElementById(target);
-       if (t && t.value && cbi_d[target][t.value]) {
-               for (var i=0; i<cbi_d[target][t.value].length; i++) {                   
-                       var y = document.getElementById(cbi_d[target][t.value][i])
-                       if (!y.value) { 
-                               y.style.display = "table-row";
-                       } else {
-                               y.style.display = "block";
-                       }
-               }
-       }
-}
-
-function cbi_d_init() {
-       for (var x in cbi_d) {
-               cbi_d_update(x);
-       }
-}
\ No newline at end of file
diff --git a/themes/fledermaus/root/www/luci/media/logo.png b/themes/fledermaus/root/www/luci/media/logo.png
deleted file mode 100644 (file)
index d4c5dd9..0000000
Binary files a/themes/fledermaus/root/www/luci/media/logo.png and /dev/null differ