Getting started

Prerequisite developement environement

Installing the developement environement
ComponentLink
XAMPP 7.4 Web Server with php and My SQLwww.apachefriends.org/download.html
Java SE Development for Netbeanswww.oracle.com/java/technologies/downloads/#jdk19-windows
Nebeans Editornetbeans.apache.org/download/nb15
K8 Web Kitk8webkitb5.zip

Install K8 Web Kit

Download and install

  • Download K8 Web Kit mit Bootstrap 5
  • Unzip
  • Install: copy it in your php server folder: <myproject>
  • Create your mysql database
  • Execute the sql scripts
  • set the mysql connection: "masterdata/_mysql.php"
  • set the domain variables: "masterdata/_init.php"

Set the mysql connection

Open the file "masterdata/_mysql.php" and set the connection parameter to your mysql-server: server, username, password and database.

Execute the SQL script

Please execute the following scripts from the folder "mysql":

  • k8basic.sql
  • k8examples.sql

User

this are the the pre installed username:

  • superuser, password superuser
  • admin, password admin (clientID=1)

Don't forget to register new users for testing (Attention _init.php changes first).

Configuration in init.php

Parameter for user management
Parameter Description
domain_useractive 0 : direct after registration
1 : with activation mail
domain_activekey 1234 : with this factor the activation key is encoded, please put your own number in.
domain_readpassword 0 : off, the password is never read
1 : password read by user and admin
2 : password read only by user
3 : password read only by admin
domain_loginenabled 0 : login is disabled
1 : login is enabled
domain_registerenabled 0 : registration is disabled
1 : registration is enabled
3 : registration still in menu, but not yet available
domain_roles 1 : admin, all rigths for client
2 : superuser, all rights in database
3 : member, logged in user
5 : friends, added in my data
30: right groups, look social groups below
domain_rightmode 0 : Standard
1 : with clients
2 : with right groups
domain_testemail empty or example: user@yourdomain.com
Normally an email has to be unique in your application. For your own testing this email is an exeption.
domain_email If you use only your native language write please your own text here. If you use multiple languages, change it please in the masterdata/js/lang_sys_<language>.js file.
['activate']['subject'] activate your account
['activate']['content'] Dear member,
please activate your account: <a href=\"{{activation_link}}\"<activation link>/a><br>Greetings<br>{{domain_name}}
['sendPwd']['subject'] Your password
['sendPwd']['content'] Dear member,
your new password: {{password}}
Greetings
{{domain_name}}

Please edit the file masterdata/init.php.

CSS

This are the CSS files:

  • css/k8webkitb5.css
    here you should put your CSS in. You also can rename it. If you rename it, change the name also on _head.php.
  • css/examples.css
    common CSS for HTML elements.
  • masterdata/css/examples.css
    CSS for the core elements

Many other CSS files from bootstrap or the libraries are located in specific project parts.

k8webkitb5.css

The CSS defines your individual design:

  • body
    • text, family, size, ...
    • color
    • background-color
  • general
    • header: h1, h2, h3, h4, h5, h6
    • link: a, hover, visited
  • areas
    • navbar
    • footer
  • pages
    • landing page
    • membership
    • ...

Using a CSS template, for example from bootstrapmade

css/k8webkitb5.css:

Main parts of the index.php

This are the main parts of the website included in the index.php:

  • PHP
    • masterdata/_init.php
    • _init_page.php
  • head
    • _head.php
  • body
    • _header.php
    • your content
    • _footer.php

_init_page.php

The basic pages are defined in the pages-array. Basic and additional pages are listed below. One easy way to add more pages is to extend the pages array.

_head.php

The links to all required libraries and stylesheets are defined here.

_header.php

The brand name and the menu is defined here. The file can be overwritten or the menu can be changed like described here.

your content

The content can be filled by:

  • your programm code
  • 1 element
  • multiple elements

_footer.php

The foot of the page can be designed here.

Basic Pages

The basic pages
Designation page Comment
Public
Landing Page ""
(this page is displayed by empty page)
by k8pages
masterdata/_init.php, $domain_homepage=home
datadefID=k8pages&marking=home
otherwise
_home.php
Registration register datadefID=k8loginregister
Login login login and send password
folder: myproject/_loginlogout
Activate activate This is the link form the activation email
folder: myproject
file: _activate.php
Contact contact The contact form is displayed
folder: myproject
file: _contact
masterdata/ProcessMethod.php?process_action=sendContact
Legal notice depend on init.php
Privacy policy depend on init.php
Terms of use depend on init.php
Member
Membership membership depend on init.php
My data mydata The details to the logged in user are displayed
folder: masterdata
datadefID=k8login
Member member This is an example of k8components
folder: kitsamples
datadefID=k8components
Admin
User list user_list Master data dialog for the users
folder: masterdata
datadefID=k8login
Basics basics Dialog for the groups
folder: masterdata
datadefID=k8groups
Pages Master data dialog for pages
folder: masterdata
datadefID=k8pages&page=masterdata
Menu Master data dialog for menuentries
folder: masterdata
datadefID=k8menuentries&page=masterdata
Test test

Allows to test your code.
folder: myproject
file: _test.php

Info info

Displays Browser and Session details.
file: _test.php

The pages can be copied to the project folder and can be changed there. A description of the parameters is added later.

depend on _init.php

in the _init.php, variable "pagelinks" the url and title can be defined. The url can be a page with a file or an record of the k8pages table.

Additional Pages

The additional pages
page Comment
masterdata displays a master data dialog
list displays a list (tabulator library)
form displays the form (k8form)
catalog displays a catalog
detail displays a detail page
lineedit displays a list which can be edited
simpledata displays a master data form with a search field
chartjs displays chart.js graph

Additional pages display the desired page and datadefinition. The parameter "datadefID" always need to be added, example:

  • index.php
    ?page=masterdata
    &datadefID=k8components

Connection and Session

A Web App needs a connection to the server and a server session to control the data access. Unfortunately, both can be lost. Due to inactivity the web server closes the session. A mobile device can lose the internet coverage for various reasons.

This are the measurements to reduce the user problems:

  • session loss
    • login with cookie: With the next request, the user is automatically logged in again
    • without cookie: the user is automatically logged out due to inactivity
  • connection loss, a loss of connection is only recognized by an user interaction:
    • clicking a link: the service worker opens an offline page. The original page will load automatically when the connection is restored.
    • clicking save: an error message is displayed. The “brand-name” is displayed in red color. After the connection is restored, the brand-name will be displayed in normal color again. When a cookie is set, the form data will be saved.
    • filtering data: an error message is displayed. The “brand-name” is displayed in red color. After the connection is restored, the brand-name will be displayed in normal color again. The requested data will be loaded and displayed.

Other interactions need to be coded by the app developer.

Cookies

In germany necessary cookies, like session-ID or cookie request, are allowed without obligation to inform. For other cookies an express consent in necessary. Please have a look to e-recht24.de.

Please, take care on the cookie law in your country.

masterdata/_init.php, the domain_cookiemode:

  1. no cookie (manual)
  2. cookie request (manual)
  3. cookie allowed (by user)
  4. cookie denied (by user)

domain_cookieconfig[language], the text in dialog

  • title
  • text
  • allow
  • deny

Place the cookies at the end of index.php in the section domain_cookiemode==2.