Skip to content

Commit

Permalink
Merge pull request #17 from webability-go/late-night
Browse files Browse the repository at this point in the history
patch v0.1.0
  • Loading branch information
metalwolf committed Jan 4, 2021
2 parents 546ef86 + 0a025b0 commit 4393dad
Show file tree
Hide file tree
Showing 203 changed files with 11,665 additions and 2,490 deletions.
99 changes: 98 additions & 1 deletion README.md
Expand Up @@ -9,7 +9,97 @@ WAJAF for GO v1

WAJAF is the WebAbility Javascript Application Framework. It is a synchronized GO-Server <=> JS-Client framework to developp organized web applications.

Manuals are available on godoc.org [![GoDoc](https://godoc.org/github.com/webability-go/wajaf?status.png)](https://godoc.org/github.com/webability-go/wajaf)
GO manuals are available on godoc.org [![GoDoc](https://godoc.org/github.com/webability-go/wajaf?status.png)](https://godoc.org/github.com/webability-go/wajaf)

JAVASCRIPT manual:
=============================

The examples and tests show the working functions and the manual of them.

[![GoDoc](https://devwajaf.webability.info)

1. The main core.

The main core contains:

- 2 attributes:

Examples & manuals: [![GoDoc](https://devwajaf.webability.info/examples/core.attributes.html)


- zIndex method, used to set an unused zIndex to a node,

Examples & manuals: [![GoDoc](https://devwajaf.webability.info/examples/core.zindex.html)


- Verification methods is*, used to know the type of JS objects. All the functions return true/false. True means the variable match the specified type by the is* method.
-- isDefined: returns true if the variable is not undefined.
-- isEmpty: returns true if the variable is empty: empty means undefined, null, empty array or empty string.
-- isBool: returns true if the variable is a boolean.
-- isNumber: returns true if the variable is number, integer or float.
-- isString: returns true if the variable is a string or a String object.
-- isArray: returns true if the variable is an array.
-- isObject: returns true if the variable is an object. It includes String(), Date(), {}. etc. Note than Javasript consider null as an object too.
-- isFunction: returns true if the variable is a function.
-- isDate: return true if the variable is a Date object.
-- isDOM: return true if the variable is a DOM node object.

Examples & manuals: [![GoDoc](https://devwajaf.webability.info/examples/core.is.html)


- Objects and nodes methods.

For objects:
- WA.extend: Will extends an object from another (inheritance).
- WA.clone: Will clone an object and all its children.
-- If you dont care the type of object but only its attributes, you can use WA.clone(object, true)
-- If you use the normal method WA.clone(object), it will close the whole object with attributes and methods.
- WA.sizeof: Will calculates the size (number of attributes) of an object.

For DOM nodes:
- WA.createDomNode: Will create a DOM Node of specified type, and apply classname if defined.
- WA.getDomNode: Will get the DOM node of the specified Id.
- WA.toDOM: Will get the DOM node from a string ID or a node itself.

Examples & manuals: [![GoDoc](https://devwajaf.webability.info/examples/core.other.html)


- Node get() functions.

The get function lets you find a node or a set of nodes by rules, then apply some changes on the node.

The get() method works as followed:

1. The code will search all the nodes corresponding to the filter you give it.

There are 3 posibilities:

a - No nodes were found. The subsequent operations will do nothing.
b - There was only one node found. The subsequent operations will work directly on this node.
c - There was more than 1 node found (from 2 to the whole DOM). The subsequent operations will work for each one of the found nodes.

2. The operation is applied to all the node(s).

3. The operations can be chained.


The parameter of get() method is a string used to search the nodes:

"#id": If you want to find a single node by its unique id, using the CSS syntax.
".class": If you want to find a list of nodes by their class, using the CSS syntax.
"!name": If you want to find a list of nodes by their name (in a form).
"tag": If you want to find a list of nodes by their tag type (example: 'div', 'a').

Examples & manuals: [![GoDoc](https://devwajaf.webability.info/examples/core.get.html)


2. The browser core:








TO DO:
Expand All @@ -20,6 +110,13 @@ TO DO:
Version Changes Control
=======================

v0.1.0 - 2020-12-22
------------------------
- First build on GO, with all the necesary code to devel, test, publish and show live examples.
- Adds titleview parameter to buttonelement.js (missing)
- Separates coreext.js and coretemplate.js from core.js


v0.0.15 - 2020-04-26
------------------------
- JS code is now embedded into GO code in resources directory. embed.go is added to generate embedded code, but is not compilable with the libraries.
Expand Down
Empty file added examples/README.md
Empty file.
50 changes: 50 additions & 0 deletions examples/pages/4gl/4gl.code
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title>WAJAF Examples Center</title>
<meta name="Generator" content="WAJAF v1 - www.webability.info - (c) 1999-2020, Ing. Philippe Thomassigny C." />
<meta http-equiv="PRAGMA" content="NO-CACHE" />
<meta http-equiv="Expires" content="-1" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<link rel="stylesheet" href="../prettify/prettify.css" type="text/css" />
<script language="javascript" type="text/javascript" src="/prettify/prettify.js"></script>
<script language="javascript" type="text/javascript" src="/js/wajaf.js"></script>
</head>

<body>

<div id="loading" style="position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; z-index: 50000; background-color: white;"><div id="loadingdata" style="position: absolute; left: 40%; top: 40%; border: 2px solid #99bbe8; padding: 10px; font-size: 28px; font-family: Verdana; text-align: center; color: #1663b7; width: 200px; height: 100px; background-color: #dfe8f6;"><img src="/skins/images/loader.gif" style="vertical-align: middle; margin-top: 10px; margin-bottom: 10px;" /><br />Loading...</div></div>

<div id="wa4glcontainer" style="position: absolute; left: 0px; top: 0px; overflow: hidden; border: 1px solid blue;"></div>

<script type="text/javascript">

WA.Managers.wa4gl.setURL('', '/js');
WA.Managers.wa4gl.prelib = ''; // we remove the first / since we are in relative directory for those examples

window.onload =
function()
{
/*
// we load the debug system
var popupdebug = window.open('', 'debug', 'scrollbars=1,width=400,height=600');
popupdebug.moveTo(0,0);
WA.debug.console = popupdebug.document;
*/
// we load the styles sheets with the manager so we can play with dynamic skins reload
WA.Managers.ondemand.loadCSS('/skins/css/reset.css', null, true);
WA.Managers.ondemand.loadCSS('/skins/css/4gl.css', null, true);
WA.Managers.ondemand.loadCSS('/skins/css/control.css', null, true);

// we laod the main app dispatcher
WA.Managers.wa4gl.startApplication('wa4glcontainer', 'main', 'single', '', 'full');
};
</script>

</body>

</html>
Empty file added examples/pages/4gl/4gl.instance
Empty file.
2 changes: 2 additions & 0 deletions examples/pages/4gl/4gl.page
@@ -0,0 +1,2 @@
type=simple
status=published
2 changes: 2 additions & 0 deletions examples/pages/errors/block/block.code
@@ -0,0 +1,2 @@
ERROR [[PARAM,code]]L The block does not exists:<br />
Page: [[PARAM,page]] ** Code: [[PARAM,code]] ** Message: [[PARAM,message]]<br />
Empty file.
2 changes: 2 additions & 0 deletions examples/pages/errors/block/block.page
@@ -0,0 +1,2 @@
type=simple
status=published
5 changes: 5 additions & 0 deletions examples/pages/errors/page/page.code
@@ -0,0 +1,5 @@
ERROR [[PARAM,code]]<br />
<hr>
Page: [[PARAM,page]]<br />
Code: [[PARAM,code]]<br />
Message: [[PARAM,message]]<br />
Empty file.
2 changes: 2 additions & 0 deletions examples/pages/errors/page/page.page
@@ -0,0 +1,2 @@
type=simple
status=published
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" ?>
<language id="ex-groupcontainer" lang="en">

</language>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" ?>
<language id="ex-groupcontainer" lang="es">

</language>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" ?>
<language id="ex-groupcontainer" lang="fr">

</language>
21 changes: 21 additions & 0 deletions examples/pages/ex-groupcontainer/ex-groupcontainer.go
@@ -0,0 +1,21 @@
package main

import (
"github.com/webability-go/xcore/v2"

"github.com/webability-go/xamboo/assets"
)

func Run(ctx *assets.Context, template *xcore.XTemplate, language *xcore.XLanguage, e interface{}) interface{} {

params := &xcore.XDataset{
// "#": language,
}

return template.Execute(params)
}

func Myform(ctx *assets.Context, template *xcore.XTemplate, language *xcore.XLanguage, e interface{}) interface{} {

return "{}"
}
Empty file.
4 changes: 4 additions & 0 deletions examples/pages/ex-groupcontainer/ex-groupcontainer.page
@@ -0,0 +1,4 @@
type=wajafapp
status=published
template=
acceptpathparameters=yes
149 changes: 149 additions & 0 deletions examples/pages/ex-groupcontainer/ex-groupcontainer.template
@@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8" ?>
<application id="ex-groupcontainer">

<!-- Note important: the min-width of the container should be always: max field size + 480px (help size) -->
<container type="groupContainer" id="myform" style="min-width: 880px;" mode="4" authmodes="1234" varkey="key" key="1" varorder="order" varmode="mode">
<zone type="field">
<element type="textfieldElement" id="fullname" size="400" minlength="3" maxlength="50" minwords="2" maxwords="10" format="^[a-zA-Z0-9\s]{1,}$" visible="1234" info="34" disabled="" readonly="" notnull="123" helpmode="12">
Your full name:
<defaultvalue></defaultvalue>
<helpdescription>Help: This field must have a min length of 3 chars, max length of 50 chars, min 2 words, max 10 words, and can be only a-z, A-Z, 0-9 and spaces</helpdescription>
<statusnotnull>The value must not be null</statusnotnull>
<statusbadformat>The value has a bad format</statusbadformat>
<statustooshort>The value is too short (3 chars min)</statustooshort>
<statustoolong>The value is too long (50 chars max)</statustoolong>
<statustoofewwords>The value has too few words (2 words min)</statustoofewwords>
<statustoomanywords>The value has to much words (10 words max)</statustoomanywords>
<statuscheck>The field has an error by user check validity (fill with your error)</statuscheck>
</element>
</zone>
<zone type="field">
<element type="textfieldElement" id="address1" size="400" minlength="3" maxlength="150" minwords="2" maxwords="20" format="^[a-zA-Z0-9\s,\.#]{1,}$" visible="1234" info="34" disabled="" readonly="" notnull="123" helpmode="12">
Your address (line 1):
<defaultvalue></defaultvalue>
<helpdescription>Help: This field must have a min length of 3 chars, max length of 150 chars, min 2 words, max 20 words, and can be only a-z, A-Z, 0-9, coma, dot, # and spaces</helpdescription>
<statusnotnull>The value must not be null</statusnotnull>
<statusbadformat>The value has a bad format</statusbadformat>
<statustooshort>The value is too short (3 chars min)</statustooshort>
<statustoolong>The value is too long (150 chars max)</statustoolong>
<statustoofewwords>The value has too few words (2 words min)</statustoofewwords>
<statustoomanywords>The value has to much words (20 words max)</statustoomanywords>
<statuscheck>The field has an error by user check validity (fill with your error)</statuscheck>
</element>
</zone>
<zone type="field">
<element type="textfieldElement" id="address2" size="400" minlength="3" maxlength="150" minwords="2" maxwords="20" format="^[a-zA-Z0-9\s,\.#]{1,}$" visible="1234" info="34" disabled="" readonly="" notnull="123" helpmode="12">
Your address (line 2):
<defaultvalue></defaultvalue>
<helpdescription>Help: This field must have a min length of 3 chars, max length of 150 chars, min 2 words, max 20 words, and can be only a-z, A-Z, 0-9, coma, dot, # and spaces</helpdescription>
<statusnotnull>The value must not be null</statusnotnull>
<statusbadformat>The value has a bad format</statusbadformat>
<statustooshort>The value is too short (3 chars min)</statustooshort>
<statustoolong>The value is too long (150 chars max)</statustoolong>
<statustoofewwords>The value has too few words (2 words min)</statustoofewwords>
<statustoomanywords>The value has to much words (20 words max)</statustoomanywords>
<statuscheck>The field has an error by user check validity (fill with your error)</statuscheck>
</element>
</zone>
<zone type="info">
<element type="htmlElement">
SUPER TITULO
</element>
</zone>
<zone type="field">
<element type="colorfieldElement" id="color" size="200" visible="1234" info="34" disabled="" readonly="" notnull="123" helpmode="12">
Choose a color:
<defaultvalue></defaultvalue>
<helpdescription>Help: This field permits to write or choose a color</helpdescription>
<statusnotnull>The value must not be null</statusnotnull>
<statusbadformat>The value has a bad format</statusbadformat>
</element>
</zone>
<zone type="field">
<element type="datefieldElement" id="date" size="400" visible="1234" info="34" disabled="" readonly="" notnull="123" helpmode="12">
Choose a date:
<defaultvalue></defaultvalue>
<helpdescription>Help: This field permits to select a date</helpdescription>
<statusnotnull>The value must not be null</statusnotnull>
<statusbadformat>The value has a bad format</statusbadformat>
</element>
</zone>
<zone type="field">
<element type="mmcfieldElement" id="mmc" size="400" visible="1234" info="34" disabled="" readonly="" notnull="123" helpmode="12">
Choose a multimedia file:
<defaultvalue></defaultvalue>
<helpdescription>Help: This field permits to upload a multimedia file</helpdescription>
<statusnotnull>The value must not be null</statusnotnull>
<statusbadformat>The value has a bad format</statusbadformat>
</element>
</zone>
<zone type="field">
<element type="textareafieldElement" id="comments" areawidth="400" areaheight="150" minlength="" maxlength="4000" minwords="" maxwords="" visible="1234" info="34" disabled="" readonly="" notnull="" helpmode="12">
Some comments:
<defaultvalue></defaultvalue>
<helpdescription>Help: Any comments, anotate them here. This field accept any character, up to 4000 characters.</helpdescription>
<statustoolong>The value is too long (4000 chars max)</statustoolong>
<statuscheck>The field has an error by user check validity (fill with your error)</statuscheck>
</element>
</zone>
<zone type="field">
<element type="hiddenfieldElement" id="hiddenparam">default value</element>
</zone>
<zone type="field">
<element type="lovfieldElement" id="select1" size="400" visible="1234" info="34" disabled="" readonly="" notnull="1" helpmode="12" >
Color:
<defaultvalue>2</defaultvalue>
<helpdescription>Help: Please select one of the three colors.</helpdescription>
<options>
<option key="1">Red</option>
<option key="2">Green</option>
<option key="3">Blue</option>
</options>
</element>
</zone>

<zone type="control">
<element type="buttonElement" action="first" visible="4">First record</element>
<element type="buttonElement" action="previous" visible="4">Previous record</element>
<element type="buttonElement" action="next" visible="4">Next record</element>
<element type="buttonElement" action="last" visible="4">Last record</element>
<element type="buttonElement" action="insert" visible="4">New record</element>
<element type="buttonElement" action="update" visible="4">Update this record</element>
<element type="buttonElement" action="delete" visible="4">Delete this record</element>

<element type="buttonElement" action="submit" visible="123">Send to server
<titleinsert>Send information</titleinsert>
<titleupdate>Accept changes</titleupdate>
<titledelete>Confirm the deletion</titledelete>
</element>
<element type="buttonElement" action="reset" visible="123">Undo changes</element>
<element type="buttonElement" action="view" visible="123">Cancel and back to the list</element>
</zone>
<alertmessage>Error, the data have not been sent to the server. Please check the fields in red to correct them.</alertmessage>
<servermessage>Error, the server has responded: </servermessage>
<titleinsert>Insert a new record</titleinsert>
<titleupdate>Update the record</titleupdate>
<titledelete>Delete the record</titledelete>
<titleview>View the record</titleview>
<insertok>The record has been inserted successfully</insertok>
<updateok>The record has been updated successfully</updateok>
<deleteok>The record has been deleted successfully</deleteok>
<event type="failure">
<code><![CDATA[
function()
{
}
]]></code>
</event>
<event type="success">
<code><![CDATA[
function(p1, p2, p3)
{
if (this.mode == 3)
return confirm('Do you want to fetch another record since this one is deleted? (note the record is NOT deleted from the server, only simulated in this example)');
}
]]></code>
</event>
</container>

</application>

0 comments on commit 4393dad

Please sign in to comment.