[PATCH v11 4/6] fff-web: Include new options into settings.html

Adrian Schmutzler mail at adrianschmutzler.de
Fr Nov 3 14:46:05 CET 2017


Hallo,

siehe unten.

> -----Original Message-----
> From: Tim Niemeyer [mailto:tim at tn-x.org]
> Sent: Donnerstag, 2. November 2017 23:30
> To: Adrian Schmutzler <freifunk at adrianschmutzler.de>; franken-
> dev at freifunk.net
> Subject: Re: [PATCH v11 4/6] fff-web: Include new options into settings.html
> 
> Hi
> 
> Am Mittwoch, den 18.10.2017, 23:30 +0200 schrieb Adrian Schmutzler:
> > This includes the new options introduced due to the /etc/config/fff
> > file into the WebUI.
> >
> > Changes in v11:
> > - Readjusted to KeyXchangeV2
> >
> > Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> >
> > Tested-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> > ---
> >  .../fff-web/files/www/ssl/cgi-bin/settings.html    | 72
> ++++++++++++++++++++--
> >  1 file changed, 67 insertions(+), 5 deletions(-)
> >
> > diff --git
> > a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
> > b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
> > index b785aed..99d8c7a 100755
> > --- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
> > +++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
> > @@ -37,7 +37,33 @@ if [ "$REQUEST_METHOD" == "POST" ] ; then
> >  		uci -q set "simple-tc.example.ifname=wan"
> >  		uci -q set "simple-
> tc.example.limit_ingress=${POST_limit_ingress}"
> >  		uci -q set "simple-
> tc.example.limit_egress=${POST_limit_egress}"
> > -
> > +
> > +		# Restliche Einstellungen
> > +		uci -q set "fff.notifyupdate=webui"
> > +		if [ "$POST_upgrade_notification" == "on" ] ; then
> > +			uci -q set "fff.notifyupdate.value=1"
> > +		else
> > +			uci -q set "fff.notifyupdate.value=0"
> > +			rm -f /tmp/fwcheck
> > +			rm -f /tmp/isupdate
> > +		fi
> Ok
> 
> > +		if [ "$POST_upgrade_reset" == "on" ] ; then
> > +			uci -q set "fff.notifyupdate.resetonupgrade=1"
> > +		else
> > +			uci -q set "fff.notifyupdate.resetonupgrade=0"
> > +		fi
> Kann weg.
> 
> > +
> > +		if uci -q get system.poe_passthrough > /dev/null ; then
> > +			uci -q set "fff.poe_passthrough=fff"
> > +			if [ "$POST_poe_passthrough" == "on" ] ; then
> > +				uci -q set "fff.poe_passthrough.active=1"
> > +				uci -q set "system.poe_passthrough.value=1"
> > +			else
> > +				uci -q set "fff.poe_passthrough.active=0"
> > +				uci -q set "system.poe_passthrough.value=0"
> > +			fi
> > +		fi
> > +
> Ok
> 
> >  		uci -q commit
> >
> >  		MSG='<span class="green">Daten gespeichert! - Bitte Router
> neustarten.</span>'
> > @@ -48,11 +74,22 @@ fi
> >  <%in /www/ssl/cgi-bin/helpers %>
> >  <%
> >  # read
> > -if [ "$(uci -q get 'fff.trafficcontrol.enabled')" == "1" ] ; then
> > -	traffic_checked='checked="checked" '
> > +chkd='checked="checked" '
> > +if [ "$(uci -q get 'fff.trafficcontrol.enabled')" == "1" ] ; then # not set=0
> > +	traffic_checked="$chkd"
> >  else
> >  	traffic_checked=""
> >  fi
> > +if [ "$(uci -q get 'fff.notifyupdate.value')" == "0" ] ; then # not
> > +set=1
> not set = 1? Ne, weil bei 0 wird ja checked nicht gesetzt, sondern bei 1..

Das ist anders gemeint: "not set" heißt wenn der Eintrag in der fffconfig fehlt, weil ihn noch nie jemand dorthin geschrieben hat.

Im Falle der Update-Notification ist die aktiv ("1"), wenn kein Eintrag existiert (not set).

Entsprechend prüfe ich hier =0, damit der Fall =1 im else clause landet.

Bei den anderen ist es anders herum (Trafficcontrol ist standardmäßig aus ...).

Grüße

Adrian


> 
> > +	upgrade_checked=""
> > +else
> > +	upgrade_checked="$chkd"
> > +fi
> > +if [ "$(uci -q get 'fff.notifyupdate.resetonupgrade')" == "0" ] ;
> > +then # not set=1
> Weg damit.. ;)
> 
> > +	upgrade_reset_checked=""
> > +else
> > +	upgrade_reset_checked="$chkd"
> > +fi
> >  %>
> >  <% show_msg %>
> >  <form method="post">
> > @@ -74,8 +111,9 @@ fi
> >  		<tr><th>E-Mail Adresse:</th><td><input type="email"
> name="contact" value="<%= $(uci -q get 'fff.system.contact') %>"
> /></td></tr>
> >  	</table>
> >  </fieldset>
> > +<p><input type="submit" style="margin-top: 5px; margin-left: 3px;"
> > +/></p>
> >  </td><td>
> > -<fieldset style="min-height: 13em;" class="smallinput">
> > +<fieldset style="min-height: 7em;" class="smallinput">
> >  	<legend>Bitratenbegrenzung</legend>
> >  	<table>
> >  		<tr><th>Aktiviert:</th><td colspan="2"> @@ -85,8 +123,32
> @@ fi
> >  		<tr><th>Freifunk Upload:</th><td><input
> type="text" name="limit_egress" value="<%= $(uci -q get
> 'fff.trafficcontrol.limit_out') %>" /></td><td>kbit/s</td></tr>
> >  	</table>
> >  </fieldset>
> > +<fieldset style="min-height: 8em;" class="smallinput">
> > +	<legend>Weitere Einstellungen</legend>
> > +	<table>
> > +		<tr><th>Show upgrade notification:</th><td colspan="2">
> > +			<input type="checkbox"
> name="upgrade_notification" <%= ${upgrade_checked} %>/>
> > +		</td></tr>
> > +		<tr><th>Reset notification setting after upgrade:</th><td
> > +colspan="2">
> Weg damit..
> 
> > +			<input type="checkbox" name="upgrade_reset" <%=
> ${upgrade_reset_checked} %>/>
> > +		</td></tr>
> > +
> > +		<%
> > +		if uci -q get system.poe_passthrough > /dev/null ; then
> > +			if [ "$(uci -q get 'fff.poe_passthrough.active')" == "1" ]
> ; then # not set=0
> > +				poe_pt_checked="$chkd"
> > +			else
> > +				poe_pt_checked=""
> > +			fi
> > +		%>
> > +		<tr><th>Enable PoE passthrough:</th><td colspan="2">
> > +			<input type="checkbox" name="poe_passthrough"
> <%= ${poe_pt_checked} %>/>
> > +		</td></tr>
> > +		<% fi %>
> > +
> > +	</table>
> > +</fieldset>
> >  </td></tr>
> >  </table>
> > -<p><input type="submit" style="margin-top: 5px; margin-left: 3px;"
> > /></p>
> Kann mir grade nicht vorstellen, wie der Button oben aussieht..
> 
> Tim
> 
> >  </form>
> >  <%in /www/ssl/cgi-bin/footer %>
> > --
> > 2.7.4
> >




Mehr Informationen über die Mailingliste franken-dev