Changeset 5680
- Timestamp:
- 02/24/10 16:30:28 (3 years ago)
- Location:
- luci2/cbi2
- Files:
-
- 12 modified
-
cbi.c (modified) (4 diffs)
-
cbi.h (modified) (1 diff)
-
Makefile (modified) (1 diff)
-
network.luci (modified) (4 diffs)
-
widget.c (modified) (1 diff)
-
widgets/file.c (modified) (1 diff)
-
widgets/foreach.c (modified) (2 diffs)
-
widgets/form.c (modified) (1 diff)
-
widgets/option.c (modified) (2 diffs)
-
widgets/page.c (modified) (1 diff)
-
widgets/section.c (modified) (2 diffs)
-
widgets/tsection.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
luci2/cbi2/cbi.c
r5676 r5680 122 122 cbi_get_element_id(e->parent, buffer, file); 123 123 id = cbi_find_prop(e, "id"); 124 if(!id && (e->caps & CAP_ UCI))125 id = cbi_find_prop(e, " uci");124 if(!id && (e->caps & CAP_DATA)) 125 id = cbi_find_prop(e, "src"); 126 126 if(!id) 127 127 return; … … 144 144 return; 145 145 if(w) 146 if(w->caps & CAP_ UCI)147 id = cbi_find_prop(e, " uci");146 if(w->caps & CAP_DATA) 147 id = cbi_find_prop(e, "src"); 148 148 if(!id) 149 149 id = cbi_find_prop(e, "name"); … … 440 440 INIT_LIST_HEAD(&f->e.properties); 441 441 f->e.widget = strdup("file"); 442 f->e.caps = CAP_ UCI| CAP_PACKAGE;443 cbi_add_property(&f->e, " uci", f->name, 1);442 f->e.caps = CAP_DATA | CAP_PACKAGE; 443 cbi_add_property(&f->e, "src", f->name, 1); 444 444 blob_for_each_attr(pos, map, rem) 445 445 { … … 534 534 } 535 535 } 536 printf("\nglobals:\n");536 /* printf("\nglobals:\n"); 537 537 cbi_dump_list(&ctx->globals); 538 538 printf("\npagess:\n"); 539 cbi_dump_list(&ctx->pages); 539 cbi_dump_list(&ctx->pages);*/ 540 540 } 541 541 -
luci2/cbi2/cbi.h
r5676 r5680 41 41 #define CAP_OPTION 0x0004 42 42 #define CAP_PAGE 0x0008 43 #define CAP_ UCI0x001043 #define CAP_DATA 0x0010 44 44 #define CAP_FILE 0x0020 45 45 #define CAP_TEMPLATE 0x0040 -
luci2/cbi2/Makefile
r5679 r5680 26 26 rm -f $(BINARY) *.luco *.o widgets/*.o validators/*.o 27 27 28 run: $(BINARY) 29 mkdir -p ./root/lib/luci2 30 cp *.luci ./root/lib/luci2/ 31 ./luci -v -r /root/lib/luci2/ 32 28 33 %.o: $(wildcard *.h) 29 34 %.o: %.c -
luci2/cbi2/network.luci
r5677 r5680 1 2 <luci:page id="internet" uci="network"> 1 <luci:page id="internet" src="network"> 3 2 <luci:title>Page title</luci:title> 4 3 Page text … … 6 5 <luci:title>Form title</luci:title> 7 6 Form text 8 <luci:option uci="proto">Proto</luci:option>9 <luci:option uci="dns_override">Manual DNS</luci:option>10 <luci:option uci="ipaddr">IP</luci:option>11 <luci:option uci="netmask">Netmask</luci:option>12 <luci:option uci="gateway">Gateway</luci:option>13 <luci:option uci="dns1">DNS1</luci:option>14 <luci:option uci="dns2">DNS2</luci:option>15 <luci:option uci="username">Username</luci:option>16 <luci:option uci="password">Password</luci:option>17 <luci:option uci="mtu">MTU</luci:option>7 <luci:option src=".proto">Proto</luci:option> 8 <luci:option src=".dns_override">Manual DNS</luci:option> 9 <luci:option src=".ipaddr">IP</luci:option> 10 <luci:option src=".netmask">Netmask</luci:option> 11 <luci:option src=".gateway">Gateway</luci:option> 12 <luci:option src=".dns1">DNS1</luci:option> 13 <luci:option src=".dns2">DNS2</luci:option> 14 <luci:option src=".username">Username</luci:option> 15 <luci:option src=".password">Password</luci:option> 16 <luci:option src=".mtu">MTU</luci:option> 18 17 <luci:field>custom</luci:field> 19 18 </luci:section> … … 23 22 <luci:title>Lan Configuration</luci:title> 24 23 Lan Configuration description 25 <luci:option uci="ipaddr">IP</luci:option>26 <luci:option uci="netmask" >Netmask</luci:option>24 <luci:option src=".ipaddr">IP</luci:option> 25 <luci:option src=".netmask" >Netmask</luci:option> 27 26 </luci:tsection> 28 27 29 28 <luci:tsection name="dhcp_lease"> 30 29 <luci:title>DHCP lease</luci:title> 31 <luci:option uci="ipaddr">IP</luci:option>32 <luci:option uci="netmask" >Netmask</luci:option>30 <luci:option src=".ipaddr">IP</luci:option> 31 <luci:option src=".netmask" >Netmask</luci:option> 33 32 </luci:tsection> 34 33 35 <luci:page uci="network">34 <luci:page src="network"> 36 35 <luci:section ref="network.simple" name="wan"> 37 36 <luci:section package="dhcp" name="dhcp"> 38 <luci:option uci="enable">Enable</luci:option>39 <luci:option uci="start">start_ip</luci:option>40 <luci:option uci="stop">stop_ip</luci:option>41 <luci:foreach ref="network.dhcp_lease" package="dhcp" uci="leases">37 <luci:option src=".enable">Enable</luci:option> 38 <luci:option src=".start">start_ip</luci:option> 39 <luci:option src=".stop">stop_ip</luci:option> 40 <luci:foreach ref="network.dhcp_lease" package="dhcp" src=".leases"> 42 41 <luci:filter net="wan"/> 43 42 </luci:foreach> … … 45 44 </luci:section> 46 45 </luci:page> 47 <luci:option uci="enable">Enable</luci:option>46 <luci:option src=".enable">Enable</luci:option> 48 47 -
luci2/cbi2/widget.c
r5666 r5680 63 63 static int widget_verify_uci(struct cbi_element *e, struct cbi_widget *w) 64 64 { 65 if(!(w->caps | CAP_ UCI))65 if(!(w->caps | CAP_DATA)) 66 66 return 0; 67 67 if(w->caps & CAP_PACKAGE) -
luci2/cbi2/widgets/file.c
r5669 r5680 7 7 8 8 struct cbi_widget_property file_props[] = { 9 { " uci", PROP_REQUIRED },9 { "src", PROP_REQUIRED }, 10 10 { "id", PROP_REQUIRED }, 11 11 }; 12 12 13 13 struct cbi_widget file = { 14 .caps = CAP_ UCI| CAP_PACKAGE,14 .caps = CAP_DATA | CAP_PACKAGE, 15 15 .init = file_init, 16 16 WPROPS(file_props), -
luci2/cbi2/widgets/foreach.c
r5677 r5680 7 7 8 8 struct cbi_widget_property foreach_props[] = { 9 { " uci", PROP_REQUIRED },9 { "src", PROP_REQUIRED }, 10 10 { "id", PROP_REQUIRED }, 11 11 { "package", PROP_OPTIONAL }, … … 13 13 14 14 struct cbi_widget foreach = { 15 .caps = CAP_ UCI| CAP_PAGE | CAP_PACKAGE,15 .caps = CAP_DATA | CAP_PAGE | CAP_PACKAGE, 16 16 .parent_caps = CAP_SECTION, 17 17 .init = foreach_init, -
luci2/cbi2/widgets/form.c
r5669 r5680 7 7 8 8 struct cbi_widget_property form_props[] = { 9 { "uci", PROP_REQUIRED },10 9 { "id", PROP_REQUIRED }, 11 10 }; -
luci2/cbi2/widgets/option.c
r5669 r5680 2 2 3 3 struct cbi_widget_property option_props[] = { 4 { " uci", PROP_REQUIRED },4 { "src", PROP_REQUIRED }, 5 5 { "id", PROP_REQUIRED }, 6 6 { "section", PROP_OPTIONAL }, … … 14 14 15 15 struct cbi_widget option = { 16 .caps = CAP_ UCI| CAP_OPTION,16 .caps = CAP_DATA | CAP_OPTION, 17 17 .parent_caps = CAP_SECTION, 18 18 .init = option_init, -
luci2/cbi2/widgets/page.c
r5669 r5680 7 7 8 8 struct cbi_widget_property page_props[] = { 9 { " uci", PROP_REQUIRED },9 { "src", PROP_REQUIRED }, 10 10 { "id", PROP_REQUIRED }, 11 11 }; 12 12 13 13 struct cbi_widget page = { 14 .caps = CAP_ UCI| CAP_PAGE | CAP_PACKAGE,14 .caps = CAP_DATA | CAP_PAGE | CAP_PACKAGE, 15 15 .init = page_init, 16 16 WPROPS(page_props), -
luci2/cbi2/widgets/section.c
r5677 r5680 9 9 { "name", PROP_REQUIRED }, 10 10 { "id", PROP_REQUIRED }, 11 { " uci", PROP_OPTIONAL },11 { "src", PROP_OPTIONAL }, 12 12 { "package", PROP_OPTIONAL }, 13 13 { "ref", PROP_OPTIONAL }, … … 15 15 16 16 struct cbi_widget section = { 17 .caps = CAP_ UCI| CAP_PACKAGE | CAP_SECTION,17 .caps = CAP_DATA | CAP_PACKAGE | CAP_SECTION, 18 18 .parent_caps = CAP_PACKAGE, 19 19 .init = section_init, -
luci2/cbi2/widgets/tsection.c
r5677 r5680 12 12 13 13 struct cbi_widget tsection = { 14 .caps = CAP_ UCI| CAP_SECTION | CAP_TEMPLATE,14 .caps = CAP_DATA | CAP_SECTION | CAP_TEMPLATE, 15 15 .parent_caps = CAP_PACKAGE, 16 16 .init = tsection_init,
