Jo-Philipp Wich [Wed, 14 Nov 2018 19:48:15 +0000 (20:48 +0100)]
Merge pull request #2282 from TDT-AG/pr/
20181114-luci-base
luci-base: allow optional default value for file browser
Jo-Philipp Wich [Wed, 14 Nov 2018 13:35:01 +0000 (14:35 +0100)]
luci-lib-ipkg: move out of luci-base
Move the old luci.model.ipkg utility class into a separate package and
let the components using it depend on the new library package.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Wed, 14 Nov 2018 13:07:41 +0000 (14:07 +0100)]
luci-mod-system: replace builtin opkg support with luci-app-opkg
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Wed, 14 Nov 2018 12:48:59 +0000 (13:48 +0100)]
luci-mod-system: use luci.sys.process.exec() in system controller
Switch the system controller to the common luci.sys.process.exec() function
and drop the local ltn12_popen() and fork_exec() helpers.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Wed, 14 Nov 2018 12:37:51 +0000 (13:37 +0100)]
luci-mod-system: prevent comment injection in mtdbackup endpoint
Rework the parameter handling to both prevent a crash when no parameter is
given and to prevent root command injection through the mtd index part of
the parameter value.
Fixes: 9840d310e ("modules: add backup module for mtdblock devices")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Wed, 14 Nov 2018 08:53:15 +0000 (09:53 +0100)]
applications: add luci-app-opkg
Add a new luci-app-opkg which is a feature-complete replacement for the
builtin opkg functionality of luci-mod-system using mostly client side
JavaScript to reduce the amount of server side processing.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Tue, 13 Nov 2018 19:01:32 +0000 (20:01 +0100)]
luci-app-firewall: remove references to cbi_bind()
Use the standard addEventListener() instead. Also remove an old
cbi_validate_field() call referencing a not existing field.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Tue, 13 Nov 2018 17:42:56 +0000 (18:42 +0100)]
luci-mod-status: use progressbar widgets on main status page
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Tue, 13 Nov 2018 17:32:19 +0000 (18:32 +0100)]
luci-base: simplify apply widget code
- Drop embedded CSS in favor to new global rules
- Drop extraneous include of cbi.js
- Use showModal() facilities
- Fix a cosmetic bug in countdown timeout handling
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Tue, 13 Nov 2018 15:30:46 +0000 (16:30 +0100)]
luci-base: cbi.js: add modal dialog functions
Add two new functions showModal() and hideModal() which will fade in and
close an open modal respectively.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Tue, 13 Nov 2018 15:19:23 +0000 (16:19 +0100)]
luci-theme-bootstrap: add modal/progressbar rules, cleanup
- Add rules for modal dialogs and progress bar widgets
- Drop redundant, unused or obsolete rules
- Add spin utility class
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Tue, 13 Nov 2018 15:12:00 +0000 (16:12 +0100)]
luci-theme-openwrt: modal/progressbar rules, mobile improvements
- Add rules for modal dialogs and progress bar widgets
- Increase button and input size on mobile devices
- Convert pt to px units
- Add label and h5 styles
- Add common flash and spin utility classes
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Mon, 12 Nov 2018 09:48:08 +0000 (10:48 +0100)]
luci-base: add luci.sys.process.exec()
The new process.exec() function simplifies spawning external processes
and capturing their stdio.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Mon, 12 Nov 2018 09:13:34 +0000 (10:13 +0100)]
applications: drop luci-app-asterisk
This application was never useful to begin with, drop it to avoid
further confusion.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Thu, 8 Nov 2018 12:02:24 +0000 (13:02 +0100)]
luci-base, themes: dropdown behaviour improvements
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Mon, 5 Nov 2018 17:50:24 +0000 (18:50 +0100)]
luci-base: cbi.js: remove dead code in cbi_validate_field()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Mon, 5 Nov 2018 17:43:32 +0000 (18:43 +0100)]
luci-base: cbi.js: enable validation for dropdown fields
Directly attach validation handlers to cbi dropdowns as well, this allows
validating dropdown choices made by the user, similar to how plain select
boxes are handled by the cbi JavaScript.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Mon, 5 Nov 2018 17:38:25 +0000 (18:38 +0100)]
luci-theme-openwrt: dropdown style tweaks
- Remove 2em min height, this looks out of place with the OpenWrt theme
- Only colorize invalid dropdown when not open
- Drop use of image background for invalid fields while we're at it
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Mon, 5 Nov 2018 17:11:36 +0000 (18:11 +0100)]
luci-theme-bootstrap: add invalid style for dropdowns
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Mon, 5 Nov 2018 17:10:26 +0000 (18:10 +0100)]
luci-theme-{freifunk-generic,material,openwrt}: z-index fixes
Ensure that open dropdowns cover active tooltips.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Mon, 5 Nov 2018 17:07:42 +0000 (18:07 +0100)]
luci-theme-bootstrap: z-index fixes
Lower z-index of header bar to allow tooltips and dropdowns to overlap it,
also increase the z-index of open dropdowns to ensure that they cover
active tooltip bubbles.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Mon, 5 Nov 2018 15:52:05 +0000 (16:52 +0100)]
luci-base: cbi.js: set .value property of cbi dropdown elements
In order to make cbi dropdowns usable for validation and other code
expecting native form elements, set the .value DOM property on the
dropdown parent element whenever the selection is changed.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Mon, 5 Nov 2018 15:48:10 +0000 (16:48 +0100)]
luci-base: cbi.js: properly handle cbi tooltips on nested elements
Rework the tooltip event delegation logic to prevent hiding the tooltop
when the cursor is moved to a children of the tooltip container element.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Mon, 5 Nov 2018 15:44:20 +0000 (16:44 +0100)]
luci-base: cbi.js: avoid using .form property directly
In order to prepare support for calling cbi validation on non-native form
widgets, remove direct usages of the node.form property and lookup the
containing form using findParent() instead.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Mon, 5 Nov 2018 15:41:25 +0000 (16:41 +0100)]
luci-base: cbi.js: fix passing multiple dropdown values in change event
Due to a misspelled property name, only the first value was passed in
the event details.
Fixes: c2b570998 ("luci-base: cbi.js: rework dropdown implementation")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Mon, 5 Nov 2018 15:35:36 +0000 (16:35 +0100)]
luci-base: rework dynamic list template
Commit
7c7821833 ("luci-base, themes: rework dynlist and dropdown widgets")
changed the way we initialize dynamic lists on client side, avoiding the
need for pre-rendering the items on the server side.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Mon, 5 Nov 2018 15:34:10 +0000 (16:34 +0100)]
luci-base: add ARIA label to reveal/hide password button
Fixes #2070.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Mon, 5 Nov 2018 12:01:50 +0000 (13:01 +0100)]
luci-base: update german translation
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Hannu Nyman [Wed, 14 Nov 2018 14:36:08 +0000 (16:36 +0200)]
Merge pull request #2281 from TDT-AG/pr/
20181114-luci-app-mwan3
luci-app-mwan3: add/remove options
Hannu Nyman [Wed, 14 Nov 2018 14:32:07 +0000 (16:32 +0200)]
Merge pull request #2277 from sotux/master
i18n: luci-base: update Simplified Chinese translation
Dirk Brenken [Wed, 14 Nov 2018 10:49:05 +0000 (11:49 +0100)]
Merge pull request #2284 from dibdot/travelmate
luci-app-travelmate: consolidate css
Dirk Brenken [Wed, 14 Nov 2018 10:48:45 +0000 (11:48 +0100)]
Merge pull request #2283 from dibdot/adblock
luci-app-adblock: consolidate css
Dirk Brenken [Wed, 14 Nov 2018 10:48:14 +0000 (11:48 +0100)]
Merge pull request #2280 from dibdot/banip
luci-app-banip: fix remaining css issues
Dirk Brenken [Wed, 14 Nov 2018 08:01:00 +0000 (09:01 +0100)]
luci-app-banip: fix remaining css issues
* fix IE Edge rendering issues
* merge remaining external styles in central css
Signed-off-by: Dirk Brenken <dev@brenken.org>
Dirk Brenken [Wed, 14 Nov 2018 10:43:39 +0000 (11:43 +0100)]
luci-app-travelmate: consolidate css
* fix IE Edge rendering issues
* merge external styles in central css
Signed-off-by: Dirk Brenken <dev@brenken.org>
Dirk Brenken [Wed, 14 Nov 2018 09:45:18 +0000 (10:45 +0100)]
luci-app-adblock: consolidate css
* fix IE Edge rendering issues
* merge external styles in central css
Signed-off-by: Dirk Brenken <dev@brenken.org>
Florian Eckert [Wed, 14 Nov 2018 09:05:02 +0000 (10:05 +0100)]
luci-base: allow optional default value for file browser
With this change we could set optional value for the file browser.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Florian Eckert [Thu, 8 Nov 2018 08:52:54 +0000 (09:52 +0100)]
luci-app-mwan3: remove deprecated local_source option
Remove deprecated local_source option which is not supported/needed anymore.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Florian Eckert [Tue, 16 Oct 2018 10:43:18 +0000 (12:43 +0200)]
luci-app-mwan3: add rt_table_lookup option
Make list option rt_table_lookup configurable in luci.
With this option we could define additional routing tables which get
scanned by mwan3 and then get added to the connected ipset.
The entries will be treated as connected network and will not get
mangeld by mwan3.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Florian Eckert [Tue, 16 Oct 2018 07:45:41 +0000 (09:45 +0200)]
luci-app-mwan3: add rtmon interval option
Add the configuration option rtmon to luci.
With this parameter we could adjust how often the routing table get
synced between main routing table and the interface routing table.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Florian Eckert [Tue, 16 Oct 2018 07:34:28 +0000 (09:34 +0200)]
luci-app-mwan3: rename variable in globalsconfig.lua
Name variables as the options name in uci.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Florian Eckert [Tue, 16 Oct 2018 07:31:52 +0000 (09:31 +0200)]
luci-app-mwan3: declare variables in globalsconfig.lua local
It is best practice to declar module variables local.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Jo-Philipp Wich [Wed, 14 Nov 2018 06:28:25 +0000 (07:28 +0100)]
Merge pull request #2279 from yglb/master
luci-theme-rosy: Remove redundant statements and fixed typo
Yanlan Shen [Wed, 14 Nov 2018 03:50:49 +0000 (11:50 +0800)]
luci-theme-rosy: fixed typo
Signed-off-by: Yanlan Shen <yanlan.shen.@rosinson.com>
Yanlan Shen [Wed, 14 Nov 2018 03:49:33 +0000 (11:49 +0800)]
luci-theme-rosy: Remove redundant statements
Signed-off-by: Yanlan Shen <yanlan.shen.@rosinson.com>
Zheng Qian [Wed, 14 Nov 2018 02:21:59 +0000 (10:21 +0800)]
i18n: luci-base: update Simplified Chinese translation
Signed-off-by: Zheng Qian <sotux82@gmail.com>
Jo-Philipp Wich [Mon, 12 Nov 2018 18:34:24 +0000 (19:34 +0100)]
Merge pull request #2245 from Ansuel/fstab
luci-mod-system: add support for additional filesystem
Ansuel Smith [Wed, 24 Oct 2018 17:19:58 +0000 (19:19 +0200)]
luci-mod-system: add support for additional filesystem
The filesystem option doesn't include additional filesystem included with /etc/filesystems, this is usefull if someone have ntfs-3g installed and wants to force use the external utility to mount partition instead of the default present in the kernel (if it's supported)
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Hannu Nyman [Mon, 12 Nov 2018 17:21:57 +0000 (19:21 +0200)]
Merge pull request #2275 from musashino205/l10n/tmate-upd-ja
luci-app-travelmate: update Japanese translation
INAGAKI Hiroshi [Mon, 12 Nov 2018 17:16:50 +0000 (02:16 +0900)]
luci-app-travelmate: update Japanese translation
Updated Japanese translations.
Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
Kevin Darbyshire-Bryant [Wed, 17 May 2017 13:29:43 +0000 (14:29 +0100)]
luci-mod-admin-full: dnsmasq clarify non-wildcard mode
'non-wildcard' interfaces enables dnsmasq's '--bind-dynamic' mode.
This binds dynamically to interfaces rather than wildcard addresses
*and* keeps track of interface comings/goings via a unique Linux api.
Quoting dnsmasq's author "bind-dynamic (bind individual addresses,
keep up with changes in interface config) ... On linux, there's actually
no sane reason not to use --bind-dynamic, and it's only not the default
for historical reasons."
listen/exclude interfaces may be used independently of bind dynamic mode
so removed the bogus dependency of 'nonwildcard' enabling access to
'listen/exclude' interfaces - they may be used in any mode.. In fact
the dnsmasq init script takes notice of include/exclude interfaces
irrespective of the 'nonwildcard' parameter.
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Jo-Philipp Wich [Mon, 12 Nov 2018 14:38:27 +0000 (15:38 +0100)]
Merge pull request #2274 from TDT-AG/pr/
20181112-luic-mod-system
luci-mod-system: add user defined interface to netdev trigger
Florian Eckert [Fri, 9 Nov 2018 10:03:36 +0000 (11:03 +0100)]
luci-mod-system: add user defined interface to netdev trigger
Give the user the possibility to define and interface for the netdev
trigger which is not available at the moment. This is usefull if a
interface is not presented on configuration time.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Dirk Brenken [Mon, 12 Nov 2018 11:16:31 +0000 (12:16 +0100)]
Merge pull request #2272 from dibdot/banip
luci-app-banip: fix JS errors in chromium
Dirk Brenken [Mon, 12 Nov 2018 11:14:52 +0000 (12:14 +0100)]
luci-app-banip: fix JS errors in chromium
* fix JS errors in chromium on ipset- & ripe-view page
Signed-off-by: Dirk Brenken <dev@brenken.org>
Jo-Philipp Wich [Mon, 12 Nov 2018 06:52:50 +0000 (07:52 +0100)]
Merge pull request #2262 from yglb/master
luci-theme-rosy
Jo-Philipp Wich [Sun, 11 Nov 2018 17:41:57 +0000 (18:41 +0100)]
Merge pull request #2268 from hnyman/rrd
luci-app-statistics: remove old deprecated rrdtool po files
Hannu Nyman [Sun, 11 Nov 2018 16:10:46 +0000 (18:10 +0200)]
luci-app-statistics: remove old deprecated rrdtool po files
Remove old rrdtool.po* files that have been deprecated already
in 2011-2015.
Also remove reference to them from i18n-sync.pl
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
Dirk Brenken [Sun, 11 Nov 2018 13:59:39 +0000 (14:59 +0100)]
Merge pull request #2264 from dibdot/banip
luci-app-banip: new package
Hannu Nyman [Sun, 11 Nov 2018 07:17:38 +0000 (09:17 +0200)]
Merge pull request #2267 from musashino205/l10n/base-upd-ja_2
luci-base: fix issues and update Japanese translation
INAGAKI Hiroshi [Sun, 11 Nov 2018 06:47:49 +0000 (15:47 +0900)]
luci-base: update Japanese translation
Updated Japanese translations.
Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
INAGAKI Hiroshi [Sun, 11 Nov 2018 06:35:47 +0000 (15:35 +0900)]
luci-base: sync translations
Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
INAGAKI Hiroshi [Sun, 11 Nov 2018 06:24:18 +0000 (15:24 +0900)]
luci-base: fix translation issues
Fixed several issues for translation.
- add translation markup to "Expecting "
- add missing ")" into "valid time (HH:MM:SS"
Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
Hannu Nyman [Sat, 10 Nov 2018 19:26:41 +0000 (21:26 +0200)]
i18n: cleanup old strings
also sync translations
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
Hannu Nyman [Sat, 10 Nov 2018 19:25:54 +0000 (21:25 +0200)]
luci-app-travelmate: further translation fixup
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
Hannu Nyman [Sat, 10 Nov 2018 13:07:09 +0000 (15:07 +0200)]
Merge pull request #2265 from danrl/dm
luci-*-wireguard: Remove inactive maintainer
Dan Lüdtke [Sat, 10 Nov 2018 12:54:59 +0000 (13:54 +0100)]
luci-*-wireguard: Remove inactive maintainer
I tried to find a successor in the last months, but that failed.
Signed-off by Dan Luedtke <mail@danrl.com>
Dirk Brenken [Sat, 10 Nov 2018 10:19:50 +0000 (11:19 +0100)]
luci-app-banip: new package
for details & LuCI screenshots see base package desprition/PR:
https://github.com/openwrt/packages/pull/7373
Signed-off-by: Dirk Brenken <dev@brenken.org>
Yanlan Shen [Fri, 9 Nov 2018 06:57:02 +0000 (14:57 +0800)]
luci-theme-rosy: Bug fix for network-interfaces
Signed-off-by: Yanlan Shen <yanlan.shen.@rosinson.com>
Yanlan Shen [Tue, 6 Nov 2018 02:00:40 +0000 (10:00 +0800)]
luci-theme-rosy: Fix resolution-related styles
Signed-off-by: Yanlan Shen <yanlan.shen.@rosinson.com>
Yanlan Shen [Tue, 6 Nov 2018 01:59:35 +0000 (09:59 +0800)]
luci-theme-rosy: Modify the layout of the header and footer
Signed-off-by: Yanlan Shen <yanlan.shen.@rosinson.com>
Yanlan Shen [Tue, 6 Nov 2018 01:58:16 +0000 (09:58 +0800)]
luci-theme-rosy: Add a background picture
Signed-off-by: Yanlan Shen <yanlan.shen.@rosinson.com>
Hannu Nyman [Wed, 7 Nov 2018 16:10:59 +0000 (18:10 +0200)]
i18n: sync translations, add location annotatations
Thanks to a recent commit, the translation files will now
have info about locations where the string is used. That
can help is deciding the correct translation, as all contexts
are more easily found.
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
Hannu Nyman [Wed, 7 Nov 2018 16:05:26 +0000 (18:05 +0200)]
luci-app-nft-qos: remove extra .po files
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
Hannu Nyman [Wed, 7 Nov 2018 14:54:07 +0000 (16:54 +0200)]
Merge pull request #1855 from rosysong/nqos
luci-app-nft-qos: add new application
Rosy Song [Fri, 3 Aug 2018 04:16:39 +0000 (12:16 +0800)]
luci-app-nft-qos: add new application
This application is for nft-qos package.
Signed-off-by: Rosy Song <rosysong@rosinson.com>
Jo-Philipp Wich [Mon, 5 Nov 2018 10:16:54 +0000 (11:16 +0100)]
luci-mod-network: move AHCP protocol model to AHCP application
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Mon, 5 Nov 2018 10:19:17 +0000 (11:19 +0100)]
luci-base: validate DHCP clientid as hexstring
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Mon, 5 Nov 2018 10:13:39 +0000 (11:13 +0100)]
luci-base: cbi.js: add client-side hexstring datatype validator
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Mon, 5 Nov 2018 10:11:46 +0000 (11:11 +0100)]
luci-base: cbi.js: add heuristics to attribute handling in E()
If a given attribute value is a function, register it as event listener,
if it is an object, filter it through JSON.stringify(), else set it
as-is.
This helps to reduce some boiler-plate code when building DOM structures.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Sun, 21 Oct 2018 09:47:29 +0000 (11:47 +0200)]
luci-theme-material: add invalid input class
Fixes #1070.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Sat, 20 Oct 2018 15:56:02 +0000 (17:56 +0200)]
luci-base, themes: rework dynlist and dropdown widgets
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Sat, 20 Oct 2018 14:30:24 +0000 (16:30 +0200)]
luci-theme-bootstrap: add flash animation
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Sat, 20 Oct 2018 08:06:57 +0000 (10:06 +0200)]
luci-base: cbi.js: rework dropdown implementation
- Refactor event handler closures into class methods and bind them instead
- Fix quirk in dropdown placement calculation
- Different dropdown placement strategy on touch devices
- Broadcast custom "cbi-dropdown-change" event when value is changed
- Implement setValues() method to alter dropdown selection
- Prevent creating empty custom values
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Sat, 20 Oct 2018 07:55:59 +0000 (09:55 +0200)]
luci-base: cbi.js: utilize node.closest() if available
Use node.closest() in findParent() when available since it should be faster
than manaually traversing the ancestor chain.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Fri, 19 Oct 2018 17:16:00 +0000 (19:16 +0200)]
luci-base: cbi.js: drop cbi_bind()
Just use node.addEventListener() directly since all reasonably recent
browsers support it nowadays.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Fri, 19 Oct 2018 06:39:23 +0000 (08:39 +0200)]
luci-base: cbi.js: rework client side input validation
- Refactor and fix datatype validation functions
- Turn the type compilation and validation into a proper class
- Display tooltip with error hint on invalid inputs
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Fri, 19 Oct 2018 06:21:51 +0000 (08:21 +0200)]
luci-base: cbi.js: fix corner case in IPv6() address parser
The implementation allowed a hexadecimal string without any colons.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Thu, 18 Oct 2018 14:14:35 +0000 (16:14 +0200)]
luci-base, themes: add tooltip helpers & styles
Add the required JS and CSS infrastructure to support rich hover/focus
tooltips for element.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Thu, 18 Oct 2018 12:03:52 +0000 (14:03 +0200)]
luci-base: cbi.js: switch to client side translation
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Thu, 18 Oct 2018 11:58:10 +0000 (13:58 +0200)]
themes: load client side translations
Extend the theme headers to include the translation string scripts,
allowing client side code to translate strings without server side
support.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Thu, 18 Oct 2018 11:48:05 +0000 (13:48 +0200)]
luci-base: cbi.js: add client side translation infrastructure
Implement the string hash algorithm used by LuCI's translation system in
JavaScript and provide a `_()` translation wrapper function to lookup
messages in the global string table.
Once client side translation loading is activated in a later commit,
JavaScript code can use the same string translation mechanism as server
side Lua code, e.g. `_("Static Routes")` would yield "Statische Routen"
when the German translation is loaded.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Thu, 18 Oct 2018 11:44:39 +0000 (13:44 +0200)]
luci-base: expose system translations to JavaScript
Add a new /admin/translations/ endpoint which exposes the loaded system
translations as JavaScript file.
Once referenced by <script>, the endpoint will create a `window.TR` object
containing the entire translation string table for use on the client side.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Thu, 18 Oct 2018 11:32:52 +0000 (13:32 +0200)]
luci-base: remove unused i18n functions
Drop load(), loadc(), string() and stringf() from the luci.i18n class since
these functions are either no longer unused or were never used to begin with.
Also slightly rework the module to only use local symbols and unify the
module require style.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Thu, 18 Oct 2018 09:02:28 +0000 (11:02 +0200)]
luci-base: remove references to luci.i18n.loadc()
The i18n.loadc() function has been a no-op since almost six years so it
makes no sense to invoke it anymore.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Thu, 18 Oct 2018 09:00:25 +0000 (11:00 +0200)]
luci-app-mjpg-streamer: remove reference to luci.i18n.loadc()
The i18n.loadc() function has been a no-op since almost six years.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Thu, 18 Oct 2018 08:54:12 +0000 (10:54 +0200)]
luci-base: introduce luci.i18n.dump()
Add a new luci.i18n.dump() function which returns all currently loaded
translation strings as Lua table.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Thu, 18 Oct 2018 07:52:07 +0000 (09:52 +0200)]
luci-base: fix luci.i18n.setlanguage()
Rework the setlanguage() implementation to actually switch catalogues
if another language has been loaded previously and change it to return
the effectively loaded language tag.
Also improve input parameter validation and accept tags in both lower
or upper case.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Wed, 17 Oct 2018 10:57:34 +0000 (12:57 +0200)]
luci-base: template: add translation iterator function
Introduce a new luci.template.parser.get_translations() function which will
iterate all loaded translation entries and pass the to the given callback
function.
This is useful to expose the loaded translations in other formats, e.g. for
wrapping them into JSON feeds.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich [Wed, 17 Oct 2018 10:47:20 +0000 (12:47 +0200)]
build: i18n-scan.pl: *.js support, location annotations
Extend i18n-scan.pl to scan JavaScript files for translation strings as
well and annotate produced *.po template files with source code location
markers.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>