diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/form.js | 14 | ||||
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/ui.js | 5 | ||||
-rw-r--r-- | modules/luci-base/luasrc/dispatcher.lua | 32 | ||||
-rw-r--r-- | modules/luci-base/po/de/base.po | 8 | ||||
-rw-r--r-- | modules/luci-base/po/fr/base.po | 22 | ||||
-rw-r--r-- | modules/luci-compat/luasrc/view/cbi/footer.htm | 6 | ||||
-rw-r--r-- | modules/luci-compat/luasrc/view/cbi/header.htm | 3 | ||||
-rw-r--r-- | modules/luci-compat/luasrc/view/cbi/map.htm | 6 |
8 files changed, 71 insertions, 25 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index c65cb04b13..9e0a80ad33 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -2266,6 +2266,16 @@ var CBITableSection = CBITypedSection.extend(/** @lends LuCI.form.TableSection.p */ /** + * If set to `true`, the header row with the options descriptions will + * not be displayed. By default, descriptions row is automatically displayed + * when at least one option has a description. + * + * @name LuCI.form.TableSection.prototype#nodescriptions + * @type boolean + * @default false + */ + + /** * The `TableSection` implementation does not support option tabbing, so * its implementation of `tab()` will always throw an exception when * invoked. @@ -2402,7 +2412,7 @@ var CBITableSection = CBITypedSection.extend(/** @lends LuCI.form.TableSection.p trEls.appendChild(trEl); } - if (has_descriptions) { + if (has_descriptions && !this.nodescriptions) { var trEl = E('div', { 'class': 'tr cbi-section-table-descr ' + anon_class }); @@ -2421,7 +2431,7 @@ var CBITableSection = CBITypedSection.extend(/** @lends LuCI.form.TableSection.p (typeof(opt.width) == 'number') ? opt.width+'px' : opt.width; } - if (this.sortable || this.extedit || this.addremove || has_more) + if (this.sortable || this.extedit || this.addremove || has_more || has_action) trEl.appendChild(E('div', { 'class': 'th cbi-section-table-cell cbi-section-actions' })); diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index 4219932b9a..50410762fe 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -444,7 +444,8 @@ var UITextarea = UIElement.extend(/** @lends LuCI.ui.Textarea.prototype */ { /** @override */ render: function() { - var frameEl = E('div', { 'id': this.options.id }), + var style = !this.options.cols ? 'width:100%' : null, + frameEl = E('div', { 'id': this.options.id, 'style': style }), value = (this.value != null) ? String(this.value) : ''; frameEl.appendChild(E('textarea', { @@ -454,7 +455,7 @@ var UITextarea = UIElement.extend(/** @lends LuCI.ui.Textarea.prototype */ { 'readonly': this.options.readonly ? '' : null, 'disabled': this.options.disabled ? '' : null, 'placeholder': this.options.placeholder, - 'style': !this.options.cols ? 'width:100%' : null, + 'style': style, 'cols': this.options.cols, 'rows': this.options.rows, 'wrap': this.options.wrap ? '' : null diff --git a/modules/luci-base/luasrc/dispatcher.lua b/modules/luci-base/luasrc/dispatcher.lua index e132044625..d14a866737 100644 --- a/modules/luci-base/luasrc/dispatcher.lua +++ b/modules/luci-base/luasrc/dispatcher.lua @@ -324,6 +324,14 @@ local function tree_to_json(node, json) end end + if type(subnode.acl_depends) == "table" then + for _, acl in ipairs(subnode.acl_depends) do + spec.depends = spec.depends or {} + spec.depends.acl = spec.depends.acl or {} + spec.depends.acl[#spec.depends.acl + 1] = acl + end + end + if (subnode.sysauth_authenticator ~= nil) or (subnode.sysauth ~= nil and subnode.sysauth ~= false) then @@ -1321,12 +1329,23 @@ function _cbi(self, ...) local cbi = require "luci.cbi" local tpl = require "luci.template" local http = require "luci.http" + local util = require "luci.util" local config = self.config or {} local maps = cbi.load(self.model, ...) local state = nil + local function has_uci_access(config, level) + local rv = util.ubus("session", "access", { + ubus_rpc_session = context.authsession, + scope = "uci", object = config, + ["function"] = level + }) + + return (type(rv) == "table" and rv.access == true) or false + end + local i, res for i, res in ipairs(maps) do if util.instanceof(res, cbi.SimpleForm) then @@ -1380,6 +1399,7 @@ function _cbi(self, ...) local applymap = false local pageaction = true local parsechain = { } + local writable = false for i, res in ipairs(maps) do if res.apply_needed and res.parsechain then @@ -1405,12 +1425,19 @@ function _cbi(self, ...) end for i, res in ipairs(maps) do + local is_readable_map = has_uci_access(res.config, "read") + local is_writable_map = has_uci_access(res.config, "write") + + writable = writable or is_writable_map + res:render({ firstmap = (i == 1), redirect = redirect, messages = messages, pageaction = pageaction, - parsechain = parsechain + parsechain = parsechain, + readable = is_readable_map, + writable = is_writable_map }) end @@ -1421,7 +1448,8 @@ function _cbi(self, ...) redirect = redirect, state = state, autoapply = config.autoapply, - trigger_apply = applymap + trigger_apply = applymap, + writable = writable }) end end diff --git a/modules/luci-base/po/de/base.po b/modules/luci-base/po/de/base.po index e6762a7477..4376aa9fe9 100644 --- a/modules/luci-base/po/de/base.po +++ b/modules/luci-base/po/de/base.po @@ -3,8 +3,8 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-05-26 17:57+0200\n" -"PO-Revision-Date: 2020-04-11 19:41+0000\n" -"Last-Translator: Jo <jo@mein.io>\n" +"PO-Revision-Date: 2020-04-20 07:11+0000\n" +"Last-Translator: ce4 <chregger@gmail.com>\n" "Language-Team: German <https://hosted.weblate.org/projects/openwrt/luci/de/>" "\n" "Language: de\n" @@ -12,7 +12,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.0-dev\n" +"X-Generator: Weblate 4.0.2-dev\n" #: modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js:927 msgid "%.1f dB" @@ -4744,7 +4744,7 @@ msgstr "Resource nicht gefunden" #: modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js:810 #: modules/luci-mod-system/htdocs/luci-static/resources/view/system/startup.js:97 msgid "Restart" -msgstr "Neustarten" +msgstr "Neustart" #: modules/luci-mod-status/htdocs/luci-static/resources/view/status/iptables.js:313 msgid "Restart Firewall" diff --git a/modules/luci-base/po/fr/base.po b/modules/luci-base/po/fr/base.po index ec37bfd44d..506a679eae 100644 --- a/modules/luci-base/po/fr/base.po +++ b/modules/luci-base/po/fr/base.po @@ -3,8 +3,8 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-06-10 03:40+0200\n" -"PO-Revision-Date: 2020-04-10 05:49+0000\n" -"Last-Translator: Claude Villermain <cvi@villermain.net>\n" +"PO-Revision-Date: 2020-04-20 11:03+0000\n" +"Last-Translator: viking76 <liaudetgael@gmail.com>\n" "Language-Team: French <https://hosted.weblate.org/projects/openwrt/luci/fr/>" "\n" "Language: fr\n" @@ -12,7 +12,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.0-dev\n" +"X-Generator: Weblate 4.0.2-dev\n" #: modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js:927 msgid "%.1f dB" @@ -301,8 +301,8 @@ msgstr "Ponts ATM" #: protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/pppoa.js:66 msgid "ATM Virtual Channel Identifier (VCI)" msgstr "" -"Identifiant de canal virtuel (<abbr title=\"Virtual Channel Idendifier" -"\">VCI</abbr>) ATM" +"Identifiant de canal virtuel (<abbr title=\"Identifiant de canal virtuel\"" +">VCI</abbr>) ATM" #: modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js:969 #: protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/pppoa.js:70 @@ -580,7 +580,7 @@ msgstr "" #: modules/luci-base/htdocs/luci-static/resources/form.js:569 msgid "An error occurred while saving the form:" -msgstr "" +msgstr "Une erreur pendant enregistrement formulaire :" #: modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js:888 #: modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/50_dsl.js:20 @@ -902,7 +902,7 @@ msgstr "Débit" #: modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js:266 msgid "Bogus NX Domain Override" -msgstr "Contourne les « NX Domain » bogués" +msgstr "Contourne les « NX Domain » bogués" #: modules/luci-base/htdocs/luci-static/resources/network.js:2859 #: modules/luci-compat/luasrc/model/network.lua:1421 @@ -1559,7 +1559,7 @@ msgstr "Appareil inaccessible ! Toujours en attente de l’appareil ..." #: modules/luci-mod-network/root/usr/share/luci/menu.d/luci-mod-network.json:78 msgid "Diagnostics" -msgstr "Diagnostics" +msgstr "Diagnostiques" #: protocols/luci-proto-3g/htdocs/luci-static/resources/protocol/3g.js:101 #: protocols/luci-proto-ncm/htdocs/luci-static/resources/protocol/ncm.js:93 @@ -3893,11 +3893,11 @@ msgstr "Fréquence de fonctionnement" #: modules/luci-base/htdocs/luci-static/resources/form.js:1766 #: modules/luci-base/htdocs/luci-static/resources/form.js:3380 msgid "Option \"%s\" contains an invalid input value." -msgstr "" +msgstr "Option \"%s\" contient une valeur erronée." #: modules/luci-base/htdocs/luci-static/resources/form.js:1779 msgid "Option \"%s\" must not be empty." -msgstr "" +msgstr "Option \"%s\" doit être vide." #: modules/luci-base/htdocs/luci-static/resources/ui.js:3866 msgid "Option changed" @@ -4912,7 +4912,7 @@ msgstr "Enregistrer et Appliquer" #: modules/luci-base/htdocs/luci-static/resources/form.js:568 msgid "Save error" -msgstr "" +msgstr "Erreur Sauvegarde" #: modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js:398 msgid "Save mtdblock" diff --git a/modules/luci-compat/luasrc/view/cbi/footer.htm b/modules/luci-compat/luasrc/view/cbi/footer.htm index fecf1bce7c..abcc47b920 100644 --- a/modules/luci-compat/luasrc/view/cbi/footer.htm +++ b/modules/luci-compat/luasrc/view/cbi/footer.htm @@ -19,15 +19,15 @@ end if display_apply then - %><input class="btn cbi-button cbi-button-apply" type="button" value="<%:Save & Apply%>" onclick="cbi_submit(this, 'cbi.apply')" /> <% + %><input class="btn cbi-button cbi-button-apply" type="button" value="<%:Save & Apply%>" onclick="cbi_submit(this, 'cbi.apply')"<%=ifattr(not writable, "disabled")%> /> <% end if display_save then - %><input class="btn cbi-button cbi-button-save" type="submit" value="<%:Save%>" /> <% + %><input class="btn cbi-button cbi-button-save" type="submit" value="<%:Save%>"<%=ifattr(not writable, "disabled")%> /> <% end if display_reset then - %><input class="btn cbi-button cbi-button-reset" type="button" value="<%:Reset%>" onclick="location.href='<%=REQUEST_URI%>'" /> <% + %><input class="btn cbi-button cbi-button-reset" type="button" value="<%:Reset%>" onclick="location.href='<%=REQUEST_URI%>'"<%=ifattr(not writable, "disabled")%> /> <% end %></div><% diff --git a/modules/luci-compat/luasrc/view/cbi/header.htm b/modules/luci-compat/luasrc/view/cbi/header.htm index 821fa3efae..9d7ea5079b 100644 --- a/modules/luci-compat/luasrc/view/cbi/header.htm +++ b/modules/luci-compat/luasrc/view/cbi/header.htm @@ -1,4 +1,7 @@ <%+header%> + +<% local has_writeable_map = false %> + <form method="post" name="cbi" action="<%=REQUEST_URI%>" enctype="multipart/form-data" onreset="return cbi_validate_reset(this)" onsubmit="return cbi_validate_form(this, '<%:Some fields are invalid, cannot save values!%>')"<%= attr("data-strings", luci.util.serialize_json({ label = { diff --git a/modules/luci-compat/luasrc/view/cbi/map.htm b/modules/luci-compat/luasrc/view/cbi/map.htm index cda4d3530c..a96f722378 100644 --- a/modules/luci-compat/luasrc/view/cbi/map.htm +++ b/modules/luci-compat/luasrc/view/cbi/map.htm @@ -2,7 +2,8 @@ <div class="alert-message warning"><%=pcdata(msg)%></div> <%- end end -%> -<div class="cbi-map" id="cbi-<%=self.config%>"> +<% if readable then %> +<div class="cbi-map" id="cbi-<%=self.config%>"<%=ifattr(not writable, "style", "opacity:.6; pointer-events:none")%>> <% if self.title and #self.title > 0 then %> <h2 name="content"><%=self.title%></h2> <% end %> @@ -38,3 +39,6 @@ <%- self:render_children() %> <% end %> </div> +<% else %> +<div class="alert-message warning"><%:Insufficient permissions to read UCI configuration.%></div> +<% end %> |