root/luci2/cbi2/widgets/file.c @ 5699

Revision 5699, 0.6 KB (checked in by blogic, 3 years ago)

add function to start/stop all datasources, extend some widgets to be able to generate json, extend uci source json handler

Line 
1#include "../cbi.h"
2
3int file_init(struct cbi_ctx *ctx, struct cbi_element *e)
4{
5    return 0;
6}
7
8json_object* file_json(struct cbi_ctx *ctx, struct cbi_element *e)
9{
10    json_object *j = json_object_new_object();
11    const char *type = cbi_find_prop(e, "type");
12    json_object_object_add(j, "type", json_object_new_string((type)?(type):("package")));
13    return j;
14}
15
16struct cbi_widget_property file_props[] = {
17    { "src", PROP_REQUIRED },
18    { "id", PROP_REQUIRED },
19};
20
21struct cbi_widget file = {
22    .caps = CAP_DATA | CAP_PACKAGE,
23    .init = file_init,
24    .json = file_json,
25    WPROPS(file_props),
26};
27
28WIDGET(file)
Note: See TracBrowser for help on using the browser.