``The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
ANY KIND, either express or implied. See the License for the specificlanguage governing rights and
limitations under the License.

The Original Code is KF Web Server Admin Interface.

The Initial Developer of the Original Code is KeyFocus Ltd. (http://www.keyfocus.net) Portions created by
KeyFocus Ltd. are Copyright (C) 2002-2003 KeyFocus Ltd. All Rights Reserved.

Contributor(s): ______________________________________.


[NOTE: The text of this Exhibit A may differ slightly from the text of the notices in the Source Code files of the Original Code.
You should use the text of this Exhibit A rather than the text found in the Original Code Source Code for Your Modifications.]

================================================================================

KF Web Server Admin Interface Source Code
----------------------------------------

KeyFocus has released the source code for the Admin Interface to enable you to make custom modifications
and translate it into other languages.

The Admin Interface has been released under the Mozilla Public License.
Please read the file LICENSE.TXT for details.
The rest of KF Web Server is not subject to this license and the source code will not be released.

Included in this distribution you will find the source code to the admin interface, system scripts and
the supporting image, html and javascript files.

- KeyFocus Developers
http://www.keyfocus.net


System Scripts
==============
Located in systemscripts

servererror.wkf
---------------
This script is used by the server to generate custom error messages.

makeindex.wkf
---------------
This script is used by the server to generate a directory index.

Admin Scripts
=============
Located in admin and admin\lib

The main admin interface source file is index.wkf
This is only a small file. Most of the interface is in the *.ikf include files which are added into the
index.wkf script by the compiler.

Compiling the admin interface
=============================
The scripts are written in a language called KPL.

KPL is a compiled language. The ASCII test of the source files are converted into a special p-code
format that makes it more compact and much faster to run.

To compile the admin interface the KPL compiler must be run.
A batch file called makekfws.bat automates this process. This can be run from the command line or by
double clicking on it from Windows Explorer.

If the compilation worked no message will be displayed by the compiled file index.ckf will be
created or updated if it already exists.

If there was a problem, such as a syntax error then the compiler will print out a message telling you
the line number and the source file containing the error.

Once compiled simply copy over the file index.ckf into the server directory to make it run.

Editing the code
----------------
Use any text editor to change the code. Make sure you save the files as plain ASCII text.

The KPL Language
----------------
We have not had time to document the KPL language, but the following notes should help.

KPL is very similar PHP, however it has an entirly different code base under the hood and
there are many small differences.

The purpose of KPL is to generate HTML files that are sent to the user's browser.
KPL does other things as well such as shutting down the server and re-writting the servers
configuration file; kfws.conf


Translating the source code into other languages
------------------------------------------------
In order to translate the admin interface into another language you only need to change the
text contain in string that are displayed to the user.

Be carefull which string you change. Many of the strings contained in the code are names
used to update the configuration file. This names are hard coded in the web server and if they
are changed the web server will not recognise them.

There are two ways of specifing a string of text in KPL.

Double quote strings
--------------------
Characters surrounded by "" are considered a text value.
These strings must be on a single line, i.e. they cannot contain the new line character.
These string can contain escape codes that are translated into other characters.
e.g. \n, new line \t, tab, \" double quote.

Code example
------------
echo("Hello World\n"); // write out the text Hello World followed by a new line.

Pipe quote strings
--------------------
Characters surrounded by || are considered a text value.
These strings can be on multiple lines, i.e. they can contain the new line character.
Pipe quote strings ignore escape codes so \n will be treated as is.

Pipe quote strings are very useful for containing a large blocks of text that may contain quote
characters, such is often used in HTML.

Code example
------------
echo(|Hello World
|); // write out the text Hello World followed by a new line.


Where to start
==============
There is a lot of code in the admin interface, however most does not need to be altered.

Start with changing the text of the main main.

Open up the file "kfwsmenu.ikf" and find the text "function showTitleMenu($selmenu)".

Change the values of these strings.

$topmenu[0] = "Status";
$topmenu[1] = "Web Sites";
$topmenu[2] = "Server";
$topmenu[3] = "Security";
$topmenu[4] = "MIME";

Now go ahead and find the similar code for all the sub menus.

Now have a go at changing the text of the server status screen.

Open up the file "kfwsstatus.ikf" and find the text "function showserverruntime()".

Change the string in this function call:

echo("The Server has been running since <B>",$sst,"</B>, for");

Do not change "<B>", as this is a HTML tag.

The text $sst is a variable containing the current time obtained from the system
function serverstarttime()

Warning
-------
kfconfigSetTypeSetting("","","sinbinNumConnectionLimitExceeded", toint($sinbinNumConnectionLimitExceeded));

In the example code line above, the string "sinbinNumConnectionLimitExceeded" is the
name of the configuration setting and must not be changed.




