ASAMPLE site
Contents
This document presents the XTEND ASAMPLE site which is the default site provided by XTEND and which contains the standard XTEND token definition as well as an HTML project built with DreamWeaver (web creation software).
This project contains template pages (home, about, login, contact, error...) in order to help the XTEND developer start a project.
The HTML project
Files
The HTML ASMAPLE site is based on a Dreamweaver template.
Pages structure
The page template ('Template\ASAMPLE.dwt') provides an example of divisions via the use of "editable regions" and "libraries .lbi'" with main content and common elements to all pages:
- the name of the company on the top left corner
- a zone for displaying messages on the top right corner
- a menu on the left
- a menu at the bottom
- a style sheet
- 2 JavaScript functions to factorize processes
- upon loading the page (xBodyOnLoad)
- by clicking on a dynamic link (xtdDoMyDlk)
Editable regions
The template provides the following division of "editable regions":
- The page title (doctitle)
- The HTML header (head)
- The content before the FORM tag (beforeForm)
- The main content (Content)
- The content after the FORM tag (afterForm)
Libraries
A page template 'Template\ASAMPLE.dwt' composed of the following libraries:
- A TopLeft.lbi cell which contains the name of the company
- A TopRight.lbi cell which contains the date of the current day and the user messages (aMsgUser token)
- A bottom menu (BottomMenu.lbi)
- A left menu (LeftMenu.lbi)
The paging.lbi library is used to manage paging in XTEND grids.
Graphic elements
The following graphic elements are provided:
- A style sheet (my.css.)
- A range of images in the IMG\ directory
- Images of country flags FLAG\ used in the page "list of countries"
Html pages
The following Html template pages are provided:
- home.html
- about.html
- account.html
- contact.html
- countries.html
- login.html
The following technical html pages are provided:
- notavail.html
- reconnection.html
- error.html
Files
Location
The HTML ASAMPLE project is stored on the main X3 server in the following directory X3_PUB/X3FOLDER/X_TEND/X_HTML/ASAMPLE/FRA in French and .../ENG in English.
X3_PUB
Publication directory for all folders from the current solution
X3FOLDER
Current X3 folder name
If the ASMAPLE site files are not in this directory, it means that XTEND is not available for the current X3 folder.
Under Unix, the user must check that all files of the HTML project have the following access authorizations:
- "Read" for all
- 'Read/Write/execute' for XTEND developers
Copy locally
It is recommended to not modify the ASAMPLE site but to copy files locally by modifying the site name.
Download locally the site content via an FTP customer as FileZilla.
DreamWeaver should be installed first in order to build a site from this template. Then, create a new site which is directed to the locally downloaded directory.
But if DreamWeaver is not installed, the user can perform test by modifying HTML pages with a text editor such as NotePad ++ OR PSPad and update distantly(on the X3 server) via the FTP client. In that case, the used can delete the "Library" and "Templates" directory.
Content management
The pages content is not stored in the HTML page but in the X3 database that can be accessed via the XTEND Html content function.
This aims at showing how it is possible to manage the HTML content of the site in X3.
This method is not optimum because of answer times. The call to the HTML content reading web service (CLOB) is less preferment than the direct display of an HTML page by the HTTP server.
A compromise should thus be found between performance -which depends on many factors (network/machine infrastructure, document size, X3 server workflow, among others) and the easiness of administration of the XTEND site.
Technically, the content is displayed by a field (TEXTE) which value is provided by a section (ABLKDOCHTML).
This section select the HTML content of the page according to the web page name (DOCCOD field) via the call to an interface (ADOCHTML) with the type 'Table generated access'.
Page list
Content pages
home
Home page (Name=AHOME)
about
"About" page (Name=ABOUT)
contact
Page for HTML form entry and save in X3 (Alias=ACONTACT)
login
XTEND login page (Name=ALOGIN)
account
User information page after login (Name=ACCOUNT)
countries
Example page of "Data access" and "detail/list link" which displays the (paged) list of countries (TABCOUNTRY table) and used to select a country in order to display the information (details) on the currency and the language (Name=ACOUNTRIES)
Technical pages
The following pages are technical pages defined at the XTEND site level.
error
Displayed if there is a critical error (Exception) - (Name-AERROR)
notavail
Displayed when the site is not yet available (Name=ANOTVAIL)
reconnection
Displayed when the user gets the session back after closing the browser (Name=ARECONNECTION)
Note
The site works for ENG. All pages are not available in that language.
SAFE X3 links
This paragraph displays the list of interfaces and web services used by the ASAMPLE site and indicates how they can be activated when XTEND is started.
Creation of the web service pool.
Web services can work only after the definition of a default XTEND web service pool.
Validate the pool after creation so that the XTEND server takes it into account.
Operations to perform via the X3 console
The current X3 folder must be published on an X3WEB server via the X3 console. Moreover, the user must find an entry on this folder in the list of "Web services pool" that can be accessed via the X3 function GESAYS(Tool/Web services pools menu).
If the list is empty or does not contains the user's X3 folder, it means that:
- the X3 folder has not been published on the X3WEB server
- no connection pool has been defined for this X3 folder in the configuration of the web service server
These two operations must be done via the X3 console.
Definition of XTEND web service pool
This operation consists in defining a connection pool by default which will be the "entry point" (URL) of all web service calls used by the ASAMPLE site.
Go to the Web services pool.
If the pool 'ADEFAULT' is displayed in the list, modify the information:
- "X3 Pool" so that it is directed to the web service server and the right connection pool
- "User" with the valid X3 login information
If the pool does not exist, refer to the XTEND web service pool document in order to created it with the name 'ADEFAULT'.
Interfaces
This paragraph presents the operation to perform in order to activate interfaces used by the ASAMPLE site.
The ASAMPLE site used the following three interfaces which can be accessed via the interface(GESAYI) function.
Code |
Type |
Parameters |
Publication name |
Description |
ADOCHTML |
Generated access to Table |
AYTDOC Table |
AXTDHTML |
Access the HTML content of XTEND pages |
AXTDLOGIN |
Sub-program action |
AYTXTLOGIN process |
AXTDLOGIN |
XTEND users login |
AXTDFORM |
Object action |
AYZ object |
AXTDAYZ |
XTEND HTML forms (used for contacts) |
ACOUNTRY |
Generated access to Table |
TABCOUNTRY table |
ACOUNTRY |
Access country table |
ACURRENCIES |
Generated access to Table |
TABCUR table |
TABCUR |
Access currency details |
ALANGUAGES |
Generated access to Table |
TABLAN table |
TABLAN |
Access language details |
Interface file Common setups
Pool by default:Yes
Protected access:No
Messages display:Check information, warning, error
ADOCHTML interface
1. Open the ADOCHTML interface record
2. Check the following setups and modify them if they are not correct
Type:'Generated access to Table"
Table code:AYTDOC
Publication name:AXTDHTML
3. Generate the access by clicking on the button "Generate access"
The following elements are created automatically: WTAXTDHTML process, WTAXTDHTML/ACCTAB sub-program record and AXTDHTML web service
1. Check the following setups and modify them if they are not correct
Maximum nb. of lines:10
Fields grid:
Code |
Group |
Dimension |
CAT |
RES |
10 |
CREDAT |
RES |
10 |
DES |
RES |
10 |
DOCCOD |
RES |
10 |
LAN |
RES |
10 |
TEXT |
RES |
10 |
2. Click on OK
3. Check that there are no errors (red text in the log file)
4. Close log file
4. Save and validate the record
AXTDFORM interface
1. Open the AXTDFORM interface record
2. Check the following setups and modify them if they are not correct
Type:Object User action
Object :AYZ
Publication name:AXTDAYZ
3. Generate the access by clicking on the button "Generate access"
The following elements are created automatically: WJAXTDAYZ process and AXTDAYZ web service
1. Check the following setups and modify them if they are not correct
Fields grid:
Code | Group | Dimension |
FRMCOD | AYZ1_1 | 1 |
FCYCOD | AYZ1_1 | 1 |
STATUT | AYZ1_1 | 1 |
TTL | AYZ1_2 | 1 |
MAICOD | AYZ1_2 | 1 |
CREDAT | AYZ1_2 | 1 |
CREHEURE | AYZ1_2 | 1 |
CMT | AYZ1_4 | 1 |
PCT | AYZ1_5 | 1 |
PARNBR | AYZ1_3 | 1 |
PARCOD | AYZ1_3 | 40 |
PARVAL | AYZ1_3 | 40 |
2. Click on OK
3. Check that there are no errors (red text in the log file)
4. Close log file
4. Save and validate the record
AXTDLOGIN interface
1. Open the AXTDLOGIN Interface record
2. Check the following setups and modify them if they are not correct
Type"Sub-program User action"
Process:AYTXTLOGIN
Sub-program:ACTION
Sub-program record (by tunnel on the process field): AYTXTLOGIN/ACTION
3. Generate the access by clicking on the button "Generate access"
The following elements are created automatically: AXTDLOGIN web service
1. Check the following setups and modify them if they are not correct
Fields grid:
Code | Group | Dimension |
AXPARCOD | AX_PAR | 20 |
AXPARVAL | AX_PAR | 20 |
AXUSERCODE | AXLOG_PAR | 1 |
AXPWD | AXLOG_PAR | 1 |
AXUSERPROF | AXLOG_PAR | 1 |
AX3SOL | X3LOG | 10 |
AX3FLDR | X3LOG | 10 |
AX3LANG | X3LOG | 10 |
AX3USER | X3LOG | 10 |
AX3PWD | X3LOG | 10 |
AXLOGCOD | AXLOG_RES | 50 |
AXLOGVAL | AXLOG_RES | 50 |
SHIPADR1 | X3LOG | 10 |
SHIPADR2 | X3LOG | 10 |
SHIPCITY | X3LOG | 10 |
SHIPZIP | X3LOG | 10 |
2. Click on OK
3. Check that there are no errors (red text in the log file)
4. Close log file
4. Save and validate the record
ACOUNTRY/ACURRENCIES/ALANGUAGES interfaces
The procedure is the same as for ADOCHTML with TABCOUNTRY, TABCUR, TABLAN tables.
JavaScript
The use of JavaScript in the ASAMPLE site is limited to:
- the control of particular entered data
- the management of the display of messages
In the following example, a certain number of standard entry points are presented. They are programmed in the DreamWeaver template file (ASAMPLE.dwt) and can be accessed from all pages based on this template.
XTEND library
The JavaScript code, specific to XTEND, is inserted in the HTML page via the ALIBJS token. This token inserts:
- the prototype.js library
- the XTEND JavaScript libraries
- an XTEND style sheet
<script adx="ALIBJS"></script>
HTML page loading
// onLoad event handler for all pages
function xBodyOnLoad()
{
// Set '0' value for unselected checkboxes
xtdSetUnSelelectedValue('0');
// pageBodyOnLoad is the page onLoad handler
if (typeof(pageBodyOnLoad)=="function")
pageBodyOnLoad();
}
}
pageBodyOnLoad
This entry point is used to perform processes specific to the HTML page on the '<BODY onLoad>' event of the page.
To activate this entry point, the user has to declare a JavaScript function 'function pageBodyOnLoad(){}' in the HTML page.
Processes on click on dynamic link
This function is used to erase the user message and to call the control entry point for clicks on dynamic links.
// Called each time the user clicks on an XTEND link
function xtdDoMyDlk(aDomOut)
{
// Clear user messages
xtdRemoveElmtId("xtdusermsg",true);
var wContinue=true;
// Call page handler pageDoMyDlk if any
if (typeof(pageDoMyDlk)=="function") wContinue=pageDoMyDlk(aDomOut);
return wContinue;
}
pageDoMyDlk
This entry point is used to perform processes specific to an HTML page on click on dynamic link.
To activate this entry point, the user has to declare a JavaScript function 'function pageDoMyDlk(){aDomOut}' in the HTML page.
//Asks user to confirm creation of a new form if user clicks on ADLKCONTACTNEW dynamic link
function pageDoMyDlk(aDomOut)
{
if (aDomOut.isDlk("ADLKCONTACTNEW"))
return confirm('Confirm creation of the form\nConfirm creation');
return true;
}