From patchwork Thu Feb 18 14:30:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo-Andres Hofmann X-Patchwork-Id: 3898 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4DhHFD2B43z3wps for ; Thu, 18 Feb 2021 14:30:56 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4DhHFC59vGzsY; Thu, 18 Feb 2021 14:30:55 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4DhHFC4WZpz2xn3; Thu, 18 Feb 2021 14:30:55 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4DhHFB0gdbz2xX7 for ; Thu, 18 Feb 2021 14:30:54 +0000 (UTC) Received: from arche.uberspace.de (arche.uberspace.de [185.26.156.147]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPS id 4DhHF81RH4z11 for ; Thu, 18 Feb 2021 14:30:52 +0000 (UTC) Received: (qmail 28734 invoked from network); 18 Feb 2021 14:30:36 -0000 Received: from localhost (HELO localhost) (127.0.0.1) by arche.uberspace.de with SMTP; 18 Feb 2021 14:30:36 -0000 From: Leo-Andres Hofmann To: development@lists.ipfire.org Subject: [PATCH v2 4/6] zoneconf.cgi: Add Javascript for new GUI elements Date: Thu, 18 Feb 2021 15:30:14 +0100 Message-Id: <20210218143016.972-4-hofmann@leo-andres.de> X-Mailer: git-send-email 2.27.0.windows.1 In-Reply-To: <20210218143016.972-1-hofmann@leo-andres.de> References: <20210218143016.972-1-hofmann@leo-andres.de> MIME-Version: 1.0 ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=none; spf=pass (mail01.ipfire.org: domain of hofmann@leo-andres.de designates 185.26.156.147 as permitted sender) smtp.mailfrom=hofmann@leo-andres.de ARC-Seal: i=1; s=202003rsa; d=lists.ipfire.org; t=1613658652; a=rsa-sha256; cv=none; b=mbanNl2Wp57V/rHJH65Q3C50tHg2AhEdn5rkeizRpzBimDS1GpXFY7pXt9SQmgava1auA9 3BPKozrwA8mRnT0K2GONHwEIFLlDp2NWoiFI7E7uHXm9pv+vTW2+MI10k/Gu777/Fk3koX X0iEGjrw/K/+UWL6x7RAJjlQqI9P52Fj1WLQ+G6bhmcs6Ff8+qwwI85Hf1ho3+/+UdQ0tH Te8Af8jDDNrEnmbzvNxxw1ti9JklhAl/CEXkTz4iJY1K3UDJiIlu4orpBgtJr2L9yEjUzs 3F81hFG1TOnGLkt2IHn9oAd0xnwh7CuHhocofTtCOOqz3sZ6xnx/lMrZqBnNBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.ipfire.org; s=202003rsa; t=1613658652; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4PJUOc3W0+2qra0kHnBLCSPbxR0umMn/yyA4Wg3JOm8=; b=iYV0iKqGYFV6fvLDkyCydh+gNcoJBBi/baR9pVx9Y4z1StjgYOiQbL7SUcUBVYjSEf+mRw HykBGq9boJIrSXTUcotHbGvTv6sI4H+BGSqhyOGzy/qztXiv1dO1+ckeHlRdhnIpECpkhh FGSd9lzxitCDUyxkaUlZWyrS6oBRFi7+cbwPMDy8blY/xVqtdhUU6urgpkrETCqzWxq4F7 soeKVoZ27sPv+ILuFXMyBeMsqaMX/4v8Or/ciYcX7q3ihUgjugeRCepyisz/+1yUgJg9aa 05Hq4oZL+p+dOD5Lp0Ynl2PC/7qJOtzJYi8xWuNUQtPzA/P4rQZhNc4JQ4aztQ== Authentication-Results: mail01.ipfire.org; dkim=none; spf=pass (mail01.ipfire.org: domain of hofmann@leo-andres.de designates 185.26.156.147 as permitted sender) smtp.mailfrom=hofmann@leo-andres.de; dmarc=none X-Rspamd-Server: mail01.haj.ipfire.org X-Spamd-Result: default: False [-0.01 / 11.00]; ARC_NA(0.00)[]; BAYES_HAM(-3.00)[99.99%]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+mx:c]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_TLS_LAST(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MID_CONTAINS_FROM(1.00)[]; IP_REPUTATION_HAM(-1.71)[asn: 205766(-0.24), country: DE(-0.01), ip: 185.26.156.147(-0.61)]; ARC_SIGNED(0.00)[lists.ipfire.org:s=202003rsa:i=1]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:205766, ipnet:185.26.156.0/24, country:DE]; RCVD_COUNT_TWO(0.00)[2]; DMARC_NA(0.00)[leo-andres.de] X-Rspamd-Queue-Id: 4DhHF81RH4z11 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Signed-off-by: Leo-Andres Hofmann --- html/cgi-bin/zoneconf.cgi | 6 +++--- html/html/include/zoneconf.js | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/html/cgi-bin/zoneconf.cgi b/html/cgi-bin/zoneconf.cgi index 1d30450ed..eb6cd0e66 100644 --- a/html/cgi-bin/zoneconf.cgi +++ b/html/cgi-bin/zoneconf.cgi @@ -410,7 +410,7 @@ foreach (@zones) { print <$uc
- @@ -544,7 +544,7 @@ foreach (@zones) { # load settings and prepare form elements for each zone # enable checkbox HTML my $row_1 = < - + END ; @@ -553,7 +553,7 @@ END # priority input box HTML my $row_2 = < - + END ; diff --git a/html/html/include/zoneconf.js b/html/html/include/zoneconf.js index d76f0ab68..d27a79bc8 100644 --- a/html/html/include/zoneconf.js +++ b/html/html/include/zoneconf.js @@ -54,3 +54,30 @@ function highlightAccess(selectObj) { //if interface is assigned, highlight table cell in zone color colorParentCell(selectObj, zoneColor, (selectObj.value !== 'NONE')); } + +//update zone mode +function changeZoneMode(selectObj) { + if(!(selectObj && ('zone' in selectObj.dataset))) { + return; //required parameters are missing + } + + // STP enable checkbox + let stpEnable = document.getElementById('STP-' + selectObj.dataset.zone); + if(stpEnable) { + stpEnable.disabled = (selectObj.value !== 'BRIDGE'); //STP is available if zone is in bridge mode + stpEnable.checked = stpEnable.checked && (! stpEnable.disabled); //un-check if disabled + stpEnable.dispatchEvent(new Event('change')); + } +} + +//STP enable checkbox change toggles priority input +function changeEnableSTP(inputObj) { + if(!(inputObj && ('zone' in inputObj.dataset))) { + return; //required parameters are missing + } + + let priority = document.getElementById('STP-PRIORITY-' + inputObj.dataset.zone); + if(priority) { + priority.disabled = inputObj.disabled || (! inputObj.checked); + } +}