﻿———————————————————————————————————————————————————————————————————————————————————————————————————————

     Project : WebMail
     Revision: 1.0
     Date    : 22.4.2006 11:38:21

———————————————————————————————————————————————————————————————————————————————————————————————————————

FOLDER STRUCTURE

       \_project        - project folder
          \backup       - backup folder
          \dev          - dev folder for testing purpose only
          \doc          - project documentation
       \inc             - all javascripts
       \languages       - client translations
          \en           - translation name
             \help      - help translation
       \objects         - objects descriptors
       \skins           - skins folder
          \default      - skin name
             \css       - cascade styles
             \images    - images for interface
             \inc       - skin javascripts
             \templates - skin & object templates


———————————————————————————————————————————————————————————————————————————————————————————————————————

JAVASCRIPT EXTENSIONS

  Folder     : \inc
  Filename   : lowercase with _ext appendix
  Extension  : .js
  ================================

  #browser_ext.js
   Brief     : Contains functions and methods for extend JavaScript and provide compatibility
               sw layer between supported browsers

  #object_ext.js
   Brief     : Contains functions and methods for extends potential of OOP in JS


———————————————————————————————————————————————————————————————————————————————————————————————————————

BASIC CLASSES

  Folder     : \inc
  Filename   : lowercase
  Extension  : .js
  ================================
  
  #dataset
   Brief     : provides cross browser compatible solution for synchronization data sources between objects

   Instance  : dataSet

   Methods   : obey             - adds listener object for given data-set
               disobey          - removes listener object from data-set
               add              - add data into data-set
               remove           - remove data from data-set (listeners are styl active)
               get              - returns value of given dataset
               update           - calls all listener's _update() method with dataset name as string parametr

   Dataset behaviour:
               
               All GUI objects have properties:

                   ._noupdate   - no _saveme() method will not cause dataset update
                   ._pathName   - is pased into dataSet.add by _saveme() to avoid self refresh

                   LISTENER FOR VALUE
                   ._listener
                   ._listenerPath
                   
                   OPTIONAL DATA LISTENER
                   ._listenerData
                   ._listenerDataPath

                   ._saver
                   ._saverPath

               All GUI objects have methods:

                   ._saveme()
                   ._value()
                   ._listen()
               


  #storage
   Brief     : object with transparent cache for loading all parts of interface and program

   Instance  : storage

   Properties: bCheckNames bool - anly specified files can be loaded

   Methods   : css              - load css file and append it to the global scope
                                or make it enabled if method remove_css was called before
               remove_css       - disable css file in global scope (css isn't removed)
               library          - load js library into global scope (has problems in safari prowser)
               language         - load language file and store it into storage.language
               template         - return template as string
               object           - load object xml descriptor and process library, css parts

   
  #xmltools
   Brief     : class containing useful methods for work with xml

   Instance  : XMLTools

   Methods   : XML2Str          - converts XML document into string
               Str2XML          - converts string into XML document
               Arr2XML          - converts array into XML document
               XML2Arr          - converts XML document into array
               XMLDoc           - return latest supported Dom Document version (for internal use in XMLTools)


  #httprequest
   Brief     : HTTP request object, provides cross browser compatible solution for background communication
               between JS client and Server side in synchronous and asynchronous mode.

   Properties: sURL             - string, request URL (default: webmail.php)
               bSync            - request mode
               bGET             - request type

   Methods   : sendXML          - send XMLdocument object to server
               sendArr          - converts array into XMLdoc and send it to server
               sendStr          - converts string into XMLdoc and send it to server
               responseText     - return response in string format
               responseXML      - return response in XMLdoc format
               responseArray    - return response in array format


  #template
   Brief     : JS version of template.dll from php. Replace {name} constructions in stings
               with values from given array. Supports logic switches {optional} and loops
               {dynamic} booth is supported in cascade construction.
               
   Instance  : template
   
   Methods   : tpl              - retrive template from storage and return processed output
               exe              - return processed output from string and array;


  #gui
   Brief     : Gui object makes object tree withch is reflection of rednered gui on uses screen.
               Object offers a few basic methods and function which are inherited into all gui objects.

   Instance  : gui
   
   Properties: _skipsaving
   
   Methods   : All methods starting with "_" are public and "__" are private(protected)
               _create          - create new gui object as method of current object (creates tree structure)
               _draw            - print obj template into target HTML anchor
               _listen          - obey object to given dataset
               _saveme            - save object value back into dataset
               _destruct        - destruct object, child objects and html
               _add_destructor  - add given method into destruction sequence
               _remove_destructor - remove given method from destruction sequence
               

———————————————————————————————————————————————————————————————————————————————————————————————————————

GUI OBJECTS

  Folder     : \inc
  Filename   : lowercase with "obj_" prefix
  Extension  : .js
  ================================
  
  ALL OBJECTS INHERITS METHODS AND PROPERTIES FROM GUI OBJECT
   Properties: _name            - obj. name from _create method
               _type            - obj. type from _create method
               _parent          - parent object in gui tree
               _main            - container HTML DOM element
               _anchors         - anchor pointers for child objects (optional)
               _template        - name of main template
               _pathName        - path in gui tree e.g. "gui_obj1_obj2" == gui/obj1/obj2
               _listener        - name of data set object is binded to (optional)
               _listenerPath    - path to value in listening dataset (optional)
               _saver           - name of data set object where method _saveme() store obj. value (optional)
               _saverPath       - path to value in _saver dataset
               _skipsaving      - disable method _saveme()
               
   Methods   : DESCRIBED IN BASIC CLASSES / #gui
               _create
               _listen
               _saveme
               _add_destructor
               _remove_destructor
               _destruct

  
  #obj_form_generic
   Brief     : Generic object extension for FORM objects
               Affected objects are obj_input, obj_text, obj_button, obj_checkbox, onj_select

   Methods   : _value           - return or set object value
               _disabled        - controls object's property "disabled"

  #obj_input
   Brief     : Input TEXT object, inherits #obj_form_generic
   Properties: __eIN            - form object itself
   
   
  #obj_text
   Brief     : Input TEXTAREA object, inherits #obj_form_generic
   Properties: __eIN            - form object itself
   
   
  #obj_button
   Brief     : Input BUTTON object, inherits #obj_form_generic
   Properties: __eIN            - form object itself
   
   
  #obj_password
   Brief     : Input PASSWORD object, inherits #obj_form_generic
   Properties: __eIN            - form object itself
   
   
  #obj_select
   Brief     : Input SELECT object

   Properties: __eIN            - form object itself

   Methods   : _listen_data     - listener for select's options
               _fill            - create select's options from given array


  #obj_label
   Brief     : Label object useful for checkbox buttons

   Properties: __eIN            - form object itself

   Methods   : _value           - label string content
               _bind            - "for" label property setter


  #obj_radio
   Brief     : radio buttons group
   
   Methods   : _disabled        - controls object's property "disabled"
               _value           - returns selected button value or select button with given value
               _listen          - pointer into dataset with value of selected button
               _listen_data     - pointer into dataset with radio button's values and labels
               _fill            - creates group of radiobuttons from given array


  #obj_checkbox
   Brief     : Input CHECKBOX object

   Methods   : _value           - return and set object's checked state


  #obj_suggest
   Brief     :

   Properties: _min             - int, minimal length of input value for check for suggestions
               _limit           - int, maximal count of suggestions
               _dynamic         - bool, switch between dynamic(makes queries on server)
                                  and static (search for suggestion in given dataset) mode

   Methods   : _disabled        - controls input object's property "disabled"
               _value           - return or set input's value
               _listen_data     - dataset for suggestions
               ————————————
               _query           - method which is called in dynamic mode (default empty)


  #obj_tabs
   Brief     : tabs container object, obj_tabs can by created inside
   
   Methods   : _saveall         - call _saveme(true) method in all child objects
               _value           - return name of active tab or activate given tab
   
   
  #obj_tab
   Brief     : tab container object, this object represents 1 tab containing anything ;)
   
   Methods   : _saveall         - call _saveme(true) method in all child objects
               _title           - set title text (actually HTML) for tab
               _disabled        - disable tab (_active method is inactive)
               _active          - show tab and hide all other tabs with same obj_tab parent


  #obj_form
   Brief     : simple container object
   
   Methods   : save_all         - tries to save all child objects with _saveme method
  
  
  #obj_xform
   Brief     : converts xform xml documents into HTML form stucture as easy tool for GUI bilding
   
   Methods   : _xml             - retrieve xmlform document as array and pass it to the _exe method
               _exe             - convert array into html form structure


  #obj_tree
   Brief     : visual object for ordering array data into tree structure

   Methods   : _fill         - tries to save all child objects with _saveme method
               _openup       - apply css to given node and all parent nodes
               _open         - open or close given node
               _listen_data  - listen data for tree structure
               _listen       - listen data for open threads (contains only last nodes in each opened thread)
               _value        - array containing last nodes in each opened thread

