summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base
AgeCommit message (Collapse)Author
2018-11-05luci-base: validate DHCP clientid as hexstringJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-05luci-base: cbi.js: add client-side hexstring datatype validatorJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-05luci-base: cbi.js: add heuristics to attribute handling in E()Jo-Philipp Wich
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>
2018-11-05luci-base, themes: rework dynlist and dropdown widgetsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-05luci-base: cbi.js: rework dropdown implementationJo-Philipp Wich
- 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>
2018-11-05luci-base: cbi.js: utilize node.closest() if availableJo-Philipp Wich
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>
2018-11-05luci-base: cbi.js: drop cbi_bind()Jo-Philipp Wich
Just use node.addEventListener() directly since all reasonably recent browsers support it nowadays. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-05luci-base: cbi.js: rework client side input validationJo-Philipp Wich
- 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>
2018-11-05luci-base: cbi.js: fix corner case in IPv6() address parserJo-Philipp Wich
The implementation allowed a hexadecimal string without any colons. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-05luci-base, themes: add tooltip helpers & stylesJo-Philipp Wich
Add the required JS and CSS infrastructure to support rich hover/focus tooltips for element. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-05luci-base: cbi.js: switch to client side translationJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-05luci-base: cbi.js: add client side translation infrastructureJo-Philipp Wich
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>
2018-11-05luci-base: expose system translations to JavaScriptJo-Philipp Wich
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>
2018-11-05luci-base: remove unused i18n functionsJo-Philipp Wich
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>
2018-11-05luci-base: remove references to luci.i18n.loadc()Jo-Philipp Wich
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>
2018-11-05luci-base: introduce luci.i18n.dump()Jo-Philipp Wich
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>
2018-11-05luci-base: fix luci.i18n.setlanguage()Jo-Philipp Wich
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>
2018-11-05luci-base: template: add translation iterator functionJo-Philipp Wich
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>
2018-11-04i18n: sync translationsHannu Nyman
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-11-02Merge pull request #2252 from stweil/lgtmJo-Philipp Wich
Add missing variable declarations in JavaScript code
2018-10-30timezone data: update to 2018gHannu Nyman
Update timezone data to 2018g http://mm.icann.org/pipermail/tz-announce/2018-October/000052.html * Morocco switches to permanent +01 on 2018-10-27. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-10-28Add missing variable declarations in JavaScript codeStefan Weil
This fixes errors reported by LGTM. Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-25Merge pull request #2247 from tano-systems/luci-base-upd-ru-i18nHannu Nyman
luci-base: update and improve Russian translation
2018-10-25luci-base: update and improve Russian translationAnton Kikin
Add missing translations and update existing not quite correct translations. Also removed unnecessary dots at the end of some translations. Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
2018-10-25 timezone data: update to 2018fHannu Nyman
Update timezone data to 2018f http://mm.icann.org/pipermail/tz-announce/2018-October/000051.html Volgograd moves from +03 to +04 on 2018-10-28. Fiji ends DST 2019-01-13, not 2019-01-20. Most of Chile changes DST dates, effective 2019-04-06. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-10-22Merge pull request #2227 from YuriPet/masterHannu Nyman
luci-base: update Ukrainian translation
2018-10-20Merge pull request #2233 from musashino205/l10n/base-upd-jaJo-Philipp Wich
luci-base: update Japanese translation
2018-10-20Merge pull request #2215 from MonwF/feature_root_redirect_pathJo-Philipp Wich
luci-base: redirect root path to /cgi-bin/luci/
2018-10-20luci-base: update Japanese translationINAGAKI Hiroshi
Added and updated Japanese translations. Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2018-10-17luci-base: fix cbi dropdown quirks with MS EdgeJo-Philipp Wich
On MS Edge, the behaviour of "value" attributes on "li" elements is unreliable, so use the "data-" prefix to circumvent the problem. Ref: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/19320991/ Fixes: #2224 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-10-14luci-base: update Ukrainian translationYurii
Updated with the latest sync translation, corrections. Signed-off-by: Yurii yuripet@gmail.com
2018-10-12treewide: Fix typos in UI stringsyangfl
Signed-off-by: David Yang <mmyangfl@gmail.com>
2018-10-11i18n: sync translationsHannu Nyman
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-10-11i18n: fix translationsHannu Nyman
fix .po files Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-10-11luci-base: cbi.js: remove dead codeJo-Philipp Wich
Remove some superfluous code which was added with a previous commit. Fixes: 8270f10f1 ("luci-base: cbi.js: code cleanups") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-10-11luci-base: cbi.js: code cleanupsJo-Philipp Wich
- unify code style - add matchesElem() helper - replace nodeName checks with selector tests - replace className manipulations with classList operations Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-10-10Merge pull request #2197 from yangfl/masterHannu Nyman
treewide: Fix typos in comments
2018-10-10luci-base: move luci.sys.iptparser into separate packageJo-Philipp Wich
Since commit f6bfac211 ("luci-mod-status: rework iptables status page"), nothing in luci-base depends on the iptparser class anymore, so fold it out into a separate package and let the few apps that require it depend on the new library package. Saves about 10K uncompressed in luci-base while the iptables status rework enlarged the markup by roughly 5KB, saving roughly 5KB of size overall. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-10-10treewide: Fix typos in commentsyangfl
Signed-off-by: David Yang <mmyangfl@gmail.com>
2018-10-10luci-base: show default forwarding policy in zone forwarding listJo-Philipp Wich
The zone forwarding list widget misleadingly displays the intra-zone forwarding policy as default policy action when no forwardings exist instead of the appropriate global defaults forwarding policy which is the one applied to inter-zone forwarded traffic. Fix the issue by displaying the defaults policy and not the per-zone policy to match what the firewall implementation is actually doing. Fixes: #2213 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-10-10luci-base: validate name in firewall zone selector widgetJo-Philipp Wich
When creating a new zone through the firewall zone selector widget, validate the given name before creating new items. Depends on commit 0b6ae96f2 ("luci-base: cbi.js: recognize invalid input in dropdown create field"). Fixes: #2211 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-10-10luci-base: cbi.js: recognize invalid input in dropdown create fieldJo-Philipp Wich
This is required to allow for validating the create field values in later commits. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-10-10luci-base: redirect root path to /cgi-bin/luci/xiongjie
Fix openwrt/luci#1062 Signed-off-by: MonwF <boluo2@gmail.com>
2018-10-09timezone data: update to 2018eHannu Nyman
Update timezone data to 2018e http://mm.icann.org/pipermail/tz-announce/2018-May/000050.html North Korea switches back to +09 on 2018-05-05. The main format uses negative DST again, for Ireland Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-10-03luci-base: reword rollback notification dialogJo-Philipp Wich
Rename "Apply unchecked" to "Apply anyway" for better clarity and update the base translation files accordingly. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-10-01i18n: update Chinese translationyangfl
Signed-off-by: David Yang <mmyangfl@gmail.com>
2018-09-29luci-base: corrections to Russian translationJo-Philipp Wich
Add grammar corrections suggested in PRs #2114 and #2190. Suggested-by: Roman <x.wserfer@gmail.com> [squash #2114 and #2190, reword commit message] Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-09-29luci-base: cbi.lua: fix TypedSection.parse()Darius
It's not necessary to execute all code if section already exists. Signed-off-by: Darius Joksas <jok.darius@gmail.com> [reword commit message, squash commits, remove stray semicolon] Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-09-27Merge pull request #2184 from kyle30312/logout-cookie-fixJo-Philipp Wich
luci-base: fix sysauth cookie not removed on logout
2018-09-27luci-base: fix sysauth cookie not removed on logoutKyle Rogers
Signed-off-by: Kyle Rogers <7157021+kyle30312@users.noreply.github.com>