#!/bin/sh
export DATE="14.8.2007";SCRIPT=${0#/rom}
export TITLE="Admin: Publish"
. ${SCRIPT%/*}/cgi-bin-pre.sh
cat< With
the micro-authoring system included with this firmware, it is quite easy
to customize the web pages on this device or add new ones. With the
operating system Windows, you need to install two additional programs: The
script language Perl and an archive
program to pack TAR archives (e.g. UltimateZip).
A standard Linux normally has this software included already. A
perl script (template.pl) will read in an HTML template file
(template.html) looking for the character string "%BODY%". Next,
the perl script will read all other HTML files in the current directory
successively extracting the part between <BODY> and </BODY>.
The extracted HTML code is then injected into the template at the %BODY%
position and the outcome will be written to a new directory (./out-en/).
Referenced
files (e.g. images) are copied by the perl script into the new directory
as well. The character string "$(echo -n %)DATE%" is replaced by
the date/time stamp of the source file. The character string "$(echo -n %)TITLE%" is replaced bye the first H1 headline found in the
source file. If the filename of the source
file starts with "cgi-bin" appropriate shell commands will be
inserted for web server execution. Own shell commands can be written
between <SCRIPT LANGUAGE="shell"></SCRIPT> tags into
the source file. During web server execution shell variables will be
resolved in the standard way. Examples: "\$PWD" will output
$PWD, "\$(ls /tmp)" will list the directory contents of /tmp.
The
resulting destination directory (./out-en/) is then packet with all
subdirectories into a TAR-, TGZ- or TAR.GZ archive. The archive file can
be uploaded via this admin page. Existing pages (such as these admin
pages) are not deleted during this process. Notes
for Windows users: If the programs "tar" and "perl"
are installed, the Linux commands will be accepted in the windows command
prompt as well. You need to replace the "/" character with the
backslash ("\"). The perl script can be executed also by double
clicking the file name "template.pl". Write valid HTML and close open <Tags>
with </Tags>. Use a validating HTML editor or use a text editor with
a some discipline. Add a link to a new
page to the template.html file. Copy one of the existing table rows (e.g.
<TR>... Status ...</TR>) and change the tag <A HREF="">
and the text. It may be necessary to widen the left navigation bar. Search
and change the WIDTH="150" attributes to the desired width. A
new subdirectory will also need a new template.html. The perl script will
read in separate templates for each subdirectory. To save space, change
references to existing images such as "../images/". The
TAR archive will be examined in order to cut out additional subdirectories
in the archive file. Multi-language
support may be added with <SPAN LANG="xx"> tags. Also
TITLE, ALT and VALUE attributes are scanned for the "All
languages!xx:Text for language A!yy:Text for language B" pattern. The
perl script accepts a parameter to filter out the desired language. Web page
upload was aborted.
Web page archive (*.tar)
or intro.jpg:
Creating web pages
Functioning
Brief
Manual
Tips
$ffout
" if [ "${ffout##*/}" = "intro.jpg" ]; then set -x rm -f /www/images/intro.jpg mv "$ffout" /www/images set +x else zflag= if [ -z "${ffout##*.tar.gz}" ] || [ -z "${ffout##*.tgz}" ]; then zflag=-z fi tardir=$(tar $zflag -tvf "$ffout"|if read line;then if [ "-" != $(echo $line|dd bs=1 count=1 2>&-) ];then set $line;echo $6;fi;fi) mkdir /tmp/wwwtmp.$$/ tar -C /tmp/wwwtmp.$$/ $zflag -xf "$ffout" rm -f "$ffout" chmod +x /tmp/wwwtmp.$$/$tardir/cgi-bin*>/dev/null 2>&1 chmod +x /tmp/wwwtmp.$$/$tardir/cgi-bin/*>/dev/null 2>&1 tar -cC "/tmp/wwwtmp.$$/$tardir" .| tar -xvC /www/ rm -rf /tmp/wwwtmp.$$/ fi echo "" else cat<
Web page upload was cancelled.
EOF fi . ${SCRIPT%/*}/cgi-bin-post.sh