Installing the jLogBook Application

What you need before you get started

Overview of Installation Steps

Installing jLogBook

Configuring jLogBook with the config.py and jLogbook.prefs file

Configuring multiple Instances

Logging In from a URL or Hypertext Link

 

1 What you need before you get started

Before installing jLogBook, the following must have been completed:

1.1 Choosing the web server

There are two webservers available for you to choose from I.e. The Apache web server and the jLogBook web server. Essentially, the Apache server is more scalable up to very large numbers of users and the jLogBook server is a much simpler installation. You should choose:

  1. The Apache web server if you intend having a large number of users connected at once (say 15 plus) and
  2. The jLogBook server if you do not intend have a large number of users connected at any one time (say less than 15) and you would like to have a very simple installation.

Note that the jLogBook configuration is the same for the apache web server and the jLogBookserver so it is easy to change from one kind of server to the other. If you are just investigating the functionality of the jLogBook, we would recommend the jLogBook server.

2 Overview of Installation Steps

To install jLogBook, you need to do the following:

  1. Install the database of your choice (Oracle or SQL Server). Note that even if the database is installed on another machine, you will need the client software for the database installed on the machine you are running the jLogBook 4 server from. You will also need Microsoft's Data Access Components MDAC version 2.6 or later.
    (If you are using Access, there is no need to install the database, since the Access drivers are included with the Microsoft Data Access Components.)

  2. Download jLogBook Version 4 and the relevant license file.

  3. Install the Web Server and associated software.

  4. Install the jLogBook software.

  5. Install the spell checker and the relevant dictionary.

Note that steps 3 and 4 above are included in a single step if you choose the jLogBook server.

3 Installing jLogBook 4

The jLogBook version 4, being a server-based system, will require someone who is familiar with the concept of web servers.

3.1 Downloading the Version 4 Install files

You can get the jLogBook Version 4 files from the St. James Software web at http://www.sjsoft.com or directly from St. James by e-mailing them at info@sjsoft.com.

The jLogBook server version is typically called: jLogbook-4.4.9-setup.exe where in this case the version number is 4.4.9 and

The apache version is typically called jLogbook-4.4.9.win32-py2.3.exe

3.2 Installing the jLogBook server version

To install the jLogBook server version of jLogBook:


Double Click on the jLogbook-4.4.8-setup.exe applications:
The Welcome banner will appear. Click on Next:
The system will ask which directory to install jLogBook on. Select C:\Program Files\jLogBook and click next:
The system will ask which Start Menu folder to use: Select jLogBook
The system will say Ready to Install. Click on Install and the system will start installing.
The system will say Completed Installing. Click on the Finish Button.

Starting the jLogBook System

Click on the Start->Programs->jLogBook>jLogbookServer
A command window will appear saying "Listening on port 8080"
This means the server is ready to accept connections.

(Note that you can also just start a command window, CD into the c:\program files\jLogBook directory and enter jLogBookserver.)

Connecting to the jLogBook Server

In a browser (Internet Explorer or Firefox) enter the URL
http://localhost:8080 (for the local machine) or
http://<machinename>:8080 for a remote server.

You will see a screen saying Login for jLogBook Menu Page.
Enter the username admin with no password and click on Login

You will see the Select application page.
Click on the Demo option. You will see the demo application appear.

3.3 Installing the Apache web server version

3.3.1 Unzipping the install files

Unzip the jLogbook4xx.zip file into a directory called c:\install say. When you unzip the download file, it will create a folder called jLogBook under the install folder. You will need the files from this directory for the install below.

3.3.2 Components of the install files

In addition to the jLogBook install, you will also find installs for Apache, Mod Python and the spell checker (in the c:\program files\Aspell directory). There is also a copy of this manual in pdf form in the c:\install directory). There is also a copy of jMachine.exe in the install directory. (This is used to get the id of the server machine for the permanent license).

3.3.4 Windows Installer

Note that you will need windows installer version 1.2 or higher to load the software in the next section. You can get the latest version from http://www.microsoft.com. If you need help, please contact St. James Software.

3.3.5 Install Apache

From the install\jLogBook folder;

Double click on the apache_2.0.46-win32-x86-no_src.msi (or later) file. The installer will start up...

Set: Network Domain: e.g. sjsoft.com

Server Name : e.g. vmwin2000

Administrators email address: e.g. nickh@sjsoft.com

