modules/admin-full: new interface overview page, other template changes
[project/luci.git] / modules / admin-full / luasrc / view / admin_uci / changelog.htm
1 <%#
2 LuCI - Lua Configuration Interface
3 Copyright 2010 Jo-Philipp Wich <xm@subsignal.org>
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9         http://www.apache.org/licenses/LICENSE-2.0
10
11 $Id$
12
13 -%>
14
15 <% export("uci_changelog", function(changes) -%>
16 <fieldset class="cbi-section">
17         <strong><%:Legend:%></strong>
18         <div class="uci-change-legend">
19                 <div class="uci-change-legend-label"><ins>&nbsp;</ins> <%:Section added%></div>
20                 <div class="uci-change-legend-label"><del>&nbsp;</del> <%:Section removed%></div>
21                 <div class="uci-change-legend-label"><var><ins>&nbsp;</ins></var> <%:Option changed%></div>
22                 <div class="uci-change-legend-label"><var><del>&nbsp;</del></var> <%:Option removed%></div>
23                 <br style="clear:both" />
24         </div>
25         <br />
26
27         <div class="uci-change-list"><%
28                 local util = luci.util
29                 local ret  = { }
30
31                 for r, tbl in pairs(changes) do
32                         for s, os in pairs(tbl) do
33                                 -- section add
34                                 if os['.type'] and os['.type'] ~= "" then
35                                         ret[#ret+1] = "<ins>%s.%s=<strong>%s</strong>" %{ r, s, os['.type'] }
36                                         for o, v in util.kspairs(os) do
37                                                 if o:sub(1,1) ~= "." then
38                                                         ret[#ret+1] = "<br />%s.%s.%s=<strong>%s</strong>" %{ r, s, o, util.pcdata(v) }
39                                                 end
40                                         end
41                                         ret[#ret+1] = "</ins><br />"
42
43                                 -- section delete
44                                 elseif os['.type'] and os['.type'] == "" then
45                                         ret[#ret+1] = "<del>%s.<strong>%s</strong></del><br />" %{ r, s }
46
47                                 -- modifications
48                                 else
49                                         ret[#ret+1] = "<var>%s.%s<br />" %{ r, s }
50                                         for o, v in util.kspairs(os) do
51                                                 if o:sub(1,1) ~= "." then
52                                                         if v and v ~= "" then
53                                                                 ret[#ret+1] = "<ins>%s.%s.%s=<strong>%s</strong><br /></ins>" %{ r, s, o, util.pcdata(v) }
54                                                         else
55                                                                 ret[#ret+1] = "<del>%s.%s.<strong>%s</strong><br /></del>" %{ r, s, o }
56                                                         end
57                                                 end
58                                         end
59                                         ret[#ret+1] = "</var><br />"
60                                 end
61                         end
62                 end
63
64                 write(table.concat(ret))
65         %></div>
66 </fieldset>
67 <%- end) %>