All pastes #395343 Raw Edit

Stuff

public text v1 · immutable
·published 2007-03-14 23:28 UTC
rendered paste body


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<!DOCTYPE HTML PUBLIC "-//SoftQuad Software//DTD HoTMetaL PRO 6.0::19990601::extensions to HTML 4.0//EN" "hmpro6.dtd">
2<html>
3<head>
4<LINK REL="stylesheet" TYPE="text/css" HREF="/ISTech/includes/scripts/xdesktop/x-desktop.css">
5 <script>
6 var LOADED = 0;
7 var LOADMESSAGE = "Cross-Browser Core Library";
8 var lw = window.open("/ISTech/includes/scripts/xdesktop/loading.html","Loading","resizable=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,toolbar=0,width=400,height=200");
9 </script>
10
11 <script type="text/javascript" src="/ISTech/includes/scripts/xdesktop/cbe_core.js"></script>
12 <script>LOADMESSAGE = "Cross-Browser Event Library";</script>
13 <script type="text/javascript" src="/ISTech/includes/scripts/xdesktop/cbe_event.js"></script>
14 <script>LOADMESSAGE = "Cross-Browser Slide Library";</script>
15 <script type="text/javascript" src="/ISTech/includes/scripts/xdesktop/cbe_slide.js"></script>
16 <script>LOADMESSAGE = "x-desktop WIN skin";</script>
17 <script type="text/javascript" src="/ISTech/includes/scripts/xdesktop/x-desktop_skin_WIN.js"></script>
18 <script>LOADMESSAGE = "x-desktop OSX skin";</script>
19 <script type="text/javascript" src="/ISTech/includes/scripts/xdesktop/x-desktop_skin_OSX.js"></script>
20 <script>LOADMESSAGE = "x-desktop OSXA skin";</script>
21 <script type="text/javascript" src="/ISTech/includes/scripts/xdesktop/x-desktop_skin_OSXA.js"></script>
22 <script>LOADMESSAGE = "x-desktop KDE skin";</script>
23 <script type="text/javascript" src="/ISTech/includes/scripts/xdesktop/x-desktop_skin_KDE.js"></script>
24 <script>LOADMESSAGE = "x-desktop GNOME skin";</script>
25 <script type="text/javascript" src="/ISTech/includes/scripts/xdesktop/x-desktop_skin_GNOME.js"></script>
26 <script>LOADMESSAGE = "x-desktop SBO skin";</script>
27 <script type="text/javascript" src="/ISTech/includes/scripts/xdesktop/x-desktop_skin_SBO.js"></script>
28 <script>LOADMESSAGE = "x-desktop XP skin";</script>
29 <script type="text/javascript" src="/ISTech/includes/scripts/xdesktop/x-desktop_skin_XP.js"></script>
30 <script>LOADMESSAGE = "x-desktop AEON skin";</script>
31 <script type="text/javascript" src="/ISTech/includes/scripts/xdesktop/x-desktop_skin_AEON.js"></script>
32 <script>LOADMESSAGE = "x-desktop REDHAT skin";</script>
33 <script type="text/javascript" src="/ISTech/includes/scripts/xdesktop/x-desktop_skin_REDHAT.js"></script>
34 <script>LOADMESSAGE = "x-desktop NONE skin";</script>
35 <script type="text/javascript" src="/ISTech/includes/scripts/xdesktop/x-desktop_skin_NONE.js"></script>
36 <script>LOADMESSAGE = "x-desktop SUSE skin";</script>
37 <script type="text/javascript" src="/ISTech/includes/scripts/xdesktop/x-desktop_skin_SUSE.js"></script>
38 <script>LOADMESSAGE = "x-desktop core library";</script>
39 <script type="text/javascript" src="/ISTech/includes/scripts/xdesktop/x-desktop_core.js"></script>
40 <script>LOADMESSAGE = "x-desktop inititializion";</script>
41<title>Conttrol Panel</title>
42</head>
43<body LEFTMARGIN="0" TOPMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0" bgcolor="#FFffff">
44<script>
45 function StartDesktop() {
46 xDT.desktop.init();
47 xDT.addWindow('test','Desktop Startup Window: x-desktop.html',510,285,'center',0);
48 xDT.url("test",'http://www.google.com');
49 xDT.show("test");
50 alert($('test').value);
51 LOADED = 1;
52 }
53 </script><script>
54 var xDT = new xDesktop('/ISTech/includes/scripts/xdesktop/xDT/','DEFAULT',50,StartDesktop);
55 </script>
56</body>
57</html>
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;i<xDTSkins.length;i++) {
104 var _func = eval( "skin_" + xDTSkins[i]);
105 if ( typeof _func == "function") xDTSkins[xDTSkins[i]] = _func;
106 }
107}
108/*========================*/
109/* internal Object */
110/*========================*/
111var xDTwin = new xDesktopVariables();
112/* ========================*/
113/* load / unload functions */
114/* ========================*/
115function windowOnload() {
116 for (var i=0;document.getElementById('xDTwi' + i);i++) {
117 xDTwin.setWindowHandle(i);
118 with ( xDTwin.wHandle(i,"cbe",document.getElementById('xDTwi' + i).cbe ) ) {
119 hide();
120 color('#000000');
121 background('#ffffff');
122 resizeTo(1,1);
123 moveTo(0,0);
124 if (i>2) {
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('<div id="xDTwi' + i + '" class="xDT_clsCBE"></div>');
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('<iframe onmouseover="xDT.autoPopupWindow(' + "'" + wName + "')" + '" name="xDTiF_' + wName + '" src="' + wUrl + '" width="100%" height="100%" marginwidth="0" marginheight="0" frameborder="0" scrolling="' + wScroll + '">');
311 if (document.all) {e = document.getElementById('xDTiF_'+wName); e.src = wUrl; e.width = "100%"; e.height = "100%" }
312 // next line is to fix a bug in mozilla 1.3
313 if (! _property(wName,"wSkin").match(/^xDT/) && _property(wName,"innercbe").height() >= _property(wName,"cbe").height()) _resizeWindow(wName,_property(wName,"wWidth"),200);
314 }
315 function _html(wName,wHtml,wUrl,wScroll) {
316 if (! xDTwin.property(wName,"wName") ) {alert("Unknown window name: " + wName + " !"); return }
317 if (wHtml) _property(wName,"wHtml",wHtml);
318 wHtml = _property(wName,"wHtml",wHtml); // maybe some existing html
319 if (typeof(wUrl) == 'undefined' || ! wUrl.length) wUrl = p_respath + 'files/htmlwindow.html';
320 if (wScroll == 'no' || wScroll == 0 || wScroll == false) wScroll = 'no'; else wScroll = 'auto';
321 xDTwin.property(wName,"wScroll",wScroll); /*allowtransparency="true" style="background-color: transparent"*/
322 _property(wName,"innercbe").innerHtml('<iframe onmouseover="xDT.autoPopupWindow(' + "'" + wName + "')" + '" name="xDTiF_' + wName + '" src="' + wUrl + '" width="100%" height="100%" marginwidth="0" marginheight="0" frameborder="0" scrolling="' + wScroll + '">');
323 if (document.all) {e = document.getElementById('xDTiF_'+wName); e.src = wUrl; e.width = "100%"; e.height = "100%" }
324 // next line is to fix a bug in mozilla 1.3
325 //if (! _property(wName,"wSkin").match(/^xDT/) && _property(wName,"innercbe").height() >= _property(wName,"cbe").height()) _resizeWindow(wName,_property(wName,"wWidth"),200);
326 if (_property(wName,"innercbe").height() >= _property(wName,"cbe").height()) _resizeWindow(wName,_property(wName,"wWidth"),parseInt(_property(wName,"cbe").height()) + 60);
327 }
328 function _refreshWindow(wName,wSkin) {
329 var sc = ""; // save content
330 eval(_frameName(wName) + ".location.reload()");
331 /*
332 if ( _property(wName,"innercbe") ) sc = _property(wName,"innercbe").innerHtml(); else sc = _cbe(wName).innerHtml();
333 if (! wSkin) wSkin = _property(wName,"wSkin"); _setSkin(wName,wSkin);
334 if ( _property(wName,"innercbe") ) _property(wName,"innercbe").innerHtml(sc); else _cbe(wName).innerHtml(sc);
335 _property(wName,"wSkin",wSkin);
336 */
337 }
338 function _sysMessage(msg,hide) {
339 if (typeof(msg) == 'undefined' && typeof(hide) == 'undefined') return p_sysmessage;
340 _addWindow('dMessage','System Message',300,200,'ne','');
341 if (msg) p_sysmessage = msg;
342 if (!hide) _cbe('dMessage').zIndex(xDTwin.xDTdrag());
343 if (!hide) _show('dMessage');
344 _url('dMessage',p_respath + 'files/sysmsg.html');
345 }
346 function _checkUpdate(wPos) { if (typeof(wPos) == 'undefined') wPos = "0,0"; _addWindow('xDTonlUC','Online Update Check',400,130,wPos); _url('xDTonlUC',p_respath + 'files/update.html'); _show('xDTonlUC'); }
347 function _alert(msg,cOK) {
348 if (typeof(msg) == 'undefined') return p_message;
349 if ( (typeof(cOK) == 'string' && cOK.length) || typeof(cOK) == 'function') p_cOK = cOK; else p_cOK = "";
350 msg += "";
351 (msg.match(/^(\s+)?$/)) ? p_message = '&lt;NO VALUE&gt;' : p_message = msg;
352 _cbe('dDummy').background('transparent');
353 var opac = "";
354 (document.all) ? opac = 'style="background-color: #000000; filter:alpha(opacity=35); -moz-opacity:0.35"' : opac = 'style="background-image: url(' + p_respath + 'images/opac.gif)" ';
355 _cbe('dDummy').innerHtml('<table ' + opac + ' cellpadding="0" cellspacing="0" border="0" width="100%" height="100%"><tr><td width="100%" height="100%"></td></tr></table>');
356 _cbe('dDummy').resizeTo(document.cbe.width(),document.cbe.height());
357 _cbe('dDummy').zIndex(9999998);
358 _cbe('dDummy').show();
359 var w = 150;
360 (parseInt(400 / p_message.length) < 10) ? w = 400 : w += p_message.length * 10;
361 _addWindow('dUser','',w,140,'center','');
362 _url('dUser',p_respath + 'files/alert.html');
363 _cbe('dUser').zIndex(9999999);
364 _show('dUser');
365 p_autopop = 0;
366 }
367 function _confirm(msg,cOK,cCancel) {
368 if (typeof(msg) == 'undefined') return p_message;
369 if ( (typeof(cOK) == 'string' && cOK.length) || typeof(cOK) == 'function') p_cOK = cOK; else p_cOK = "";
370 if ( (typeof(cCancel) == 'string' && cCancel.length ) || typeof(cCancel) == 'function') p_cCancel = cCancel; else p_cCancel = "";
371 (msg.match(/^(\s+)?$/)) ? p_message = '&lt;NO VALUE&gt;' : p_message = msg;
372 _cbe('dDummy').background('transparent');
373 var opac = "";
374 (document.all) ? opac = 'style="background-color: #000000; filter:alpha(opacity=35); -moz-opacity:0.35"' : opac = 'style="background-image: url(' + p_respath + 'images/opac.gif)" ';
375 _cbe('dDummy').innerHtml('<table ' + opac + ' cellpadding="0" cellspacing="0" border="0" width="100%" height="100%"><tr><td width="100%" height="100%"></td></tr></table>');
376 _cbe('dDummy').resizeTo(document.cbe.width(),document.cbe.height());
377 _cbe('dDummy').zIndex(9999998);
378 _cbe('dDummy').show();
379 var w = 200;
380 (parseInt(400 / p_message.length) < 40) ? w = 400 : w += p_message.length * 10;
381 _addWindow('dUser','',w,140,'center','');
382 _url('dUser',p_respath + 'files/confirm.html');
383 _cbe('dUser').zIndex(9999999);
384 _show('dUser');
385 p_autopop = 0;
386 }
387 function _quit(c,cval) {
388 p_autopop = 1;
389 if (!c) { _hide('dDummy'); _hide('dUser'); return }
390 if (c.match(/^c(OK|CANCEL)/)) {
391 _hide('dDummy');
392 _hide('dUser');
393 if (c == 'cOK' && (typeof p_cOK) == 'string' && p_cOK.length) eval(p_cOK);
394 else if (c == 'cOK' && (typeof p_cOK) == 'function') p_cOK();
395 else if (c == 'cCANCEL' && (typeof p_cCancel) == 'string' && p_cCancel.length) eval(p_cCancel);
396 else if (c == 'cCANCEL' && (typeof p_cCancel) == 'function') p_cCancel();
397 }
398 else if (c == "cDate" && typeof(cval) == "string") p_caldate.value = cval;
399 }
400 function _docs(anker,apath) {
401 if (! anker || !anker.length) anker = 'docs.html'; else anker = 'docs.html#' + anker;
402 (apath) ? apath += anker : apath = p_respath + 'docs/' + anker;
403 var win = _addWindow('xDTlocDOC','Development documentation',700,480,'ne','');
404 _url(win,apath);
405 _show(win);
406 }
407 function _home() { var win = _addWindow('xDTlocHOME','Home of x-Desktop',800,600,'ne',''); _url(win,'http://www.x-desktop.org'); _show(win) }
408 function _playSound(sfile,vol) {if (! sfile.match(/\.mp3$/i) ) return; if (vol) sfile += "," + vol; _addWindow('dSound',sfile,200,200,'center',''); _property('dSound',"wTitle",sfile); _url('dSound',p_respath + 'files/sound.html'); }
409 function _cbe(wName) {if (wName) return xDTwin.windowalert(wName) }
410 function _property(wName,wProp,wVal) {if (wName) return xDTwin.property(wName,wProp,wVal) }
411 function _maxWindow() {return xDTwin.lastWindow()}
412 function _respath(rpath) {if (rpath) p_respath = rpath; return p_respath}
413 function _moveWindow(wTitle) {_cbe("dMove").innerHtml('<table cellpadding="0" cellspacing="0" border="0" height="100%" width="100%"><tr><td class="xDT_moveWindow" align="center" valign="middle">' + wTitle + '</td></tr></table>') }
414 function _addSkin(wskin,mTop,mBottom) {xDTwin.addSkin(wskin,mTop,mBottom); if (wskin) { _taskbarColor("transparent","#000000","#000000") } }
415 function _dSkin() {return p_desktop }
416 function _lastError() {
417 var errMessages = new Array(["No Errors"],
418 ["Error "],
419 ["Missing parameter"],
420 ["Nothing found"]
421 );
422 return "[" + p_lError[0] + "] " + errMessages[p_lError[0]][0] + " " + p_lError[1];
423 }
424
425 function _window(wName) {
426 this.find = _find;
427 this.skin = _skin;
428 this.pos = _pos;
429 this.title = _title;
430 this.icon = _icon;
431 this.name = _name;
432 this.onClose = _onClose;
433 this.onResize = _onResize;
434 this.onMove = _onMove;
435 this.properties = _properties;
436 function _find(wName) {if (wName != "undefined" && xDTwin.window(wName) != null ) return 1; else return 0 }
437 function _skin(wName,wSkin) {if (! _find(wName) || ! _property(wName,"wSkin") ) return 0;if (wSkin && wSkin.length) _property(wName,"wSkin",wSkin);return _property(wName,"wSkin")}
438 function _pos(wName,wPos) {if (! _find(wName) || ! _property(wName,"wPos") ) return 0;if (wPos && wPos.length) _property(wName,"wPos",wPos);return _property(wName,"wPos")}
439 function _title(wName,wTitle) {if (! _find(wName) ) return 0;if (typeof(wTitle) != 'undefined') _property(wName,"wTitle",wTitle); if (document.getElementById('xDTiT_'+wName)) document.getElementById('xDTiT_'+wName).innerHTML = wTitle ;return _property(wName,"wTitle")}
440 function _icon(wName,wIcon) {if (! _find(wName) ) return 0;if ( wIcon.match(/^[IXMC][10]$/) ) _property(wName,"wIcon",wIcon);return _property(wName,"wIcon")}
441 function _name(wName) {if (wName.indexOf('xDTiF_') == 0) wName = wName.replace(/^xDTiF_/,"");if (! _find(wName) ) return 0;return wName}
442 function _onClose(wName,fcl) {if (wName && (typeof(fcl) == 'string' || typeof(fcl) == 'function')) _property(wName,"fClose",fcl) }
443 function _onResize(wName,fcl) {if (wName && (typeof(fcl) == 'string' || typeof(fcl) == 'function')) _property(wName,"fResize",fcl) }
444 function _onMove(wName,fcl) {if (wName && (typeof(fcl) == 'string' || typeof(fcl) == 'function')) _property(wName,"fMove",fcl) }
445 function _properties(wName) {
446 var str = "";
447 var w = xDTwin.getAllWindows().split('/');
448 if (w[0].length == 0) return "";
449 if (wName && _find(wName)) w = new Array(wName);
450 for (var s in w) {
451 var p = xDTwin.getAllWindowProperties(w[s]).split(",");
452 if (p == "" || _property(w[s],"wName") == "" ) continue;
453 if (_property(w[s],"wIndex") < p_syswin) str += w[s] + " (system)\n"; else str += w[s] + "\n";
454 for (var prop in p) {
455 str += " !-- " + p[prop] + ": ";
456 if (p[prop] == "wHtml" && _property(w[s],p[prop]).length > 15) str += _property(w[s],p[prop]).substr(0,12) + "...";
457 else {
458 var to = typeof _property(w[s],p[prop]);
459 ( to.match(/function|object/) ) ? to = to : to = _property(w[s],p[prop]);
460 str += to;
461 }
462 str += "\n";
463 }
464 str += " !-- " + 'DesktopSkin' + ": " + _dSkin() + "\n";
465 str += " !-- " + 'cbe.width' + ": " + _cbe(w[s]).width() + "\n";
466 str += " !-- " + 'cbe.height' + ": " + _cbe(w[s]).height() + "\n";
467 str += " !-- " + 'cbe.left' + ": " + _cbe(w[s]).left() + "\n";
468 str += " !-- " + 'cbe.top' + ": " + _cbe(w[s]).top() + "\n";
469 str += " !-- " + 'p_zIndex' + ": " + p_zIndex + "\n";
470 str += " !-- " + 'p_respath' + ": " + p_respath + "\n";
471 str += " !-- " + 'p_desktop' + ": " + p_desktop + "\n";
472 str += " !-- " + 'p_tbBgColor' + ": " + p_tbBgColor + "\n";
473 str += " !-- " + 'p_tbColor' + ": " + p_tbColor + "\n";
474 str += " !-- " + 'p_tbBoColor' + ": " + p_tbBoColor + "\n";
475 str += " !-- " + 'p_taskbar' + ": " + p_taskbar + "\n";
476 str += " !-- " + 'p_hidedesktop' + ": " + p_hidedesktop + "\n";
477 str += " !-- " + 'maxwin' + ": " + maxwin + "\n";
478
479 }
480 if (str) { _sysMessage(str); _positionWindow("dMessage") }
481 }
482 }
483 function _desktop() {
484 this.init = _init;
485 this.skin = _skin;
486 var dtw = ""; // Desktop Window Object
487 function _init() {
488 if (dtw == "") { window.cbe.addEventListener('resize',DesktopResizeListener) }
489 _skin(); // startup Desktop
490 p_lastdt = p_desktop;
491 _addWindow('dMessage','System Message',300,200,'ne',''); // create by default
492 _addWindow('dUser','',400,150,'center',''); // create by default
493 _sysMessage("x-Desktop initialized.",true);
494 }
495 function _skin(wSkin) {
496 if (wSkin) p_desktop = wSkin;
497 var _setskin = eval("desktop_" + p_desktop);
498 _setskin();
499 if (xDTwin.getAllWindows(p_syswin) == 0) return;
500 var uw = xDTwin.getAllWindows(p_syswin).split('/');
501 for (var w in uw){if (p_lastdt.length && p_lastdt != _property(uw[w],"wSkin") ) continue; _refreshWindow(uw[w],wSkin); _positionWindow(uw[w]) }
502 _refreshWindow("dMessage",wSkin);
503 _positionWindow("dMessage");
504 _refreshWindow("dUser",wSkin);
505 _positionWindow("dUser");
506 _taskbar();
507 p_lastdt = wSkin;
508 }
509 }
510 function _taskbar(rWin) {
511 if (rWin) {
512 _cbe(rWin).zIndex(xDTwin.xDTdrag());
513 _show(rWin);
514 _property(rWin,"wStat","OK");
515 _taskbar();
516 }
517 var str = ""; var winName = ""; var winTitle = "";
518 for (var i=0;i<=maxwin;i++) { winName = xDTwin.wName(i); if (!winName) continue; if (i < p_syswin && !winName.match(/^(dMessage)$/) ) continue; if (_property(winName,"wStat") != "min") continue; if (str == "") str = winName; else str += "," + winName; }
519 wins = str.split(",");
520 if (!str || wins.length < 1) {_cbe("dTaskbar").resizeTo(20,20); _cbe("dTaskbar").moveTo(0,0); _hide("dTaskbar"); p_taskbar = false; return }
521 str = '<form style="position: absolute">';
522 p_taskbar = true;
523 var bh = 20; // height of default task button, see stylesheet
524 var bw = 120; // width of default task button, see stylesheet
525 var tl = 15; // max title length
526 var h = 0;
527 var bprow = parseInt( (document.cbe.width() - 1) / bw); // buttons per row
528 if (wins.length <= bprow) h = bh;
529 else if ( (wins.length % bprow) == 0 ) h = bh * (wins.length / bprow);
530 else h = bh * (1 + parseInt(wins.length / bprow));
531 //alert("taskbar= " + p_tbBgColor + "/" + p_tbColor);
532 for (var i=0;i<wins.length;i++) {
533 winName = wins[i];
534 winTitle = _property(winName,"wTitle");
535 if (winTitle.length > tl) winTitle = winTitle.substr(0,tl) + "...";
536 str += '<input type="button" class="xDT_min_DEFAULT" style="border: 1px ' + p_tbBoColor + ' solid; background-color: ' + p_tbBgColor + "; color: " + p_tbColor+ '" name="tb' + i + '" value="' + winTitle + '" onclick="' + "xDT.taskbar('" + winName + "')" + '">';
537 }
538 str += '</form>';
539 _cbe("dTaskbar").resizeTo(document.cbe.width() - 1,h);
540 _cbe("dTaskbar").background('transparent');
541 _cbe("dTaskbar").innerHtml(str);
542 _cbe("dTaskbar").moveTo(0,document.cbe.height() - (++h) - 0 );
543 _cbe("dTaskbar").moveTo(0,document.cbe.height() - (++h) - xDTwin.marginBottom(_dSkin()) );
544 _cbe("dTaskbar").zIndex(xDTwin.xDTdrag());
545 _property("dTaskbar","wWidth",_cbe("dTaskbar").width());
546 _property("dTaskbar","wHeight",_cbe("dTaskbar").height());
547 _show("dTaskbar");
548 }
549 function _closeAllWindows(wName,wC) {
550 if (xDTwin.getAllWindows(p_syswin) == 0) return false;
551 var uw = xDTwin.getAllWindows(p_syswin).split('/');
552 if (wName) wName = "," + wName + ",";
553 for (var w in uw){
554 if (wName && wName.indexOf(',' + uw[w] + ',') > -1 ) continue;
555 if (_property(uw[w],"fClose") == "") {_hide(uw[w]); _closeWindow(uw[w],wC) }
556 else if (_property(uw[w],"fClose") != "" && wC) {_hide(uw[w]); _closeWindow(uw[w],wC) }
557 else return false;
558 }
559 _closeWindow('dMessage'); _closeWindow('dUser'); _closeWindow('dDummy'); _closeWindow('dSound');
560 _taskbar();
561 return true;
562 }
563 function _minimizeAllWindows(wName) {
564 if (xDTwin.getAllWindows(p_syswin) == 0) return; var uw = xDTwin.getAllWindows(p_syswin).split('/'); if (wName) wName = "," + wName + ",";
565 for (var w in uw){if (wName && wName.indexOf(',' + uw[w] + ',') > -1 ) continue; _property(uw[w],"wStat","min");_hide(uw[w]) }
566 _taskbar();
567 }
568 function _restoreAllWindows() {
569 if (xDTwin.getAllWindows(p_syswin) == 0) return;
570 var uw = xDTwin.getAllWindows(p_syswin).split('/');
571 for (var w in uw){ _show(uw[w]); _cbe(uw[w]).zIndex(_property(uw[w],"zIndex")); _property(uw[w],"wStat","OK"); }
572 _taskbar();
573 }
574 function _arrangeAllWindows(x,y,xoffset,yoffset,wName) {
575 if ((typeof x) == 'undefined') {x = 20; y = 20; xoffset = 20; yoffset = 20 }
576 if ((typeof y) == 'undefined') {y = 20; xoffset = 20; yoffset = 20 }
577 if ((typeof xoffset) == 'undefined') {xoffset = 20; yoffset = 20 }
578 if ((typeof yoffset) == 'undefined') yoffset = 20;
579 if (xDTwin.getAllWindows(p_syswin) == 0) return;
580 var uw = xDTwin.getAllWindows(p_syswin).split('/');
581 var wLeft = x;
582 var wTop = xDTwin.marginTop(_dSkin());
583 (wTop != 0) ? wTop += 0 : wTop = y;
584 if (wName) wName = "," + wName + ",";
585 for (var w in uw) {
586 if (wName && wName.indexOf(',' + uw[w] + ',') > -1 ) continue;
587 _cbe(uw[w]).zIndex(xDTwin.xDTdrag());
588 _cbe(uw[w]).moveTo(wLeft,wTop);
589 _cbe(uw[w]).resizeTo(_property(uw[w],"wWidth"),_property(uw[w],"wHeight"));
590 _show(uw[w]);
591 _property(uw[w],"wX",wLeft);
592 _property(uw[w],"wY",wTop);
593 _property(uw[w],"zIndex",_cbe(uw[w]).zIndex());
594 _property(uw[w],"wStat","OK");
595 wTop += yoffset;
596 (xoffset > 0) ? wLeft += xoffset : wLeft = wLeft;
597 }
598 _taskbar();
599 }
600 function _preloadImages() {
601 var mysrc = "";
602 for (var i=0;i<arguments.length;i++) {
603 (arguments[i].indexOf(':/') == -1 && arguments[i].indexOf('/') != 0) ? mysrc = p_respath + arguments[i] : mysrc = arguments[i];
604 var img = new Image();
605 img.src = mysrc;
606 }
607 }
608 /*
609 function _data(key,val) {
610 if (_data.arguments.length == 0) {var str = ""; var n = 0; for (var i in p_data) {str += i + "=" + typeof(p_data[i]) + "\t"; n++ } return n }
611 if (typeof(key) != "string" || key.length == 0) return -1;
612 if (_data.arguments.length == 1) return p_data[key]; else {p_data.push[key];p_data[key] = val;}
613 }
614 */
615 /*========================================*/
616 /* -- Modules / Interfaces to 3rd parties */
617 /*========================================*/
618 function _calendar(calfield) {
619 p_caldate = calfield;
620 var w = 'mCalendar';
621 _addWindow(w,'',228,220,'center','xDTnoBORDER');
622 _url(w,p_respath + 'files/calendar.html','no');
623 _cbe(w).zIndex(9999999);
624 _show(w);
625 }
626 /*===================================*/
627 /* -- Object Methods for private use */
628 /*===================================*/
629 function ChooseSize(val) { if (typeof(val) != 'string') return val; var r = val.split(","); if (r.length == 1) return parseInt(r[0]); if ( p_scw < r.length ) return parseInt(r[p_scw]); else return parseInt(r[r.length-1]) }
630 function SetScreen() {p_scw = (screen.width <= 1024)? 0 : 1; if (p_scw) p_scw = (screen.width <= 1280)? 1 : 2; }
631 function SetWindowPos(wName,wPos) {
632 if ( wPos.match(/^(\d+),(\d+)$/) ) {
633 _property(wName,"wX",RegExp.$1); // default wX
634 _property(wName,"wY",RegExp.$2); // default wY
635 _cbe(wName).moveTo(RegExp.$1,RegExp.$2);
636 }
637 else if (wPos.match(/(.+)\:(.)\:([-+]?\d+)$/) ) {
638 if (! xDT.window.find(RegExp.$1) ) {alert("Unknown Window: " + RegExp.$1 + "," + RegExp.$2 + "," + RegExp.$3);_cbe(wName).moveTo('center');_property(wName,"wX",_cbe(wName).left());_property(wName,"wY",_cbe(wName).top()) }
639 else if (RegExp.$2 == "B") {_property(wName,"wX",_property(RegExp.$1,"wX")); _property(wName,"wY",_property(RegExp.$1,"wY") + _property(RegExp.$1,"wHeight") + parseInt(RegExp.$3) ); _cbe(wName).moveTo(_property(wName,"wX"),_property(wName,"wY")) }
640 else if (RegExp.$2 == "T") {_property(wName,"wX",_property(RegExp.$1,"wX"));_property(wName,"wY",_property(RegExp.$1,"wY") - _property(wName,"wHeight") - parseInt(RegExp.$3) );_cbe(wName).moveTo(_property(wName,"wX"),_property(wName,"wY")) }
641 else if (RegExp.$2 == "L") {_property(wName,"wY",_property(RegExp.$1,"wY"));_property(wName,"wX",_property(RegExp.$1,"wX") - _property(wName,"wWidth") - parseInt(RegExp.$3) );_cbe(wName).moveTo(_property(wName,"wX"),_property(wName,"wY")) }
642 else if (RegExp.$2 == "R") {_property(wName,"wY",_property(RegExp.$1,"wY"));_property(wName,"wX",_property(RegExp.$1,"wX") + _property(RegExp.$1,"wWidth") + parseInt(RegExp.$3) );_cbe(wName).moveTo(_property(wName,"wX"),_property(wName,"wY")) }
643 else {alert("Unknown Parameter(s): " + RegExp.$1 + "," + RegExp.$2 + "," + RegExp.$3);_cbe(wName).moveTo('center');_property(wName,"wX",_cbe(wName).left());_property(wName,"wY",_cbe(wName).top()); }
644 }
645 else {_cbe(wName).moveTo(wPos);_property(wName,"wX",_cbe(wName).left());_property(wName,"wY",_cbe(wName).top());}
646 _property(wName,"wPos",wPos);
647 _positionWindow(wName);
648 }
649
650 function DeleteWindowFunction(wName,wC) { if (wC) return true; var f = _property(wName,"fClose"); if ((typeof f) == 'function') return f(wName); if ((typeof f) == 'string' && f.length) return eval(f); return true; }
651 function SetLastError(number,text) { p_lError[0] = number; var fs = functionstack(); (!text) ? p_lError[1] = fs : p_lError[1] = fs + ": " + text; }
652 function functionname(fstr) { var str = fstr.toString().match(/function (\w*)/)[1]; if ((str == null) || (str.length==0)) str="anonymous"; return str; }
653 function functionstack() {
654 if (! p_Debug) return "";
655 var str = "";
656 for (var ac = arguments.caller; ac != null; ac = ac.caller) {
657 if (str != "") str += "->";
658 str += functionname(ac.callee);
659 if (ac.caller == ac) {str += "*"; break }
660 }
661 return str;
662 }
663 /*========================================*/
664 /* final calls during main object creation*/
665 /*========================================*/
666 if (_fmain) xDTwin.setStartup(_fmain);
667 else if ( (typeof start) != 'undefined') xDTwin.setStartup(start);
668 else xDTwin.setStartup(function() { alert("No startup routine defined !") });
669 CheckInit(maxwin,_fmain);
670}
671/*==========================*/
672/* -- External Functions -- */
673/*==========================*/
674function test() { alert('hier') }
675function CheckInit(max) { if (xDTwin.wLength() >= max) xDTwin.Startup(); else {var str = "CheckInit('" + max + "')"; setTimeout(str,10);}}
676function TimeAndDate() {
677 var timer = null; var clock = ""; var secs = 0; var showsecs = 0; var prev = "";
678 this.time = _time; this.stop = _stop; this.clock = _clock; this.date = _date;
679 this.showSecs = function _showSecs(doit) {
680 if (doit) {showsecs = 1 }
681 else { showsecs = 0 }
682 }
683 function _clock() {
684 var time = new Date(); var hours = time.getHours(); var minutes = time.getMinutes();
685 minutes=((minutes < 10) ? "0" : "") + minutes; var seconds = time.getSeconds();
686 seconds=((seconds < 10) ? "0" : "") + seconds; clock = hours + ":" + minutes + ":" + seconds;
687// if (!showsecs) clock = clock.replace(/\:\d\d$/,"");
688// if (clock != prev) {xDT.cbe("dClock").innerHtml('<b class="xDT_clock">' + clock + '</b>'); prev = clock }
689 secs++; timer = setTimeout("_clock()",1000);
690 }
691 function _time() { return clock }
692 function _stop() { clearTimeout(timer) }
693 function _date() {
694 var d=new Date();
695 var monthname=new Array("Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez");
696 var str = d.getDate() + "/" + (d.getMonth() + 1) + "/" + d.getFullYear();
697 }
698}
699function SwiImg(obj,img) { // Switch Image
700 img = img.replace(/^https?:\/\/[^\/]+\//i,'/');
701 document.images[obj].src = img;
702}
703function DesktopResizeListener() {
704 var w = document.cbe.width();
705 var h = document.cbe.height();
706 //w--; h--;
707 xDT.cbe("dDesktop").resizeTo(w,h);
708 xDT.taskbar();
709 xDT.positionAllWindows();
710}
711function dStartListener(e) {
712 xDTwin.noevent(false);
713 var wName = xDTwin.wName(parseInt(e.cbeCurrentTarget.id.replace(/xDTwi/,'')));
714 if (wName.match(/^(dDummy|dUser)$/) ) return;
715 if (xDT.prop(wName,"wStat") == "MAX" && ! xDT.prop(wName,"wIcon").match(/.1$/) ) {xDTwin.noevent(true); return;}
716 else if (xDT.prop(wName,"wIcon") == "C1") {xDTwin.noevent(true); xDT.deleteWindow(wName); return }
717 else if (xDT.prop(wName,"wIcon") == "I1" && wName != "dMessage") {xDTwin.noevent(true); xDT.window.properties(wName); return }
718 else if (xDT.prop(wName,"wIcon") == "M1") {
719 xDT.prop(wName,"wStat","min") ;
720 xDTwin.noevent(true);
721 e.cbeCurrentTarget.hide();
722 xDT.taskbar();
723 return;
724 }
725 else if (xDT.prop(wName,"wIcon") == "X1") {
726 xDT.maximizeWindow(wName);
727 xDTwin.noevent(true);
728 return;
729 }
730 if (e.offsetX > (e.cbeCurrentTarget.width() - 20) && e.offsetY > (e.cbeCurrentTarget.height() - 20) ) {e.cbeCurrentTarget.isResizing = true; /*xDT.innerWindows(wName,'hide');*/ }
731 else e.cbeCurrentTarget.isResizing = false;
732 e.cbeCurrentTarget.zIndex(0);
733 e.cbeCurrentTarget.hide();
734 xDT.cbe("dMove").resizeTo(xDT.prop(wName,"wWidth"),xDT.prop(wName,"wHeight"));
735 xDT.cbe("dMove").moveTo(xDT.prop(wName,"wX"),xDT.prop(wName,"wY"));
736 xDT.cbe("dMove").zIndex(9999999);
737 xDT.moveWindow(xDT.prop(wName,"wTitle"));
738 xDT.prop("dMove","wTitle",xDT.prop(wName,"wTitle"));
739 xDT.moveWindow(xDT.prop("dMove","wTitle") + "<br><br>" + xDT.cbe("dMove").left() + ',' + xDT.cbe("dMove").top() + "<br><br>" + xDT.cbe("dMove").width() + "," + xDT.cbe("dMove").height() );
740 xDT.cbe("dMove").background(xDT.cbe(wName).background(),"");
741 xDT.show("dMove");
742 xDT.innerWindows(wName,'hide');
743}
744function dListener(e) {
745 if (e.cbeCurrentTarget.isResizing) { xDT.cbe("dMove").resizeBy(e.dx,e.dy) }
746 else {xDT.cbe("dMove").moveBy(e.dx,e.dy) }
747 if (xDT.cbe("dMove").left() < 0) { xDT.cbe("dMove").moveTo(0,xDT.cbe("dMove").top()) }
748 if ( (xDT.cbe("dMove").left() + xDT.cbe("dMove").width() ) > document.cbe.width()) { xDT.cbe("dMove").moveTo(document.cbe.width() - xDT.cbe("dMove").width(),xDT.cbe("dMove").top()) }
749 //xDT.moveWindow(xDT.prop("dMove","wTitle") + "<br><br>" + xDT.cbe("dMove").left() + ',' + xDT.cbe("dMove").top() + "<br><br>" + xDT.cbe("dMove").width() + "," + xDT.cbe("dMove").height() );
750
751}
752function dEndListener(e) {
753 var wName = xDTwin.wName(parseInt(e.cbeCurrentTarget.id.replace(/xDTwi/,'')));
754 if (wName == "" || wName.match(/^(dDummy|dUser)$/) ) return;
755 if ( xDTwin.noevent() ) return;
756 e.cbeCurrentTarget.resizeTo(xDT.cbe("dMove").width(),xDT.cbe("dMove").height());
757 if (xDT.cbe("dMove").width() < xDT.prop(wName,"wWidthOrg")) e.cbeCurrentTarget.resizeTo(xDT.prop(wName,"wWidthOrg"),xDT.cbe("dMove").height());
758 if (xDT.cbe("dMove").height() < xDT.prop(wName,"wHeightOrg")) e.cbeCurrentTarget.resizeTo(xDT.cbe("dMove").width(),xDT.prop(wName,"wHeightOrg"));
759 if (xDT.cbe("dMove").width() < xDT.prop(wName,"wWidthOrg") && xDT.cbe("dMove").height() < xDT.prop(wName,"wHeightOrg")) e.cbeCurrentTarget.resizeTo(xDT.prop(wName,"wWidthOrg"),xDT.prop(wName,"wHeightOrg"));
760
761 e.cbeCurrentTarget.moveTo(xDT.cbe("dMove").left(),xDT.cbe("dMove").top());
762 e.cbeCurrentTarget.zIndex(xDTwin.xDTdrag());
763 e.cbeCurrentTarget.show();
764 if (xDT.prop(wName,"innercbe") ) {/*xDT.prop(wName,"innercbe").zIndex(xDT.prop(wName,"cbe").zIndex());*/ xDT.prop(wName,"innercbe").show(); }
765 xDT.prop(wName,"wX",xDT.cbe(wName).left());
766 xDT.prop(wName,"wY",xDT.cbe(wName).top());
767 xDT.prop(wName,"wPos",xDT.cbe(wName).left() + "," + xDT.cbe(wName).top());
768 xDT.prop(wName,"wWidth",xDT.cbe(wName).width());
769 xDT.prop(wName,"wHeight",xDT.cbe(wName).height());
770 xDT.prop(wName,"zIndex",xDTwin.xDTdrag());
771 xDT.cbe("dMove").zIndex(0);
772 xDT.cbe("dMove").resizeTo(10,10);
773 xDT.cbe("dMove").moveTo(xDT.prop(wName,"wX"),xDT.prop(wName,"wY"));
774 xDT.hide("dMove");
775 xDT.positionWindow(wName);
776 xDT.innerWindows(wName,'show');
777 if (e.cbeCurrentTarget.isResizing) { var f = xDT.prop(wName,"fResize"); if ((typeof f) == 'function') return f(wName); if ((typeof f) == 'string' && f.length) return eval(f); }
778 else { var f = xDT.prop(wName,"fMove"); if ((typeof f) == 'function') return f(wName); if ((typeof f) == 'string' && f.length) return eval(f); }
779}
780function skin_DEFAULT(wName) {
781 var frame_bgcolor = "#cacaca";
782 var frame_titleclass = "xDT_wTitleBn";
783 var frame_borderwidth = 2;
784 var frame_topheight = 16;
785 var frame_bottomheight = 10;
786 var frame_contentbgcolor = '#6B8CCE';
787 var frame_dummypic = xDT.resPath() + 'images/blank.gif';
788 var iconpath = xDT.resPath() + 'skins/DEFAULT';
789 var frame_stylecolor = '#000000';
790 var frame_border = 1;
791 var frame_bordertype = "outset"; // solid, outset, inset
792 var frame_style = 'border-top: ' + frame_border + 'px ' + frame_stylecolor + ' ' + frame_bordertype + '; ' +
793 'border-bottom: ' + frame_border + 'px ' + frame_stylecolor + ' ' + frame_bordertype + '; ' +
794 'border-left: ' + frame_border + 'px ' + frame_stylecolor + ' ' + frame_bordertype + '; ' +
795 'border-right: ' + frame_border + 'px ' + frame_stylecolor + ' ' + frame_bordertype + '; ';
796 return (
797 '<table cellpadding="0" cellspacing="0" border="0" height="100%" width="100%"><tr>' +
798 '<td align="left" valign="top" height="100%" width="100%" style="' + frame_style + '">' +
799 '<table cellpadding="0" cellspacing="0" border="0" height="100% width="100%" bgcolor="' + frame_bgcolor + '" >' +
800 '<tr style="cursor: move"><td><img src="' + frame_dummypic + '" width="' + frame_borderwidth + '" height="' + frame_topheight + '" border="0"></td>' +
801 '<td bgcolor="' + frame_bgcolor + '" width="100%" align="left" valign="middle" class="' + frame_titleclass + '">' +
802 '<table cellpadding="0" cellspacing="0" border="0" background="' + iconpath + '/wintitlebgr.gif"><tr>' +
803 '<td class=""><a class="" href="javascript: void(0)" onmouseover="' + "SwiImg('winleft_" + wName + "','" + iconpath + "/winleft_over.gif'); " + 'xDT.prop(' + "'" + wName + "','wIcon','I1'" +')" ' + 'onmouseout="' + "SwiImg('winleft_" + wName + "','" + iconpath + "/winleft.gif');" + 'xDT.prop(' + "'" + wName + "','wIcon','I0'" + ')"'+ '><img name="winleft_' + wName + '" border="0" src="' + iconpath + '/winleft.gif"></a><img name="wintitleleft" border="0" src="' + iconpath + '/wintitleleft.gif"></td>' +
804 '<td width="100%" align="left" valign="middle" class="' + frame_titleclass + '">&nbsp;<span id="xDTiT_' + wName + '">' + xDT.prop(wName,"wTitle") + '</span></td>' +
805 '<td class="' + frame_titleclass + '"><a class="" href="javascript: void(0)" onmouseover="' + "SwiImg('winmin_" + wName + "','" + iconpath + "/winmin_over.gif'); " + 'xDT.prop(' + "'" + wName + "','wIcon','M1'" +')" ' + 'onmouseout="' + "SwiImg('winmin_" + wName + "','" + iconpath + "/winmin.gif'); " + 'xDT.prop(' + "'" + wName + "','wIcon','M0'" + ')"'+ '><img name="winmin_' + wName + '" border="0" src="' + iconpath + '/winmin.gif"></a></td>' +
806 '<td><img src="' + frame_dummypic + '" width="5" border="0"></td>' +
807 '<td class="' + frame_titleclass + '"><a class="" href="javascript: void(0)" onmouseover="' + "SwiImg('winmax_" + wName + "','" + iconpath + "/winmax_over.gif'); " + 'xDT.prop(' + "'" + wName + "','wIcon','X1'" +')" ' + 'onmouseout="' + "SwiImg('winmax_" + wName + "','" + iconpath + "/winmax.gif'); " + 'xDT.prop(' + "'" + wName + "','wIcon','X0'" + ')"'+ '><img name="winmax_' + wName + '" border="0" src="' + iconpath + '/winmax.gif"></a></td>' +
808 '<td><img src="' + frame_dummypic + '" width="5" border="0"></td>' +
809 '<td class="' + frame_titleclass + '"><a class="" href="javascript: void(0)" onmouseover="' + "SwiImg('winclose_" + wName + "','" + iconpath + "/winclose_over.gif'); " + 'xDT.prop(' + "'" + wName + "','wIcon','C1'" +')" ' + 'onmouseout="' + "SwiImg('winclose_" + wName + "','" + iconpath + "/winclose.gif'); " + 'xDT.prop(' + "'" + wName + "','wIcon','C0'" + ')"'+ '><img name="winclose_' + wName + '" border="0" src="' + iconpath + '/winclose.gif"></a></td>' +
810 '</tr></table>' +
811 '</td>' +
812 '<td><img src="' + frame_dummypic + '" width="' + frame_borderwidth + '" height="' + frame_topheight + ' border="0"></td></tr>' +
813 '<tr><td><img src="' + frame_dummypic + '" width="' + frame_borderwidth + '" border="0"></td><td align="left" valign="top" width="100%" background="' + iconpath + '/wintitlebgr.gif" height="100%" style="background: ' + frame_contentbgcolor +'; " id="' + wName + 'iTD' + '"></td><td><img src="' + frame_dummypic + '" width="' + frame_borderwidth + '" border="0"></td></tr>' +
814 '<tr style="cursor: move"><td><img src="' + frame_dummypic + '" width="' + frame_borderwidth + '" height="' + frame_bottomheight + '" border="0"></td><td align="right" width="100%" background="' + iconpath + '/wintitlebgr.gif"><img src="' + frame_dummypic + '" style="cursor: se-resize" width="15" height="' + frame_bottomheight + '" border="0"></td><td><img src="' + frame_dummypic + '" style="cursor: se-resize" width="' + frame_borderwidth + '" height="' + frame_bottomheight + '" border="0"></td></tr></table>' +
815 '</td></tr></table>'
816 );
817}
818function desktop_DEFAULT() {
819 var iconpath = xDT.resPath() + 'skins/DEFAULT';
820 xDT.addSkin('DEFAULT',0,0);
821 xDT.taskbarColor("#6B8CCE","#ffffff","#000000");
822 xDT.cbe("dDesktop").resizeTo(document.cbe.width(),document.cbe.height());
823 xDT.cbe("dDesktop").innerHtml('<img src="' + iconpath +'/wallpaper_default.jpg" border="0" style="width: 100%; height: 100%">');
824 xDT.cbe("dDesktop").zIndex(0);
825 xDT.show("dDesktop");
826}
827function skin_xDTnoBORDER(wName) {
828 var frame_borderwidth = 1;
829 var frame_topheight = 10;
830 var frame_bgcolor = "transparent";
831 var frame_dummypic = xDT.resPath() + 'images/blank.gif';
832 return (
833 '<table style="background-color: ' + frame_bgcolor + '" cellpadding="0" cellspacing="0" border="0" height="100%" width="100%">' +
834 '<tr><td></td><td style="cursor: move" height="' + frame_topheight + '"></td><td></td></tr>' +
835 '<tr><td><img src="' + frame_dummypic + '" width="' + frame_borderwidth + '" border="0"></td><td width="100%" height="100%" id="' + wName + 'iTD' + '"></td><td><img src="' + frame_dummypic + '" width="' + frame_borderwidth + '" border="0"></td></tr>' +
836 '<tr><td></td><td height="' + frame_borderwidth + '"></td><td></td></tr>' +
837 '</table>'
838 );
839}
840function skin_xDTnoWIN(wName) {
841 return ('<table cellpadding="0" cellspacing="0" border="0" height="100%" width="100%"><tr><td width="100%" height="100%" id="' + wName + 'iTD' + '"></td></tr></table>');
842}