Leave the All Users checkbox checked

Click the Next button

 

Next page: choose Typical

Folder: Accept c:\program files\apache group

Then start Install

......

Finished.

 

You should also see the Apache feather icon in the system tray.

 

To test:

Start Apache by left clicking on the feather icon on the system tray.

Start Internet Explorer

Go to http://<servername> e.g. http://vmwin2000

You should see the Apache test page.

3.3.6 Install Python

From the jLogBook folder:

Double click on the Python 2.3.3 (or later) item. The installation will start:

Accept the python directory and click Next

Choose make backups on the next screen and click Next

Deselect all the options except

click Next

Accept the program group and click Next

click Next again and python will install.

Click Finish.

 

To Test:

From the start menu, click programs, Python 2.3, Python(command line) You should see python start up and the >>>> prompt.

Type Ctrl Z and enter to exit

3.3.7 Install the Python Extensions for Windows

From the jLogBook folder:

Double click on the pywin32-200.win32-py2.3.exe (or later) item. The installation will start:

click Next,

Leave the (...default editor....) checkbox checked and click next again. The installation will start.

Click finish.

 

To Test:

From the start ->program files-> python2.3, start the PythonWin editor. It should start fine. Close the editor down.

3.3.8 Install Mod_Python

From the jLogBook folder:

Double click on the mod_python-3.1.3-1.win32-py2.3.exe (or later) item. The installation will start:

click Next to go to the next screen.

Accept the python options on the next screen.

Click Next to start the Mod_Python installation.

Accept the "Where is Apache installed" option.

Accept the suggestions on modifying the Apache configuration.

Finish

 

3.3.9 Install jLogBook 4.x.x

 

Note: If you have already installed jLogBook and you are going to install a later version, then you should first back up the config.py file and your jLogbook.lic file.

(These files should be in the C:/Python23/Lib/site-packages/jLogBook/python directory.)

Once the new version is installed, if required, you can copy the back-up over the new config.py.

 

To install this module, double click on the jLogbook-4.0.x.win32-py2.2.exe (or later) item in the jLogBook install directory.

Click Next when the install program starts

Then accept the Python install location by clicking Next again.

Click Next again to start the install, Click Yes to overwrite files.

Accept the recommended changes to the Apache configuration files.

Finish.

 

To test jLogBook with the supplied demo database:

First check that your config.py file is pointing to the correct database. I.e. Open up the file

C:\Python23\Lib\site-packages\jLogBook\python\config.py with an editor.

Check the DBNAME is pointing to the database. Once you have made any changes, save the file and restart apache.

 

Open your web browser and enter http://<servername>/demo/

(replace <servername> with the name of your server, as you did above).

 

You should see a login prompt, and can login as admin (no password)

 

If there are any errors at this stage, they should be investigated before proceeding.

3.5 Installing the license

3.11 Setting up the jLogBook License

jLogBook Version 4 Licensing Paradigm

jLogBook version 4 uses a concept known as floating licenses. I.e. the licenses are floating in that they may be used from any computer on the network. In contrast to earlier versions, jLogBook version 4 is only concerned with how many users or strictly speaking user sessions are logged in at any one time and not concerned with which users. I.e. users may now log in from any computer that has access to the server as defined by the permissions that have been set up by your system administrator.

When a user attempts to log on, jLogBook simply counts the number of sessions currently connected to the system and if the number of sessions is less than the sessions specified in the License, then jLogBook will allow the new user to log on. If however, the number of active sessions has already reached the number of sessions specified in the license, then jLogBook will not allow the new user to connect to the system and will display a message indicating that the Licensed number of sessions has already been reached.

To increase the number of active sessions connected to a system, simply purchase additional licenses and install the new license file as described below.

Purchasing and Installing the jLogBook Licenses

You can purchase license either by

  1. Calling St. James Software (+27 21 782 0868, or, in the USA 1 877 696 2047 XT 86) or

  2. Sending an email to sales@sjsoft.com

Getting the id of your server machine.

To get your permanent license, you will need to send the id of your server machine to St. James Software. You do this by

  1. Opening a command (DOS) window and changing directories to the c:\install directory,

  2. Entering jMachine at the prompt. The id will be printed out in the window.

  3. Highlight the id and click on enter

  4. Paste the id (with control V) into an email to support@sjsoft.com .

  5. St. James Software will email you back the license file (called jLogbook.lic) which must be saved in the c:\python23\lib\site-packages\jLogBook\python folder.

