xDTwList[xDTwName[windowName]] has no properties [Break on this error] this.window = function _window(windowName) {if (xDTwName[windowName] != null) r... x-desktop_core.js (line 21) xDTwList[xDTwName[windowName]] has no properties [Break on this error] return xDTwList[xDTwName[windowName]][wProp]; x-desktop_core.js (line 66) xDTwList[xDTwName[windowName]] has no properties [Break on this error] return xDTwList[xDTwName[windowName]][wProp]; x-desktop_core.js (line 66) 1 2 3 4 5 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41Conttrol Panel 42 43 44 56 57 1/*============================================================== 2 x-desktop_core.js - release 1 $ 3 x-Desktop CrossBrowserDesktop Library from www.x-desktop.org 4 Copyright (c) 2003-2004 Tobias Schulze (webmaster@x-desktop.org) & Lars Gehrmann 5 Distributed under the terms of the GNU GPL from gnu.org 6 see attached license.html or visit http://www.x-desktop.org 7================================================================*/ 8/* ============ */ 9/* Enumerations */ 10/* ============ */ 11function xDesktopVariables() { 12 var xDTwList = new Array(); 13 var xDTwName = new Array(); 14 var xDTSkins = new Array(new Array("DEFAULT")); 15 var xDTmain = ""; var maxwin = 0; var xDTsyswin = 15; 16 var xDTdragZ = 0; 17 var xDTnoevent = false; 18 this.lastWindow = function _lastWindow(mwin) {if (mwin) maxwin = mwin; return maxwin } 19 this.setWindowHandle = _setWindowHandle; this.wHandle = _wHandle; this.wName = _wName; this.setStartup = _setStartup; this.Startup = _Startup; 20 this.wLength = function _wLength() { return xDTwList.length } 21 this.window = function _window(windowName) {if (xDTwName[windowName] != null) return xDTwList[xDTwName[windowName]]["cbe"]; else return null } 22 this.windowalert = function _windowalert(windowName) {if (xDTwName[windowName] != null) return xDTwList[xDTwName[windowName]]["cbe"]; else {alert("Unknown window: " + windowName + " !"); return xDTwList[xDTsyswin-1]["cbe"] } } 23 this.windowalert2 = function _windowalert(windowName) {if (xDTwName[windowName] != null) return xDTwList[xDTwName[windowName]]["innercbe"]; else {alert("Unknown innercbe: " + windowName + " !");return xDTwList[xDTsyswin-1]["innercbe"] } } 24 this.property = _property; this.newWindow = _newWindow; this.getWindowIndex = _getWindowIndex; this.getAllWindows = _getAllWindows; 25 this.getAllUserWindows = _getAllUserWindows; this.getAllWindowProperties = _getAllWindowProperties; this.deleteWindowProperties = _deleteWindowProperties; 26 this.xDTdrag = function _xDTdrag() {++xDTdragZ; return xDTdragZ } 27 this.addSkin = _addSkin; this.skin = _skin; this.noevent = _noevent; 28 this.marginTop = function _marginTop(sk) {return xDTSkins[sk]["mTop"] } 29 this.marginBottom = function _marginBottom(sk) {return xDTSkins[sk]["mBottom"] } 30 function _noevent(ev) {if (ev == true || ev == false) xDTnoevent = ev; return xDTnoevent } 31 function _deleteWindowProperties(idx) { 32 if (idx < xDTsyswin) return; 33 var tmp = xDTwList[idx]["cbe"]; // save cbe window handle; 34 xDTwName[xDTwList[idx]["wName"]] = null; // delete windowName 35 _setWindowHandle(idx); // initialize 36 xDTwList[idx]["cbe"] = tmp; // restore previous cbe window handle 37 } 38 function _setWindowHandle(idx) { 39 xDTwList[idx] = new Array("cbe","innercbe","wName","wTitle","wWidthOrg","wWidth","wHeightOrg","wHeight","wPos","wX","wY","wSkin","wIcon","wUrl","wScroll","wHtml","zIndex","wIndex","wStat","fClose","wVisible","fResize","fMove"); // create this window properties 40 var w = xDTwList[idx].join(',').split(","); 41 for (var i in w) xDTwList[idx][w[i]] = ""; 42 if (idx == 0) { xDTwList[idx]["wName"] = "dDesktop"; xDTwName["dDesktop"] = idx } 43 else if (idx == 1) { xDTwList[idx]["wName"] = "dTaskbar"; xDTwName["dTaskbar"] = idx } 44 else if (idx == 2) { xDTwList[idx]["wName"] = "dMove"; xDTwName["dMove"] = idx } // Move window (instead of real window....) 45 else if (idx == 3) { xDTwList[idx]["wName"] = "dMessage"; xDTwName["dMessage"] = idx } // System Message window 46 else if (idx == 4) { xDTwList[idx]["wName"] = "dSound"; xDTwName["dSound"] = idx } // System Sound window 47 else if (idx == 5) { xDTwList[idx]["wName"] = "dUser"; xDTwName["dUser"] = idx } // User Messages like alert etc... 48 else if (idx == 9) { xDTwList[idx]["wName"] = "dDummy"; xDTwName["dDummy"] = idx } // Dummy window 49 else if (idx == 10) { xDTwList[idx]["wName"] = "dCustom1"; xDTwName["dCustom1"] = idx } // dCustom1 50 else if (idx == 11) { xDTwList[idx]["wName"] = "dCustom2"; xDTwName["dCustom2"] = idx } // dCustom2 51 else if (idx == 12) { xDTwList[idx]["wName"] = "dCustom3"; xDTwName["dCustom3"] = idx } // dCustom3 52 else if (idx == 13) { xDTwList[idx]["wName"] = "dCustom4"; xDTwName["dCustom4"] = idx } // dCustom4 53 else if (idx == 14) { xDTwList[idx]["wName"] = "dCustom5"; xDTwName["dCustom5"] = idx } // dCustom5 54 else xDTwList[idx]["wName"] = ""; 55 xDTwList[idx]["wIndex"] = idx; 56 } 57 function _wHandle(idx,param,val) {xDTwList[idx][param] = val; return val } 58 function _wName(idx) {if (idx < xDTwList.length) return xDTwList[idx]["wName"]; else return -1 } 59 function _setStartup(func) { xDTmain = func } 60 function _Startup() { xDTmain() } 61 function _getWindowIndex(windowName) { return xDTwName[windowName] } 62 function _property(windowName,wProp,wVal) { 63 if (xDTwName[windowName] == null) return xDTwName[windowName]; 64 if (wProp) { 65 if (wVal == 0 || (wVal && wVal != '') ) xDTwList[xDTwName[windowName]][wProp] = wVal; 66 return xDTwList[xDTwName[windowName]][wProp]; 67 } 68 return ""; 69 } 70 function _newWindow(windowName) { 71 //if (xDTwName[windowName]) {alert("Window " + windowName + " does exists already !"); return 0 } 72 if (xDTwName[windowName]) return "_WTHERE_"; //OK, window will be reused 73 for (var i=xDTsyswin;i<=maxwin;i++) { 74 if (xDTwList[i]["wName"] == "") { 75 if (windowName == "w") windowName += i; 76 xDTwList[i]["wName"] = windowName; 77 xDTwName[windowName] = i; 78 return windowName; 79 } 80 } 81 alert("Cannot create window " + windowName + ". Out of space. Increase maxwin !"); 82 return 0; 83 } 84 function _getAllWindows(sk) {var str = ""; for(var i in xDTwName) {if (sk) {if (xDTwName[i] < sk) continue };if (str != "") str += "/"; str += i; } return str; } 85 function _getAllUserWindows() {for(i=xDTsyswin;i<=maxwin;i++) {if (xDTwList[i]["wName"] != "") return xDTwList[i]["wName"] } return 0 } 86 function _getAllWindowProperties(windowName) { 87 if (xDTwName[windowName] != 0 && (xDTwName[windowName] == "" || xDTwName[windowName] == null) ) return ""; 88 return xDTwList[xDTwName[windowName]].join(","); 89 } 90 function _addSkin(wskin,mTop,mBottom) { 91 var _func = eval( "skin_" + wskin); 92 if ( typeof _func == "function") xDTSkins[wskin] = _func; 93 else alert("skin_" + wskin + " function missing or invalid / not loaded"); 94 (mTop && mTop >= 0) ? xDTSkins[wskin]["mTop"] = mTop : xDTSkins[wskin]["mTop"] = 0; 95 (mBottom && mBottom >= 0) ? xDTSkins[wskin]["mBottom"] = mBottom : xDTSkins[wskin]["mBottom"] = 0; 96 } 97 function _skin(wskin,wName) { 98 if (typeof xDTSkins[wskin] == "function") return xDTSkins[wskin](wName); 99 if (typeof eval("skin_" + wskin) == "function") {_addSkin(wskin,0,0); return xDTSkins[wskin](wName) } 100 alert("Skin " + wskin + " is not available ! Using skin_DEFAULT() instead ...."); 101 return xDTSkins["DEFAULT"](wName); 102 } 103 for (i=0;i2) { 125 addEventListener('dragStart',dStartListener,false); 126 addEventListener('drag',dListener,false); 127 addEventListener('dragEnd',dEndListener,false); 128 } 129 } 130 } 131} 132function windowOnunload() { 133 //xDTwin = null; 134} 135/* ========================*/ 136/* The xDesktop Object */ 137/* ========================*/ 138function xDesktop(respath,sdt,maxwin,_fmain) { // resourcepath, startupdesktop,maximumwindows,startup function 139 var p_zIndex = 10; // z-index of window 140 var p_respath = './xDT/'; // (root) path for resources 141 var p_desktop = 'DEFAULT'; // default Desktop style 142 var p_tbBgColor = 'transparent'; // default Taskbar Background Color 143 var p_tbColor = '#000000'; // default Taskbar Foreground Color 144 var p_tbBoColor = '#000000'; // default Taskbar Border Color 145 var p_taskbar = false; var p_lastpopup = ""; // default number of window elements 146 var p_hidedesktop = false; // hide Desktop when moving windows 147 var p_language = ""; // default Language (none = english) 148 var p_version_major = "1.5 Development Release"; // Major Release 149 var p_version_minor = "0"; // Minor Release 150 var p_message = ""; // Message for alert/confirm etc.. and push button status 151 var p_cOK = ""; var p_cCancel = ""; // confirm OK/Cancel push button assigned functions 152 var p_caldate = ""; // calender date target field 153 var p_lastdt = ""; // last desktop skin 154 var p_sysmessage = ""; // current systemmessage 155 var p_scw = 0; // screen width (0 <=1024,1 <=1280,2 >1280) 156 var p_useautopopup = 0; // use autopopup 157 var p_autopop = 1; // do auto popup 158 var p_dateformat = 0; // dateformat 0=european , 1 = us 159 var p_data = new Array(); // data array for global use 160 var p_syswin = 15; // internal sys windows same as xDTsyswin 161 SetScreen(); 162 if (! maxwin || maxwin < 20 || maxwin > 500) maxwin = 50; 163 xDTwin.lastWindow(maxwin); // default number of window elements 164 if (typeof(respath) == 'string' && respath.length > 1) p_respath = respath; 165 if (typeof(sdt) == 'string' && sdt.length > 1) p_desktop = sdt; 166 var p_lError = new Array(0,""); var p_windowList = new Array(); var p_Debug = 1; var p_maxwin = maxwin; 167 this.lastError = _lastError; this.window = new _window; this.desktop = new _desktop; this.resPath = _respath; this.taskbar = _taskbar; this.sysMessage = _sysMessage; 168 this.maxWindow = _maxWindow; this.addWindow = _addWindow; this.deleteWindow = this.closeWindow = _closeWindow; this.moveWindow = _moveWindow; this.resizeWindow = _resizeWindow; 169 this.refreshWindow = _refreshWindow; this.positionWindow = _positionWindow; this.positionAllWindows = _positionAllWindows; this.popupWindow = _popupWindow; 170 this.innerWindows = _innerWindows; this.maximizeWindow = _maximizeWindow; this.minimizeWindow = _minimizeWindow; this.minimizeAllWindows = _minimizeAllWindows; this.deleteAllWindows = this.closeAllWindows = _closeAllWindows; 171 this.restoreAllWindows = _restoreAllWindows; this.arrangeAllWindows = _arrangeAllWindows; this.frameName = _frameName; this.show = _show; this.hide = _hide; 172 this.cbe = _cbe; this.prop = _property; this.url = _url; this.html = _html; this.taskbarColor = _taskbarColor; this.taskbarStatus = _taskbarStatus; this.version = _version; 173 this.addSkin = _addSkin; this.setSkin = _setSkin; this.dSkin =_dSkin; this.playSound = _playSound; this.hideDesktop = _hideDesktop; this.checkUpdate = _checkUpdate; 174 this.alert = _alert; this.confirm = _confirm; this.quit = _quit; this.language = _language; this.docs = _docs; this.home = _home; this.preloadImages = _preloadImages; 175 this.calendar = _calendar; this.autoPopupWindow = _autoPopupWindow; this.autoPopup = _autoPopup; this.dateFormat = _dateFormat; 176 //this.data = _data; 177 /*==================================*/ 178 /* -- Auto init stuff ------------- */ 179 /*==================================*/ 180 for (var i=0;i<=maxwin;i++) { 181 document.write('
'); 182 } 183 /*==================================*/ 184 /* -- Object Methods for public use */ 185 /*==================================*/ 186 function _dateFormat(df) { if (typeof(df) == 'undefined') return p_dateformat; else if (typeof(df) == 'string') df = parseInt(df); df ? p_dateformat = 1 : p_dateformat = 0; return p_dateformat } 187 function _minimizeWindow(wName) { if (wName) { _property(wName,"wStat","min"); _hide(wName); _taskbar() } } 188 function _language(lang) {if (lang && lang.length) p_language = lang; return p_language } 189 function _version() {var str = ""; p_version_major.match(/^([0-9.]+)\s+(.+)$/) ? str = RegExp.$1 + "." + p_version_minor + " (" + RegExp.$2 + ")" : str = p_version_major + " " + p_version_minor; return str } 190 function _hideDesktop(stat) { stat ? p_hidedesktop = true : p_hidedesktop = false; return p_hidedesktop } 191 function _show(wName) {if (! xDTwin.window(wName)) return; _property(wName,"wVisible",true); _cbe(wName).show(); return true} 192 function _hide(wName) {if (! xDTwin.window(wName)) return; _property(wName,"wVisible",false); _cbe(wName).hide(); return true} 193 function _popupWindow(wName) {if (_property(wName,"wIndex") < p_syswin) return; if (! xDTwin.window(wName) || wName == p_lastpopup) return wName; _cbe(wName).zIndex(xDTwin.xDTdrag()); _property(wName,"zIndex",_cbe(wName).zIndex()); _show(wName); _property(wName,"wStat","OK"); p_lastpopup = wName; _taskbar(); return wName } 194 function _autoPopupWindow(wName) {if (p_useautopopup && p_autopop) _popupWindow(wName) } 195 function _autoPopup(onoff) {if (_autoPopup.arguments.length == 0) return p_useautopopup; (onoff) ? p_useautopopup = 1 : p_useautopopup = 0; return p_useautopopup } 196 function _frameName(wName) {if (! xDTwin.window(wName)) return ""; if (_property(wName,"wUrl") != "") return "xDTiF_" + wName; return "" } 197 function _taskbarStatus() {return p_taskbar } 198 function _taskbarColor(bg,c,b) {if (bg) p_tbBgColor = bg; if (c) p_tbColor = c; if (b) p_tbBoColor = b; _taskbar() } 199 function _closeWindow(wName,wC) {if (xDTwin.window(wName) && (DeleteWindowFunction(wName,wC) || wC == "KILL" )) {_hide(wName); if (typeof(_property(wName,"innercbe")) == "object") _property(wName,"innercbe").innerHtml(""); xDTwin.deleteWindowProperties(xDTwin.getWindowIndex(wName)); _taskbar() } } 200 function _addWindow(wName,wTitle,wWidth,wHeight,wPos,wSkin) { 201 p_zIndex++; 202 if (wName && !wName.match(/^[a-zA-Z][a-zA-Z0-9]+$/) ) {alert('Invalid window name: ' + wName); return 0 } 203 if (!wName) wName = "w"; 204 var wNsave = wName; 205 if (! wName.match(/^(dMessage|dUser|dSound|dCustom\d+)$/) ) wName = xDTwin.newWindow(wName); 206 if (wName == "_WTHERE_") {_property(wNsave,"wStat","OK"); _taskbar(wNsave); return wNsave } 207 if (!wName) return 0; 208 _cbe(wName).background('transparent'); 209 if (!wSkin) wSkin = _dSkin(); 210 _property(wName,"wSkin",wSkin); // default window style 211 SetScreen(); 212 wWidth = ChooseSize(wWidth); 213 wHeight = ChooseSize(wHeight); 214 (wWidth > 0 && wWidth <= 10000) ? wWidth = wWidth : wWidth = 300; 215 (wHeight > 0 && wHeight <= 10000) ? wHeight = wHeight : wHeight = 200; 216 _property(wName,"wWidth",wWidth); // default window width 217 _property(wName,"wHeight",wHeight); // default window height 218 _property(wName,"wWidthOrg",_property(wName,"wWidth")); // save Org width Value 219 _property(wName,"wHeightOrg",_property(wName,"wHeight")); // save Org height Values 220 _cbe(wName).resizeTo(wWidth,wHeight); 221 if (!wPos) wPos = "center"; 222 SetWindowPos(wName,wPos); // default window pos 223 if (!wTitle) wTitle = " "; 224 _property(wName,"wTitle",wTitle); // default Title 225 p_zIndex = xDTwin.xDTdrag(); 226 _property(wName,"zIndex",p_zIndex); 227 _setSkin(wName,wSkin); 228 _cbe(wName).zIndex(p_zIndex); 229 return wName; 230 } 231 function _resizeWindow(wName,wWidth,wHeight,wPos) { 232 if (! xDTwin.window(wName)) return; 233 SetScreen(); 234 wWidth = ChooseSize(wWidth); 235 wHeight = ChooseSize(wHeight); 236 if (wWidth > 0 && wWidth <= 10000) _property(wName,"wWidth",wWidth); 237 if (wHeight > 0 && wHeight <= 10000) _property(wName,"wHeight",wHeight); 238 _cbe(wName).resizeTo(_property(wName,"wWidth"),_property(wName,"wHeight")); 239 if (!wPos) wPos = _property(wName,"wPos"); 240 SetWindowPos(wName,wPos); 241 } 242 function _maximizeWindow(wName) { 243 if (_property(wName,"wIndex") < p_syswin) return; 244 var tb = 0; if (_taskbarStatus()) tb = _property("dTaskbar","wHeight") + 1; 245 if (_property(wName,"wStat") == "MAX") { 246 _cbe(wName).moveTo(_property(wName,"wX"),_property(wName,"wY")); 247 _cbe(wName).resizeTo(_property(wName,"wWidth"),_property(wName,"wHeight")); 248 _property(wName,"wStat","OK"); 249 return; 250 } 251 _property(wName,"wStat","MAX"); 252 _cbe(wName).moveTo(0,xDTwin.marginTop(_dSkin())); 253 _cbe(wName).resizeTo(document.cbe.width() - 1,document.cbe.height() - tb - xDTwin.marginBottom(_dSkin()) - xDTwin.marginTop(_dSkin()) - 1); 254 _cbe(wName).zIndex(xDTwin.xDTdrag()); 255 _property(wName,"zIndex",_cbe(wName).zIndex()); 256 } 257 function _positionWindow(wName) { 258 var wSkin = _dSkin(); 259 var wX = _property(wName,"wX"); // left 260 var wY = _property(wName,"wY"); // top 261 var mT = xDTwin.marginTop(wSkin); 262 var tb = 0; if (_taskbarStatus()) tb = _property("dTaskbar","wHeight") + 1; 263 var fB = document.cbe.height() - (_cbe(wName).height() + xDTwin.marginBottom(wSkin) + tb); 264 if (_cbe(wName).left() < 0) _cbe(wName).moveTo(0,_cbe(wName).top()); 265 if ( (_cbe(wName).left() + _cbe(wName).width()) > document.cbe.width()) _cbe(wName).moveTo(document.cbe.width() - _cbe(wName).width(),_cbe(wName).top()); 266 if ( wY <= mT) _cbe(wName).moveTo(wX,mT); if ( wY > fB ) _cbe(wName).moveTo(wX,fB); 267 if (_cbe(wName).left() < 0) _cbe(wName).moveTo(0,_cbe(wName).top()); 268 if ( (_cbe(wName).left() + _cbe(wName).width()) > document.cbe.width()) _cbe(wName).moveTo(document.cbe.width() - _cbe(wName).width(),_cbe(wName).top()); 269 _property(wName,"wX",_cbe(wName).left()); _property(wName,"wY",_cbe(wName).top()); 270 } 271 function _positionAllWindows() { 272 if (xDTwin.getAllWindows(p_syswin) != 0) { 273 var uw = xDTwin.getAllWindows(p_syswin).split('/'); 274 for (var w in uw) _positionWindow(uw[w]); 275 _positionWindow("dMessage"); 276 _positionWindow("dUser"); 277 } 278 } 279 function _innerWindows(wName,stat) { 280 if (xDTwin.getAllWindows(p_syswin) != 0) { 281 var uw = xDTwin.getAllWindows(p_syswin).split('/'); 282 if (uw) uw.push("dMessage"); 283 if (stat == "hide" && p_hidedesktop) _hide("dDesktop"); 284 else if (stat == "show" && p_hidedesktop) _show("dDesktop"); 285 for (var w in uw) { 286 if (uw[w] == wName) continue; 287 if (_property(uw[w],"innercbe")) { 288 if (stat == "hide") _property(uw[w],"innercbe").hide(); 289 else if (stat == "show") _property(uw[w],"innercbe").show(); 290 } 291 } 292 } 293 } 294 function _setSkin(wName,wSkin) { 295 _cbe(wName).innerHtml( xDTwin.skin(wSkin,wName) ); 296 var ele = ""; 297 if (ele = document.getElementById(wName + 'iTD')) { 298 var cbe = new CrossBrowserElement(); 299 cbeBindElement(cbe,ele); 300 document.cbe.appendNode(cbe); 301 _property(wName,"innercbe",cbe); 302 } 303 } 304 function _url(wName,wUrl,wScroll) { 305 if (! xDTwin.property(wName,"wName") ) {alert("Unknown window name: " + wName + " !"); return } 306 if (wUrl) xDTwin.property(wName,"wUrl",wUrl); 307 wUrl = xDTwin.property(wName,"wUrl",wUrl); // maybe some existing url 308 if (wScroll == 'no' || wScroll == 0 || wScroll == false) wScroll = 'no'; else wScroll = 'auto'; 309 xDTwin.property(wName,"wScroll",wScroll); /*allowtransparency="true" style="background-color: transparent"*/ 310 _property(wName,"innercbe").innerHtml('