From 29db71587f1332a9c44d5993a2be389f3a392ce4 Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Wed, 27 Dec 2006 21:22:01 +0000 Subject: [PATCH] r20364: SWAT updates, part 1 These next few check-ins will add a working Statistics module to SWAT, and add an API Documentation module as well. Next step will be to modify the LDB browser to work with this new module and fsm structure. Derrell --- services/samba/adm.esp | 6 + services/samba/management.esp | 184 ++++++++++++++++++ source/scripting/ejs/smbcalls_sys.c | 18 ++ swat/apps/script/qx.js | 2 +- swat/apps/swat/Makefile | 55 ++++-- swat/apps/swat/source/class/swat/main/Gui.js | 24 ++- swat/apps/swat/source/class/swat/main/Main.js | 56 +++--- .../class/swat/module/AbstractModule.js | 12 +- .../class/swat/module/AbstractModuleFsm.js | 36 +++- .../module/documentation/Documentation.js | 55 ++++++ .../source/class/swat/module/stats/Fsm.js | 138 ------------- .../source/class/swat/module/stats/Gui.js | 28 --- .../class/swat/module/stats/Statistics.js | 33 ---- 13 files changed, 399 insertions(+), 248 deletions(-) create mode 100644 services/samba/management.esp create mode 100644 swat/apps/swat/source/class/swat/module/documentation/Documentation.js delete mode 100644 swat/apps/swat/source/class/swat/module/stats/Fsm.js delete mode 100644 swat/apps/swat/source/class/swat/module/stats/Gui.js delete mode 100644 swat/apps/swat/source/class/swat/module/stats/Statistics.js diff --git a/services/samba/adm.esp b/services/samba/adm.esp index 2fd0ec2f97f..8843a068eb7 100644 --- a/services/samba/adm.esp +++ b/services/samba/adm.esp @@ -19,4 +19,10 @@ function _nbt_packet_stats(params, error) { } jsonrpc.method.NBTPacketStats = _nbt_packet_stats; + +/* + * Local Variables: + * mode: c + * End: + */ %> diff --git a/services/samba/management.esp b/services/samba/management.esp new file mode 100644 index 00000000000..1efd8f67770 --- /dev/null +++ b/services/samba/management.esp @@ -0,0 +1,184 @@ +<% +/* + * Copyright: + * (C) 2006 by Derrell Lipman + * All rights reserved + * + * License: + * LGPL 2.1: http://creativecommons.org/licenses/LGPL/2.1/ + */ + +/* + * JSON-RPC mappings to management functions + */ + +libinclude("base.js"); +libinclude("management.js"); + +/** + * Get statistics from each of the servers + * + * @param params[0] + * Optional enum_smb_sessions flag, default false + * + * @param params[1] + * Optional enum_smb_tcons flag, default false + * + * @param error + * An object of class JsonRpcError. + * + * @return + * Success: Object containing all of the statistics + * Failure: error event + */ +function _get_statistics(params, error) +{ + var enum_smb_sessions = false; + var enum_smb_tcons = false; + + if (params.length >= 1) + { + enum_smb_sessions = params[0]; + } + if (params.length >= 2) + { + enum_smb_tcons = params[1]; + } + + var info = new Object(); + + info["nbt"] = new Object(); + info["wins"] = new Object(); + info["cldap"] = new Object(); + info["kdc"] = new Object(); + info["smb"] = new Object(); + info["ldap"] = new Object(); + info["rpc"] = new Object(); + + for (var service in info) + { + var irpc = irpc_init(); + var status; + var obj = info[service]; + obj.status = null; + + if (!service_enabled(service)) + { + obj.status = "DISABLED"; + } + else + { + status = irpc.connect(service + "_server"); + if (status.is_ok != true) + { + obj.status = "INACTIVE"; + } + else + { + var io = irpcObj(); + status = irpc.irpc_uptime(io); + if (status.is_ok != true) + { + obj.status = "NOT RESPONDING"; + } + else + { + obj.status = "RUNNING"; + + if (service == "smb" || + service == "ldap" || + service == "rpc") + { + obj.connections = io.results.length; + } + + if (service == "smb") + { + if (enum_smb_sessions) + { + var io = irpcObj(); + io.input.level = irpc.SMBSRV_INFO_SESSIONS; + status = irpc.smbsrv_information(io); + obj.sessions = new Array(0); + if (status.is_ok == true) + { + /* gather the results into a single array */ + var count = 0; + for (var i = 0; i < io.results.length; i++) + { + var sessions = + io.results[i].info.sessions.sessions; + for (var j = 0; j < sessions.length; j++) + { + obj.sessions[count] = sessions[j]; + + // convert NT times to unix epoch + obj.sessions[count].auth_time = + nttime2unix(obj.sessions[count].auth_time); + obj.sessions[count].last_use_time = + nttime2unix(obj.sessions[count].last_use_time); + obj.sessions[count].connect_time = + nttime2unix(obj.sessions[count].connect_time); + + count++; + } + } + } + } + + if (enum_smb_tcons) + { + var io = irpcObj(); + io.input.level = irpc.SMBSRV_INFO_TCONS; + status = irpc.smbsrv_information(io); + obj.tcons = new Array(0); + + if (status.is_ok == true) + { + /* gather the results into a single array */ + var count=0; + for (var i = 0; i < io.results.length; i++) + { + var tcons = io.results[i].info.tcons.tcons; + for (var j = 0; j < tcons.length; j++) + { + obj.tcons[count] = tcons[j]; + + + // convert NT times to unix epoch + obj.tcons[count].last_use_time = + nttime2unix(obj.tcons[count].last_use_time); + obj.tcons[count].connect_time = + nttime2unix(obj.tcons[count].connect_time); + + count++; + } + } + } + } + } + else if (service == "nbt") + { + var io = irpcObj(); + io.input.level = irpc.NBTD_INFO_STATISTICS; + status = irpc.nbtd_information(io); + if (status.is_ok == true) + { + obj.statistics = io.results[0].info.stats; + } + } + } + } + } + } + + return info; +} +jsonrpc.method.get_statistics = _get_statistics; + +/* + * Local Variables: + * mode: c + * End: + */ +%> diff --git a/source/scripting/ejs/smbcalls_sys.c b/source/scripting/ejs/smbcalls_sys.c index 97fcc19cd1f..ce3f3f5a98a 100644 --- a/source/scripting/ejs/smbcalls_sys.c +++ b/source/scripting/ejs/smbcalls_sys.c @@ -165,6 +165,23 @@ static int ejs_sys_gmtime(MprVarHandle eid, int argc, struct MprVar **argv) return 0; } +/* + return the given NT time as a time_t value +*/ +static int ejs_sys_nttime2unix(MprVarHandle eid, int argc, struct MprVar **argv) +{ + time_t t; + struct MprVar v; + if (argc != 1 || !mprVarIsNumber(argv[0]->type)) { + ejsSetErrorMsg(eid, "sys_ntgmtime invalid arguments"); + return -1; + } + t = nt_time_to_unix(mprVarToNumber(argv[0])); + v = mprCreateNumberVar(t); + mpr_Return(eid, v); + return 0; +} + /* return the given NT time as a gmtime structure */ @@ -417,6 +434,7 @@ static int ejs_sys_init(MprVarHandle eid, int argc, struct MprVar **argv) mprSetCFunction(obj, "unix2nttime", ejs_sys_unix2nttime); mprSetCFunction(obj, "gmmktime", ejs_sys_gmmktime); mprSetCFunction(obj, "gmtime", ejs_sys_gmtime); + mprSetCFunction(obj, "nttime2unix", ejs_sys_nttime2unix); mprSetCFunction(obj, "ntgmtime", ejs_sys_ntgmtime); mprSetCFunction(obj, "ldaptime", ejs_sys_ldaptime); mprSetCFunction(obj, "httptime", ejs_sys_httptime); diff --git a/swat/apps/script/qx.js b/swat/apps/script/qx.js index b84aeab883f..8d348049902 100644 --- a/swat/apps/script/qx.js +++ b/swat/apps/script/qx.js @@ -1 +1 @@ -if(!window.qx){qx={}};if(!qx.Settings){qx.Settings={}};if(!qx.Settings._customSettings){qx.Settings._customSettings={}};qx.Settings._defaultSettings={};qx._LOADSTART=(new Date).valueOf();qx.Settings.substitute=function(vTemplate){if(typeof vTemplate!=="string"){return vTemplate};return vTemplate.replace(/\%\{(.+)\}/g,function(vMatch,vKey){return eval(vKey)})};qx.Settings.getValue=function(vKey){return qx.Settings.getValueOfClass(qx.Class.classname,vKey)};qx.Settings.getValueOfClass=function(vClassName,vKey){var vCustomObject=qx.Settings._customSettings[vClassName];if(vCustomObject&&vCustomObject[vKey]!=null){return vCustomObject[vKey]};var vDefaultObject=qx.Settings._defaultSettings[vClassName];if(vDefaultObject&&vDefaultObject[vKey]!=null){return vDefaultObject[vKey]};return null};qx.Settings.setDefault=function(vKey,vValue){return qx.Settings.setDefaultOfClass(qx.Class.classname,vKey,vValue)};qx.Settings.setDefaultOfClass=function(vClassName,vKey,vValue){var vDefaultObject=qx.Settings._defaultSettings[vClassName];if(!vDefaultObject){vDefaultObject=qx.Settings._defaultSettings[vClassName]={}};vDefaultObject[vKey]=vValue};qx.Settings.setCustom=function(vKey,vValue){return qx.Settings.setCustomOfClass(qx.Class.classname,vKey,vValue)};qx.Settings.setCustomOfClass=function(vClassName,vKey,vValue){var vCustomObject=qx.Settings._customSettings[vClassName];if(!vCustomObject){vCustomObject=qx.Settings._customSettings[vClassName]={}};vCustomObject[vKey]=qx.Settings.substitute(vValue)};qx.Settings.init=function(){for(var vClass in qx.Settings._customSettings){var vSettings=qx.Settings._customSettings[vClass];for(var vKey in vSettings){qx.Settings.setCustomOfClass(vClass,vKey,vSettings[vKey])}}};qx.Settings.init();qx.OO={};qx.OO.classes={};qx.OO.setter={};qx.OO.getter={};qx.OO.resetter={};qx.OO.values={};qx.OO.propertyNumber=0;qx.OO.C_SET="set";qx.OO.C_GET="get";qx.OO.C_APPLY="apply";qx.OO.C_RESET="reset";qx.OO.C_FORCE="force";qx.OO.C_TOGGLE="toggle";qx.OO.C_CHANGE="change";qx.OO.C_STORE="store";qx.OO.C_RETRIEVE="retrieve";qx.OO.C_PRIVATECHANGE="_change";qx.OO.C_INVALIDATE="_invalidate";qx.OO.C_INVALIDATED="_invalidated";qx.OO.C_RECOMPUTE="_recompute";qx.OO.C_CACHED="_cached";qx.OO.C_COMPUTE="_compute";qx.OO.C_COMPUTED="_computed";qx.OO.C_UNITDETECTION="_unitDetection";qx.OO.C_GLOBALPROPERTYREF="PROPERTY_";qx.OO.C_UNIT_VALUE="Value";qx.OO.C_UNIT_PARSED="Parsed";qx.OO.C_UNIT_TYPE="Type";qx.OO.C_UNIT_TYPE_NULL="TypeNull";qx.OO.C_UNIT_TYPE_PIXEL="TypePixel";qx.OO.C_UNIT_TYPE_PERCENT="TypePercent";qx.OO.C_UNIT_TYPE_AUTO="TypeAuto";qx.OO.C_UNIT_TYPE_FLEX="TypeFlex";qx.OO.C_GETDEFAULT="getDefault";qx.OO.C_SETDEFAULT="setDefault";qx.OO.C_RETRIEVEDEFAULT="retrieveDefault";qx.OO.C_STOREDEFAULT="storeDefault";qx.OO.C_VALUE="_value";qx.OO.C_NULL="_null";qx.OO.C_EVAL="_eval";qx.OO.C_CHECK="_check";qx.OO.C_MODIFY="_modify";qx.OO.C_NAMESPACE_SEP=".";qx.OO.C_UNDEFINED="undefined";qx.OO.defineClass=function(vClassName,vSuper,vConstructor){var vSplitName=vClassName.split(qx.OO.C_NAMESPACE_SEP);var vNameLength=vSplitName.length-1;var vTempObject=window;for(var i=0;i4||arguments.length==0){throw new Error("Invalid number of arguments for property "+p.name+": "+arguments)};try{var ret=qx.lang.Array.fromShortHand(arguments)}catch(ex){throw new Error("Invalid shorthand values for property "+p.name+": "+arguments+": "+ex)};var s=p.setter;var l=s.length;for(var i=0;i1){newValue=qx.lang.Array.fromArguments(arguments)};if(p.hasConvert){try{newValue=p.convert.call(this,newValue,p)}catch(ex){throw new Error("Attention! Could not convert new value for "+p.name+": "+newValue+": "+ex)}};var oldValue=this[valueKey];if(newValue===oldValue){return newValue};if(!(p.allowNull&&newValue==null)){if(p.hasType&&typeof newValue!==p.type){return this.error("Attention! The value \""+newValue+"\" is an invalid value for the property \""+p.name+"\" which must be typeof \""+p.type+"\" but is typeof \""+typeof newValue+"\"!",new Error())};if(p.hasInstance&&!(newValue instanceof qx.OO.classes[p.instance])){return this.error("Attention! The value \""+newValue+"\" is an invalid value for the property \""+p.name+"\" which must be an instance of \""+p.instance+"\"!",new Error())};if(p.hasClassName&&newValue.classname!=p.classname){return this.error("Attention! The value \""+newValue+"\" is an invalid value for the property \""+p.name+"\" which must be an object with the classname \""+p.classname+"\"!",new Error())};if(p.hasPossibleValues&&newValue!=null&&!qx.lang.Array.contains(p.possibleValues,newValue)){return this.error("Failed to save value for "+p.name+". '"+newValue+"' is not a possible value!",new Error())}};if(this[checkKey]){try{newValue=this[checkKey](newValue,p);if(newValue===oldValue){return newValue}}catch(ex){return this.error("Failed to check property "+p.name,ex)}};this[valueKey]=newValue;if(this[modifyKey]){try{var r=this[modifyKey](newValue,oldValue,p);if(!r){return this.error("Modification of property \""+p.name+"\" failed without exception ("+r+")",new Error())}}catch(ex){return this.error("Modification of property \""+p.name+"\" failed with exception",ex)}};if(p.hasUnitDetection){this[unitDetectionKey](p,newValue)};if(p.addToQueue){this.addToQueue(p.name)}else if(p.addToQueueRuntime){this.addToQueueRuntime(p.name)};if(p.addToStateQueue){this.addToStateQueue()};if(this.hasEventListeners&&this.hasEventListeners(changeKey)){try{this.createDispatchDataEvent(changeKey,newValue)}catch(ex){throw new Error("Property "+p.name+" modified: Failed to dispatch change event: "+ex)}};return newValue}}else{pp[qx.OO.C_SET+p.method]=function(newValue){var oldValue=this[valueKey];if(newValue===oldValue){return newValue};if(!(p.allowNull&&newValue==null)){if(p.hasType&&typeof newValue!==p.type){return this.error("Attention! The value \""+newValue+"\" is an invalid value for the property \""+p.name+"\" which must be typeof \""+p.type+"\" but is typeof \""+typeof newValue+"\"!",new Error())}};if(this[checkKey]){try{newValue=this[checkKey](newValue,p);if(newValue===oldValue){return newValue}}catch(ex){return this.error("Failed to check property "+p.name,ex)}};this[valueKey]=newValue;if(this[modifyKey]){try{var r=this[modifyKey](newValue,oldValue,p);if(!r){return this.error("Modification of property \""+p.name+"\" failed without exception ("+r+")",new Error())}}catch(ex){return this.error("Modification of property \""+p.name+"\" failed with exception",ex)}};if(this.hasEventListeners&&this.hasEventListeners(changeKey)){var vEvent=new qx.event.type.DataEvent(changeKey,newValue,oldValue,false);vEvent.setTarget(this);try{this.dispatchEvent(vEvent,true)}catch(ex){throw new Error("Property "+p.name+" modified: Failed to dispatch change event: "+ex)}};return newValue}};if(typeof p.getAlias===qx.constant.Type.STRING){pp[p.getAlias]=pp[qx.OO.C_GET+p.method]};if(typeof p.setAlias===qx.constant.Type.STRING){pp[p.setAlias]=pp[qx.OO.C_SET+p.method]}};qx.OO.changeProperty=qx.OO._createProperty;qx.OO.addProperty=function(p){qx.OO.propertyNumber++;qx.OO._createProperty(p);if(typeof qx.Proto._properties!==qx.constant.Type.STRING){qx.Proto._properties=p.name}else{qx.Proto._properties+=qx.constant.Core.COMMA+p.name};switch(p.type){case undefined:case qx.constant.Type.OBJECT:case qx.constant.Type.FUNCTION:if(typeof qx.Proto._objectproperties!==qx.constant.Type.STRING){qx.Proto._objectproperties=p.name}else{qx.Proto._objectproperties+=qx.constant.Core.COMMA+p.name}}};qx.OO.inheritField=function(vField,vData){qx.lang.Object.carefullyMergeWith(vData,qx.Super.prototype[vField]);qx.Proto[vField]=vData};qx.OO.isAvailable=function(vClassName){return typeof qx.OO.classes[vClassName]!==qx.constant.Type.UNDEFINED};qx.OO.defineClass("qx.lang.String");qx.Class.toCamelCase=function(str){var vArr=str.split(qx.constant.Core.DASH),vLength=vArr.length;if(vLength==1){return vArr[0]};var vNew=str.indexOf(qx.constant.Core.DASH)==0?vArr[0].charAt(0).toUpperCase()+vArr[0].substring(1):vArr[0];for(var vPart,i=1;i]+>/gi,qx.constant.Core.EMPTY)};qx.Class.startsWith=function(fullstr,substr){return !fullstr.indexOf(substr)};qx.Class.endsWith=function(fullstr,substr){return fullstr.lastIndexOf(substr)===fullstr.length-substr.length};qx.Class.pad=function(str,length,ch){if(typeof ch===qx.constant.Type.UNDEFINED){ch=qx.constant.Core.ZERO};var temp=qx.constant.Core.EMPTY;for(var i=length,l=str.length;l",PERCENT:"%",PIXEL:"px",MILLISECONDS:"ms",FLEX:"1*",ZEROPIXEL:"0px",HUNDREDPERCENT:"100%",YES:"yes",NO:"no",ON:"on",OFF:"off",SET:"set",GET:"get",DEFAULT:"default",AUTO:"auto",NONE:"none",DISABLED:"disabled",HIDDEN:"hidden"});qx.OO.defineClass("qx.constant.Type",{UNDEFINED:"undefined",NUMBER:"number",STRING:"string",BOOLEAN:"boolean",FUNCTION:"function",OBJECT:"object"});qx.OO.defineClass("qx.util.Validation");qx.util.Validation.isValid=function(v){switch(typeof v){case qx.constant.Type.UNDEFINED:return false;case qx.constant.Type.OBJECT:return v!==null;case qx.constant.Type.STRING:return v!==qx.constant.Core.EMPTY;case qx.constant.Type.NUMBER:return !isNaN(v);case qx.constant.Type.FUNCTION:case qx.constant.Type.BOOLEAN:return true};return false};qx.util.Validation.isInvalid=function(v){switch(typeof v){case qx.constant.Type.UNDEFINED:return true;case qx.constant.Type.OBJECT:return v===null;case qx.constant.Type.STRING:return v===qx.constant.Core.EMPTY;case qx.constant.Type.NUMBER:return isNaN(v);case qx.constant.Type.FUNCTION:case qx.constant.Type.BOOLEAN:return false};return true};qx.util.Validation.isValidNumber=function(v){return typeof v===qx.constant.Type.NUMBER&&!isNaN(v)};qx.util.Validation.isInvalidNumber=function(v){return typeof v!==qx.constant.Type.NUMBER||isNaN(v)};qx.util.Validation.isValidString=function(v){return typeof v===qx.constant.Type.STRING&&v!==qx.constant.Core.EMPTY};qx.util.Validation.isInvalidString=function(v){return typeof v!==qx.constant.Type.STRING||v===qx.constant.Core.EMPTY};qx.util.Validation.isValidArray=function(v){return typeof v===qx.constant.Type.OBJECT&&v!==null&&v instanceof Array};qx.util.Validation.isInvalidArray=function(v){return typeof v!==qx.constant.Type.OBJECT||v===null||!(v instanceof Array)};qx.util.Validation.isValidObject=function(v){return typeof v===qx.constant.Type.OBJECT&&v!==null&&!(v instanceof Array)};qx.util.Validation.isInvalidObject=function(v){return typeof v!==qx.constant.Type.OBJECT||v===null||v instanceof Array};qx.util.Validation.isValidNode=function(v){return typeof v===qx.constant.Type.OBJECT&&v!==null};qx.util.Validation.isInvalidNode=function(v){return typeof v!==qx.constant.Type.OBJECT||v===null};qx.util.Validation.isValidElement=function(v){return typeof v===qx.constant.Type.OBJECT&&v!==null||v.nodeType!==1};qx.util.Validation.isInvalidElement=function(v){return typeof v!==qx.constant.Type.OBJECT||v===null||v.nodeType!==1};qx.util.Validation.isValidFunction=function(v){return typeof v===qx.constant.Type.FUNCTION};qx.util.Validation.isInvalidFunction=function(v){return typeof v!==qx.constant.Type.FUNCTION};qx.util.Validation.isValidBoolean=function(v){return typeof v===qx.constant.Type.BOOLEAN};qx.util.Validation.isInvalidBoolean=function(v){return typeof v!==qx.constant.Type.BOOLEAN};qx.util.Validation.isValidStringOrNumber=function(v){switch(typeof v){case qx.constant.Type.STRING:return v!==qx.constant.Core.EMPTY;case qx.constant.Type.NUMBER:return !isNaN(v)};return false};qx.util.Validation.isInvalidStringOrNumber=function(v){switch(typeof v){case qx.constant.Type.STRING:return v===qx.constant.Core.EMPTY;case qx.constant.Type.NUMBER:return isNaN(v)};return false};qx.OO.defineClass("qx.lang.Array");qx.lang.Array.fromArguments=function(args){return Array.prototype.slice.call(args,0)};qx.lang.Array.fromShortHand=function(params){var l=params.length;if(l>4){throw new Error("Invalid number of arguments!")};var v;var list=[];for(var i=0;i=j){return true}};return false};qx.Class.getLength=function(h){var i=0;for(var s in h){i++};return i};qx.Class.getKeys=function(h){var r=[];for(var s in h){r.push(s)};return r};qx.Class.getKeysAsString=function(h){return qx.lang.Object.getKeys(h).join(", ")};qx.Class.getValues=function(h){var r=[];for(var s in h){r.push(h[s])};return r};qx.Class.mergeWith=function(vObjectA,vObjectB){for(var vKey in vObjectB){vObjectA[vKey]=vObjectB[vKey]};return vObjectA};qx.Class.carefullyMergeWith=function(vObjectA,vObjectB){for(vKey in vObjectB){if(typeof vObjectA[vKey]===qx.constant.Type.UNDEFINED){vObjectA[vKey]=vObjectB[vKey]}};return vObjectA};qx.Class.merge=function(vObjectA){var vLength=arguments.length;for(var i=1;i=0;i--){if(this[i]===obj){return i}};return -1}};if(!Array.prototype.forEach){Array.prototype.forEach=function(f,obj){for(var i=0,l=this.length;i=0;i--){vObject=qx.core.Object._db[i];if(vObject&&vObject._disposed===false){vObject.dispose()}}};qx.Class.summary=function(){var vData={};var vCounter=0;for(var i=qx.core.Object._db.length-1;i>=0;i--){vObject=qx.core.Object._db[i];if(vObject&&vObject._disposed===false){if(vData[vObject.classname]==null){vData[vObject.classname]=1}else{vData[vObject.classname]++};vCounter++}};var vArrData=[];for(var vClassName in vData){vArrData.push({classname:vClassName,number:vData[vClassName]})};vArrData.sort(function(a,b){return b.number-a.number});var vMsg="Summary: ("+vCounter+" Objects)\n\n";for(var i=0;i=this.getMinLevel())?Filter.ACCEPT:Filter.DENY}};qx.OO.defineClass("qx.dev.log.Appender",qx.dev.log.LogEventProcessor,function(){qx.dev.log.LogEventProcessor.call(this)});qx.OO.addProperty({name:"useLongFormat",type:qx.constant.Type.BOOLEAN,defaultValue:true,allowNull:false});qx.Proto.handleLogEvent=function(evt){if(this.decideLogEvent(evt)!=qx.dev.log.Filter.DENY){this.appendLogEvent(evt)}};qx.Proto.appendLogEvent=function(evt){throw new Error("appendLogEvent is abstract")};qx.Proto.formatLogEvent=function(evt){var Logger=qx.dev.log.Logger;var text="";var time=new String(new Date().getTime()-qx._LOADSTART);while(time.length<6){time=qx.constant.Core.ZERO+time};text+=time;if(this.getUseLongFormat()){switch(evt.level){case Logger.LEVEL_DEBUG:text+=" DEBUG: ";break;case Logger.LEVEL_INFO:text+=" INFO: ";break;case Logger.LEVEL_WARN:text+=" WARN: ";break;case Logger.LEVEL_ERROR:text+=" ERROR: ";break;case Logger.LEVEL_FATAL:text+=" FATAL: ";break}}else{text+=": "};var indent="";for(var i=0;i"+this._name+""+''+'
');logDocument.close();this._logElem=logDocument.getElementById("log");if(this._logEventQueue!=null){for(var i=0;i");this._logElem.appendChild(divElem);while(this._logElem.childNodes.length>this.getMaxMessages()){this._logElem.removeChild(this._logElem.firstChild);if(this._removedMessageCount==null){this._removedMessageCount=1}else{this._removedMessageCount++}};if(this._removedMessageCount!=null){this._logElem.firstChild.innerHTML="("+this._removedMessageCount+" messages removed)"};this._logWindow.scrollTo(0,this._logElem.offsetHeight)}};qx.Proto.dispose=function(){if(this.getDisposed()){return true};this.closeWindow();return qx.dev.log.Appender.prototype.dispose.call(this)};qx.Class._nextId=1;qx.Class._registeredAppenders={};qx.Class.register=function(appender){var WindowAppender=qx.dev.log.WindowAppender;var id=WindowAppender._nextId++;WindowAppender._registeredAppenders[id]=appender;return id};qx.Class.getAppender=function(id){return qx.dev.log.WindowAppender._registeredAppenders[id]};qx.OO.defineClass("qx.dev.log.Logger",qx.dev.log.LogEventProcessor,function(name,parentLogger){qx.dev.log.LogEventProcessor.call(this);this._name=name;this._parentLogger=parentLogger});qx.Proto.getName=function(){return this._name};qx.Proto.getParentLogger=function(){return this._parentLogger};qx.Proto.indent=function(){qx.dev.log.Logger._indent++};qx.Proto.unindent=function(){qx.dev.log.Logger._indent--};qx.Proto.addAppender=function(appender){if(this._appenderArr==null){this._appenderArr=[]};this._appenderArr.push(appender)};qx.Proto.removeAppender=function(appender){if(this._appenderArr!=null){this._appenderArr.remove(appender)}};qx.Proto.removeAllAppenders=function(){this._appenderArr=null};qx.Proto.handleLogEvent=function(evt){var Filter=qx.dev.log.Filter;var decision=Filter.NEUTRAL;var logger=this;while(decision==Filter.NEUTRAL&&logger!=null){decision=logger.decideLogEvent(evt);logger=logger.getParentLogger()};if(decision!=Filter.DENY){this.appendLogEvent(evt)}};qx.Proto.appendLogEvent=function(evt){if(this._appenderArr!=null&&this._appenderArr.length!=0){for(var i=0;i=0&&propValue<=255){propKey=propValue.toString();break};return propValue;case qx.constant.Type.OBJECT:if(propValue==null||propValue instanceof qx.renderer.color.Color){return propValue};if(typeof propValue.join===qx.constant.Type.FUNCTION&&propValue.length==3){propKey=qx.renderer.color.Color.RGBCSS_START+propValue.join(qx.constant.Core.COMMA)+qx.renderer.color.Color.RGBCSS_STOP;propKeyAsStyle=true;break};default:return propValue};if(qx.renderer.color.ColorCache._data[propKey]){return qx.renderer.color.ColorCache._data[propKey]};var vColorObject=qx.renderer.color.ColorCache._data[propKey]=qx.renderer.color.Color.themedNames[propValue]?new qx.renderer.color.ColorObject(propValue):new qx.renderer.color.Color(propValue);if(propKeyAsStyle){vColorObject._style=propKey};return vColorObject};qx.renderer.color.ColorCache._data={};qx.OO.defineClass("qx.renderer.color.Color",qx.core.Object,function(vValue){if(qx.util.Validation.isValid(vValue)){this.setValue(vValue)};qx.core.Object.call(this)});qx.renderer.color.Color.rgb2style=function(r,g,b){return qx.renderer.color.Color.RGBCSS_START+r+qx.constant.Core.COMMA+g+qx.constant.Core.COMMA+b+qx.renderer.color.Color.RGBCSS_STOP};qx.renderer.color.Color.RGBCSS_START="rgb(";qx.renderer.color.Color.RGBCSS_STOP=")";qx.renderer.color.Color.m_hex=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];qx.renderer.color.Color.m_rgb={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15};qx.renderer.color.Color.r_hex3=/^#([0-9a-f]{1})([0-9a-f]{1})([0-9a-f]{1})$/;qx.renderer.color.Color.r_hex6=/^#([0-9a-f]{1})([0-9a-f]{1})([0-9a-f]{1})([0-9a-f]{1})([0-9a-f]{1})([0-9a-f]{1})$/;qx.renderer.color.Color.r_cssrgb=/^rgb\(\s*([0-9]{1,3}\.{0,1}[0-9]*)\s*,\s*([0-9]{1,3}\.{0,1}[0-9]*)\s*,\s*([0-9]{1,3}\.{0,1}[0-9]*)\s*\)$/;qx.renderer.color.Color.r_rgb=/^[0-9]{1,3},[0-9]{1,3},[0-9]{1,3}$/;qx.renderer.color.Color.r_number=/^[0-9]{1,3}\.{0,1}[0-9]*$/;qx.renderer.color.Color.r_percent=/^[0-9]{1,3}\.{0,1}[0-9]*%$/;qx.renderer.color.Color.htmlNames={maroon:[128,0,0],red:[255,0,0],orange:[255,165,0],yellow:[255,255,0],olive:[128,128,0],purple:[128,0,128],fuchsia:[255,0,255],white:[255,255,255],lime:[0,255,0],green:[0,128,0],navy:[0,0,128],blue:[0,0,255],aqua:[0,255,255],teal:[0,128,128],black:[0,0,0],silver:[192,192,192],gray:[128,128,128],transparent:[-1,-1,-1]};qx.renderer.color.Color.themedNames={activeborder:1,activecaption:1,appworkspace:1,background:1,buttonface:1,buttonhighlight:1,buttonshadow:1,buttontext:1,captiontext:1,graytext:1,highlight:1,highlighttext:1,inactiveborder:1,inactivecaption:1,inactivecaptiontext:1,infobackground:1,infotext:1,menu:1,menutext:1,scrollbar:1,threeddarkshadow:1,threedface:1,threedhighlight:1,threedlightshadow:1,threedshadow:1,window:1,windowframe:1,windowtext:1};qx.renderer.color.Color.fromString=function(vDefString){return new qx.renderer.color.Color(vDefString)};qx.renderer.color.Color.fromRandom=function(){return new qx.renderer.color.Color([Math.round(255*Math.random()),Math.round(255*Math.random()),Math.round(255*Math.random())])};qx.Proto._value=null;qx.Proto._style=null;qx.Proto._isRgbColor=false;qx.Proto._isHtmlColor=false;qx.Proto._isThemedColor=false;qx.Proto._red=null;qx.Proto._green=null;qx.Proto._blue=null;qx.Proto._hex=null;qx.Proto.add=qx.util.Return.returnTrue;qx.Proto.remove=qx.util.Return.returnTrue;qx.Proto.isRgbColor=function(){return this._isRgbColor};qx.Proto.isHtmlColor=function(){return this._isHtmlColor};qx.Proto.isThemedColor=function(){return this._isThemedColor};qx.Proto.setValue=function(vValue){this._normalize(vValue);if(this._isThemedColor){throw new Error("Please use qx.renderer.color.ColorObject for themed colors!")}};qx.Proto.getValue=function(){return this._value||qx.constant.Core.EMPTY};qx.Proto.getStyle=function(){if(this._style==null){this._evalStyle()};return this._style};qx.Proto._evalStyle=function(){if(this._isRgbColor){this._style=qx.renderer.color.Color.rgb2style(this._red,this._green,this._blue)}else if(this._isThemedColor){this._applyThemedValue()}else if(this._isHtmlColor){this._style=this._value}else if(qx.util.Validation.isValid(this._value)){throw new Error("_evalStyle could not handle non-rgb colors :"+this.getValue()+"!")}};qx.Proto.getHex=function(){if(this._hex==null){this._evalHex()};return this._hex};qx.Proto._evalHex=function(){if(this._isRgbColor){var a=[qx.constant.Core.HASH];var r=this.getRed();a.push(qx.renderer.color.Color.m_hex[Math.floor(r/16)]);a.push(qx.renderer.color.Color.m_hex[Math.floor(r%16)]);var g=this.getGreen();a.push(qx.renderer.color.Color.m_hex[Math.floor(g/16)]);a.push(qx.renderer.color.Color.m_hex[Math.floor(g%16)]);var b=this.getBlue();a.push(qx.renderer.color.Color.m_hex[Math.floor(b/16)]);a.push(qx.renderer.color.Color.m_hex[Math.floor(b%16)]);this._hex=a.join(qx.constant.Core.EMPTY)}else{}};qx.Proto.getRed=function(){if(this._red==null){this._evalRgb()};return this._red};qx.Proto.getGreen=function(){if(this._green==null){this._evalRgb()};return this._green};qx.Proto.getBlue=function(){if(this._blue==null){this._evalRgb()};return this._blue};qx.Proto._evalRgb=function(){if(this._isThemedColor){this._applyThemedValue()}else if(this._isHtmlColor){var a=qx.renderer.color.Color.htmlNames[this._value];this._red=a[0];this._green=a[1];this._blue=a[2]}else{throw new Error("_evalRgb needs implementation!")}};qx.Proto._normalize=function(vInValue){this._isThemedColor=this._isRgbColor=this._isHtmlColor=false;this._hex=null;var invalid=new Error("Invalid color: "+vInValue);switch(typeof vInValue){case qx.constant.Type.STRING:vInValue=vInValue.toLowerCase();if(qx.renderer.color.Color.htmlNames[vInValue]){this._isHtmlColor=true}else if(qx.renderer.color.Color.themedNames[vInValue]){this._isThemedColor=true}else if(qx.renderer.color.Color.r_cssrgb.test(vInValue)){this._red=parseInt(RegExp.$1);this._green=parseInt(RegExp.$2);this._blue=parseInt(RegExp.$3);this._isRgbColor=true}else if(qx.renderer.color.Color.r_hex3.test(vInValue)){this._hex=vInValue;this._red=(qx.renderer.color.Color.m_rgb[RegExp.$1]*16)+qx.renderer.color.Color.m_rgb[RegExp.$1];this._green=(qx.renderer.color.Color.m_rgb[RegExp.$2]*16)+qx.renderer.color.Color.m_rgb[RegExp.$2];this._blue=(qx.renderer.color.Color.m_rgb[RegExp.$3]*16)+qx.renderer.color.Color.m_rgb[RegExp.$3];this._isRgbColor=true}else if(qx.renderer.color.Color.r_hex6.test(vInValue)){this._hex=vInValue;this._red=(qx.renderer.color.Color.m_rgb[RegExp.$1]*16)+qx.renderer.color.Color.m_rgb[RegExp.$2];this._green=(qx.renderer.color.Color.m_rgb[RegExp.$3]*16)+qx.renderer.color.Color.m_rgb[RegExp.$4];this._blue=(qx.renderer.color.Color.m_rgb[RegExp.$5]*16)+qx.renderer.color.Color.m_rgb[RegExp.$6];this._isRgbColor=true}else{throw invalid};break;case qx.constant.Type.NUMBER:if(vInValue>=0&&vInValue<=255){this._red=this._green=this._blue=vInValue;this._isRgbColor=true}else{throw invalid};break;case qx.constant.Type.OBJECT:if(qx.util.Validation.isValidArray(vInValue)&&vInValue.length==3){this._red=vInValue[0];this._green=vInValue[1];this._blue=vInValue[2];this._isRgbColor=true;break};default:throw invalid};if(!this._isRgbColor){this._red=this._green=this._blue=null;this._style=this._isHtmlColor?vInValue:null}else{this._style=null;if(!(this._red>=0&&this._red<=255&&this._green>=0&&this._green<=255&&this._blue>=0&&this._blue<=255)){throw invalid}};return this._value=vInValue};qx.Proto.dispose=function(){if(this.getDisposed()){return true};delete this._value;delete this._style;delete this._red;delete this._green;delete this._blue;delete this._isRgbColor;delete this._isHtmlColor;delete this._isThemedColor;return qx.core.Object.prototype.dispose.call(this)};qx.OO.defineClass("qx.renderer.color.ColorObject",qx.renderer.color.Color,function(vValue){this.setValue(vValue);if(qx.manager.object.ColorManager.getInstance().has(this._value)){return qx.manager.object.ColorManager.getInstance().get(this._value)};qx.core.Object.call(this);qx.manager.object.ColorManager.getInstance().add(this);this._dependentObjects={}});qx.renderer.color.ColorObject.fromString=function(vDefString){return new qx.renderer.color.ColorObject(vDefString)};qx.Proto._updateTheme=function(vTheme){if(!this._isThemedColor){throw new Error("Could not redefine themed value of non os colors!")};this._applyThemedValue();this._syncObjects()};qx.Proto._applyThemedValue=function(){var vTheme=qx.manager.object.ColorManager.getInstance().getColorTheme();var vRgb=vTheme.getValueByName(this._value);if(vRgb){this._red=vRgb[0];this._green=vRgb[1];this._blue=vRgb[2]};this._style=vTheme.getStyleByName(this._value);this._hex=null};qx.Proto._syncObjects=function(){for(var i in this._dependentObjects){this._dependentObjects[i]._updateColors(this,this._style)}};qx.Proto.setValue=function(vValue){this._normalize(vValue);this._syncObjects()};qx.Proto.add=function(vObject){this._dependentObjects[vObject.toHashCode()]=vObject};qx.Proto.remove=function(vObject){delete this._dependentObjects[vObject.toHashCode()]};qx.Proto.dispose=function(){if(this.getDisposed()){return true};if(this._dependentObjects){for(var i in this._dependentObjects){delete this._dependentObjects[i]};delete this._dependentObjects};return qx.renderer.color.Color.prototype.dispose.call(this)};qx.OO.defineClass("qx.manager.object.ObjectManager",qx.core.Target,function(){qx.core.Target.call(this);this._objects={}});qx.Proto.add=function(vObject){if(this.getDisposed()){return};this._objects[vObject.toHashCode()]=vObject;return true};qx.Proto.remove=function(vObject){if(this.getDisposed()){return};delete this._objects[vObject.toHashCode()];return true};qx.Proto.has=function(vObject){return this._objects[vObject.toHashCode()]!=null};qx.Proto.get=function(vObject){return this._objects[vObject.toHashCode()]};qx.Proto.getAll=function(){return this._objects};qx.Proto.enableAll=function(){for(var vHashCode in this._objects){this._objects[vHashCode].setEnabled(true)}};qx.Proto.disableAll=function(){for(var vHashCode in this._objects){this._objects[vHashCode].setEnabled(false)}};qx.Proto.dispose=function(){if(this.getDisposed()){return};if(this._objects){for(var i in this._objects){delete this._objects[i]};delete this._objects};return qx.core.Target.prototype.dispose.call(this)};qx.OO.defineClass("qx.manager.object.ColorManager",qx.manager.object.ObjectManager,function(){qx.manager.object.ObjectManager.call(this);this._colorThemes={};this._dependentObjects={}});qx.Settings.setDefault("colorTheme","qx.theme.color.WindowsRoyaleColorTheme");qx.OO.addProperty({name:"colorTheme",type:qx.constant.Type.OBJECT,allowNull:false,instance:"qx.renderer.theme.ColorTheme"});qx.Proto.registerColorTheme=function(vThemeClass){this._colorThemes[vThemeClass.classname]=vThemeClass;if(vThemeClass.classname==this.getSetting("colorTheme")){this.setColorTheme(vThemeClass.getInstance())}};qx.Proto.setColorThemeById=function(vId){this.setColorTheme(this._colorThemes[vId].getInstance())};qx.Proto.add=function(oObject){var vValue=oObject.getValue();this._objects[vValue]=oObject;if(oObject.isThemedColor()){this._dependentObjects[vValue]=oObject}};qx.Proto.remove=function(oObject){var vValue=oObject.getValue();delete this._objects[vValue];delete this._dependentObjects[vValue]};qx.Proto.has=function(vValue){return this._objects[vValue]!=null};qx.Proto.get=function(vValue){return this._objects[vValue]};qx.Proto._modifyColorTheme=function(propValue,propOldValue,propData){propValue.compile();for(var i in this._dependentObjects){this._dependentObjects[i]._updateTheme(propValue)};return true};qx.Proto.createThemeList=function(vParent,xCor,yCor){var vButton;var vThemes=this._colorThemes;var vIcon="icon/16/colors.png";var vPrefix="Color Theme: ";var vEvent=qx.constant.Event.EXECUTE;for(var vId in vThemes){var vObj=vThemes[vId].getInstance();var vButton=new qx.ui.form.Button(vPrefix+vObj.getTitle(),vIcon);vButton.setLocation(xCor,yCor);vButton.addEventListener(vEvent,new Function("qx.manager.object.ColorManager.getInstance().setColorThemeById('"+vId+"')"));vParent.add(vButton);yCor+=30}};qx.Proto.dispose=function(){if(this.getDisposed()){return};this._colorThemes=null;for(var i in this._dependentObjects){delete this._dependentObjects[i]};delete this._dependentObjects;return qx.manager.object.ObjectManager.prototype.dispose.call(this)};qx.Class.getInstance=qx.util.Return.returnInstance;qx.OO.defineClass("qx.renderer.theme.ColorTheme",qx.core.Object,function(vTitle){qx.core.Object.call(this);this._compiledColors={};this.setTitle(vTitle)});qx.OO.addProperty({name:"title",type:qx.constant.Type.STRING,allowNull:false,defaultValue:qx.constant.Core.EMPTY});qx.Proto._needsCompilation=true;qx.Proto._colors={};qx.Proto.getValueByName=function(vName){return this._colors[vName]||qx.constant.Core.EMPTY};qx.Proto.getStyleByName=function(vName){return this._compiledColors[vName]||qx.constant.Core.EMPTY};qx.Proto.compile=function(){if(!this._needsCompilation){return};for(var vName in qx.renderer.color.Color.themedNames){this._compileValue(vName)};this._needsCompilation=false};qx.Proto._compileValue=function(vName){var v=this._colors[vName];this._compiledColors[vName]=v?qx.renderer.color.Color.rgb2style.apply(this,this._colors[vName]):vName};qx.Proto._register=function(){return qx.manager.object.ColorManager.getInstance().registerTheme(this)};qx.Proto.dispose=function(){if(this.getDisposed()){return};delete this._colors;delete this._compiledColors;qx.core.Object.prototype.dispose.call(this)};qx.OO.defineClass("qx.theme.color.WindowsRoyaleColorTheme",qx.renderer.theme.ColorTheme,function(){qx.renderer.theme.ColorTheme.call(this,"Windows Royale")});qx.Proto._colors=qx.lang.Object.carefullyMergeWith({activeborder:[212,208,200],activecaption:[51,94,168],appworkspace:[128,128,128],background:[0,0,64],buttonface:[235,233,237],buttonhighlight:[255,255,255],buttonshadow:[167,166,170],buttontext:[0,0,0],captiontext:[255,255,255],graytext:[167,166,170],highlight:[51,94,168],highlighttext:[255,255,255],inactiveborder:[212,208,200],inactivecaption:[111,161,217],inactivecaptiontext:[255,255,255],infobackground:[255,255,225],infotext:[0,0,0],menu:[255,255,255],menutext:[0,0,0],scrollbar:[212,208,200],threeddarkshadow:[133,135,140],threedface:[235,233,237],threedhighlight:[255,255,255],threedlightshadow:[220,223,228],threedshadow:[167,166,170],window:[255,255,255],windowframe:[0,0,0],windowtext:[0,0,0]},qx.Super.prototype._colors);qx.Class.getInstance=qx.util.Return.returnInstance;qx.manager.object.ColorManager.getInstance().registerColorTheme(qx.Class);qx.OO.defineClass("qx.constant.Event",{MOUSEOVER:"mouseover",MOUSEMOVE:"mousemove",MOUSEOUT:"mouseout",MOUSEDOWN:"mousedown",MOUSEUP:"mouseup",MOUSEWHEEL:"mousewheel",CLICK:"click",DBLCLICK:"dblclick",CONTEXTMENU:"contextmenu",KEYDOWN:"keydown",KEYPRESS:"keypress",KEYUP:"keyup",BLUR:"blur",FOCUS:"focus",FOCUSIN:"focusin",FOCUSOUT:"focusout",SELECT:"select",SCROLL:"scroll",INPUT:"input",CHANGE:"change",RESIZE:"resize",CHANGESELECTION:"changeSelection",INTERVAL:"interval",EXECUTE:"execute",CREATE:"create",LOAD:"load",ERROR:"error",SUBMIT:"submit",UNLOAD:"unload",BEFOREUNLOAD:"beforeunload",TREEOPENWITHCONTENT:"treeOpenWithContent",TREEOPENWHILEEMPTY:"treeOpenWhileEmpty",TREECLOSE:"treeClose",BEFOREAPPEAR:"beforeAppear",APPEAR:"appear",BEFOREDISAPPEAR:"beforeDisappear",DISAPPEAR:"disappear",BEFOREINSERTDOM:"beforeInsertDom",INSERTDOM:"insertDom",BEFOREREMOVEDOM:"beforeRemoveDom",REMOVEDOM:"removeDom",DRAGDROP:"dragdrop",DRAGOVER:"dragover",DRAGOUT:"dragout",DRAGMOVE:"dragmove",DRAGSTART:"dragstart",DRAGEND:"dragend",CREATED:"created",CONFIGURED:"configured",QUEUED:"queued",SENDING:"sending",RECEIVING:"receiving",COMPLETED:"completed",ABORTED:"aborted",FAILED:"failed",TIMEOUT:"timeout",DIALOGOK:"dialogok",DIALOGCANCEL:"dialogcancel",DIALOGCLOSE:"dialogclose",DIALOGPREVIOUS:"dialogprevious",DIALOGNEXT:"dialognext",DIALOGFIRST:"dialogfirst",DIALOGLAST:"dialoglast"});qx.OO.defineClass("qx.renderer.border.BorderCache");qx.renderer.border.BorderCache=function(propValue,propData){if(qx.util.Validation.isValidArray(propValue)&&propValue.length>1){propString=qx.constant.Core.EMPTY;for(var i=0,l=propValue.length,p;i