———————————————————————————————————————————————————————————————————————————————————————————————————————

XML DESCRIPTOR

  Folder     : \objects
  Filename   : lowercase optionaly with "obj_" prefix
  Extension  : .xml
  ================================
  
Example:

  <object>
      <type>inline</type>
      <css>obj_suggest</css>
      <library>obj_suggest</library>
      <template>obj_suggest</template>
      <anchors>
          <elm>main</elm>
          <elm>ul</elm>
      </anchors>
      <extension>obj_suggest</extension>

      <onload>obj_suggest_init(this[sName])</onload>
      <onunload>text<onunload>

      <parents>
          <obj>_type of allowed parent object</obj>
      </parents>
  </object>

  Tags: <type>                  - 1 - type of container element, values: inline, block
        <css>                   - * - name of css file
        <library class="obj_x"> - * - include file from \inc folder, attr "class" means name of class
				      from lib file the same name as lib is used when not specified
        <template>              - ? - default object template
        <anchors><elm>          - ? - anchors name
        <onload>                - * - string for eval
	<parents>		- ? - allowed parent objects, object can be created only as child of specified objects
	        
———————————————————————————————————————————————————————————————————————————————————————————————————————

TAMPLATE

  Folder     : \skins\
  Filename   : lowercase optionaly with "obj_" prefix
  Extension  : .xml
  ================================
  
