Skip to content

<package>.cgi

JBBgameich edited this page May 1, 2018 · 2 revisions

<package>.cgi

This script file generates the packages specific web-page where the package specific configuration and settings can be configured.\

In the build environment located at:

~/freetz-trunk/make/files/root/usr/lib/cgi-bin/<package>.cgi

on router located at:

/mod/usr/lib/cgi-bin/<package>.cgi

The Freetz GUI is based on the concept of Proccgi (http://www.fpx.de/fp/Software/ProcCGI.html) from Frank Pilhofer.

This is for the environment variables in the form of <PACKAGE>_<VARIABLENAME>
The input-fields in the HTML-pages will have the Tag name="<variablename>".
These fields correspond with the variables.
The GUI-pages all make use of a Frame-Formula, that is part of freetz, which after using the Apply button on the page, will read the values of these variables, and assigns to the corresponding environment variables.\

Below a generic <package>.cgi file with only one config variable:

#!/bin/sh


. /usr/lib/libmodcgi.sh

check "$<PACKAGE>_ENABLED" yes:auto "*":man

sec_begin '$(lang de:"Starttyp" en:"Start type")'

cat << EOF
<p>
<input id="e1" type="radio" name="enabled" value="yes"$auto_chk><label for="e1">$(lang de:"Automatisch" en:"Automatic")</label>
<input id="e2" type="radio" name="enabled" value="no"$man_chk><label for="e2">$(lang de:"Manuell" en:"Manual")</label>
EOF
cat << EOF
</p>
EOF

sec_end
sec_begin '$(lang de:"<package>" en:"<package>")'

cat << EOF

<p>$(lang de:"<Parameter>" en:"<Parameter>"): <input type="text" name="<parameter>" size="80" maxlength="255" value="$(html "$<PACKAGE>_<VARIBALE>")"></p>
EOF

sec_end

NOTE: the lang instruction is used on the build environment only.
Using a file with the lang instruction on the router will generate the following output *** error: language not set ***
This (a bit misleading) message is generated by /bin/lang\

cat /bin/lang

#!/bin/sh
echo '*** error: language not set ***'
Clone this wiki locally