To test whether your license has been successfully loaded and recognized

3.12 Installing the StartUp and Demo databases on Oracle and SQL Server

Before you get started with Oracle or SQL Server, you need to install the StartUp and Demo databases. (The jLogBook Download already includes MS Access Databases.) To create the necessary tables in Oracle or SQL Server,

  1. First make sure you have a valid connection to the database,
    Oracle: As an example, log in as sys/<password>@<databaseName> you will need to create a schema with code similar to Create user logbook identified by logbook, then grant resource, connect to logbook.
    SQL Server: As an example, use QTADO and connect via the Microsoft OLDEB provider. You will probably connect using user sa, with no password.

  2. Go to the jLogBook Home directory (usually c:\python22\Lib\site-packages\jLogBook) and locate the jLogbookDemoV4xx.txt and the jLogbookStartupV4xx.txt files.

  3. In a command shell, go to the jLogBook Home directory (usually c:\python22\Lib\site-packages\jLogBook), CD into the python directory and type:
    restore.py <nameofinstance> jLogbookDemoV4xx.txt 1 1 or
    restore.py <nameofinstance> jLogbookStartupV4xx.txt 1 1

If you are having difficulty running these scripts, please contact your system administrator or contact us via email at support@sjsoft.com.

3.13 Installing the Spell Checker and Language dictionary

If you intend to use a spell checker, then you must install both the spellchecker and the associated dictionary

 

If you have downloaded the jLogBook (complete installation) and unzipped it, you will find the Aspell setup.exe and the Aspell English dictionary in the c:\install directory.

 

