Show
Ignore:
Timestamp:
10/28/11 16:15:27 (19 months ago)
Author:
jow
Message:

luci-0.10: sync with trunk, drop broken and unfinished applications

Location:
luci/branches/luci-0.10/themes
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • luci/branches/luci-0.10/themes

    • Property svn:mergeinfo deleted
  • luci/branches/luci-0.10/themes/freifunk-generic

    • Property svn:mergeinfo deleted
  • luci/branches/luci-0.10/themes/freifunk-generic/luasrc/view/themes/freifunk-generic/header.htm

    r7231 r7810  
    22LuCI - Lua Configuration Interface 
    33Copyright 2008 Steven Barth <steven@midlink.org> 
    4 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> 
     4Copyright 2008-2011 Jo-Philipp Wich <xm@subsignal.org> 
    55 
    66Licensed under the Apache License, Version 2.0 (the "License"); 
     
    1212 
    1313<% 
    14 require("luci.sys") 
    15 local uci = require "luci.model.uci".cursor() 
    16 local fs = require "luci.fs" 
    17  
    18 local load1, load5, load15 = luci.sys.loadavg() 
    19 local request  = require("luci.dispatcher").context.path 
    20 local category = request[1] 
    21 local tree     = luci.dispatcher.node() 
    22 local cattree  = category and luci.dispatcher.node(category) 
    23 local node     = luci.dispatcher.context.dispatched 
    24 local hostname = luci.sys.hostname() 
    25 local ff = uci:get("freifunk", "community", "name") or "" 
    26 local co = "profile_" .. ff 
    27 local community = uci:get_first(co, "community", "name") or "Freifunk" 
    28 local hp = uci:get_first(co, "community", "homepage") or "http://www.freifunk.net" 
    29 local logo = "/luci-static/freifunk-generic/logo.jpg" 
    30 local banner = false 
    31 local show_comm = true 
    32  
    33 local lo = fs.glob("/www/luci-static/resources/custom_logo.*") 
    34 if lo[1] then 
    35     logo = string.gsub(lo[1], "/www", "") 
    36 end 
    37  
    38 local lon = fs.glob("/www/luci-static/resources/custom_logo_only.*") 
    39 if lon[1] then 
    40     logo = string.gsub(lon[1], "/www", "") 
    41     show_comm = false 
    42 end 
    43  
    44 local hea = fs.glob("/www/luci-static/resources/custom_header.*") 
    45 if hea[1] then 
    46     logo = string.gsub(hea[1], "/www", "") 
    47     show_comm = false 
    48     banner = true 
    49 end  
    50  
    51 local c = tree 
    52 for i,r in ipairs(request) do 
    53     if c.nodes and c.nodes[r] then 
    54         c = c.nodes[r] 
    55         c._menu_selected = true 
    56     end 
    57 end 
    58  
    59 require("luci.i18n").loadc("default") 
    60 require("luci.http").prepare_content("application/xhtml+xml") 
    61  
     14    local fs   = require "luci.fs" 
     15    local sys  = require "luci.sys" 
     16    local http = require "luci.http" 
     17    local disp = require "luci.dispatcher" 
     18 
     19    local hostname = sys.hostname() 
     20    local load1, load5, load15 = sys.loadavg() 
     21 
     22    local request  = disp.context.path 
     23    local category = request[1] 
     24    local cattree  = category and disp.node(category) 
     25 
     26    local tree = disp.node() 
     27    local node = disp.context.dispatched 
     28 
     29    local categories = disp.node_childs(tree) 
     30 
     31    local c = tree 
     32    local i, r 
     33 
     34    -- tag all nodes leading to this page 
     35    for i, r in ipairs(request) do 
     36        if c.nodes and c.nodes[r] then 
     37            c = c.nodes[r] 
     38            c._menu_selected = true 
     39        end 
     40    end 
     41 
     42    local uci  = require "luci.model.uci".cursor() 
     43    local ff = uci:get("freifunk", "community", "name") or "" 
     44    local co = "profile_" .. ff 
     45    local community = uci:get_first(co, "community", "name") or "Freifunk" 
     46    local hp = uci:get_first(co, "community", "homepage") or "http://www.freifunk.net" 
     47    local logo = "/luci-static/freifunk-generic/logo.jpg" 
     48    local banner = false 
     49    local show_comm = true 
     50 
     51    local lo = fs.glob("/www/luci-static/resources/custom_logo.*") 
     52    if lo[1] then 
     53        logo = string.gsub(lo[1], "/www", "") 
     54    end 
     55 
     56    local lon = fs.glob("/www/luci-static/resources/custom_logo_only.*") 
     57    if lon[1] then 
     58        logo = string.gsub(lon[1], "/www", "") 
     59        show_comm = false 
     60    end 
     61 
     62    local hea = fs.glob("/www/luci-static/resources/custom_header.*") 
     63    if hea[1] then 
     64        logo = string.gsub(hea[1], "/www", "") 
     65        show_comm = false 
     66        banner = true 
     67    end 
    6268-%> 
    6369 
     
    7076<link rel="stylesheet" type="text/css" media="screen" href="<%=media%>/cascade.css" /> 
    7177<link rel="stylesheet" media="only screen and (max-device-width: 480px)" href="<%=media%>/mobile.css" type="text/css" /> 
    72 <link rel="stylesheet" media="handheld" href="<%=media%>/mobile.css" type="text/css" />  
     78<link rel="stylesheet" media="handheld" href="<%=media%>/mobile.css" type="text/css" /> 
    7379<!--[if IE 7]><link rel="stylesheet" type="text/css" media="screen" href="<%=media%>/ie7.css" /><![endif]--> 
    7480<% if node and node.css then %><link rel="stylesheet" type="text/css" media="screen" href="<%=resource%>/<%=node.css%>" /> 
     
    7682<script type="text/javascript" src="<%=resource%>/xhr.js"></script> 
    7783 
    78 <title><%=striptags( hostname .. ( (node and node.title) and ' - ' .. node.title or '')) %> - LuCI</title> 
     84<title><%=striptags( hostname .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI</title> 
    7985</head> 
    8086 
     
    119125            <%:Load%>: <%="%.2f" % load1%> <%="%.2f" % load5%> <%="%.2f" % load15%><br /> 
    120126            <%:Hostname%>: <%=hostname%><br /> 
     127            <span id="xhr_poll_status" style="display:none" onclick="XHR.running() ? XHR.halt() : XHR.run()"> 
     128                <%:Auto Refresh%>: 
     129                <span id="xhr_poll_status_on"><%:on%></span> 
     130                <span id="xhr_poll_status_off" style="display:none"><%:off%></span> 
     131            </span> 
    121132        </div> 
    122133    <%end%> 
    123134</div> 
    124135 
     136<%- 
     137    local function submenu(prefix, node) 
     138        local childs = disp.node_childs(node) 
     139        if #childs > 0 then 
     140%> 
     141    <ul id="submenu_<%=string.gsub(string.gsub(prefix, "/", "_"), "^_(.-)_$", "%1")%>"> 
     142        <%- 
     143            for i, r in ipairs(childs) do 
     144                local nnode = node.nodes[r] 
     145                local href  = controller .. prefix .. r .. "/" .. 
     146                    (nnode.query and http.build_querystring(nnode.query) or "") 
     147        %> 
     148            <li> 
     149                <a<%=ifattr(nnode._menu_selected, "class", "active")%> href="<%=luci.util.pcdata(href)%>"><%=translate(nnode.title)%></a> 
     150                <%- submenu(prefix .. r .. "/", nnode) %> 
     151            </li> 
     152        <%- 
     153            end 
     154        %> 
     155    </ul> 
     156<% 
     157        end 
     158    end 
     159%> 
     160 
    125161<div id="menubar"> 
    126162<h2 class="navigation"><a id="navigation" name="navigation"><%:navigation Navigation%></a></h2> 
    127163<ul id="mainmenu" class="dropdowns"> 
    128 <%- 
    129 local function submenu(prefix, node) 
    130     if not node.nodes or node.hidden then 
    131         return false 
    132     end 
    133     local index = {} 
    134     local count = 0 
    135     for k, n in pairs(node.nodes) do 
    136         if n.title and n.target then 
    137             table.insert(index, {name=k, order=n.order or 100}) 
    138             count = count + 1 
    139         end 
    140     end 
    141  
    142     table.sort(index, function(a, b) return a.order < b.order end) 
    143  
    144     if count > 0 then 
    145 %> 
    146 <ul id="submenu_<%=string.gsub(string.gsub(prefix, "/", "_"), "^_(.-)_$", "%1")%>"> 
    147 <%- 
    148         for j, v in pairs(index) do 
    149             if #v.name > 0 then 
    150                 local nnode = node.nodes[v.name] 
    151                 local href = controller .. prefix .. v.name .. "/" 
    152                 href = (nnode.query) and href .. luci.http.build_querystring(nnode.query) or href 
    153 %> 
    154 <li><a<% if nnode._menu_selected then %> class="active"<%end%> href="<%=luci.util.pcdata(href)%>"><%=nnode.title%></a><%- 
    155 submenu(prefix .. v.name .. "/", nnode) 
    156 %></li> 
    157 <%- 
     164    <% 
     165        local childs = disp.node_childs(cattree) 
     166        if #childs > 0 then 
     167            for i, r in ipairs(childs) do 
     168                local nnode = cattree.nodes[r] 
     169                local href  = controller .. "/" .. category .. "/" .. r .. 
     170                    (nnode.query and http.build_querystring(k.query) or "") 
     171    %> 
     172        <li> 
     173            <a<%=ifattr(nnode._menu_selected, "class", "preactive")%> href="<%=href%>"><%=translate(nnode.title)%></a> 
     174            <%- submenu("/" .. category .. "/" .. r .. "/", nnode) %> 
     175        </li> 
     176    <% 
    158177            end 
    159178        end 
    160 %> 
     179    %> 
     180    <li></li> 
    161181</ul> 
    162 <% 
    163     end 
    164 end 
    165  
    166 if cattree and cattree.nodes then 
    167     local index = {} 
    168     for k, node in pairs(cattree.nodes) do 
    169         table.insert(index, {name=k, order=node.order or 100}) 
    170     end 
    171  
    172     table.sort(index, function(a, b) return a.order < b.order end) 
    173  
    174     for i, k in ipairs(index) do 
    175         node = cattree.nodes[k.name] 
    176         if node.title and node.target and not node.hidden then 
    177             local href = controller.."/"..category.."/"..k.name.."/" 
    178             href = (k.query) and href .. luci.http.build_querystring(k.query) or href 
    179 %> 
    180 <li><a<% if node._menu_selected then %> class="preactive"<%end%> href="<%=href%>"><%=node.title%></a><% 
    181 submenu("/" .. category .. "/" .. k.name .. "/", node) 
    182 %></li><% end 
    183     end 
    184 end 
    185 %> 
    186 <li></li></ul> 
    187  
    188 <ul id="modemenu"><% 
    189 for k,node in pairs(tree.nodes) do 
    190     if node.title and not node.hidden then %> 
    191 <li><a<% if request[1] == k then %> class="active"<%end%> href="<%=controller%>/<%=k%>/"><%=node.title%></a></li><% 
    192     end 
    193 end 
    194 %> 
    195 </ul> 
     182 
     183<% if #categories > 1 then %> 
     184    <ul id="modemenu"> 
     185    <% for i, r in ipairs(categories) do %> 
     186        <li><a<%=ifattr(request[1] == r, "class", "active")%> href="<%=controller%>/<%=r%>/"><%=striptags(translate(tree.nodes[r].title))%></a></li> 
     187    <% end %> 
     188    </ul> 
     189<% end %> 
    196190 
    197191<% 
     
    206200    end 
    207201-%> 
    208  
    209 <div id="savemenu"> 
    210     <% if ucic > 0 then %> 
    211         <a class="warning" href="<%=controller%>/<%=category%>/uci/changes/?redir=<%=luci.http.urlencode(luci.http.formvalue("redir") or REQUEST_URI)%>"><%:Unsaved Changes%>: <%=ucic%></a> 
    212     <% end -%> 
    213 </div><% end %> 
     202    <div id="savemenu"> 
     203        <% if ucic > 0 then %> 
     204            <a class="warning" href="<%=controller%>/<%=category%>/uci/changes/?redir=<%=http.urlencode(http.formvalue("redir") or REQUEST_URI)%>"><%:Unsaved Changes%>: <%=ucic%></a> 
     205        <% end -%> 
     206    </div> 
     207<% end %> 
    214208 
    215209<div class="clear"></div>