// JavaScript Document //*********************************************************************** // WEBSITE //*********************************************************************** WOS = function () { //Idenfication this._class=new Object(); this._class.comp = "WOSwebsite"; this._class.name = "activeWebsite"; this._class.parent = this; this._class.root = this; this._class.dom = document.body; //Target for this class //Mode this.mode="standard"; //Settings this._isMaster=true; this._isWOSwebsite = true; this._loadDebug = false; //Switch for debugging this._loadMain = true; //Switch for main this._isLogging = true; //Switch for logging this._isLive = false; //Switch for live this._isMaster = true; //Switch for in prosses of loading scripts this._strroot = name; //Name of website to root spesification this._strSkin = "dhx_skyblue"; //Default skin this._strBtns = "default"; //Default buttons this._strIcons = "default"; //Default icons this._strWebsite = "webSite"; //Target and name of website this._strLoader = "webLoader"; //Target and name of loader this._strContent = "webContent"; //Target and name of website content this._strDebugger = "webDebugger"; //Target and name of debugger this._optChangeCSS = true; //Change CSS codes this._aryLoaded = new Array(); //Loaded Scripts this._aryCSSlogg = new Array(); //Logg CSS this._aryBrowsers = new Array(); //Allowed browsers this._aryBrowsers["Firefox"] = 1.0; this._aryBrowsers["Explorer"] = 8.0; this._aryBrowsers["Safari"] = 4.0; //Globalize activeWebsite = this; //Init Website this.init(); } //Init WOS WOS.prototype = { init: function (data) { var that=this; this.loader("index.php?call=getExtension(loadScripts)",function(){ that.loader("index.php?call=getExtension(starter)",function(){ that.starter._class=new Object(); that.starter._isMaster=false; that.starter._class.parent=that; that.starter._class.root=that; that.starter.init(); }); }); }, // // COMMON // execute: function (para) { var func = "WOSwebsite.execute"; try { if (window.execScript) { var type = "window.execScript"; window.execScript(para); } else { var type = "window.eval"; window.eval(para); } activeWebsite.addLogg(func + " ('" + type + "' ) -> OK ", "OK", 0, func, this); } catch (e) { activeWebsite.addLogg(func + " ('" + type + "' ) -> ERROR " + e.message + "' (line '" + e.lineNo + "') on '" + para + "'", "Error", 0, func, e); } }, setSkin: function (value) {this._strSkin = value;}, // // CONSTRUCT TOOL // run: function (object, cb){this.object.run(object, cb)}, // // COMMUNICATION TOOLS // load: function (value, sync, post, data, execute, cb) {return this.server.send("index.php?call=" + value, sync, post, data, execute, cb);}, send: function (value, sync, post, data, execute, cb) {return this.server.send(value, sync, post, data, execute, cb);}, // // SYSTEM TOOLS // setServices: function (object) {if (this.services) this.services.setServices(object);}, setWindow: function (object) {if (this.windows) this.windows.setWindow(object);}, closeWindow: function (object) {this.windows.close(object);}, addLogg: function (text, status, id, func, obj) { if (this.logg && this._isLogging) { this.logg.addLogg(text, status, id, func, obj); } }, signIn: function (value) { //Sign in user this.user.signIn(value); //Close all windows this.window.closeAll(); //Build visual this.main.refresh(value); }, signOut: function () { //Sign out user this.user.signOut() //Close all windows this.window.closeAll(); //Refresh visual var option=new Object(); this.main.refresh(option); }, progressOn: function () {if (this.main && this.main.layout) this.main.layout.progressOn();}, progressOff: function () {if (this.main && this.main.layout) this.main.layout.progressOff();}, // // REFRESH // refresh: function (option) {this.main.desktop.refresh(option);}, // // EVENTS // onResize: function (e) {if (this.main) this.main.onResize(e);}, onResizeEnd: function (e) {if (this.main) this.main.onResizeEnd(e);}, onAddLogg: function (logg) { if (activeWebsite._domDebugger) { activeWebsite._domDebugger.innerHTML += logg[2] + "
"; } else { var dom = document.getElementById(activeWebsite._strDebugger); if (dom) { dom.innerHTML += logg[2] + "
"; } } }, loader: function (file,cb){ //NB This will be overwritten by the system, because this is a simple loader var head = document.getElementsByTagName('head')[0]; var script = document.createElement("script"); script.type = "text/javascript"; script.onreadystatechange = function () { if (this.readyState == 'complete' || this.readyState == 'loaded'){ if (cb) cb(); }; } script.onload = function (ev) { if(cb) cb(); }; script.src = file; head.appendChild(script); } }