[luci] SimpleForm,section and configs questions

Jo-Philipp Wich xm at subsignal.org
Wed Jan 13 19:26:50 CET 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Tomek.

First of all, sorry for the late reply but I'm busy these days.
Now let me try to answer your questions.

> 1. Editing several config files on 1 page
> Configuration is stored in several configs: tunnel1, tunnel2.
> (Config file layout does not depend on me, so I can't change it.)
> I'd like to have one page that allows configuration of values in 2 
> config files. Is there any way to do that, except creating SimpleForm
> and painfully reading each field manually (using several calls like
> luci.model.uci.cursor():get("config1", "section1","option1")?

No, SimpleForms are not really suitable for that, they're more designed
to build simple forms (heh) without any associated configuration file,
this is used for example on the system page where you can change the
root password.

When I need to expose several configuration files on one page I usually
build a model containing several Map() instances, each referring to a
different file. See [1] for an example.

> 2. Sections in SimpleForm
> My page will have lots of parameters and I'd like to group them. 
> Is there a way to declare Sections in SimpleForm?

No, this is only possible with Maps, in the current LuCI trunk I added
some new options to render sections as tabs, see [2] and [3].

> 3. Hiding whole section
> [...]
> Is there a way to hide whole section in the same manner?
> http://luci.subsignal.org/trac/wiki/Documentation/CBI states that
> TypedSection has :depends() property. However, when I set it (and the 
> dependency is not met), the section itself is still visible, but does not 
> contain any fields.

Hm, this should be changed then, I implemented the auto-hiding of empty
sections for tabs but it is missing for the plain version. I'll look
into it - it should be a simple JavaScript change.

> 4. Documentation
> Is there more complete reference available than what is here:
> http://luci.subsignal.org/trac/wiki/Documentation?
> I've found that there is a class Form. Does it offer more than SimpleForm?
> What does SimpleForm offers?

See above for SimpleForm. Form is a special variant of SimpleForm, it
has no header and footer section allowing it to be embedded in other pages.

There is no full documentation coverage of the CBI module yet. You can
look at the source of the other model files in the repository for examples.


[1]http://luci.subsignal.org/trac/browser/luci/trunk/modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua
[2]http://luci.subsignal.org/~jow/luci-join-4.png
[3]http://luci.subsignal.org/trac/browser/luci/trunk/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua#L71


Regards,
JoW
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAktOEGoACgkQdputYINPTPO8kQCfctti6doW1ZH4ipw0gVLrT6v8
mSUAoJpDD55Knub7Vn6foSn3bN62K4hu
=Mz/N
-----END PGP SIGNATURE-----


More information about the luci mailing list