You just double click on each of these in turn and they will install. Once installed, you will also have to inform the system (via the config.py file (or for the jLogBook server, the jLogbook.prefs file) which fields are to be spell checked. (See section 2.5.7below)

 

If you need a language other than English, you will need to download and install the relevant dictionary from the web site at:
http://aspell.net/win32/ and

 

4 Configuring jLogBook using the configuration file

The configuration of the admin oriented components of jLogBook such as the database connection is carried out via the configuration file. In earlier versions, this was via the config.py file and in later versions, via the jLogbook.prefs file. The format of the two are very similar and essentially they do the same thing. See the section on configuration file compatibility.


4.1 The configuration file for the jLogBook server version

The jLogBook server uses a configuration file called jLogbook.prefs. This file is usually located in the c:\program files\jLogBook directory. In essence, the file is very similar to the config.py file discussed below. Like the config.py file, there are instances in the jLogbook.prefs file. Here are two example instances (applications):

 

Demo = Common:
  DBNAME = "jLogbookDemo.mdb"
  DBHOST = None
  DBUSER = "admin"
  DBPASSWORD = ""
  DBPROVIDER = ADOProviders.AccessProvider
  DBTYPE = "access"
  attachmentsdir = "attachments/demo"
  sessionkey='demo-change'
  gridrefreshinterval=30
  formheight=40
DemoSql = Common:
  DBNAME = 'demosql'
  DBHOST = 'HURLEY'
  DBUSER = "sa"
  DBPASSWORD = ""
  DBPROVIDER = "SQLOLEDB.1"
  DBTYPE = "sqlserver"
  attachmentsdir = "c:\temp\attachments"
  sessionkey='change'
  gridrefreshinterval=30
  formheight=40
  gridheight=60
  extrafilters='boolean'
  reporttype = 'html'
  maxgridlines = 1
  maxgridchars = 400
  formlabelalignment = 'right'
  logoimage = 'c:\program files\jLogBook\demologo.png'
  logform:
    MESSAGE:
        SPELLCHECK = "True"

The jLogbook.prefs file (like the config.py file for the Apache version) tells the jLogBook where to look for the database as well as many other things which are discussed here.

4.2 The configuration file for the apache version

The apache version uses a configuration file called config.py.

You need to edit the config.py configuration file to reflect your database and various other settings.

To get started:

Open the file: C:\Python23\Lib\site-packages\jLogBook\python\config.py

(If you right click on it, and select "Edit" it should open in PythonWin. You can also use notepad or any other text editor)

Note that by default two application configurations (instances) are provided – Demo, which links to the standard Demo database included, and Logs, which you can modify to your own database.

To edit the Logs configuration, follow the instructions below. If you later want to include other configurations, see Section 2.6 (Configuring Multiple Instances).

 

Example of a class in config.py

Here is a typical example of a class (that represents your application in jLog). We will refer to this in the notes below:

class Demo(common):
  DBNAME = 'C:\\Program Files\\jLogBook\\jLogbookDemo.mdb'
  DBHOST = None
  DBUSER = "admin"
  DBPASSWORD = ""
  DBPROVIDER = "Microsoft.Jet.OLEDB.4.0"
  DBTYPE = "access"
  attachmentsdir = "c:\\temp\\attachments"
  sessionkey='change'
  gridrefreshinterval=30
  formheight=40
  gridheight=60
  formlabelalignment = 'right'
  extrafilters='boolean'

 

4.3 Configuring the database connection parameters

Customize the login information so that the system is aware of the database you intend using as described below.

  1. DBNAME: Enter the name of the database you are going to connect to.
    Access: Simply the filename of the database.
    E.g. 'C:\\Program Files\\jLogBook\\jLogbookDemoV40.mdb'
    SQL Server: The name of the database. E.g. ‘Process1’
    Oracle: The name of the database. E.g. ‘LogBook’

  2. DBHOST: This is a SQL Server specific parameter. The host name of the computer in which the database is running. I.e. if SQL Server is running in a different computer, then you should enter the name of the computer host here. E.g. ‘dbserver’. Note that if you are using the database in the same machine as the jLogBook application, or are using a database other than SQL Server, just enter the word None here without any enclosing hyphens.

  3. DBUSER: The name of the user login for the database that jLogBook will use to log in to the database. E.g.
    Access: the name would typically be ‘Admin’.
    SQL Server: The name of the user that jLogBook will use to log in to the SQL database. E.g. ‘System’. (Often the database may have been created with the user 'sa' and with password ''.
    Oracle: You may have created a new schema to run the application so you would enter the schema name here.

  4. DBPASSWORD: Enter the password here. E.g. ‘userpassword’

  5. DBPROVIDER: This is the name of the OLEDB provider that will be used to communicate with the database server. You can either use a predefined provider name from ADOProviders, or enter a name as a string. E.g.
    Access: ADOProviders.AccessProvider or "Microsoft.Jet.OLEDB.4.0"
    SQL Server: ADOProviders.SQLServerProvider or "SQLOLEDB.1"
    Oracle: ADOProviders.MSOracleProvider or "MSDAORA.1"
    Note: to use the Oracle-supplied OLE DB Provider for Oracle instead of the Microsoft-supplied provider, enter ADOProviders.OracleProvider.

  6. DBTYPE: This should be one of the following 'access', 'oracle', or 'sqlserver'.

4.3 Other system parameters in the configuration file

There are other system parameters that you can configure in the config.py file in addition to the log in parameters:


4.3.1 The reporttype parameter

If you would like the reports to print out in Acrobat format, then you should enter the following line in your config.py file.

reporttype = "pdf"

If this is the case, then you will have to install the reportlab application. You can get this from the St. James Software support center. I.e. support@sjsoft.com

Note that the reporttype default is "htm" which you do not have to specify.

4.3.2 The formlabelalignment parameter

You can use this parameter if you would like the labels in the form to be right justified or middle justified (default is left justified). Here are two examples:

formlabelalignment = 'middle'

formlabelalignment = 'right'

 

 

4.3.3 The extrafilters parameter

You may specify two alternate filters for power users that will appear when the filter button is clicked. These are:

specialfilter: here you can enter a where clause which will be added to the filter string (e.g. Area='South' or Area = 'Central' ) or

boolean: which will allow you to create a filter string by pointing and clicking the various elements.

 

To specify the extrafilters, you add the following line to the config.py file (remember to be careful of the indenting)

extrafilters='boolean,special' for both filters or

 

extrafilters='boolean' for just the Boolean or

 

extrafilters='special' for just the special filter.

For information on how to use the extra filters, please see the section Extra Filters

 

 

4.3.4 The maximum attachment size parameter

The Max Attachment Size Parameter is also specified in the configuration file.

(Usually in the c:\python22\Lib\site-packages\jLogbook\python directory.)

 

The format of the specification is:

maxattachmentsize = <Number of Kilobytes>

 

e.g.

maxattachmentsize = 1500

means that, if the user attempts to load a file whose size is greater than 1.5MB then the system will not attach the file.

 

The statement is placed in the config.py file in the instance class area as shown in the above example in section 2.5.

 

If you do not specify a maxattachmentsize , then the system will attach any file irrespective of its size.

4.3.5 The timeshift parameter

If the server is located in a different timezone and you want to record the logs in the local time, you can specify the difference in time between the server and the local user. In the example below, the user site is in New York and the server is located in San Antonio. Since the user site is one hour ahead, we specify the time (in seconds) as 3600. I.e.

    timeshift = 3600

Now when an operator in New York adds a record, the time will show as 1 hour ahead of the server in Texas.

If however, the user was in Denver, (for the same server in Texas) you would specify the time shift as:

    timeshift = -3600

Note that the audit log still currently records the changes in logs in the server time.

4.3.6 The Spell Checking facility

Note that if you want to use this facility, then you must download and install the spellchecker and the required language dictionary you want to use with the spell checker. (See spell checker installation here.)

If you want to perform a spell check on any of the fields, then you need to specify these fields in the config.py. For example, if you wanted to perform a spell check on the MESSAGE and COMMENT fields, then you would add entries to the instance in the config.py or the config.prefs file as shown below:

Adding the specification in the jLogbook.prefs file:

A typical specification will look like this in the jLogbook.prefs file:

Classname = Class(Common)
  # other specifiers here.
  logform:
    MESSAGE:
      SPELLCHECK = "True"
    COMMENT:
      SPELLCHECK = "True"

Adding the specifications in the config.py file:

 

class logform:
  MESSAGE = {"SPELLCHECK": "True"}
  COMMENT = {"SPELLCHECK": "True"}

 

Please note that these are curly brackets {} not round brackets()!

 

Indentation: Note that the line with the words class logform must be the same indentation as the other lines in the instance specification. The last part of a typical config.py section may look similar to this:

  formheight=40
  gridheight=60
  class logform:
    OPCOMMENT = {"SPELLCHECK": "True"}
    MESSAGE = {"SPELLCHECK": "True"}

Where in this case, the two categories to have spell check ability would be OPCOMMENT and MESSAGE.

Note also, that you may only perform a spell check on items that are text type items. I.e. in the configuration, the Type of Form Object should be Text.

Using the spell checking facility

When you have done this, a button will appear below the fields you have specified (after you have clicked the add or modify link) and if you click on this, a spell check will be performed allowing you to modify the words if necessary. See the diagram below:

 

Once you have changed the words that are spelt incorrectly, click on the resume editing button and you will see the normal modify form.

 

4.3.7 maxgridchars and maxgridlines configuration

Where the log entries are large, for example in a Knowledge base application, you may wish to limit the number of lines or number of characters in a single entry in the grid. To do this, use one or both of the maxgridlines or maxgridchars parameters in the instance in the config.py file. For example,

 

maxgridlines = 5

maxgridchars = 400

 

Will limit the maximum number of lines showing in the grid to 5, or the maximum number of characters showing in the grid to 400.

 

Note that the mechanism will only limit the viewed data after the first return character after the maxgridlines or maxgridchars limit has been reached. I.e. it doesn't truncate the sentence in the middle but waits till it is completed. This means that the actual displayed number of lines will usually be larger than the number specified.

 

4.3.8 The Gallery facility

Overview

If you are working a lot with graphic files, you can define a gallery of graphics. (For example, if you want to take a large number of screenshots during an incident, you may want to just dump them in the gallery.)

When you click on the link in the form, you will see thumbnails of the images in the gallery. Now you can choose one or a number of these images to be attached to your record. When you have finished, selecting the images, just click on the Finished button.

 

Setting up the Gallery Facility

To attach documents from the gallery, you create a category of type ImagesAttachment. Here is a typical configuration screen.

 

 

You Set the Type to ImagesAttachment and the DB format to STRING. You also set the Form to True so that there is a link in the Form.

 

In addition to this configuration, you must also modify the config.py file. You need to:

 

  1. add an import statement at the top of the config.py. (No indenting) I.e.

    from jToolkit.widgets import thumbgallery
    and


  2. add two additional lines into the config.py into the instance that relates to this gallery as follows.

 

serverclass = thumbgallery.ThumbnailServer(jlogbook.jLogbookServer)
gallerydir = 'c:\\docs\\My Pictures'

Please make sure that the indenting of these two lines coincides with the indenting of the other lines. For example:
gridrefreshinterval=30

formheight=40

  gridheight=60
  extrafilters='boolean'
  serverclass = thumbgallery.ThumbnailServer(jlogbook.jLogbookServer)
  gallerydir = 'c:\\docs\\My Pictures'

4.3.9 Adding Logos to your jLogbook

If you would like your logo on the Form, here is what you would need to do:

  1. Put the logo (as a jpg, gif or png file) into a folder under the html directory.


    For the jLogbook.prefs file: create a folder called images under the C:\Program Files\jLogbook\Lib\site-packages\jLogbook\<name of instance>\html directory and copy the logo there.
    For the config.py file: create a folder called images under the c:\python23\lib\site-packages\jLogbook\html directory and copy the logo there.
  1. Reference the logo image from the jLogbook.prefs or config.py file

You should be sure that the indentation is correct. Here is an example of a config.py instance with a logo directive:
class Demo(common):

  DBNAME = 'C:\\Program Files\\jLogbook\\demo.mdb'
  DBHOST = None
  DBUSER = "admin"

  DBPASSWORD = ""
  DBPROVIDER = "Microsoft.Jet.OLEDB.4.0"
  DBTYPE = "access"
  attachmentsdir = "c:\\temp\\attachments"
  formheight=40
  gridheight=60
  logoimage = "/images/sjslogo.png"

Restart jLogbook server or Apache and you should see the logo in the form.

3.3.9 Adding E-mail facilities to your LogBook

You can configure the logbook to send emails whenever a log is added, modified or deleted. You can send emails to specific people whenever a certain condition occurs or you can get the operator to choose who he wants to send the message to. (Or a combination of both of these options.)

This facility is covered in more detail in the mail message section.

4.4 Custom software configuration

Overview

With the jLog application, it is possible to override various programs in the standard application with custom code. For example, if there is a special requirement to re-order the grid that the standard configuration does not support, then you may want to override the "getorderbyclause" method in the jLog program with a custom version of this method. Generally, this kind of customization is best done by St James Software since they are intimately aware of the structure of the standard program.

How it works

  1. In the config.py file, we specify that the logtableclass that we will use is located in the custom directory. In this case the user is called acme. The entry in the config.py directory is as follows:
    logtableclass = acme.OrdersTable
    Essentially this statement tells the program to use this module instead of the standard module for the logtableclass.

  2. We create a custom directory called acme in the jSuite.py\custom directory.

  3. We create and add code that inherits all the methods and functions from the standard offering (in this case, a class called logrecords) but also overrides the code that we want to replace. In this case, we are overriding the getorderbyclause method. We save the custom code in the new jSuite.py\custom\acme directory and we call it acme.py. An example of this code is shown in section 2.5.11.3below.

  4. Now when the program runs, instead of using the standard logtableclass, it will use the custom logtableclass (which is identical to the standard module with the exception of the getorderbyclause method.

 

Custom specifications in the jLogbook.prefs file: Note that the specification of the custom classes in the jLogbook.prefs file is slightly different. Here is a brief example of a custom specification in the jLogbook.prefs file:

import modules:
  mailmessage = 'jLogbook.custom.mailmessage' # Note 1

acme = Common:

  logtableclass = mailmessage.LogbookTable # Note 2

Note 1: The line under the import modules line tells the jServer where to get the module (in this case from a module called mailmessage.py in the custom directory) and also assigns a name to it which can be used later in the prefs file. (In this case, the name is mailmessage)

Note 2: The line in the instance area tells jServer to use a different class for the logtableclass instead of the standard one. In this case, it is the LogbookTable class in the mailmessage class defined in Note 1. To find the class name (in this case, Logbooktable, you can look in the module code which is provided in the c:\program files\jLogbook\custom directory.

Example of custom code

Here is the example code of the custom orderbyclause requirement.

 

from jLogbook.python import logrecords

 

class OrdersTable(logrecords.LogTable):
"""customised logtable for Acme"""
def __init__(self, db, errorhandler):
logrecords.LogTable.__init__(self, db, errorhandler)

def getorderbyclause(self, session):
"""creates an order by clause for this session..."""
orderby = logrecords.LogTable.getorderbyclause(self, session)
username = "'%s'" % session.username.lower()
respusername = "%s(resp)" % self.db.dblowerfn()
# check instr both ways to ensure equality
userfirstclause = "instr(%s, %s) * instr(%s, %s) desc" % (username, respusername, respusername, username)
# note that this assumes order by is in lowercase...
orderby = orderby.replace("order by ", "order by "+userfirstclause+", ", 1)
return orderby

Maintaining the custom code

Note that the custom code should be treated in the same way as the configuration data. I.e. it should be backed up regularly together with the config.py module and the database tables.

4.5 Saving config.py and restarting

Please note the following:

4.6 Testing the configuration

Restart the apache server from the feather icon in the tray. (Or the jLogbook server from the command shell)

For the apache server,

Go to http://<servername>/logs/
(Using the Apache servername chosen above)

For the jLogbook server,
go to http://<servername>:8080/logs/

In both cases, you should be presented with a login screen.

Login, (user Admin, no password) and you should see the jLogBook in action!

Click on the configure link and you should see the number of licenses you have available.

 

5 Configuring Multiple Instances

The jLog system can support multiple different applications (instances) using the same web server. For example, you could be running an order book, a logbook and some other application you have custom designed.

If you want to add additional instances, follow the procedure below:

  1. Create a new database (SQL Server or Access) / schema (Oracle), import the sample database, and configure the new application to your requirements.

  2. Edit the config.py file as follows:
    Copy the "class Demo" block. Change the database name and log in information so that the class points to the database or schema you created in 1. above.
    Also change the name of the attachments directory and
    if necessary, the sizes of the forms and grids.
    Finally, add the name of the class as a dictionary entry into the instances dictionary on the IndexPage at the bottom of the file.

 

Once you have made these changes, restart the apache server and enter the URL http://<sitename> You should see the log in page. Now log in as admin, no password and you should see a menu of different applications (all the applications in the instances line in the config.py file.) Click on one of the links to verify that it is all working.

Users for Multiple Instances

When you are using multiple instances, there are two levels of logging in the first level to get to the menu when you first log on, and the second level where you actually log on to the application from the menu. Your config.py file may look like this:

 

class IndexPage(Demo):
  
# this maps the directories to the different application configurations
  serverclass = jlogbook.jLogbookMultiServer
  instances=         {'demo':Demo,'knowledgebook':KnowledgeBook,                        'orderbook':OrderBook,'handoverbook':HandoverBook,'logs':Logs,'MyApp':MyApp}

 

This means that the system is using the Demo class (ie. class IndexPage(Demo) to determine the first level of log in. I.e. if you add new users to the MyApp application, the first level of login is still unaware of this. In this case, you would have to log in as a Demo user to get to the menu, then, when you click on the MyAppp option, you would be able to log in as a MyApp users. To get around this problem, just change the line:

class IndexPage(Demo):

to

class IndexPage(MyApp):

and restart apache. Now the MyApp instance will be used for the initial and further logins.

 

 

 

Note: If the user is valid in both the first and second level, then the system will not ask you to log in to the second level. I.e. it already knows who you are and you meet the criteria for the second level. A new log in message only occurs if the user you logged in as on the first level is not valid on the second level.

 

If you want to change the user on the second level, but stay in the application without going back to the menu, then you can enter the following URL while logged in to the application:

http://<nameofserver>.MyApp/index.htm?islogout =true
This will take you back to a new login screen for the application without going back to the menu.

 

6.0 Starting and logging in from a URL using a hypertext link

You can go directly from a web page into the application by setting a hyperlink as follows: (in the case of the jLogbook server, add :8080 to the server name.)

 

http://<servername>/<nameofclassinconfig.py>/index.htm?islogin=1&username= <username>&password=<password>&language=English

where <servername> is the name of your server,

<nameofclassinconfig.py> is the name of the application class as defined in config.py,

<username> is the username that you would like the user to log in as, and

<password> is this username's password.

If there is no password, you do not need the password clause. If you leave out the password clause, then the system will ask you for a password for that user.

If you leave out the language clause, then it will default to Upper.

Example: This URL will call up the Demo instance in the English language using the jLogbook server.

http://localhost:8080/Demo/index.htm?islogin=1&username=admin&language=English

Note: that the password will be visible to users in the URL so you should not use this facility with the password specified for sensitive users.

Note: There are additional examples of this kind of login in the example menu page at this location.