zmx-cvs-commit Mailing List for ZMX Framework
Brought to you by:
sspickle
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
(7) |
Aug
(19) |
Sep
(1) |
Oct
(4) |
Nov
(9) |
Dec
(4) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
|
Feb
(4) |
Mar
(7) |
Apr
(5) |
May
(1) |
Jun
(3) |
Jul
(6) |
Aug
(3) |
Sep
|
Oct
(12) |
Nov
(3) |
Dec
|
| 2005 |
Jan
(4) |
Feb
(6) |
Mar
(9) |
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
(4) |
Jun
(1) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Steve S. <ssp...@us...> - 2011-07-13 11:17:19
|
Update of /cvsroot/zmx/zmx
In directory vz-cvs-4.sog:/tmp/cvs-serv2017
Modified Files:
Tag: ActionScript_2-0_conversion
XMLMessage.as XMLRPCLib.as XMLRPC_ResponseHandler.as
XML_Loader.as ZMX_XML_new.as
Log Message:
convert to unix line endingds..
Index: XMLRPC_ResponseHandler.as
===================================================================
RCS file: /cvsroot/zmx/zmx/Attic/XMLRPC_ResponseHandler.as,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** XMLRPC_ResponseHandler.as 2 Mar 2004 21:37:05 -0000 1.1.2.2
--- XMLRPC_ResponseHandler.as 13 Jul 2011 11:17:16 -0000 1.1.2.3
***************
*** 1 ****
! //
// XMLRPC_ResponseHandler knows how to notify an XMLRPC client that their request has succeeded, or failed.
//
import zmx.XML_Loader;
class zmx.XMLRPC_ResponseHandler {
var onSuccessFunc;
var onFailureFunc;
var proxy;
function XMLRPC_ResponseHandler( onSuccess, onFailure, proxy) {
this.onSuccessFunc = onSuccess;
this.onFailureFunc = onFailure;
this.proxy = proxy;
}
function onSuccess( theXML ) {
var loader = new zmx.XML_Loader();
var argObj = loader.loads( theXML )
if (argObj.params.isFault == null) {
//_global.gTrace("Applying " + this.onSuccessFunc + " to " + this.proxy + " using " + _global.serializeObject(argObj.params));
this.proxy[this.onSuccessFunc].apply( this.proxy, argObj.params);
}
else {
//_global.gTrace("Fault occured: " + _global.serializeObject(argObj.params));
this.proxy[this.onFailureFunc].apply( this.proxy, [argObj.params]);
}
}
function onFailure( argObj ) {
this.proxy[this.onFailureFunc]( argObj );
}
function mapSuccess( newName ) {
this[newName] = this.onSuccess;
}
function mapFailure( newName ) {
this[newName] = this.onFailure;
}
}
\ No newline at end of file
--- 1,45 ----
! //
! // XMLRPC_ResponseHandler knows how to notify an XMLRPC client that their request has succeeded, or failed.
! //
!
! import zmx.XML_Loader;
!
! class zmx.XMLRPC_ResponseHandler {
!
! var onSuccessFunc;
! var onFailureFunc;
! var proxy;
!
! function XMLRPC_ResponseHandler( onSuccess, onFailure, proxy) {
! this.onSuccessFunc = onSuccess;
! this.onFailureFunc = onFailure;
! this.proxy = proxy;
! }
!
! function onSuccess( theXML ) {
!
! var loader = new zmx.XML_Loader();
! var argObj = loader.loads( theXML )
!
! if (argObj.params.isFault == null) {
! //_global.gTrace("Applying " + this.onSuccessFunc + " to " + this.proxy + " using " + _global.serializeObject(argObj.params));
! this.proxy[this.onSuccessFunc].apply( this.proxy, argObj.params);
! }
! else {
! //_global.gTrace("Fault occured: " + _global.serializeObject(argObj.params));
! this.proxy[this.onFailureFunc].apply( this.proxy, [argObj.params]);
! }
! }
!
! function onFailure( argObj ) {
! this.proxy[this.onFailureFunc]( argObj );
! }
!
! function mapSuccess( newName ) {
! this[newName] = this.onSuccess;
! }
!
! function mapFailure( newName ) {
! this[newName] = this.onFailure;
! }
! }
Index: XMLMessage.as
===================================================================
RCS file: /cvsroot/zmx/zmx/Attic/XMLMessage.as,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** XMLMessage.as 3 Mar 2004 13:49:20 -0000 1.1.2.3
--- XMLMessage.as 13 Jul 2011 11:17:16 -0000 1.1.2.4
***************
*** 1 ****
! dynamic class zmx.XMLMessage {
function XMLMessage()
{
this.methodCall = new XML();
this.methodCall.ignoreWhite = true;
this.Parameters = new Array();
}
function AddParameter( theParameter ) {
this.Parameters.push( theParameter );
}
function Send( Server, Method, proxy) {
//
// conventional XMLRPC client sender..
//
this.methodResponse = new XML();
this.methodResponse.ignoreWhite = true;
this.methodResponse.ref = this;
this.methodResponse.onLoad = this.Loaded;
this.responseProxy = proxy;
this.Result = null;
// An example server might be:
// http://www.example.com:8080/RPC2
this.Server = Server;
this.BuildXML( Method );
// Make the call. Flash uses POST method for
// the sendAndLoad() XML methods.
// Added methodCall.contentType- Isaac Levy
// Content-Type http header value 'text/xml' now carried in Call headers
this.methodCall.sendAndLoad(this.Server,this.methodResponse);
return true;
}
function BuildXML ( Method )
{
var dumper = new zmx.XML_Dumper();
var xmlText = dumper.wrapMethod( this.Parameters, Method );
//_global.gTrace("BUILDXML: " + xmlText);
this.methodCall = new XML(xmlText);
this.methodCall.ignoreWhite = true;
this.methodCall.xmlDecl = "<?xml version=\"1.0\"?>";
this.Result = null;
this.methodCall.contentType = "text/xml";
return this.methodCall;
}
function onFailure( reason ) {
this.responseProxy.onFailure( reason );
}
function onSuccess( theXML ) {
this.responseProxy.onSuccess( theXML );
};
function Loaded( success ) {
if (success) {
this.ref.onSuccess( this );
}
else
{
this.ref.onFailure( this );
}
}
}
\ No newline at end of file
--- 1,82 ----
! dynamic class zmx.XMLMessage {
!
! function XMLMessage()
! {
! this.methodCall = new XML();
! this.methodCall.ignoreWhite = true;
! this.Parameters = new Array();
! }
!
! function AddParameter( theParameter ) {
! this.Parameters.push( theParameter );
! }
!
! function Send( Server, Method, proxy) {
!
! //
! // conventional XMLRPC client sender..
! //
!
! this.methodResponse = new XML();
! this.methodResponse.ignoreWhite = true;
! this.methodResponse.ref = this;
! this.methodResponse.onLoad = this.Loaded;
! this.responseProxy = proxy;
!
! this.Result = null;
!
! // An example server might be:
! // http://www.example.com:8080/RPC2
!
! this.Server = Server;
!
! this.BuildXML( Method );
!
! // Make the call. Flash uses POST method for
! // the sendAndLoad() XML methods.
!
!
! // Added methodCall.contentType- Isaac Levy
! // Content-Type http header value 'text/xml' now carried in Call headers
!
! this.methodCall.sendAndLoad(this.Server,this.methodResponse);
! return true;
! }
!
!
! function BuildXML ( Method )
! {
!
! var dumper = new zmx.XML_Dumper();
! var xmlText = dumper.wrapMethod( this.Parameters, Method );
!
! //_global.gTrace("BUILDXML: " + xmlText);
! this.methodCall = new XML(xmlText);
! this.methodCall.ignoreWhite = true;
! this.methodCall.xmlDecl = "<?xml version=\"1.0\"?>";
! this.Result = null;
!
! this.methodCall.contentType = "text/xml";
!
! return this.methodCall;
! }
!
! function onFailure( reason ) {
! this.responseProxy.onFailure( reason );
! }
!
! function onSuccess( theXML ) {
! this.responseProxy.onSuccess( theXML );
! };
!
! function Loaded( success ) {
!
! if (success) {
! this.ref.onSuccess( this );
! }
! else
! {
! this.ref.onFailure( this );
! }
! }
! }
Index: ZMX_XML_new.as
===================================================================
RCS file: /cvsroot/zmx/zmx/Attic/ZMX_XML_new.as,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** ZMX_XML_new.as 19 Feb 2004 21:19:27 -0000 1.1.2.1
--- ZMX_XML_new.as 13 Jul 2011 11:17:16 -0000 1.1.2.2
***************
*** 1 ****
! 
import zmx.*
_global.Args_To_XML = function ( args, method ) {
var xmlFunc = new _global.XMLFunction( method );
return xmlFunc.BuildArgumentMessage.apply(xmlFunc, args);
}
_global.Arg_To_XML = function ( arg, method ) {
return _global.Args_To_XML([arg], method);
}
_global.XML_To_Args = function ( theXML ) {
var argObj = XML_To_ArgObject( theXML );
return argObj.params;
}
_global.XML_To_ArgObject = function ( theXML ) {
return dumps( theXML );
}
_global.XML_CallWithArg = function ( theURL, methodName, theArg, successFunc, failFunc, client) {
//
// Deprecated! Use XML_CallWithArgs instead..
//
// theURL: URL to get 'object' reference
// methodName : method of object to call
// theArgs : arguments to pass
// successFunc: method of client to call for success notification
// failFunc : method of client to call for failure notification
// client: object to be notified..
return _global.XML_CallWithArgs( theURL, methodName, [theArg], successFunc, failFunc, client);
}
_global.XML_CallWithArgs = function ( theURL, methodName, theArgs, successFunc, failFunc, client) {
//
// theURL: URL to get 'object' reference
// methodName : method of object to call
// theArgs : arguments to pass
// successFunc: method of client to call for success notification
// failFunc : method of client to call for failure notification
// client: object to be notified..
// useLCServer: set to 'true' if the connection should be made via a LocalConnection object
//
var proxy = new XMLRPC_ResponseHandler( successFunc, failFunc, client);
var rpcFunction = new XMLFunction( methodName );
rpcFunction.BuildArguments.apply(rpcFunction, theArgs);
rpcFunction.Send(theURL, proxy);
return rpcFunction;
}
c = _global.AsyncSocket = function( parentObj ) {
//
// Async Socket that knows how to handle XML...
//
this.parentObj = parentObj;
}
p = c.prototype = new XMLSocket();
p.invokeMethod = function ( resultObj, theObj ) {
//
// invoke the method on the object using the args passed..
//
var theMethod = theObj[ resultObj.methodName ];
if ( theMethod != null) {
return theMethod.apply( theObj, resultObj.params );
}
return "ERROR! invoking method!";
}
p.onXML = function (theXML) {
var argObj = loads( theXML ) // get the arguments...
if (argObj.methodCall) {
var funcResult = this.invokeMethod( argObj, this.parentObj.proxy );
var theReply = Arg_To_XML({sender_id:this.parentObj.config.sender_id, result:funcResult});
if (theReply != null) {
this.send( theReply );
}
}
else
{
if (argObj != null) {
if (argObj.params.isFault == null) {
this.parentObj.proxy.onAsync( argObj.params );
}
else {
this.parentObj.proxy.onFailure( argObj.params );
}
}
}
}
delete p;
delete c;
#include "XML_js.as"
c = _global.XMLMessage = function()
{
this.methodCall = new XML();
this.methodCall.ignoreWhite = true;
this.Parameters = new Array();
}
p = c.prototype = new Object();
p.AddParameter = function( theParameter ) {
this.Parameters.push( theParameter );
}
p.Send = function( Server, Method, proxy) {
//
// conventional XMLRPC client sender..
//
this.methodResponse = new XML();
this.methodResponse.ignoreWhite = true;
this.methodResponse.ref = this;
this.methodResponse.onLoad = this.Loaded;
this.responseProxy = proxy;
this.Result = null;
// An example server might be:
// http://www.example.com:8080/RPC2
this.Server = Server;
this.BuildXML( Method );
// Make the call. Flash uses POST method for
// the sendAndLoad() XML methods.
// Added methodCall.contentType- Isaac Levy
// Content-Type http header value 'text/xml' now carried in Call headers
this.methodCall.sendAndLoad(this.Server,this.methodResponse);
return true;
}
p.BuildXML = function ( Method )
{
var xmlText = dumps( this.Parameters, Method );
//_global.gTrace("BUILDXML: " + xmlText);
this.methodCall = new XML(xmlText);
this.methodCall.ignoreWhite = true;
this.methodCall.xmlDecl = "<?xml version=\"1.0\"?>";
this.Result = null;
this.methodCall.contentType = "text/xml";
return this.methodCall;
}
p.onFailure = function ( reason ) {
this.responseProxy.onFailure( reason );
}
p.onSuccess = function ( theXML ) {
this.responseProxy.onSuccess( theXML );
};
p.Loaded = function ( success ) {
if (success) {
this.ref.onSuccess( this );
}
else
{
this.ref.onFailure( this );
}
}
delete p;
delete c;
c = _global.XMLFunction = function ( methodName ) {
this.methodName = methodName;
this.theArgs = null;
};
p = c.prototype = new Object();
p.BuildArgumentMessage = function() {
this.theArgs = arguments;
this.BuildArguments();
return this.BuildXML();
}
p.BuildArguments = function() {
if (this.theArgs == null) {
this.theArgs = arguments;
}
this.lastMessage = new _global.XMLMessage()
for (var i=0; i<this.theArgs.length; i++) {
this.lastMessage.AddParameter( this.theArgs[i] );
}
return this.lastMessage;
}
p.BuildXML = function ( theMsg ) {
if (theMsg == null) {
theMsg = this.lastMessage;
}
this.lastXML = theMsg.BuildXML( this.methodName );
return this.lastXML;
}
p.Send = function(Server, proxy) {
this.lastMessage.Send(Server, this.methodName, proxy);
}
delete p;
delete c;
c = _global.XMLRPC_ResponseHandler = function( onSuccess, onFailure, proxy) {
this.onSuccessFunc = onSuccess;
this.onFailureFunc = onFailure;
this.proxy = proxy;
}
p = c.prototype = new Object();
p.onSuccess = function( theXML ) {
var argObj = loads( theXML )
if (argObj.params.isFault == null) {
//_global.gTrace("Applying " + this.onSuccessFunc + " to " + this.proxy + " using " + _global.serializeObject(argObj.params));
this.proxy[this.onSuccessFunc].apply( this.proxy, argObj.params);
}
else {
//_global.gTrace("Fault occured: " + _global.serializeObject(argObj.params));
this.proxy[this.onFailureFunc].apply( this.proxy, [argObj.params]);
}
}
p.onFailure = function( argObj ) {
this.proxy[this.onFailureFunc]( argObj );
}
p.mapSuccess = function( newName ) {
this[newName] = this.onSuccess;
}
p.mapFailure = function( newName ) {
this[newName] = this.onFailure;
}
delete p;
delete c;
\ No newline at end of file
--- 1,274 ----
! 
! import zmx.*
!
! _global.Args_To_XML = function ( args, method ) {
! var xmlFunc = new _global.XMLFunction( method );
! return xmlFunc.BuildArgumentMessage.apply(xmlFunc, args);
! }
!
! _global.Arg_To_XML = function ( arg, method ) {
! return _global.Args_To_XML([arg], method);
! }
! _global.XML_To_Args = function ( theXML ) {
! var argObj = XML_To_ArgObject( theXML );
! return argObj.params;
! }
!
! _global.XML_To_ArgObject = function ( theXML ) {
! return dumps( theXML );
! }
!
! _global.XML_CallWithArg = function ( theURL, methodName, theArg, successFunc, failFunc, client) {
! //
! // Deprecated! Use XML_CallWithArgs instead..
! //
! // theURL: URL to get 'object' reference
! // methodName : method of object to call
! // theArgs : arguments to pass
! // successFunc: method of client to call for success notification
! // failFunc : method of client to call for failure notification
! // client: object to be notified..
!
! return _global.XML_CallWithArgs( theURL, methodName, [theArg], successFunc, failFunc, client);
! }
!
! _global.XML_CallWithArgs = function ( theURL, methodName, theArgs, successFunc, failFunc, client) {
! //
! // theURL: URL to get 'object' reference
! // methodName : method of object to call
! // theArgs : arguments to pass
! // successFunc: method of client to call for success notification
! // failFunc : method of client to call for failure notification
! // client: object to be notified..
! // useLCServer: set to 'true' if the connection should be made via a LocalConnection object
! //
!
! var proxy = new XMLRPC_ResponseHandler( successFunc, failFunc, client);
! var rpcFunction = new XMLFunction( methodName );
! rpcFunction.BuildArguments.apply(rpcFunction, theArgs);
! rpcFunction.Send(theURL, proxy);
! return rpcFunction;
! }
!
! c = _global.AsyncSocket = function( parentObj ) {
!
! //
! // Async Socket that knows how to handle XML...
! //
!
! this.parentObj = parentObj;
! }
!
! p = c.prototype = new XMLSocket();
!
! p.invokeMethod = function ( resultObj, theObj ) {
!
! //
! // invoke the method on the object using the args passed..
! //
!
! var theMethod = theObj[ resultObj.methodName ];
!
! if ( theMethod != null) {
! return theMethod.apply( theObj, resultObj.params );
! }
!
! return "ERROR! invoking method!";
! }
!
! p.onXML = function (theXML) {
!
! var argObj = loads( theXML ) // get the arguments...
! if (argObj.methodCall) {
! var funcResult = this.invokeMethod( argObj, this.parentObj.proxy );
! var theReply = Arg_To_XML({sender_id:this.parentObj.config.sender_id, result:funcResult});
!
! if (theReply != null) {
! this.send( theReply );
! }
! }
! else
! {
! if (argObj != null) {
! if (argObj.params.isFault == null) {
! this.parentObj.proxy.onAsync( argObj.params );
! }
! else {
! this.parentObj.proxy.onFailure( argObj.params );
! }
! }
! }
! }
!
! delete p;
! delete c;
!
! #include "XML_js.as"
!
! c = _global.XMLMessage = function()
! {
! this.methodCall = new XML();
! this.methodCall.ignoreWhite = true;
! this.Parameters = new Array();
! }
!
! p = c.prototype = new Object();
!
! p.AddParameter = function( theParameter ) {
! this.Parameters.push( theParameter );
! }
!
! p.Send = function( Server, Method, proxy) {
!
! //
! // conventional XMLRPC client sender..
! //
!
! this.methodResponse = new XML();
! this.methodResponse.ignoreWhite = true;
! this.methodResponse.ref = this;
! this.methodResponse.onLoad = this.Loaded;
! this.responseProxy = proxy;
!
! this.Result = null;
!
! // An example server might be:
! // http://www.example.com:8080/RPC2
!
! this.Server = Server;
!
! this.BuildXML( Method );
!
! // Make the call. Flash uses POST method for
! // the sendAndLoad() XML methods.
!
!
! // Added methodCall.contentType- Isaac Levy
! // Content-Type http header value 'text/xml' now carried in Call headers
!
! this.methodCall.sendAndLoad(this.Server,this.methodResponse);
! return true;
! }
!
!
! p.BuildXML = function ( Method )
! {
!
! var xmlText = dumps( this.Parameters, Method );
!
! //_global.gTrace("BUILDXML: " + xmlText);
! this.methodCall = new XML(xmlText);
! this.methodCall.ignoreWhite = true;
! this.methodCall.xmlDecl = "<?xml version=\"1.0\"?>";
! this.Result = null;
!
! this.methodCall.contentType = "text/xml";
!
! return this.methodCall;
! }
!
! p.onFailure = function ( reason ) {
! this.responseProxy.onFailure( reason );
! }
!
! p.onSuccess = function ( theXML ) {
! this.responseProxy.onSuccess( theXML );
! };
!
! p.Loaded = function ( success ) {
!
! if (success) {
! this.ref.onSuccess( this );
! }
! else
! {
! this.ref.onFailure( this );
! }
! }
!
! delete p;
! delete c;
!
! c = _global.XMLFunction = function ( methodName ) {
!
! this.methodName = methodName;
! this.theArgs = null;
! };
!
! p = c.prototype = new Object();
!
! p.BuildArgumentMessage = function() {
!
! this.theArgs = arguments;
! this.BuildArguments();
! return this.BuildXML();
! }
!
! p.BuildArguments = function() {
!
! if (this.theArgs == null) {
! this.theArgs = arguments;
! }
!
! this.lastMessage = new _global.XMLMessage()
!
!
! for (var i=0; i<this.theArgs.length; i++) {
! this.lastMessage.AddParameter( this.theArgs[i] );
! }
!
! return this.lastMessage;
! }
!
! p.BuildXML = function ( theMsg ) {
!
! if (theMsg == null) {
! theMsg = this.lastMessage;
! }
!
! this.lastXML = theMsg.BuildXML( this.methodName );
! return this.lastXML;
! }
!
! p.Send = function(Server, proxy) {
! this.lastMessage.Send(Server, this.methodName, proxy);
! }
!
! delete p;
! delete c;
!
!
! c = _global.XMLRPC_ResponseHandler = function( onSuccess, onFailure, proxy) {
! this.onSuccessFunc = onSuccess;
! this.onFailureFunc = onFailure;
! this.proxy = proxy;
! }
!
! p = c.prototype = new Object();
!
! p.onSuccess = function( theXML ) {
! var argObj = loads( theXML )
! if (argObj.params.isFault == null) {
! //_global.gTrace("Applying " + this.onSuccessFunc + " to " + this.proxy + " using " + _global.serializeObject(argObj.params));
! this.proxy[this.onSuccessFunc].apply( this.proxy, argObj.params);
! }
! else {
! //_global.gTrace("Fault occured: " + _global.serializeObject(argObj.params));
! this.proxy[this.onFailureFunc].apply( this.proxy, [argObj.params]);
! }
! }
!
! p.onFailure = function( argObj ) {
! this.proxy[this.onFailureFunc]( argObj );
! }
!
! p.mapSuccess = function( newName ) {
! this[newName] = this.onSuccess;
! }
!
! p.mapFailure = function( newName ) {
! this[newName] = this.onFailure;
! }
!
! delete p;
! delete c;
Index: XML_Loader.as
===================================================================
RCS file: /cvsroot/zmx/zmx/Attic/XML_Loader.as,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** XML_Loader.as 2 Mar 2004 21:37:05 -0000 1.1.2.2
--- XML_Loader.as 13 Jul 2011 11:17:16 -0000 1.1.2.3
***************
*** 1 ****
! //
//
// abstract Loader.. XML objects need to have attributes:
//
// nodeType, nodeName, and childNodes.
//
//
dynamic class zmx.XML_Loader {
var dispatch;
function XML_Loader() {
this.dispatch = {
boolean:this.doParseBoolean,
dateTimeType:this. doParseDate,
name:this.doParseString,
string:this.doParseString,
double:this.doParseFloat,
int:this.doParseInt,
fault:this.parseFault,
param:this.parseParam,
value:this.parseParam,
array:this.parseParam,
params:this.parseList,
data:this.parseList,
struct:this.doParseStruct,
member:this.doParseMember
}
}
function loads( xmlObj ) {
//
// start out being listish...
//
var value = null;
var currChild;
var name = null;
var aNode = xmlObj.firstChild;
while (aNode.nodeType == 3) { // skip text nodes...
aNode = aNode.nextSibling;
}
var result = this.result = new zmx.ZMX_DynamicObj({
methodCall : false,
methodResponse : false,
methodName : ''
});
if (aNode.nodeName == 'params') {
result.params = this.doParse( aNode );
}
else if (aNode.nodeName == 'methodCall') {
for (var i=0; i<aNode.childNodes.length; i++) {
currChild = aNode.childNodes[i];
if (currChild.nodeName == 'methodName') {
name = this.doParseString( currChild );
result.methodName = name;
result.methodCall = true;
}
else if (currChild.nodeName == 'params') {
result.params = this.doParse( currChild );
}
}
}
else if (aNode.nodeName == 'methodResponse') {
result.methodResponse = true;
var respChild = aNode.firstChild;
while( respChild != null) {
value = this.doParse( respChild )
if (value != null) {
break;
}
respChild = respChild.nextSibling;
}
result.params = value;
}
return result
}
function doParse( aNode ) {
if (aNode.nodeName != null) {
var nodeName = aNode.nodeName;
if (nodeName == 'dateTime.iso8601') {
nodeName = 'dateTimeType';
}
var dFunc = this.dispatch[nodeName];
if (dFunc != null) {
// we've got a parser for this node type..
return dFunc.apply(this, [aNode]);
}
else {
trace('No parse method for node ' + aNode.nodeName);
}
}
}
function parseList( aNode ) {
// parent should be root result object..
//
var currChild;
var val;
var listObj = [];
for (var i=0; i<aNode.childNodes.length; i++) {
currChild = aNode.childNodes[i];
if (currChild.nodeType == 1) { // doParse only wants nodeType == 1!
val = this.doParse( currChild );
if (val != null) {
listObj.push(val);
}
}
}
return listObj;
}
function doParseStruct( aNode ) {
var structObj = new zmx.ZMX_DynamicObj({});
var val;
var currChild;
for (var i=0; i<aNode.childNodes.length; i++) {
currChild = aNode.childNodes[i];
if (currChild.nodeType == 1) { // doParse only wants nodeType == 1!
val = this.doParse( currChild );
if (val != null) {
structObj[ val.name ] = val.value;
}
}
}
return structObj;
}
function doParseMember( aNode ) {
var structObj = {};
var value = null;
var name = null;
var currChild;
for (var i=0; i<aNode.childNodes.length; i++) {
currChild = aNode.childNodes[i];
if (currChild.nodeName == 'name') {
name = this.doParseString( currChild );
}
else if (currChild.nodeName == 'value') {
value = this.parseParam( currChild );
}
}
if ((name != null) && (value != null)) {
structObj.name = name;
structObj.value = value;
}
return structObj;
}
function parseParam( aNode ) {
var currChild;
var value;
for (var i=0; i<aNode.childNodes.length; i++) {
currChild = aNode.childNodes[i];
if (currChild.nodeType == 1) {
value = this.doParse( currChild );
break;
}
}
return value;
}
function parseFault( aNode ) {
var currChild;
var value;
for (var i=0; i<aNode.childNodes.length; i++) {
currChild = aNode.childNodes[i];
if (currChild.nodeType == 1) {
value = this.doParse( currChild );
break;
}
}
if (value == null) {
value = {isFault:true};
}
else
{
value.isFault = true;
}
return value;
}
function doParseInt( aNode ) {
var value = parseInt(aNode.firstChild.nodeValue);
return value;
}
function doParseFloat( aNode ) {
var value = parseFloat(aNode.firstChild.nodeValue);
return value;
}
function doParseString( aNode ) {
var value = aNode.firstChild.nodeValue;
return value == null ? '' : value;
}
function fromISO( aString) {
var dt = aString.split('T');
var datePart = dt[0];
var timePart = dt[1];
datePart = datePart.split('-').join('');
datePart = [datePart.slice(0,4),parseInt(datePart.slice(4,6))-1,datePart.slice(6,8)]
timePart = timePart.split(':').join('');
timePart = [timePart.slice(0,2),timePart.slice(2,4),timePart.slice(4)]
return new Date(datePart[0], datePart[1], datePart[2], timePart[0], timePart[1], timePart[2]);
}
function doParseDate( aNode ) {
var value = this.fromISO( aNode.firstChild.nodeValue );
return value;
}
function doParseBoolean( aNode ) {
var intValue = parseInt(aNode.firstChild.nodeValue);
return intValue == 0 ? false : true;
}
}
\ No newline at end of file
--- 1,248 ----
! //
! //
! // abstract Loader.. XML objects need to have attributes:
! //
! // nodeType, nodeName, and childNodes.
! //
! //
!
! dynamic class zmx.XML_Loader {
!
! var dispatch;
!
! function XML_Loader() {
! this.dispatch = {
! boolean:this.doParseBoolean,
! dateTimeType:this. doParseDate,
! name:this.doParseString,
! string:this.doParseString,
! double:this.doParseFloat,
! int:this.doParseInt,
! fault:this.parseFault,
! param:this.parseParam,
! value:this.parseParam,
! array:this.parseParam,
! params:this.parseList,
! data:this.parseList,
! struct:this.doParseStruct,
! member:this.doParseMember
! }
! }
!
! function loads( xmlObj ) {
!
! //
! // start out being listish...
! //
!
! var value = null;
! var currChild;
! var name = null;
! var aNode = xmlObj.firstChild;
!
! while (aNode.nodeType == 3) { // skip text nodes...
! aNode = aNode.nextSibling;
! }
!
! var result = this.result = new zmx.ZMX_DynamicObj({
! methodCall : false,
! methodResponse : false,
! methodName : ''
! });
!
! if (aNode.nodeName == 'params') {
! result.params = this.doParse( aNode );
! }
! else if (aNode.nodeName == 'methodCall') {
! for (var i=0; i<aNode.childNodes.length; i++) {
! currChild = aNode.childNodes[i];
! if (currChild.nodeName == 'methodName') {
! name = this.doParseString( currChild );
! result.methodName = name;
! result.methodCall = true;
! }
! else if (currChild.nodeName == 'params') {
! result.params = this.doParse( currChild );
! }
! }
! }
! else if (aNode.nodeName == 'methodResponse') {
! result.methodResponse = true;
! var respChild = aNode.firstChild;
! while( respChild != null) {
! value = this.doParse( respChild )
! if (value != null) {
! break;
! }
! respChild = respChild.nextSibling;
! }
! result.params = value;
! }
! return result
! }
!
! function doParse( aNode ) {
!
! if (aNode.nodeName != null) {
! var nodeName = aNode.nodeName;
! if (nodeName == 'dateTime.iso8601') {
! nodeName = 'dateTimeType';
! }
!
! var dFunc = this.dispatch[nodeName];
! if (dFunc != null) {
! // we've got a parser for this node type..
! return dFunc.apply(this, [aNode]);
! }
! else {
! trace('No parse method for node ' + aNode.nodeName);
! }
! }
! }
!
!
! function parseList( aNode ) {
! // parent should be root result object..
! //
!
! var currChild;
! var val;
! var listObj = [];
!
! for (var i=0; i<aNode.childNodes.length; i++) {
! currChild = aNode.childNodes[i];
! if (currChild.nodeType == 1) { // doParse only wants nodeType == 1!
! val = this.doParse( currChild );
! if (val != null) {
! listObj.push(val);
! }
! }
! }
!
! return listObj;
! }
!
! function doParseStruct( aNode ) {
! var structObj = new zmx.ZMX_DynamicObj({});
! var val;
! var currChild;
!
! for (var i=0; i<aNode.childNodes.length; i++) {
! currChild = aNode.childNodes[i];
! if (currChild.nodeType == 1) { // doParse only wants nodeType == 1!
! val = this.doParse( currChild );
! if (val != null) {
! structObj[ val.name ] = val.value;
! }
! }
! }
!
! return structObj;
! }
!
! function doParseMember( aNode ) {
!
! var structObj = {};
! var value = null;
! var name = null;
! var currChild;
!
! for (var i=0; i<aNode.childNodes.length; i++) {
! currChild = aNode.childNodes[i];
! if (currChild.nodeName == 'name') {
! name = this.doParseString( currChild );
! }
! else if (currChild.nodeName == 'value') {
! value = this.parseParam( currChild );
! }
! }
!
! if ((name != null) && (value != null)) {
! structObj.name = name;
! structObj.value = value;
! }
!
! return structObj;
! }
!
!
! function parseParam( aNode ) {
!
! var currChild;
! var value;
!
! for (var i=0; i<aNode.childNodes.length; i++) {
! currChild = aNode.childNodes[i];
! if (currChild.nodeType == 1) {
! value = this.doParse( currChild );
! break;
! }
! }
! return value;
! }
!
! function parseFault( aNode ) {
!
! var currChild;
! var value;
!
! for (var i=0; i<aNode.childNodes.length; i++) {
! currChild = aNode.childNodes[i];
! if (currChild.nodeType == 1) {
! value = this.doParse( currChild );
! break;
! }
! }
!
! if (value == null) {
! value = {isFault:true};
! }
! else
! {
! value.isFault = true;
! }
! return value;
! }
!
! function doParseInt( aNode ) {
! var value = parseInt(aNode.firstChild.nodeValue);
! return value;
! }
!
! function doParseFloat( aNode ) {
! var value = parseFloat(aNode.firstChild.nodeValue);
! return value;
! }
!
! function doParseString( aNode ) {
! var value = aNode.firstChild.nodeValue;
! return value == null ? '' : value;
! }
!
! function fromISO( aString) {
!
! var dt = aString.split('T');
!
! var datePart = dt[0];
! var timePart = dt[1];
!
! datePart = datePart.split('-').join('');
! datePart = [datePart.slice(0,4),parseInt(datePart.slice(4,6))-1,datePart.slice(6,8)]
!
! timePart = timePart.split(':').join('');
! timePart = [timePart.slice(0,2),timePart.slice(2,4),timePart.slice(4)]
!
! return new Date(datePart[0], datePart[1], datePart[2], timePart[0], timePart[1], timePart[2]);
! }
!
! function doParseDate( aNode ) {
! var value = this.fromISO( aNode.firstChild.nodeValue );
! return value;
! }
!
! function doParseBoolean( aNode ) {
! var intValue = parseInt(aNode.firstChild.nodeValue);
! return intValue == 0 ? false : true;
! }
!
! }
Index: XMLRPCLib.as
===================================================================
RCS file: /cvsroot/zmx/zmx/Attic/XMLRPCLib.as,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** XMLRPCLib.as 2 Mar 2004 21:37:05 -0000 1.1.2.2
--- XMLRPCLib.as 13 Jul 2011 11:17:16 -0000 1.1.2.3
***************
*** 1 ****
! /*
**
** Start simple....
**
** this is a 'pure' javascript core for ZMX_XML.as
**
** it's so much easier to debug/develop with rhino...
**
*/
import zmx.XML_Dumper
import zmx.XML_Loader
import zmx.XMLFunction
import zmx.XMLRPC_ResponseHandler
class zmx.XMLRPCLib {
var dumps = function(params, methodname, methodresponse) {
var m = new zmx.XML_Dumper();
var data = m.dumps(params)
if (methodname != null) {
data = "<methodCall><methodName>" + methodname + "</methodName>" + data + "</methodCall>";
}
else if (methodresponse != null) {
data = "<methodResponse>" + data + "</methodResponse>";
}
return data;
}
var loads = function( xmlObj) {
var m = new zmx.XML_Loader();
var result = m.loads(xmlObj)
return result;
}
var Args_To_XML = function ( args, method ) {
var xmlFunc = new zmx.XMLFunction( method );
return xmlFunc.BuildArgumentMessage.apply(xmlFunc, args);
}
var Arg_To_XML = function ( arg, method ) {
return this.Args_To_XML([arg], method);
}
var XML_To_Args = function ( theXML ) {
var argObj = this.XML_To_ArgObject( theXML );
return argObj.params;
}
var XML_To_ArgObject = function ( theXML ) {
return this.dumps( theXML );
}
var XML_CallWithArg = function ( theURL, methodName, theArg, successFunc, failFunc, client) {
//
// Deprecated! Use XML_CallWithArgs instead..
//
// theURL: URL to get 'object' reference
// methodName : method of object to call
// theArgs : arguments to pass
// successFunc: method of client to call for success notification
// failFunc : method of client to call for failure notification
// client: object to be notified..
return this.XML_CallWithArgs( theURL, methodName, [theArg], successFunc, failFunc, client);
}
var XML_CallWithArgs = function ( theURL, methodName, theArgs, successFunc, failFunc, client) {
//
// theURL: URL to get 'object' reference
// methodName : method of object to call
// theArgs : arguments to pass
// successFunc: method of client to call for success notification
// failFunc : method of client to call for failure notification
// client: object to be notified..
// useLCServer: set to 'true' if the connection should be made via a LocalConnection object
//
var proxy = new zmx.XMLRPC_ResponseHandler( successFunc, failFunc, client);
var rpcFunction = new zmx.XMLFunction( methodName );
rpcFunction.BuildArguments.apply(rpcFunction, theArgs);
rpcFunction.Send(theURL, proxy);
return rpcFunction;
}
}
\ No newline at end of file
--- 1,92 ----
! /*
! **
! ** Start simple....
! **
! ** this is a 'pure' javascript core for ZMX_XML.as
! **
! ** it's so much easier to debug/develop with rhino...
! **
! */
!
! import zmx.XML_Dumper
! import zmx.XML_Loader
! import zmx.XMLFunction
! import zmx.XMLRPC_ResponseHandler
!
! class zmx.XMLRPCLib {
!
! var dumps = function(params, methodname, methodresponse) {
!
! var m = new zmx.XML_Dumper();
! var data = m.dumps(params)
!
! if (methodname != null) {
! data = "<methodCall><methodName>" + methodname + "</methodName>" + data + "</methodCall>";
! }
! else if (methodresponse != null) {
! data = "<methodResponse>" + data + "</methodResponse>";
! }
!
! return data;
! }
!
! var loads = function( xmlObj) {
!
! var m = new zmx.XML_Loader();
! var result = m.loads(xmlObj)
!
! return result;
! }
!
! var Args_To_XML = function ( args, method ) {
! var xmlFunc = new zmx.XMLFunction( method );
! return xmlFunc.BuildArgumentMessage.apply(xmlFunc, args);
! }
!
! var Arg_To_XML = function ( arg, method ) {
! return this.Args_To_XML([arg], method);
! }
!
! var XML_To_Args = function ( theXML ) {
! var argObj = this.XML_To_ArgObject( theXML );
! return argObj.params;
! }
!
! var XML_To_ArgObject = function ( theXML ) {
! return this.dumps( theXML );
! }
!
! var XML_CallWithArg = function ( theURL, methodName, theArg, successFunc, failFunc, client) {
! //
! // Deprecated! Use XML_CallWithArgs instead..
! //
! // theURL: URL to get 'object' reference
! // methodName : method of object to call
! // theArgs : arguments to pass
! // successFunc: method of client to call for success notification
! // failFunc : method of client to call for failure notification
! // client: object to be notified..
!
! return this.XML_CallWithArgs( theURL, methodName, [theArg], successFunc, failFunc, client);
! }
!
! var XML_CallWithArgs = function ( theURL, methodName, theArgs, successFunc, failFunc, client) {
! //
! // theURL: URL to get 'object' reference
! // methodName : method of object to call
! // theArgs : arguments to pass
! // successFunc: method of client to call for success notification
! // failFunc : method of client to call for failure notification
! // client: object to be notified..
! // useLCServer: set to 'true' if the connection should be made via a LocalConnection object
! //
!
! var proxy = new zmx.XMLRPC_ResponseHandler( successFunc, failFunc, client);
! var rpcFunction = new zmx.XMLFunction( methodName );
! rpcFunction.BuildArguments.apply(rpcFunction, theArgs);
! rpcFunction.Send(theURL, proxy);
! return rpcFunction;
! }
!
! }
!
|
|
From: Steve S. <ssp...@us...> - 2009-09-11 13:28:30
|
Update of /cvsroot/zmx/zmx/examples In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv21024/examples Modified Files: Tag: ActionScript_2-0_conversion asyncTest.fla Log Message: update ixml connection to use onConnect for compatibility with CS3 (at least) Index: asyncTest.fla =================================================================== RCS file: /cvsroot/zmx/zmx/examples/asyncTest.fla,v retrieving revision 1.3.2.2 retrieving revision 1.3.2.3 diff -C2 -d -r1.3.2.2 -r1.3.2.3 Binary files /tmp/cvsYudebi and /tmp/cvsrNGFuD differ |
|
From: Steve S. <ssp...@us...> - 2009-09-11 13:28:28
|
Update of /cvsroot/zmx/zmx In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv21024 Modified Files: Tag: ActionScript_2-0_conversion AsyncSocket.as InstantXMLHelper.as Log Message: update ixml connection to use onConnect for compatibility with CS3 (at least) Index: InstantXMLHelper.as =================================================================== RCS file: /cvsroot/zmx/zmx/Attic/InstantXMLHelper.as,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** InstantXMLHelper.as 18 Apr 2004 13:26:18 -0000 1.1.2.2 --- InstantXMLHelper.as 11 Sep 2009 13:28:18 -0000 1.1.2.3 *************** *** 128,142 **** if (config.xmlhost != null) { - this.proxy.asyncConfigured( config ); - this.xmlc = new zmx.AsyncSocket( this ); this.xmlc.connect(this.config.xmlhost,this.config.xmlport); - var util = new zmx.XMLRPCLib(); - this.xmlc.send(util.Arg_To_XML({sender_id:this.config.sender_id})); } delete this.configHelper; } ! function send( theArgs, theMethod ) { // --- 128,153 ---- if (config.xmlhost != null) { this.xmlc = new zmx.AsyncSocket( this ); this.xmlc.connect(this.config.xmlhost,this.config.xmlport); } delete this.configHelper; } ! ! function onConnect( success ) { ! // ! // "this" is the AsyncSocket here... take care. ! // ! if (success) { ! var util = new zmx.XMLRPCLib(); ! this.xmlc.send(util.Arg_To_XML({sender_id:this.config.sender_id})); ! this.proxy.asyncConfigured( this.config ); ! } ! else ! { ! this.configFailure("Failed to connect to IXML Server."); ! } ! } ! function send( theArgs, theMethod ) { // Index: AsyncSocket.as =================================================================== RCS file: /cvsroot/zmx/zmx/Attic/AsyncSocket.as,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** AsyncSocket.as 18 Apr 2004 13:26:18 -0000 1.1.2.2 --- AsyncSocket.as 11 Sep 2009 13:28:18 -0000 1.1.2.3 *************** *** 28,31 **** --- 28,35 ---- return "ERROR! invoking method!"; } + + function onConnect( success ) { + this.parentObj.onConnect( success ); + } function onXML(theXML) { |
|
From: Steve S. <ssp...@us...> - 2009-09-03 19:33:47
|
Update of /cvsroot/zmx/zmx/examples In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv8991/examples Modified Files: Tag: ActionScript_2-0_conversion XMLRPCClient.as asyncTest.fla Log Message: more verbose output in example. Index: XMLRPCClient.as =================================================================== RCS file: /cvsroot/zmx/zmx/examples/Attic/XMLRPCClient.as,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** XMLRPCClient.as 27 Feb 2006 17:27:05 -0000 1.1.2.1 --- XMLRPCClient.as 3 Sep 2009 19:33:31 -0000 1.1.2.2 *************** *** 37,41 **** function showResult( result ) { ! this.displayText.text += "We got: " + result + '\r\n'; } --- 37,41 ---- function showResult( result ) { ! this.displayText.text += "We got: " + result + '\r\n'+zmx.ZMX_Lib.serializeObject(result); } Index: asyncTest.fla =================================================================== RCS file: /cvsroot/zmx/zmx/examples/asyncTest.fla,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -d -r1.3.2.1 -r1.3.2.2 Binary files /tmp/cvs1NdfC1 and /tmp/cvsGr1mo9 differ |
|
From: Steve S. <ssp...@us...> - 2008-12-03 17:22:16
|
Update of /cvsroot/zmx/zmx/InstantXML In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv17091/InstantXML Modified Files: .cvsignore Log Message: add .DS to cvsignore Index: .cvsignore =================================================================== RCS file: /cvsroot/zmx/zmx/InstantXML/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** .cvsignore 11 Apr 2005 11:29:22 -0000 1.2 --- .cvsignore 3 Dec 2008 17:22:11 -0000 1.3 *************** *** 1,3 **** --- 1,5 ---- *.pyc ixml.log + .DS* + |
|
From: Steve S. <ssp...@us...> - 2006-08-16 14:03:02
|
Update of /cvsroot/zmx/zmx/InstantXML In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv14156/InstantXML Added Files: Tag: ActionScript_2-0_conversion .cvsignore Log Message: add .cvsignore.. --- NEW FILE: .cvsignore --- .DS* *txt *.pyc |
|
From: Steve S. <ssp...@us...> - 2006-06-01 11:10:07
|
Update of /cvsroot/zmx/zmx In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv30863 Modified Files: ZMX_ClipClass.as Log Message: strange. This change should not matter.. but somehow it does. Index: ZMX_ClipClass.as =================================================================== RCS file: /cvsroot/zmx/zmx/ZMX_ClipClass.as,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ZMX_ClipClass.as 29 May 2006 10:47:57 -0000 1.10 --- ZMX_ClipClass.as 1 Jun 2006 11:10:01 -0000 1.11 *************** *** 358,362 **** } ! dt.setColumns(columnNames); var defPWidth = 100.0/(columnNames.length); --- 358,362 ---- } ! dt.setColumns.apply(dt, columnNames); var defPWidth = 100.0/(columnNames.length); *************** *** 367,370 **** --- 367,371 ---- if (!cdef(columnInfo.hidden,false)) { // check that this is not a hidden column column.setHeader(cdef(columnInfo.label, columnInfo.name)); + _global.gTrace("Setting header: " + columnInfo.label + ":" + columnInfo.name); column.setWidth( dt.width * cdef(columnInfo.percentWidth, defPWidth)/100.0); if (columnInfo.cellSymbol != null) { |
|
From: Steve S. <ssp...@us...> - 2006-05-29 10:48:05
|
Update of /cvsroot/zmx/zmx In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv26207 Modified Files: ZMX_ClipClass.as Log Message: change column setup Index: ZMX_ClipClass.as =================================================================== RCS file: /cvsroot/zmx/zmx/ZMX_ClipClass.as,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ZMX_ClipClass.as 16 May 2006 12:19:50 -0000 1.9 --- ZMX_ClipClass.as 29 May 2006 10:47:57 -0000 1.10 *************** *** 358,362 **** } ! dt.setColumns.apply( dt, columnNames); var defPWidth = 100.0/(columnNames.length); --- 358,362 ---- } ! dt.setColumns(columnNames); var defPWidth = 100.0/(columnNames.length); |
|
From: Steve S. <ssp...@us...> - 2006-05-29 10:47:44
|
Update of /cvsroot/zmx/zmx In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv26108 Modified Files: ZMXScreenClass.as Log Message: clean up confirm dialog Index: ZMXScreenClass.as =================================================================== RCS file: /cvsroot/zmx/zmx/ZMXScreenClass.as,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** ZMXScreenClass.as 14 Nov 2004 20:51:09 -0000 1.33 --- ZMXScreenClass.as 29 May 2006 10:47:33 -0000 1.34 *************** *** 180,185 **** // Handler for buttons that call XMLRPC methods.. // ! _global.gTrace('in doSendXML handler for ' + this + ":" + comp.send_attrs); var loadURL=''; --- 180,188 ---- // Handler for buttons that call XMLRPC methods.. // + // get loadURL, xmlSuccessHandler, xmlFailureHandler from comp + // get all other info from 'proxy' + // ! _global.gTrace('in doSendXML handler for ' + this + ":" + comp.send_attrs + ":" + comp.loadURL); var loadURL=''; *************** *** 350,354 **** var proxy = []; var dt = this[tableInfo.tableName]; - trace("trying to get checkboxes for: " + tableInfo.tableName + ":" + dt + ":" + this); var checkedRow; var obj; --- 353,356 ---- *************** *** 371,375 **** } } - trace("Returning checked rows: " + _global.serializeObject( proxy )); return proxy; } --- 373,376 ---- *************** *** 394,397 **** --- 395,422 ---- } + p.confirmWithDialog = function( xmlInfo ) { + + if (xmlInfo.confirmAction != null) { + _global.gTrace("confirmWithDialog:" + _global.seralizeObject( xmlInfo )); + var scrMessage = this.screenMessage( xmlInfo ); + scrMessage.originalProxy = xmlInfo.proxy; + scrMessage.originalComp = xmlInfo.comp; + } + else { + this.checkboxOperationComplete( xmlInfo ); + } + } + + p.checkUserConfirmed = function( comp, buttonIndex) { + // + // close handler for confirmation dialog. + // + + if ((comp.getButtons()[buttonIndex].toUpperCase() == "OK") or (comp.getButtons()[buttonIndex].toUpperCase() == "YES")) { + comp.originalProxy.actionConfirmed = 1; + this.doSendXML( comp.originalComp, comp.originalProxy ); + } + } + p.checkboxOperationComplete = function ( xmlInfo ) { *************** *** 401,405 **** this.clearCheckboxes(); this.refreshControls(); ! if (xmlInfo.message != null) { this.screenMessage( xmlInfo ); } --- 426,430 ---- this.clearCheckboxes(); this.refreshControls(); ! if ((xmlInfo.message != null) || (xmlInfo.Message != null)) { this.screenMessage( xmlInfo ); } |
|
From: Steve S. <ssp...@us...> - 2006-05-16 12:20:09
|
Update of /cvsroot/zmx/zmx In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv26007 Modified Files: ZMX_ClipClass.as Log Message: generalize clip message dialog Index: ZMX_ClipClass.as =================================================================== RCS file: /cvsroot/zmx/zmx/ZMX_ClipClass.as,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ZMX_ClipClass.as 14 Nov 2004 20:51:09 -0000 1.8 --- ZMX_ClipClass.as 16 May 2006 12:19:50 -0000 1.9 *************** *** 333,337 **** } } ! p.setupTable = function( dt, tableData ) { --- 333,337 ---- } } ! p.setupTable = function( dt, tableData ) { *************** *** 543,548 **** this.setupComponent( msgBox, msgInfo); ! msgBox.setButtons([msgInfo.buttonLabel]); ! msgBox.setMessage(msgInfo.message); return msgBox; --- 543,553 ---- this.setupComponent( msgBox, msgInfo); ! if (msgInfo.buttonLabel != null) { ! msgBox.setButtons([msgInfo.buttonLabel]); ! } ! ! if (msgInfo.message != null) { ! msgBox.setMessage(msgInfo.message); ! } return msgBox; |
|
From: Steve S. <ssp...@us...> - 2006-05-14 10:56:54
|
Update of /cvsroot/zmx/zmx/InstantXML In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv19054/InstantXML Modified Files: IXML_Client.py Log Message: more convenient client.. Index: IXML_Client.py =================================================================== RCS file: /cvsroot/zmx/zmx/InstantXML/IXML_Client.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** IXML_Client.py 20 Mar 2005 02:04:38 -0000 1.7 --- IXML_Client.py 14 May 2006 10:56:48 -0000 1.8 *************** *** 80,85 **** #print 'Finishing loop' ! CONNECT_STRUCT = {'sender_id': 'c1: IXML_Client', 'ssecret':'foo', 'send_ping':5.0} ! #CONNECT_STRUCT = {'sender_id': 'c1: IXML_Client', 'ssecret':'foo'} class IXML_Client: --- 80,85 ---- #print 'Finishing loop' ! #CONNECT_STRUCT = {'sender_id': 'c1: IXML_Client', 'ssecret':'foo', 'send_ping':5.0} ! CONNECT_STRUCT = {'sender_id': 'c1: IXML_Client',} class IXML_Client: |
|
From: Steve S. <ssp...@us...> - 2006-02-27 17:28:16
|
Update of /cvsroot/zmx/zmx/examples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22881/examples Modified Files: Tag: ActionScript_2-0_conversion asyncTest.fla testXMLRPCHelper.fla Added Files: Tag: ActionScript_2-0_conversion InstantXMLClient.as XMLRPCClient.as Log Message: make asyncTest.fla work with flash 8 Index: testXMLRPCHelper.fla =================================================================== RCS file: /cvsroot/zmx/zmx/examples/Attic/testXMLRPCHelper.fla,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 Binary files /tmp/cvspRbRPL and /tmp/cvsX7NLli differ --- NEW FILE: XMLRPCClient.as --- import zmx.* // // this is just an example XNLRPC Client class for the asyncTest .fla // dynamic class XMLRPCClient extends MovieClip { function XMLRPCClient() { this.xmlrpc = new zmx.XMLRPCHelper(this); } function onLoad() { trace("XMLRPC Client Window Loaded."); this.clearButton.addEventListener("click", function(evt_obj:Object):Void { evt_obj.target._parent.clearText(); }); this.callButton.addEventListener("click", function(evt_obj:Object):Void { evt_obj.target._parent.demoRequest(); }); } function demoRequest() { trace("Calling:" + this.getUrl.text); this.xmlrpc.callMethod(this.getUrl.text); } function responseSuccess( result ) { this.showResult("success response! " + result); } function responseFailure(reason ) { this.showResult("responseFailure! " + zmx.ZMX_Lib.serializeObject(reason)); } function showResult( result ) { this.displayText.text += "We got: " + result + '\r\n'; } function clearText(comp) { this.displayText.text = ''; } } --- NEW FILE: InstantXMLClient.as --- (This appears to be a binary file; contents omitted.) Index: asyncTest.fla =================================================================== RCS file: /cvsroot/zmx/zmx/examples/asyncTest.fla,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 Binary files /tmp/cvsZvissS and /tmp/cvsMXnZAp differ |
|
From: Steve S. <ssp...@us...> - 2006-02-24 11:00:41
|
Update of /cvsroot/zmx/zmx/InstantXML In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26983 Modified Files: Tag: ActionScript_2-0_conversion InstantXMLServer.py Log Message: sync with main branch. Index: InstantXMLServer.py =================================================================== RCS file: /cvsroot/zmx/zmx/InstantXML/InstantXMLServer.py,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** InstantXMLServer.py 23 Nov 2003 17:35:29 -0000 1.3 --- InstantXMLServer.py 24 Feb 2006 11:00:35 -0000 1.3.2.1 *************** *** 22,34 **** VERSION = string.split(RCS_ID,' ')[2] import socket import asyncore import asynchat ! from xmlrpclib import loads, dumps def clean(src): return src + '\0' class chat_channel (asynchat.async_chat): --- 22,66 ---- VERSION = string.split(RCS_ID,' ')[2] + PING_SLEEPTIME = 60 # maximum ping delay seconds + import socket import asyncore import asynchat ! from xmlrpclib import loads, dumps, Boolean ! ! from threading import RLock, Thread ! from time import sleep def clean(src): return src + '\0' + class PingThread( Thread ): + + running = 0 + + def __init__(self, client): + Thread.__init__(self) + self.client = client + + def pause(self): + """ + stop pinging. + """ + self.running = 0 + + def run(self): + """ + wait on xml... + """ + self.running = 1 + + while 1: + if self.running: + sleep(self.client.ping_delay) # the client may adjust the ping_delay depending on the configuration of the channels that need pings. + self.client.do_ping() + else: + break + class chat_channel (asynchat.async_chat): *************** *** 41,44 **** --- 73,77 ---- self.xml = '' self.sender_id = '' + self.needs_ping = 0 def collect_incoming_data (self, data): *************** *** 68,72 **** --- 101,113 ---- self.server.log_info('Found type(values) of "%s"' % type(values)) if type(values) == type({}): + if self.server.ssecret: + if self.server.ssecret != values.get('ssecret',''): # if the server + return self.sender_id = values.get('sender_id','') + self.needs_ping = values.get('send_ping',0) + + if self.needs_ping: + self.server.setup_ping_thread(self) # only set up pings if requested. + if not self.sender_id: self.sender_id = None *************** *** 86,89 **** --- 127,137 ---- self.server.log_info('Command received from: %s (%s)' % (self.sender_id, command)) self.handle_command(command) + else: + target_id = cmdDict.get('target_id','') + if target_id: + sentValues = 1 + self.server.log_info('targeted data received from: %s to %s' % (self.sender_id, target_id)) + self.server.push_line(self, xmlToSend, target_id) + if not sentValues: self.server.push_line(self, xmlToSend) *************** *** 98,102 **** if hasattr (self, name): # make sure it's a method... ! method = getattr (self, name) if type(method) == type(self.handle_command): method (command_line[1:]) --- 146,150 ---- if hasattr (self, name): # make sure it's a method... ! method = getattr (self, name, None) if type(method) == type(self.handle_command): method (command_line[1:]) *************** *** 141,149 **** channel_class = chat_channel spy = 0 ! def __init__ (self, ip='', port=8518): self.port = port self.create_socket (socket.AF_INET, socket.SOCK_STREAM) self.set_reuse_addr() --- 189,199 ---- channel_class = chat_channel + ping_delay = PING_SLEEPTIME spy = 0 ! def __init__ (self, ip='', port=8518, ssecret=''): self.port = port + asyncore.dispatcher.__init__(self) self.create_socket (socket.AF_INET, socket.SOCK_STREAM) self.set_reuse_addr() *************** *** 152,173 **** self.listen (5) self.channels = {} ! self.count = 0 def handle_accept (self): conn, addr = self.accept() ! self.count = self.count + 1 ! self.log_info('Instant XML client #%d - %s:%d' % (self.count, addr[0], addr[1])) self.channels[self.channel_class (self, conn, addr)] = 1 ! def push_line (self, from_channel, line): sender_id = from_channel.get_sender_id() if self.spy: ! self.log_info('Instant XML transmit %s: %s\r\n' % (sender_id, line)) for c in self.channels.keys(): if c is not from_channel: self.log_info('checking %s against %s' % (c.get_channel_id(), from_channel.get_channel_id())) if c.get_channel_id() == from_channel.get_channel_id(): ! c.push (clean(line)) def writable (self): return 0 --- 202,274 ---- self.listen (5) self.channels = {} ! self.count = 0L ! self.ssecret = ssecret ! self.ping_thread = None # if pings are requested by a client we'll set this up. ! self.push_lock = RLock() def handle_accept (self): conn, addr = self.accept() ! self.count = self.count + 1L ! self.log_info('Instant XML client #%ld - %s:%d' % (self.count, addr[0], addr[1])) self.channels[self.channel_class (self, conn, addr)] = 1 ! def push_line (self, from_channel, line, target_id=''): ! ! # ! # push a packet to all clients in that channel. This could be more efficient for large numbers of clients. ! # That'll be version 2. ! # ! ! self.push_lock.acquire() sender_id = from_channel.get_sender_id() if self.spy: ! if target_id: ! self.log_info('Instant XML transmit %s: %s\r\n for %s only' % (sender_id, line, target_id)) ! else: ! self.log_info('Instant XML transmit %s: %s\r\n' % (sender_id, line)) ! for c in self.channels.keys(): if c is not from_channel: self.log_info('checking %s against %s' % (c.get_channel_id(), from_channel.get_channel_id())) if c.get_channel_id() == from_channel.get_channel_id(): ! if target_id: ! # ! # if there is a target_id, only send to that channel. ! # ! if c.sender_id == target_id: ! c.push (clean(line)) ! else: ! c.push (clean(line)) ! ! self.push_lock.release() ! ! def setup_ping_thread(self, client): ! """ ! establish the ping thread. ! """ ! if type(client.needs_ping) in [type(1.0), type(1)]: ! if self.ping_delay > client.needs_ping: ! self.ping_delay = client.needs_ping # use client with minimum delay to set delay time ! ! if not self.ping_thread: ! self.ping_thread = PingThread(self) ! self.ping_thread.start() ! ! def do_ping(self): ! self.push_lock.acquire() ! pingcount = 0 ! for c in self.channels.keys(): ! if c.needs_ping: ! pingcount += 1 ! c.push(clean(dumps(({'message':'ping'},)))) + self.push_lock.release() + + if pingcount == 0: + self.log_info('Ping count fell to zero... stopping ping thread.') + self.ping_thread.pause() + self.ping_thread = None + self.ping_delay = PING_SLEEPTIME + def writable (self): return 0 *************** *** 175,178 **** --- 276,281 ---- if __name__ == '__main__': import sys + + ssecret = '' # default is no shared secret. if len(sys.argv) > 1: *************** *** 180,184 **** else: port = 8518 ! s = InstantXMLServer('', port) asyncore.loop() --- 283,290 ---- else: port = 8518 + + if len(sys.argv) > 2: + ssecret = sys.argv[2] ! s = InstantXMLServer('', port, ssecret) asyncore.loop() |
|
From: Steve S. <ssp...@us...> - 2006-02-20 14:40:31
|
Update of /cvsroot/zmx/zmx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14060 Modified Files: Tag: ActionScript_2-0_conversion XMLRPCHelper.as ZMX_ClipClass.as ZMX_Lib.as Log Message: safety... Index: ZMX_Lib.as =================================================================== RCS file: /cvsroot/zmx/zmx/Attic/ZMX_Lib.as,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** ZMX_Lib.as 18 Apr 2004 13:26:18 -0000 1.1.2.2 --- ZMX_Lib.as 20 Feb 2006 14:40:24 -0000 1.1.2.3 *************** *** 2,5 **** --- 2,13 ---- class zmx.ZMX_Lib { + static function checkDef( x, defX ) { + // shorthand.. + // if x is null, return defX, otherwise, return x + // + return x == null ? defX : x; + + } + static function serializeObject( anObject, level, limit ) { Index: ZMX_ClipClass.as =================================================================== RCS file: /cvsroot/zmx/zmx/ZMX_ClipClass.as,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -C2 -d -r1.5 -r1.5.2.1 *** ZMX_ClipClass.as 4 Dec 2003 22:22:33 -0000 1.5 --- ZMX_ClipClass.as 20 Feb 2006 14:40:24 -0000 1.5.2.1 *************** *** 13,466 **** */ ! c = _global.ZMX_ClipClass = function() { ! if (this._name != null) { ! this.constr(); ! } ! }; ! p = c.prototype = new MovieClip(); ! p.constr = function() { ! // constr is called during instance construction. ! // ! this.dynamicControls = []; ! this.msgLevel = 2000; ! } ! ! p.init = function( config ) { ! // ! // init is called when the object is "loaded" in the flash sense. ! // ! // ! // clear out any existing dynamically loaded controls.. ! // ! for (var i=0; i<this.dynamicControls.length; i++) { ! this.dynamicControls[i].removeMovieClip(); } ! this.dynamicControls = []; ! var cdef = _global.checkDef; ! ! this.controlLevel = cdef(config.controlLevel,1000); ! this.configURL = cdef(config.configURL,'zapp_get_object_info'); ! this.configArgs = cdef(config.configArgs,[]); ! if (config.IXMLConfig != null) { ! this.ixml = new _global.InstantXMLHelper( this, config.IXMLConfig ); } ! this.xmlCaller = new _global.XMLRPCHelper( this ); ! }; ! ! p.getClipKey = function( ) { ! // ! // calculate key to lookup config url from server... ! // ! return this._url.split('/').slice(-1)[0]; ! } ! ! p.getVersion = function() { ! var revRepr = 'unversioned'; ! if (this.revString != null) { ! var fullRev = this.revString; ! var frStart = 11; ! var frEnd = fullRev.length - 1; ! revRepr = "v-" + fullRev.slice(frStart, frEnd); } - return this.getClipKey() + ": " + revRepr; - } - - p.xmlConfigSuccess = function(result) { - this.initUI(result); ! if (this.doEnterKey != null) { ! this.onKeyDown = this.ZMX_Clip_onKeyDown; ! Key.addListener(this); } ! } ! ! p.onUnload = function () { ! if (this.doEnterKey != null) { ! Key.removeListener( this ); } ! } ! ! p.ZMX_Clip_onKeyDown = function () { ! if (Key.getCode() == KEY.ENTER) { ! this.doEnterKey(); } - } - - p.xmlConfigFailure = function() { - _global.gTrace("ack. failed to get XML"); - } - - p.onLoad = function ( ) { - - _global.gTrace("using XMLRPC to load clip"); ! this.xmlCaller.callMethod(this.configURL, this.configArgs, null, this, 'xmlConfigSuccess', 'xmlConfigFailure'); ! } ! ! p.callXML = function( cmdURL, args) { ! this.xmlCaller.callMethod( cmdURL, args, null, this, 'xmlResponse', 'xmlFailed'); ! } ! ! p.doCallXML = function ( comp ) { ! this.callXML( comp.cmdURL, this.getCommandArgs(comp)); ! } ! ! p.doCallInstantXML = function( comp ) { ! this.ixml.send(this.getCommandArgs(comp), comp.method); ! } ! p.xmlResponse = function( result ) { ! _global.gTrace("XML Call result: " + _global.serializeObject( result )); ! } ! ! p.xmlFailed = function( result ) { ! _global.gTrace("XML Failed! -> " + result); ! } ! ! ! p.getCompProxy = function( comp ) { ! // ! // extract useful information from a component. ! // ! var attr; ! var val; ! var proxy = {}; ! ! var send_attrs = comp.send_attrs; ! if (send_attrs != null) { ! if (typeof(send_attrs) == 'string') { ! send_attrs = send_attrs.split(':'); ! } ! for (var i=0; i<send_attrs.length; i++) { ! attr = send_attrs[i]; ! val = comp[attr]; ! if (val == null) { ! val = this.getFieldValue(attr); ! } ! proxy[attr] = val; ! } } ! if (comp.comp_ValueAttribute != null) { ! proxy[comp.comp_ValueAttribute] = comp.getValue(); } ! ! return proxy; ! } ! ! p.setupControls = function ( controlData, currX, currY ) { ! ! var cdef = _global.checkDef; ! ! var deltaX = null; ! if (controlData.deltaX != null) { ! if (typeof(controlData.deltaX) == 'string') { ! deltaX = parseFloat(controlData.deltaX); } ! else ! { ! deltaX = controlData.deltaX; } } ! ! var deltaY = null; ! if (controlData.deltaY != null) { ! if (typeof(controlData.deltaY) == 'string') { ! deltaY = parseFloat(controlData.deltaY); } ! else ! { ! deltaY = controlData.deltaY; } } ! ! var control; // alloc vars for the control and the point.. ! var point; // current point.. ! ! if ( controlData.control.length != null) { ! controls=controlData.control; ! for ( var i=0; i<controls.length; i++) { ! var control = controls[i]; ! ! if (i==0) { ! point = {_x:cdef(control._x,currX), _y:cdef(control._y,currY)}; } else { ! point = {_x:cdef(control._x,point._x), _y:cdef(control._y,point._y)}; } ! point = this.setupControl(control, point, deltaX, deltaY); } - } - } - - p.setupControl = function( control, point, deltaX, deltaY ) { - - var init = {_x:point._x, _y:point._y}; - var controlName = control.name; - var controlClip; ! if (controlName == null) { ! if (control.url != null) { ! controlClip = this.createEmptyMovieClip(controlName+this.controlLevel, this.controlLevel++); ! controlClip._x = init._x; ! controlClip._y = init._y; ! controlClip.loadMovie( control.url ); } else { return point; } ! } else { ! controlClip = this.attachMovie(controlName, controlName+this.controlLevel, this.controlLevel++, init); ! } ! ! if (controlClip != null) { ! this.dynamicControls.push(controlClip); ! } ! else { ! return point; ! } ! ! this.setupComponent( controlClip, control ); ! if (controlClip.needsChecks != null) { ! controlClip.setEnabled( false ); ! } ! if (deltaX != null) { ! point._x += controlClip.width + deltaX; ! } ! if (deltaY != null) { ! point._y += controlClip.height + deltaY; } - - return point; - } - - p.setupComponent = function( componentClip, componentInits ) { - - // - // Setup a component movieclip (componentClip) using - // information in structure (componentInits ) - // ! // if component has 'setXXX' method, then use structure's ! // 'XXX' attribute as argument. e.g., if structure has ! // {CloseHandler:'doLoadScreen'}, then call ! // component.setCloseHandler( structure.CloseHandler ); ! // ! // if structure has 'item' attribute, assume it's a list of ! // structures with 'label' and 'data' values... ! // ! var width = null; ! var height = null; ! ! for (var attr in componentInits) { ! ! if (attr == 'width') { ! width = parseInt(componentInits.width); } ! else if (attr == 'height') { ! height = parseInt(componentInits.height); } ! else if (attr != 'item') { ! if (componentClip['set' + attr] != null) { ! componentClip['set' + attr](componentInits[attr]); ! }else if (componentClip._name.slice(0,5) != 'comp_') { ! componentClip[attr] = componentInits[attr]; } } } ! ! if (width != null) { ! if (height != null) { ! componentClip.setSize(width, height); } ! else { ! componentClip.setSize(width, controlClip.height); } ! } ! ! if (componentInits.item != null) { ! for (var j=0; j<componentInits.item.length; j++) { ! var anItem = componentInits.item[j]; ! componentClip.addItem(anItem.label, anItem.data); } } - } ! p.setupTable = function( dt, tableData ) { ! ! var rowData = tableData.rows; ! ! var i,j; ! var columnInfo; // info about a column. ! var column; // the colum itself. ! var row; // a rows worth of row data.. ! ! var cdef = _global.checkDef; ! var columnNames = []; ! ! dt.removeAllItems(); ! dt.removeAllColumns(); ! dt.setSelectMultiple( cdef(tableData.selectMultiple, true)); ! dt.alternateRowColors(cdef(tableData.rowColor1,0x9999FF), ! cdef(tableData.rowColor2,0xCCCCFF)); ! ! for( i=0; i<tableData.columnInits.length; i++) { ! if (!cdef(tableData.columnInits[i].hidden,false)) { ! columnNames.push(tableData.columnInits[i].name); ! } ! } ! ! dt.setColumns.apply( dt, columnNames); ! ! var defPWidth = 100.0/(columnNames.length); ! for( i=0; i<tableData.columnInits.length; i++) { ! columnInfo = tableData.columnInits[i]; ! column = dt.getColumnAt(i); ! if (!cdef(columnInfo.hidden,false)) { // check that this is not a hidden column ! column.setHeader(cdef(columnInfo.label, columnInfo.name)); ! column.setWidth( dt.width * cdef(columnInfo.percentWidth, defPWidth)/100.0); ! if (columnInfo.cellSymbol != null) { ! column.setCellSymbol( columnInfo.cellSymbol); } } - } - - if (rowData != null) { - dt.setDataProvider( rowData ); - } ! dt.setChangeHandler(cdef(tableData.changeHandler, 'tableChanged')); ! dt.updateControl(); ! } ! ! p.getCommandProxy = function(comp) { ! // ! // get proxy for clip/component ! // ! ! var proxy = {}; ! var attr; ! var val; ! var send_attrs = comp.send_attrs; ! if (send_attrs != null) { ! if (typeof(send_attrs) == 'string') { ! send_attrs = send_attrs.split(':'); ! } ! for (var i=0; i<send_attrs.length; i++) { ! attr = send_attrs[i]; ! val = comp[attr]; ! if (val == null) { ! val = this.getFieldValue(attr); } - proxy[ attr ] = val; } } - - return proxy; - } ! p.getCommandArgs = function(comp) { ! // ! // get proxy for clip/component ! // ! ! var args = []; ! var attr; ! var val; ! var send_attrs = comp.send_attrs; ! if (send_attrs != null) { ! if (typeof(send_attrs) == 'string') { ! send_attrs = send_attrs.split(':'); } ! for (var i=0; i<send_attrs.length; i++) { ! attr = send_attrs[i]; ! val = comp[attr]; ! if (val == null) { ! val = this.getFieldValue(attr); } - args.push(val); } } ! ! return args; ! } ! ! p.getFieldValue = function ( attr, defaultValue) { ! // ! // take a stab at getting a sensible value for a field.. ! // ! ! if (defaultValue == null) { ! defaultValue = ''; ! } ! ! var val = defaultValue; ! ! var field=this[attr]; ! ! if (field != null) { ! if (field.getValue != null) { ! val = field.getValue(); ! } ! else if (field.text != null) { ! val =field.text; ! } ! else if (field.html != null) { ! val=field.html; ! } ! else { ! val = field; ! } } - return val; - } - - - p.clipWindow = function( msgInfo) { - - var ckd = _global.checkDef; - - var props = {resizable:ckd(msgInfo.resizable,false), - isScrolling:ckd(msgInfo.isScrolling,false), - scrollContent:ckd(msgInfo.name, 'defaultScreenWindow'), - paneTitle:ckd(msgInfo.title, "Information"), _x:this._width/2, _y:this._height/2, - msgInfo:msgInfo}; - - var scrWindow = this.attachMovie("FDraggablePaneSymbol", 'FDraggablePaneSymbol' + this.msgLevel, this.msgLevel++, props ); ! return scrWindow; ! } ! ! p.clipMessage = function( msgInfo ) { ! ! var msgBox = this.attachMovie("FAdvancedMessageBoxSymbol", "FAdvancedMessageBoxSymbol" + this.msgLevel, this.msgLevel++, {_x:this._width/2, _y:this._height/2}); ! if (msgBox == null) { ! msgBox = this.attachMovie("FMessageBoxSymbol", "FMessageBoxSymbol" + this.msgLevel, this.msgLevel++, {_x:this._width/2, _y:this._height/2}); ! } ! this.setupComponent( msgBox, msgInfo); ! msgBox.setButtons([msgInfo.buttonLabel]); ! msgBox.setMessage(msgInfo.message); ! ! return msgBox; } - - delete p; - delete c; --- 13,472 ---- */ ! import zmx.* ! class zmx.ZMX_ClipClass extends MovieClip { ! var dynamicControls; ! var msgLevel; ! var controlLevel; ! var configURL; ! var configArgs; ! function ZMX_ClipClass () { ! if (this._name != null) { ! this.constr(); ! } ! }; ! ! function constr() { ! // constr is called during instance construction. ! // ! this.dynamicControls = []; ! this.msgLevel = 2000; } ! function init( config ) { ! // ! // init is called when the object is "loaded" in the flash sense. ! // ! // ! // clear out any existing dynamically loaded controls.. ! // ! ! for (var i=0; i<this.dynamicControls.length; i++) { ! this.dynamicControls[i].removeMovieClip(); ! } ! ! this.dynamicControls = []; ! ! var cdef = zmx.ZMX_LIB.checkDef; ! ! this.controlLevel = cdef(config.controlLevel,1000); ! this.configURL = cdef(config.configURL,'zapp_get_object_info'); ! this.configArgs = cdef(config.configArgs,[]); ! ! if (config.IXMLConfig != null) { ! this.ixml = new zmx.InstantXMLHelper( this, config.IXMLConfig ); ! } ! ! this.xmlCaller = new zmx.XMLRPCHelper( this ); ! }; ! function getClipKey( ) { ! // ! // calculate key to lookup config url from server... ! // ! return this._url.split('/').slice(-1)[0]; ! } ! function getVersion() { ! var revRepr = 'unversioned'; ! if (this.revString != null) { ! var fullRev = this.revString; ! var frStart = 11; ! var frEnd = fullRev.length - 1; ! revRepr = "v-" + fullRev.slice(frStart, frEnd); ! } ! return this.getClipKey() + ": " + revRepr; } ! function xmlConfigSuccess(result) { ! this.initUI(result); ! ! if (this.doEnterKey != null) { ! this.onKeyDown = this.ZMX_Clip_onKeyDown; ! Key.addListener(this); ! } } ! function onUnload() { ! if (this.doEnterKey != null) { ! Key.removeListener( this ); ! } } ! ! function ZMX_Clip_onKeyDown() { ! if (Key.getCode() == KEY.ENTER) { ! this.doEnterKey(); ! } } ! ! function xmlConfigFailure() { ! _global.gTrace("ack. failed to get XML"); } ! function onLoad( ) { ! _global.gTrace("using XMLRPC to load clip"); ! ! this.xmlCaller.callMethod(this.configURL, this.configArgs, null, this, 'xmlConfigSuccess', 'xmlConfigFailure'); ! } ! function callXML( cmdURL, args) { ! this.xmlCaller.callMethod( cmdURL, args, null, this, 'xmlResponse', 'xmlFailed'); ! } ! ! function doCallXML( comp ) { ! this.callXML( comp.cmdURL, this.getCommandArgs(comp)); ! } ! ! function doCallInstantXML( comp ) { ! this.ixml.send(this.getCommandArgs(comp), comp.method); ! } ! function xmlResponse( result ) { ! _global.gTrace("XML Call result: " + _global.serializeObject( result )); } ! function xmlFailed( result ) { ! _global.gTrace("XML Failed! -> " + result); } ! ! ! function getCompProxy( comp ) { ! // ! // extract useful information from a component. ! // ! var attr; ! var val; ! var proxy = {}; ! ! var send_attrs = comp.send_attrs; ! ! if (send_attrs != null) { ! if (typeof(send_attrs) == 'string') { ! send_attrs = send_attrs.split(':'); ! } ! ! for (var i=0; i<send_attrs.length; i++) { ! attr = send_attrs[i]; ! val = comp[attr]; ! if (val == null) { ! val = this.getFieldValue(attr); ! } ! proxy[attr] = val; ! } } ! ! if (comp.comp_ValueAttribute != null) { ! proxy[comp.comp_ValueAttribute] = comp.getValue(); } + + return proxy; } ! ! function setupControls( controlData, currX, currY ) { ! ! var cdef = _global.checkDef; ! ! var deltaX = null; ! if (controlData.deltaX != null) { ! if (typeof(controlData.deltaX) == 'string') { ! deltaX = parseFloat(controlData.deltaX); ! } ! else ! { ! deltaX = controlData.deltaX; ! } } ! ! var deltaY = null; ! if (controlData.deltaY != null) { ! if (typeof(controlData.deltaY) == 'string') { ! deltaY = parseFloat(controlData.deltaY); ! } ! else ! { ! deltaY = controlData.deltaY; ! } ! } ! ! var control; // alloc vars for the control and the point.. ! var point; // current point.. ! ! if ( controlData.control.length != null) { ! controls=controlData.control; ! for ( var i=0; i<controls.length; i++) { ! var control = controls[i]; ! ! if (i==0) { ! point = {_x:cdef(control._x,currX), _y:cdef(control._y,currY)}; ! } ! else { ! point = {_x:cdef(control._x,point._x), _y:cdef(control._y,point._y)}; ! } ! point = this.setupControl(control, point, deltaX, deltaY); ! } } } ! ! function setupControl( control, point, deltaX, deltaY ) { ! ! var init = {_x:point._x, _y:point._y}; ! var controlName = control.name; ! var controlClip; ! ! if (controlName == null) { ! if (control.url != null) { ! controlClip = this.createEmptyMovieClip(controlName+this.controlLevel, this.controlLevel++); ! controlClip._x = init._x; ! controlClip._y = init._y; ! controlClip.loadMovie( control.url ); } else { ! return point; } ! } else { ! controlClip = this.attachMovie(controlName, controlName+this.controlLevel, this.controlLevel++, init); } ! if (controlClip != null) { ! this.dynamicControls.push(controlClip); } else { return point; } ! ! this.setupComponent( controlClip, control ); ! ! if (controlClip.needsChecks != null) { ! controlClip.setEnabled( false ); ! } ! if (deltaX != null) { ! point._x += controlClip.width + deltaX; ! } ! if (deltaY != null) { ! point._y += controlClip.height + deltaY; ! } ! return point; } ! function setupComponent( componentClip, componentInits ) { + // + // Setup a component movieclip (componentClip) using + // information in structure (componentInits ) + // + + // if component has 'setXXX' method, then use structure's + // 'XXX' attribute as argument. e.g., if structure has + // {CloseHandler:'doLoadScreen'}, then call + // component.setCloseHandler( structure.CloseHandler ); + // + // if structure has 'item' attribute, assume it's a list of + // structures with 'label' and 'data' values... + // + + + var width = null; + var height = null; ! for (var attr in componentInits) { ! ! if (attr == 'width') { ! width = parseInt(componentInits.width); ! } ! else if (attr == 'height') { ! height = parseInt(componentInits.height); ! } ! else if (attr != 'item') { ! if (componentClip['set' + attr] != null) { ! componentClip['set' + attr](componentInits[attr]); ! }else if (componentClip._name.slice(0,5) != 'comp_') { ! componentClip[attr] = componentInits[attr]; ! } ! } } ! ! if (width != null) { ! if (height != null) { ! componentClip.setSize(width, height); ! } ! else { ! componentClip.setSize(width, controlClip.height); ! } } ! ! if (componentInits.item != null) { ! for (var j=0; j<componentInits.item.length; j++) { ! var anItem = componentInits.item[j]; ! componentClip.addItem(anItem.label, anItem.data); } } } ! ! function setupTable( dt, tableData ) { ! ! var rowData = tableData.rows; ! ! var i,j; ! var columnInfo; // info about a column. ! var column; // the colum itself. ! var row; // a rows worth of row data.. ! ! var cdef = _global.checkDef; ! var columnNames = []; ! ! dt.removeAllItems(); ! dt.removeAllColumns(); ! dt.setSelectMultiple( cdef(tableData.selectMultiple, true)); ! dt.alternateRowColors(cdef(tableData.rowColor1,0x9999FF), ! cdef(tableData.rowColor2,0xCCCCFF)); ! ! for( i=0; i<tableData.columnInits.length; i++) { ! if (!cdef(tableData.columnInits[i].hidden,false)) { ! columnNames.push(tableData.columnInits[i].name); ! } } ! ! dt.setColumns.apply( dt, columnNames); ! ! var defPWidth = 100.0/(columnNames.length); ! ! for( i=0; i<tableData.columnInits.length; i++) { ! columnInfo = tableData.columnInits[i]; ! column = dt.getColumnAt(i); ! if (!cdef(columnInfo.hidden,false)) { // check that this is not a hidden column ! column.setHeader(cdef(columnInfo.label, columnInfo.name)); ! column.setWidth( dt.width * cdef(columnInfo.percentWidth, defPWidth)/100.0); ! if (columnInfo.cellSymbol != null) { ! column.setCellSymbol( columnInfo.cellSymbol); ! } ! } } ! ! if (rowData != null) { ! dt.setDataProvider( rowData ); } + + dt.setChangeHandler(cdef(tableData.changeHandler, 'tableChanged')); + dt.updateControl(); } ! function getCommandProxy(comp) { ! // ! // get proxy for clip/component ! // ! ! var proxy = {}; ! var attr; ! var val; ! var send_attrs = comp.send_attrs; ! if (send_attrs != null) { ! if (typeof(send_attrs) == 'string') { ! send_attrs = send_attrs.split(':'); ! } ! for (var i=0; i<send_attrs.length; i++) { ! attr = send_attrs[i]; ! val = comp[attr]; ! if (val == null) { ! val = this.getFieldValue(attr); ! } ! proxy[ attr ] = val; } } ! return proxy; ! } ! ! function getCommandArgs(comp) { ! // ! // get proxy for clip/component ! // ! var args = []; ! var attr; ! var val; ! var send_attrs = comp.send_attrs; ! ! if (send_attrs != null) { ! if (typeof(send_attrs) == 'string') { ! send_attrs = send_attrs.split(':'); ! } ! for (var i=0; i<send_attrs.length; i++) { ! attr = send_attrs[i]; ! val = comp[attr]; ! if (val == null) { ! val = this.getFieldValue(attr); ! } ! args.push(val); } } + + return args; } ! function getFieldValue( attr, defaultValue) { ! // ! // take a stab at getting a sensible value for a field.. ! // ! if (defaultValue == null) { ! defaultValue = ''; } ! ! var val = defaultValue; ! ! var field=this[attr]; ! ! if (field != null) { ! if (field.getValue != null) { ! val = field.getValue(); ! } ! else if (field.text != null) { ! val =field.text; ! } ! else if (field.html != null) { ! val=field.html; ! } ! else { ! val = field; } } + return val; } ! ! ! function clipWindow( msgInfo) { ! ! var ckd = _global.checkDef; ! ! var props = {resizable:ckd(msgInfo.resizable,false), ! isScrolling:ckd(msgInfo.isScrolling,false), ! scrollContent:ckd(msgInfo.name, 'defaultScreenWindow'), ! paneTitle:ckd(msgInfo.title, "Information"), _x:this._width/2, _y:this._height/2, ! msgInfo:msgInfo}; ! ! var scrWindow = this.attachMovie("FDraggablePaneSymbol", 'FDraggablePaneSymbol' + this.msgLevel, this.msgLevel++, props ); ! ! return scrWindow; } ! function clipMessage( msgInfo ) { ! var msgBox = this.attachMovie("FAdvancedMessageBoxSymbol", "FAdvancedMessageBoxSymbol" + this.msgLevel, this.msgLevel++, {_x:this._width/2, _y:this._height/2}); ! if (msgBox == null) { ! msgBox = this.attachMovie("FMessageBoxSymbol", "FMessageBoxSymbol" + this.msgLevel, this.msgLevel++, {_x:this._width/2, _y:this._height/2}); ! } ! ! this.setupComponent( msgBox, msgInfo); ! ! msgBox.setButtons([msgInfo.buttonLabel]); ! msgBox.setMessage(msgInfo.message); ! return msgBox; ! } } Index: XMLRPCHelper.as =================================================================== RCS file: /cvsroot/zmx/zmx/Attic/XMLRPCHelper.as,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** XMLRPCHelper.as 18 Apr 2004 13:26:18 -0000 1.1.2.3 --- XMLRPCHelper.as 20 Feb 2006 14:40:24 -0000 1.1.2.4 *************** *** 92,100 **** } ! if (this.config.CONTEXT_CONFIG == true) { ! ! if (this.config.configMethod == null) { ! this.config.configMethod = 'getXMLRPCConfig'; ! } // --- 92,96 ---- } ! if (this.config.configMethod != null) { // *************** *** 105,119 **** this.configProxy.controller = this; this.configProxy._url = proxy._url; ! this.configProxy.trace = proxy.trace; this.configProxy.responseSuccess = function( result ) { ! this.controller.configSuccess( result ); } this.configProxy.responseFailure = function( result ) { ! this.controller.configFailure( result ); } ! this.configHelper = new zmx.XMLRPCHelper( this.configProxy, {emulationMethod:this.config.emulationMethod}); this.configHelper.callMethod( this.config.configMethod, []); } --- 101,115 ---- this.configProxy.controller = this; this.configProxy._url = proxy._url; ! this.configProxy.trace = proxy.trace; this.configProxy.responseSuccess = function( result ) { ! this.controller.proxy.configSuccess( result ); } this.configProxy.responseFailure = function( result ) { ! this.controller.proxy.configFailure( result ); } ! this.configHelper = new zmx.XMLRPCHelper( this.configProxy ); this.configHelper.callMethod( this.config.configMethod, []); } *************** *** 133,136 **** --- 129,147 ---- } + function configSuccess( result ) { + trace("Config success!" + _global.serializeObject( result ) ); + + for (var attr in result) { + this.config[attr] = result[attr]; + } + this.proxy.configSuccess(); + this.proxy.trace("XMLRPC ConfigSuccess: " + _global.serializeObject( this.config )); + } + + function configFailure( msg ) { + trace("Config failure!" + msg); + this.proxy.configFailure(); + } + static function checkDef( x, defX ) { // shorthand.. |
|
From: Steve S. <ssp...@us...> - 2006-02-03 10:37:58
|
Update of /cvsroot/zmx/zmx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21676 Modified Files: Readme.txt Log Message: more readme notes. Index: Readme.txt =================================================================== RCS file: /cvsroot/zmx/zmx/Readme.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Readme.txt 20 Mar 2005 03:14:45 -0000 1.5 --- Readme.txt 3 Feb 2006 10:37:50 -0000 1.6 *************** *** 3,7 **** ZMX is a set of classes/utilities designed to assist in the development ! of Zope applications using Flash. Setup: checkout a version of zmx from sourceforge like so: --- 3,10 ---- ZMX is a set of classes/utilities designed to assist in the development ! of Zope applications using Flash and XMLRPC. It contains a bunch of ! 'widget' and 'window' type classes that use XMLRPC to get their ! configuration plus an asynchronous protocol (InstantXML) to handle ! notifications from the other processes. Setup: checkout a version of zmx from sourceforge like so: |
|
From: Steve S. <ssp...@us...> - 2005-05-27 14:15:59
|
Update of /cvsroot/zmx/zmx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31085 Modified Files: XML_js.as Log Message: make sure nulls never get sent.. Index: XML_js.as =================================================================== RCS file: /cvsroot/zmx/zmx/XML_js.as,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** XML_js.as 27 Aug 2003 16:46:30 -0000 1.10 --- XML_js.as 27 May 2005 14:15:50 -0000 1.11 *************** *** 60,63 **** --- 60,66 ---- } } + else if (result == 'undefined') { + result = null; + } return result; } |
|
From: Steve S. <ssp...@us...> - 2005-04-11 11:29:40
|
Update of /cvsroot/zmx/zmx/InstantXML In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17167/InstantXML Modified Files: .cvsignore Log Message: do not track log files in cvs.. Index: .cvsignore =================================================================== RCS file: /cvsroot/zmx/zmx/InstantXML/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 14 Feb 2005 09:55:55 -0000 1.1 --- .cvsignore 11 Apr 2005 11:29:22 -0000 1.2 *************** *** 1 **** --- 1,3 ---- *.pyc + ixml.log + |
|
From: Steve S. <ssp...@us...> - 2005-04-11 11:29:39
|
Update of /cvsroot/zmx/zmx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17167 Modified Files: .cvsignore Log Message: do not track log files in cvs.. Index: .cvsignore =================================================================== RCS file: /cvsroot/zmx/zmx/.cvsignore,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** .cvsignore 12 Jun 2003 04:16:51 -0000 1.3 --- .cvsignore 11 Apr 2005 11:29:22 -0000 1.4 *************** *** 1,4 **** --- 1,6 ---- .DS* *txt + ixml.log + |
|
From: Steve S. <ssp...@us...> - 2005-04-06 10:52:48
|
Update of /cvsroot/zmx/zmx/InstantXML In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30193 Modified Files: InstantXMLServer.py Log Message: make it compatible with python2.4 Index: InstantXMLServer.py =================================================================== RCS file: /cvsroot/zmx/zmx/InstantXML/InstantXMLServer.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** InstantXMLServer.py 20 Mar 2005 02:04:38 -0000 1.7 --- InstantXMLServer.py 6 Apr 2005 10:52:40 -0000 1.8 *************** *** 195,198 **** --- 195,199 ---- def __init__ (self, ip='', port=8518, ssecret=''): self.port = port + asyncore.dispatcher.__init__(self) self.create_socket (socket.AF_INET, socket.SOCK_STREAM) self.set_reuse_addr() |
|
From: Steve S. <ssp...@us...> - 2005-03-20 12:13:24
|
Update of /cvsroot/zmx/zmx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3379 Modified Files: ZMX_XML.as Log Message: improved notification on network return Index: ZMX_XML.as =================================================================== RCS file: /cvsroot/zmx/zmx/ZMX_XML.as,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** ZMX_XML.as 20 Mar 2005 03:15:43 -0000 1.45 --- ZMX_XML.as 20 Mar 2005 12:13:12 -0000 1.46 *************** *** 7,11 **** ** ** ! ** Rewrote all of this code to better suite my needs.. ** ** This code is inspired by two other efforts.. --- 7,11 ---- ** ** ! ** Rewrote all of this code to better suite ZMX needs.. ** ** This code is inspired by two other efforts.. *************** *** 19,34 **** ** The code the follows started more like the former, and ** ended up much more like the latter, but still has some ! ** decorations from the former. ! ** ! ** --------------------------------------------------- ! ** ! ** A major re-plumbing is happening since we discovered that ! ** DirectorMX doesn't set content-type headers in flash XMLRPC ! ** calls when Flash sprites are embedded in director movies. ** - ** As a work-around, we're allowing XMLRPC to be accessed via - ** a flash local-connetion server loaded in a web page (not - ** inside director) or a projector. This local-connection server - ** should be set up before running the director movie. ** ** sjs --- 19,25 ---- ** The code the follows started more like the former, and ** ended up much more like the latter, but still has some ! ** names from the former, though the implimentation is a ! ** complete re-write (see the CVS repository for details) ** ** ** sjs *************** *** 36,39 **** --- 27,39 ---- */ + // ------------------------------------------------------------------- + // + // the following #include is here, and the LConnXXX implementation is + // included here for historical/comatability reasons only. New Projects + // are strongly encouraged not to use the local connection proxy + // method since it's no longer being developed, or tested. + // + // ------------------------------------------------------------------- + #include "ZMX_LConnClient.as" *************** *** 63,72 **** // // config.configDelay = Boolean or number. If defined delay the configuration message. ! // If numeric use value for number of seconds to delay. // // config.send_ping = Boolean or number. If defined request pings from the // to help maintain/monitor a connection that may fail. ! // If numeric, use value to est ping delay interval (and ! // connection check interval // // config.use_LC_server Use a local connection rather than talking directly to --- 63,73 ---- // // config.configDelay = Boolean or number. If defined delay the configuration message. ! // If numeric use value for number of seconds to delay. Default ! // value is one second. // // config.send_ping = Boolean or number. If defined request pings from the // to help maintain/monitor a connection that may fail. ! // If numeric, use value to set the ping delay interval ! // (and connection check interval). Default value is 60 seconds. // // config.use_LC_server Use a local connection rather than talking directly to *************** *** 137,146 **** } this.registerInterval = SetInterval( this, "registerConnection", delayAmount); - return false; } else { this.send(this.config); ! return true; } } --- 138,147 ---- } this.registerInterval = SetInterval( this, "registerConnection", delayAmount); } else { this.send(this.config); ! this.configured = true; } + return this.configured; } *************** *** 151,156 **** // - this.configured = true; - var attr; --- 152,155 ---- *************** *** 197,215 **** } this.send(this.config); ! this.proxy.asyncConfigured( this.config ); } p.checkPingSuccess = function() { ! //trace("checking ping success.."); if (this.networkAvailable && !this.gotXMLSinceLastPing) { ! this.networkAvailable = false; ! this.proxy.networkAvailableStatus( this.networkAvailable) ! //trace("network no longer available.. "); } else if (!this.networkAvailable) { if (this.gotXMLSinceLastPing) { ! this.networkAvailable = true; ! this.proxy.networkAvailableStatus( this.networkAvailable) } else --- 196,220 ---- } this.send(this.config); ! ! if (!this.configured) { ! // ! // only send asyncConfigured once ! // ! this.proxy.asyncConfigured( this.config ); ! this.configured = true; ! } } p.checkPingSuccess = function() { ! // ! // check for async traffic since last check. ! // if (this.networkAvailable && !this.gotXMLSinceLastPing) { ! this.networkAvailableStatus( false ); } else if (!this.networkAvailable) { if (this.gotXMLSinceLastPing) { ! this.networkAvailableStatus(true); } else *************** *** 221,224 **** --- 226,234 ---- } + p.networkAvailableStatus = function( status ) { + this.networkAvailable = status; + this.proxy.networkAvailableStatus( this.networkAvailable); + } + p.send = function( theArgs, theMethod ) { // *************** *** 568,571 **** --- 578,584 ---- this.parentObj.gotXMLSinceLastPing = true; + if (!this.parentObj.networkAvailable) { + this.parentObj.networkAvailableStatus( true ); + } if (argObj.methodCall) { |
|
From: Steve S. <ssp...@us...> - 2005-03-20 03:15:51
|
Update of /cvsroot/zmx/zmx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18013 Modified Files: ZMX_XML.as Log Message: add revision string to helper classes . Index: ZMX_XML.as =================================================================== RCS file: /cvsroot/zmx/zmx/ZMX_XML.as,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** ZMX_XML.as 20 Mar 2005 03:14:46 -0000 1.44 --- ZMX_XML.as 20 Mar 2005 03:15:43 -0000 1.45 *************** *** 353,356 **** --- 353,358 ---- p = c.prototype = new Object(); + p.version = "$Revision$".slice(10,-1); + p.configSuccess = function( result ) { |
|
From: Steve S. <ssp...@us...> - 2005-03-20 03:14:56
|
Update of /cvsroot/zmx/zmx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17581 Modified Files: Readme.txt ZMXNetCommServer.as ZMX_XML.as Log Message: add revision string to helper class. Index: ZMX_XML.as =================================================================== RCS file: /cvsroot/zmx/zmx/ZMX_XML.as,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** ZMX_XML.as 20 Mar 2005 02:17:25 -0000 1.43 --- ZMX_XML.as 20 Mar 2005 03:14:46 -0000 1.44 *************** *** 36,40 **** */ - #include "ZMX_LConnClient.as" --- 36,39 ---- *************** *** 63,68 **** // get the InstantXML configuration info. // // config.use_LC_server Use a local connection rather than talking directly to ! // the host. // --- 62,75 ---- // get the InstantXML configuration info. // + // config.configDelay = Boolean or number. If defined delay the configuration message. + // If numeric use value for number of seconds to delay. + // + // config.send_ping = Boolean or number. If defined request pings from the + // to help maintain/monitor a connection that may fail. + // If numeric, use value to est ping delay interval (and + // connection check interval + // // config.use_LC_server Use a local connection rather than talking directly to ! // the host. (deprecated) // *************** *** 105,110 **** --- 112,124 ---- p = c.prototype = new Object(); + p.version = "$Revision$".slice(10,-1); p.attemptConnection = function() { + + // + // this is separated out to enable the auto-reconnect functionality + // of InstantXMLHelper when used with the 'send_ping' configuration. + // + if (this.xmlc != null) { this.xmlc.close(); *************** *** 150,153 **** --- 164,170 ---- if (this.config.use_LC_server) { + // + // this local client stuff is deprecated. + // this.myLocalClient = new LConn_ClientClass( this, config ); // sign up for a local connection client } Index: ZMXNetCommServer.as =================================================================== RCS file: /cvsroot/zmx/zmx/ZMXNetCommServer.as,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ZMXNetCommServer.as 27 Aug 2003 16:46:30 -0000 1.10 --- ZMXNetCommServer.as 20 Mar 2005 03:14:46 -0000 1.11 *************** *** 9,13 **** */ // ! // Network/Server Communication Objects. // --- 9,13 ---- */ // ! // Network/Server Communication Objects. These are deprecated in favor of XMLRPC. // Index: Readme.txt =================================================================== RCS file: /cvsroot/zmx/zmx/Readme.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Readme.txt 15 Jun 2003 15:36:15 -0000 1.4 --- Readme.txt 20 Mar 2005 03:14:45 -0000 1.5 *************** *** 20,27 **** then: cp *as .. There are some examples in the 'examples' directory. - Enjoy! - -steve --- 20,29 ---- then: + cd zmx + + then + cp *as .. There are some examples in the 'examples' directory. |
|
From: Steve S. <ssp...@us...> - 2005-03-20 02:17:34
|
Update of /cvsroot/zmx/zmx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16359 Modified Files: ZMX_XML.as Log Message: take out some debugging traces.. Index: ZMX_XML.as =================================================================== RCS file: /cvsroot/zmx/zmx/ZMX_XML.as,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** ZMX_XML.as 20 Mar 2005 02:04:35 -0000 1.42 --- ZMX_XML.as 20 Mar 2005 02:17:25 -0000 1.43 *************** *** 185,193 **** p.checkPingSuccess = function() { ! trace("checking ping success.."); if (this.networkAvailable && !this.gotXMLSinceLastPing) { this.networkAvailable = false; this.proxy.networkAvailableStatus( this.networkAvailable) ! trace("network no longer available.. "); } else if (!this.networkAvailable) { --- 185,193 ---- p.checkPingSuccess = function() { ! //trace("checking ping success.."); if (this.networkAvailable && !this.gotXMLSinceLastPing) { this.networkAvailable = false; this.proxy.networkAvailableStatus( this.networkAvailable) ! //trace("network no longer available.. "); } else if (!this.networkAvailable) { |
|
From: Steve S. <ssp...@us...> - 2005-03-20 02:04:46
|
Update of /cvsroot/zmx/zmx/InstantXML In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8185/InstantXML Modified Files: IXML_Client.py InstantXMLServer.py Log Message: added networkAvailableStatus messages. Index: InstantXMLServer.py =================================================================== RCS file: /cvsroot/zmx/zmx/InstantXML/InstantXMLServer.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** InstantXMLServer.py 10 Feb 2005 14:22:53 -0000 1.6 --- InstantXMLServer.py 20 Mar 2005 02:04:38 -0000 1.7 *************** *** 22,26 **** VERSION = string.split(RCS_ID,' ')[2] ! PING_SLEEPTIME = 10 # seconds import socket --- 22,26 ---- VERSION = string.split(RCS_ID,' ')[2] ! PING_SLEEPTIME = 60 # maximum ping delay seconds import socket *************** *** 28,32 **** import asynchat ! from xmlrpclib import loads, dumps from threading import RLock, Thread --- 28,32 ---- import asynchat ! from xmlrpclib import loads, dumps, Boolean from threading import RLock, Thread *************** *** 44,48 **** self.client = client - def pause(self): """ --- 44,47 ---- *************** *** 56,62 **** """ self.running = 1 while 1: if self.running: ! sleep(PING_SLEEPTIME) self.client.do_ping() else: --- 55,62 ---- """ self.running = 1 + while 1: if self.running: ! sleep(self.client.ping_delay) # the client may adjust the ping_delay depending on the configuration of the channels that need pings. self.client.do_ping() else: *************** *** 106,112 **** self.sender_id = values.get('sender_id','') self.needs_ping = values.get('send_ping',0) if self.needs_ping: ! self.server.setup_ping_thread(self) ! if not self.sender_id: self.sender_id = None --- 106,113 ---- self.sender_id = values.get('sender_id','') self.needs_ping = values.get('send_ping',0) + if self.needs_ping: ! self.server.setup_ping_thread(self) # only set up pings if requested. ! if not self.sender_id: self.sender_id = None *************** *** 188,191 **** --- 189,193 ---- channel_class = chat_channel + ping_delay = PING_SLEEPTIME spy = 0 *************** *** 244,247 **** --- 246,253 ---- establish the ping thread. """ + if type(client.needs_ping) in [type(1.0), type(1)]: + if self.ping_delay > client.needs_ping: + self.ping_delay = client.needs_ping # use client with minimum delay to set delay time + if not self.ping_thread: self.ping_thread = PingThread(self) *************** *** 262,265 **** --- 268,272 ---- self.ping_thread.pause() self.ping_thread = None + self.ping_delay = PING_SLEEPTIME def writable (self): Index: IXML_Client.py =================================================================== RCS file: /cvsroot/zmx/zmx/InstantXML/IXML_Client.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** IXML_Client.py 14 Feb 2005 09:55:56 -0000 1.6 --- IXML_Client.py 20 Mar 2005 02:04:38 -0000 1.7 *************** *** 80,85 **** #print 'Finishing loop' ! #CONNECT_STRUCT = {'sender_id': 'c1: IXML_Client', 'ssecret':'foo', 'send_ping':1} ! CONNECT_STRUCT = {'sender_id': 'c1: IXML_Client', 'ssecret':'foo'} class IXML_Client: --- 80,85 ---- #print 'Finishing loop' ! CONNECT_STRUCT = {'sender_id': 'c1: IXML_Client', 'ssecret':'foo', 'send_ping':5.0} ! #CONNECT_STRUCT = {'sender_id': 'c1: IXML_Client', 'ssecret':'foo'} class IXML_Client: |
|
From: Steve S. <ssp...@us...> - 2005-03-20 02:04:46
|
Update of /cvsroot/zmx/zmx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8185 Modified Files: ZMX_XML.as Log Message: added networkAvailableStatus messages. Index: ZMX_XML.as =================================================================== RCS file: /cvsroot/zmx/zmx/ZMX_XML.as,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** ZMX_XML.as 3 Mar 2005 17:54:23 -0000 1.41 --- ZMX_XML.as 20 Mar 2005 02:04:35 -0000 1.42 *************** *** 105,108 **** --- 105,134 ---- p = c.prototype = new Object(); + + p.attemptConnection = function() { + if (this.xmlc != null) { + this.xmlc.close(); + } + else + { + this.xmlc = new AsyncSocket( this ); + } + + this.xmlc.connect(this.config.xmlhost,this.config.xmlport); + + if (this.config.configDelay != null) { + var delayAmount = 1000; + if (typeof(this.config.configDelay)=='number') { + delayAmount = this.config.configDelay*1000.0; + } + this.registerInterval = SetInterval( this, "registerConnection", delayAmount); + return false; + } + else { + this.send(this.config); + return true; + } + } + p.configSuccess = function( config ) { *************** *** 128,143 **** else { ! this.xmlc = new AsyncSocket( this ); ! this.xmlc.connect(this.config.xmlhost,this.config.xmlport); ! if (this.config.configDelay != null) { ! this.registerInterval = SetInterval( this, "registerConnection", 1000); ! } ! else { ! this.send(this.config); this.proxy.asyncConfigured( this.config ); } } } - delete this.configHelper; } --- 154,175 ---- else { ! if (this.attemptConnection()) { this.proxy.asyncConfigured( this.config ); } + + if (this.config.send_ping != null) { + // + // we're expecting pings... so set up an interval to check. + // + this.networkAvailable = true; + this.ping_interval = 15000.0; // default interval of 15 seconds.. + if (typeof(this.config.send_ping) == 'number') { + this.ping_interval = 1500.0*this.config.send_ping; // 1.5 times the ping time. + } + this.gotXMLSinceLastPing = false; + this.ping_interval_id = SetInterval( this, "checkPingSuccess", this.ping_interval); + } } } delete this.configHelper; } *************** *** 151,154 **** --- 183,207 ---- } + p.checkPingSuccess = function() { + + trace("checking ping success.."); + if (this.networkAvailable && !this.gotXMLSinceLastPing) { + this.networkAvailable = false; + this.proxy.networkAvailableStatus( this.networkAvailable) + trace("network no longer available.. "); + } + else if (!this.networkAvailable) { + if (this.gotXMLSinceLastPing) { + this.networkAvailable = true; + this.proxy.networkAvailableStatus( this.networkAvailable) + } + else + { + this.attemptConnection(); + } + } + this.gotXMLSinceLastPing = false; + } + p.send = function( theArgs, theMethod ) { // *************** *** 494,497 **** --- 547,553 ---- var target_id = argObj.params[0].target_id; var sender_id = argObj.params[0].sender_id; + + this.parentObj.gotXMLSinceLastPing = true; + if (argObj.methodCall) { if (this.filterLocally && (target_id != null)) { |