Example:

  <div id={_ins}>
       <h1>{caption::text}</h1>
       {optional test}
         <strong>variable $test is True</strong>
       {/optional}

       <p>
       {dynamic varloop}
           {varloop::*},
       {/dynamic}
       </p>
       
       {!optional test}
         <strong>variable $test is False</strong>
       {/optional}
  <div>

Description:

  {_ins}                          - istance variable, contains obj. pathname (unique)
  {caption::text}                 - returns value from inputarray['caption']['text']
  {anyvar}                        - template parser replace "{anyvar}" by value in inputarray['anyvar']
                                    !! actual langs are automaticaly include in input array !!
  {optional boolvar}{/optional}   - block is printed if boolvar is true
  {noptional boolvar}{/noptional} - block is printed if boolvar is false
  {dynamic loopvar}{/dynamic}     - loop var has to be ARRAY, block behaves as for(var * in loopvar).
                                    loopvar::* can in block will be replaced by array key
  {rdynamic loopvar}{/rdynamic}   - reversed dynamic
  {lang text}			  - works as {{text}}, so output from {value} is used as key for {value}, useful for loops

———————————————————————————————————————————————————————————————————————————————————————————————————————

XFORM

  Folder     : \folders\
  Extension  : .xml
  ================================

Example:

  <form name="xform">
    <page name="pg1">
       <caption>settings</caption>
       <row class="">
          <label>msg_label</label>
          <obj name="l1" type="obj_input">
             <restrictions>
                <restrict>^[0-9]+$</restrict>
             </restrictions>
          </obj>
       </row>
       <row class="">
          <label>msg_label</label>
          .
          .
          .
       </row>
    </page>
  </form>
  
  <form>                          - root element
    att: name                     - optional, name of TABS or FORM object in gui structure.
                                    If not set than "frm_form" is used.
  <page>                          - optional, if included than TABS obj. is used as container, FORM is used otherwise
    att: name                     - optional, name of TAB object in gui structure.
                                    If not set than "frm_form" is used.
  <row>                           - represent one row eg. <tr> in table
    att: class                    - optional, CSS class name
  <label>                         - optional, represent label on left side in <th>
  <obj>                           - optional, represenation of gui object with some configs inside
    att: name                     - name of ANCHOR and object instance in gui structure
         type                     - type of object

    <restrictions>                - obj input restrictions
    <option>                      - select options (in case of obj_select)
    <listener>                    - object listener
       att: path                  - listener path
    <listenerdata>                - object listenerdata (if supported)
       att: path
    <saver>                       - object saver (if supported)
       att: path


Result obj structure:

  <parent>.<xform name>.[<tabs name>.<tab name>|<form name>].<obj>