Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1. Overview
The variable Center section(s) of the page is usually allocated for display of information
requested via navigation lists in one or more of the permanent sections. Since
all HTML sections (permanent and variable) must be regenerated for each Web-
site data request event, a copy of thepermanent Master page sections is included as a
preface for all Web-site page contents. Classical Web-site design frameworks, such
as ASP.NET were created to accommodate this archaic page level request and response
design approach and force use of their own proprietary Web-site Server System. This
esoteric Page event based framework system is in a continuous state of flux and must add
incomprehensible “bells and whistle” controls to accommodate modern Web-
site utilization needs (AJAX).
In short, the CSWAM framework changes the design theory of a Web-site from
an Active Server Page (ASP) to an Active Client Page (ACP) approach.
CSWAM Web-site program files are designed to operate in pairs, a Client-side page
layout (container-definition) file and its companion Server-side page
updating ( container-populating) program file. Each presentation element (container) on
a page is defined by a unique ID name in the layout file and references its style/attributes
declared in the Cascading Style Sheet (CSS) file. The initialization and updating
of HTML objects and data within Client-side (Browser) container elements are
managed by corresponding ID related named functions in the companion Server-
sideprogram.
1. Request, with argument data, that a 1. Execute the requested function with
named function in a companion Server- argument data to fulfill the Client-
side program is to generate side request, and respond with the
the HTMLand/or Application response desired HTML and/or Application response
information to populate/update data.
its ID Object container(s).
The CSWAM Framework programming environment is based upon the following key
concepts:
• The layout and Program management of all Page HTML container
elements/objects (DIV, SPAN, etc.).
• Use of the AMAC Message Data Structure (AMDS) to:
a. Request (RQST) Server-side function execution with named
argument data and to update Client-side ID container(s) with the
results.
b. Maintain Web-site general Page/Session (PAGE) information.
• Use of AMAC named variables that provide unique message response
sub-channels (Error messages, separate data response messages to update
different Client-side Container ID’s).
• Familiarity with the AMAC library routines to retrieve
function Call argument (RQST ) and Session (PAGE) related data and
easily access Server-side IO API logic( file systems , data-base systems,
etc)
a. URL-address
The Universal Resource Locator Address (URL-Address) is the location with
data of the Internet Web-site Program/file that is requested. A URL-
Address has the following general format:
FORMAT: Web-site/File-address?Request-data
samesite(Message-Request, Client-Destination-list)
3. AMAC Message-Request
CSWAM employs AJAX communication protocol to transfer data-string messages
between the Client (Browser) and Server executed Web-site programs. CSWAM-
AMAC message strings have simple structural rules (AMDS) that enable quick
parsing of its information into named segment-argument and argument-field
components.
The AMAC Message Data Structure (AMDS) was designed to provide concise and
versatile rules to convey data values and structures between CSWAM
Client and Server side programs.
The CSWAM framework alters the design and programming of Web-site software
from the classical Active Server Page (ASP) approach to
an Active Client Page Container (ACPC) approach. In the CSWAM/ACPC design
approach, Containers/objects within the page are the smallest unit of Web-
site presentation and event management, instead of the classical ASP approach of
page level updating for all container events. The AMAC Server request statement is
the means of updating Client-side page containers (HTML DIV and SPAN objects).
The request statement has three general components:
• The address of the web-site program to satisfy the request
(URL and CGI variable data)
• The addressed function and argument data within the server program
to process the request and generate the channel(s) of message response
information.
• The destination relationship of Client-side container ID(s) to be
updated with response message data channel information
(AMAC named variables).
FORMAT: “*{!}Member-1,Member-2,Member-n,..”
FORMAT: ID{.type}{:AMAC_var}
If a AMAC system type error is detected or the Server program generates a system
category error channel message (error code < 100) during request processing, the call
is completed by AMAC as follows:
• All Server channel messages are discarded.
• If an error container/element (DIV) has been declared (ID=_sysmesg) the
error response message (Stat.ermesg) will update (be reported in)
the _sysmesg container.
• If an error container/element (_sysmesg) was not declared, the error response
message (Stat.ermesg) will be reported as an alert message requiring User
acknowledgement.
FORMAT: Ident.Type
The Type portion of a Web-site file name designates what Client-side ‘plug-
in’ program is used process it as follows:
2. Use of PAGE Object to Setup HTML Code to Execute ‘Plug-in’ type Files
The plug-in Macro Prototype is expanded into the correct HTML element/statement
sequence (Html_seq) via execution of the _STR::make library function with
the Macro prototype followed by five additional positional arguments (~1,~2,~3,~4,~5)
as follows:
PHP Example:
$my_funcs["master"] = "master" ;
$my_funcs["title"] = "title" ;
$my_funcs["top"] = "top" ;
$my_funcs["lddir"] = "lddir" ;
$my_funcs["bottom"] = "bottom" ;
Get an HTML object Value = $(id, attr) Variable value is set with the
attribute value HTML id named object.
• When the requested Web-site page is retrieved. In this case all the
blocks of Java-script code specified
within HTML <script> and </script> tags are executed.
• When the Web-site page is first started. In this case all the Java-
script code within the HTML body tag onload attribute are
executed (<body onload=”Java-script code” . . . >).
_SND::rsp('exec', ("$('tfn','value','cswam.doc');") ;
When executed, the HTML container/object with an ID name of tfn will have
it’s value attribute set to cswam.doc.
In this case AMAC Library components were coded in the PHP language and its Class
member referencing notations are based on PHP language requirements.
An AMAC library coded in another object Oriented Language (Ex. C#, C++,JS, etc.)
would have a slightly different referencing notation for access to the same functional
constituent class members.
• _STR::match ( $str, $mstr, $ldel ) Match the beginning chars of $STR with
a delimited $LDEL list of entries
in $MSTRfor equality and if an entry
compares its position (1-n) in
the $MSTR list is returnedTRUE (n), or
if there no matches aFALSE (0) state is
returned.
• _STR:: join($sary, $del) Return a string by joining the $SARY array members
together with a $DEL delimiter between the segments.
• _SRV:: error($status, $pref, $type, $file) Send an error response message to the
Client if $STATUS is < 0. The message
will be constructed with:
• $PREF prefixing to the
message
• $TYPE of error incorporated in
the message
• $fFILE name associated with
the error condition
The $_AMAC Object (an instance of the _AVARS class) provides simple named
access to the AMAC variables as follows:
The AMDS class contains the methods (functions) to manipulate argument and field
data within the message (rqst) and session(page) data of the AMAC Server request
call. The AMAC initialization function creates an $_RQST and $_PAGE object
(instances of _Amds class) and thereby providing a set of functions to access the calls
argument data and Web-site session/page information.
The _SND class contains the methods (functions) to return response data, to the
requesting Client, via any of the AMAC named logical message response channels.
The _SND function accepts a Short-name to identify the channel and it provides the
additions to the name and format control characters to generate a syntactically
correct AMAC return message.
12. _SND:: _(“”, $mesg) Send response $MESG data via default
(response) logical channel
to ClientAMAC request caller.
The AMAC library provides a simple means of performing general I/O activities for a
Server operating system platform. The _FS static class provides the basic
Methods/Functions, and call arguments to manipulate files within a Server-
side operation system (UNIX, XP, Linux, etc). The methods included in this package
have been programmed in PHP language to be executed on a Microsoft XP
Server operating system.
The AMAC library _FS static class methods/functions provide the following CSWAM
framework Web-site Server file system activities.
14. _FS::io($type,$file, $ext, &$fbf, $cnt) Perform $TYPE (File, Dir or Stat) I/O
with file $FILE using the address (&) of
buffer $FBF for a count of $CNT (
characters to read for read operation
only).
$TYPE is a (:) delimited string that
specifies the type of I/O activity
(Stat, File or Dir) in the first field
and I/O operation in the second
field(Read, Write ,Mod time, etc.)
$EXT is used for Directory read
operations to limit the returned entry
names to those types(ending string) listed
(: delimited) in the$EXT argument.
15. _FS::stat( $oper, $file ) Return the $OPER specified state info of
a$FILE.
$OPER is a (:) delimited string that
specifies the type of state information to
be returned(Status of file:-1=doesn’t
exist, 0= directory file, 1 = non-directory
type file),Modification time, and Access
time)
1. When the requested Web-site page is retrieved. In this case all the blocks
of Java-script code specified within HTML <script> and </script> tags are
executed.
2. When the Web-site page is first loaded. In this case all the Java-script code
within the HTML body tag onload attribute are executed (<body
onload=”Java-script code” . . . >).
_SND::rsp('exec', ("$('tfn','value','cswam.doc');") ;
When executed, the HTML container/object with an ID name of tfn will have
it’s value attribute set to cswam.doc.
In this example of RQST argument substitution, the file name [f] of the
argument to the ldimg Server-side function is generated by executing
the CSWAM Nd function ( Nd( \’ lpics1\’) ), to obtain and substitute the
source (.src) name of .img type file with an object ID name/attribute
of lpics1.
_STR.set_data (str,nm,del,data) Set the (named or entry #) field NM data within the
specified string STR with the specified data DATA.
_STR.replace (str, fld, nfld ) Return a string that replaces all occurrences of
dataFLD within a string STR, with new
data NFLD.
_STR.trim (str, trmlist ) Return a string that trims (removes) all occurrences
of the listed characters in TRMLST that are a
prefixcharacter in the string STR.
Get an HTML object Value = $(id, attr) Variable value is set with the
attribute value HTML id named object.
The Client-side program of this sample Web-site is divided into three sections:
• Master Page (Permanent containers) Initialization
• Support Code including Form Verification Tables
• HTML defined Container Page layout
The design of the cswam sample Web-site breaks the presentation page into eleven (11)
sections (containers). The section object ID names are declared in
the cswam_client.php program file and their named attribute definitions are located in
the cswam_client.css file as follows:
Page Heading
• Page navigation _pgnav S_pgnav
• AMAC Request string _answer S_answer
• System error reporting _sysmesg S_sysmesg
•
Master Page Sections Master S_Master
• Page Title M_title S_title
• Top of Page M_top S_top
• Left side of page M_left S_left
• Right side of page M_right S_right
• Bottom of page M_bottom S_bottom
M_center S_center
Center of page(Variable
containers)
• Server ermesg message _ermesg S_ermesg
• Server data1 response variable _data1 S_data1
• Server response message _response S_response
The design the cswam Web-site demonstrates the interaction between the Client-side
(cswam.client.php) and its companion Server-side (cswam.server.php) program.
The ID named containers declared in the cswam_client.php program are populated via
output response data from specified functions or variable settings executed in the
companion cswam_server.php program on the Server. These relationships are as
follows:
Page Heading
• Page navigation _pgnav S_pgnav
• AMAC Request string _answer \n[[amac-answer=……]]
• System error reporting _sysmesg \n[[amac-ermesg=……]]
Master
Master Page Sections
• Page Title M_title title()
• Top of Page M_top top()
• Left side of page M_left lrqst()
• Right side of page M_right lddir()
• Bottom of page M_bottom bottom()
<script language="JavaScript">
Ajax.site = 'cswam_server.php' ;
function startup()
{
var flash = ",|movie,[f]./videos/Media.wmv";
xsamesite(',|master,[d].',
'*!M_title:response,\
M_top:data1,\
M_bottom:data2,\
M_right:data3,\
_answer:answer');
xsamesite(flash,'*!_response,_answer');
Ajax.Log.init('_pgnav') ;
}
4. Client-side Support Code including Form Verification Tables
// load pics
function ldpics(fnm)
{
var fnms = _STR.replace($(fnm,'value'),'\n','|' ) ;
var pargs = ',[ids]_STR(_STR.lbl("rpics",1,"|",1)),[attr]h=296|w=396|c=1';
var rqst = ',|tmac,[ops]sc=10000|dn=0,[imgs]' + fnms + pargs ;
xexpics( 0,'_response',rqst,"") ;
}
vmac_ents = {'kitchen':"req=req,group=ckbox,item=Kitchen,ecolor=red,emesg=Must
select at least 3 items,test=[^:]{$*0>=3}",
'color':"req=req,group=radio,item=Car_color,eid=vermess,ecolor=red,emesg=Must
select a car color,test=[^:]{$*0==1}",
'interests':"req=req,group=select,item=Interests,eid=vermess,ecolor=red,emesg=Must
select at least 1 item,test=[^:]{$*0>=1}",
'date':"req=req,item=Date,eid=vermess,ecolor=red,emesg=**date,test=**date",
'email':"req=req,item=Email,eid=vermess,ecolor=red,emesg=**email,test=**email",
'passwd':"req=req,item=Passwd,eid=vermess,emesg=*erM_passwd,test='{$*0>0}'",
'login':"req=req,server='~~',emesg=*erM_login,test=*tst_login"
};
</head>
<body onload="startup();">
</div>
</div>
</div>
</div>
</div>
</body>
</html>
B. Cswam Web-Site Server-side Argument String Servicing Functions
The directions for processing a Server message request (AMAC) are contained in the
amac-rqst variable string passed to the requested Server program (URL). The amac-
rqst string contains the information needed to process the message request; the function
name and its argument data. Amac-rqst is a delimited list of arguments and delimited
field data within the argument members. The first argument (0) in the list is the name of
the function to be executed followed by its argument data (1-n).
[ids]………. Specifies ID’s to create within the container to populate with the
images:
// Title of page
function title()
{
global $_PAGE ;
$rsp = _STR::make("<SPAN style='margin-left:300px;font-weight:bold;
font-size:18px'>CSWAM Framework Example(~1:~2-~3)</SPAN>",
$_PAGE->arg_data('[Browser]','OS=',"X"),
$_PAGE->arg_data('[Browser]','name=',"X"),
$_PAGE->arg_data('[Browser]','version=',"X") );
_SND::rsp('',$rsp);
}
4. Cswam Top Section Permanent Container Contents
// Top of page
function top()
{
$rsp = _STR::make("<SPAN id='S_top'>
<DIV id=menu>
<SPAN style='position:absolute;left:0px'>
<UL>
<LI><A href='#'>Item(s) =<TEXTAREA class='inlist' id='tfn' value='' rows=1
ondblclick=
\"samesite(',|ldfile,[f]_STR( $(\'tfn\',\'value\'))','*_response,_answer'
);\"></TEXTAREA><SPAN>
Items to access</SPAN></A></LI>
<SPAN style='position:absolute;left:260px'>
<UL>
<LI><A href='#' onclick=
\"track( 'tfn' );\">
Track Items<SPAN>Track the named items</SPAN></A></LI>
</DIV>
</SPAN>");
_SND::rsp('',$rsp ) ;
}
function tmac()
{
global $_RQST;
$imgs = $_RQST->arg_data('[imgs]','',"***") ;
$ids = $_RQST->mk_fld_array('[ids]') ;
$down = $_RQST->arg_data('[ops]','dn=',0) ;
$height = $_RQST->arg_data('[attr]','h=',0) ;
$width = $_RQST->arg_data('[attr]','w=',0) ;
$gap = $_RQST->arg_data('[attr]','g=',0) ;
$space = $_RQST->arg_data('[attr]','s=',0) ;
$cnt = $_RQST->arg_data('[attr]','c=',0) ;
$left= 0 ;
$top= 0 ;
$tinc = 0 ;
$linc = 0 ;
if( $down )$tinc = $height + $gap;
else $linc = $width + $gap;
for( $i=0, $j=$cnt, $n=sizeof($ids); ( $n-- > 0 ) ;$i++, $left += $linc, $top +=
$tinc )
{
$rsp =
_STR::make("<SPANstyle='position:absolute;top:~1px;left:~2px;",$top,$left) ;
$attr =_STR::make("height:~1px;width:~2px'>",$height,$width)
;
$id= $ids[$i] ;
$img =_STR::make("<IMG id=~1 style='height:~2px;width:~3px'
alt='~1' onclick=\"samesite(',|ldimg,[f]_STR( $(\'~1\',\'src\'))','*_response,_answer'
);\" ></SPAN>",
$id,$height,$width);
_SND::rsp('',$rsp . $attr . $img ) ;
if( --$j == 0 )
{
$j = $cnt ;
if( $down )
{
$left += $width + $space ;
$top = -$tinc ;
}
else
{
$top += $height + $space ;
$left = -$linc ;
}
}
}
if( _STR::field_pos("f",$imgs, $_RQST->fdel) >= 0 )
{
$list=_STR::splits($imgs,$_RQST->fdel);
$pics=_STR::join($list,",");
}
else
{
$ents=_FS::io("dir:read",$imgs,'jpg:gif',$dir_aray,0) ;
$pics =_STR::join($dir_aray,",");
}
_SND::rsp('data1',$pics ) ;
}
11. Cswam Load Input Table-Form verification into response window area