15 var Desktop = Desktop || {};
17 if (typeof Debug ==
'undefined')
18 console.log(
'ERROR: Debug is undefined! Must include Debug.js before Desktop.js');
19 else if (typeof Globals ==
'undefined')
20 console.log(
'ERROR: Globals is undefined! Must include Globals.js before Desktop.js');
24 Desktop.init =
function(security) {
26 Desktop.desktop = Desktop.createDesktop(security);
28 Debug.log(
"Desktop.desktop Initalized Successfully",Debug.LOW_PRIORITY);
31 Desktop.SECURITY_TYPE_NONE =
"NoSecurity";
32 Desktop.SECURITY_TYPE_DIGEST_ACCESS =
"DigestAccessAuthentication";
39 Desktop.createDesktop =
function(security) {
41 if (typeof Debug ==
'undefined')
return 0;
43 if(
false === (
this instanceof Desktop.createDesktop)) {
46 return new Desktop.createDesktop(security);
131 var _defaultWindowMinZindex = 10;
132 var _defaultWindowMaxZindex = 10000;
133 var _defaultDashboardZindex = 11000;
134 var _defaultWidth = 620;
135 var _defaultHeight = 580;
136 var _defaultLeft = 200;
137 var _defaultTop = 70;
138 var _defaultLeftOffset = 50;
139 var _defaultTopOffset = 25;
140 var _defaultOffsetTimes = 5;
141 var _currentLeft = _defaultLeft;
142 var _currentTop = _defaultTop;
144 var _windows =
new Array();
146 var _dashboard, _icons, _windowZmailbox, _mouseOverXmailbox, _mouseOverYmailbox;
147 var _needToLoginMailbox, _updateTimeMailbox, _updateSettingsMailbox, _settingsLayoutMailbox, _openWindowMailbox, _blockSystemCheckMailbox;
148 var _windowColorPostbox;
149 var _MAILBOX_TIMER_PERIOD = 500;
151 var _SYS_MSG_SOUND_PATH =
"/WebPath/sounds/fx-System-Message.wav";
152 var _sysMsgSound =
new Audio(_SYS_MSG_SOUND_PATH);
159 var _sysMsgCounter = 0;
160 var _SYS_MSG_MAX_COUNT = 10;
162 var _firstCheckOfMailboxes =
true;
170 this.checkMailboxTimer;
171 this.serverConnected =
true;
172 this.security = security;
174 this.defaultWindowFrameColor =
"rgba(196,229,255,.9)";
180 var _handleDesktopResize =
function(event) {
181 _desktopElement.style.height = (window.innerHeight-_desktopElement.offsetTop) +
"px";
182 _desktopElement.style.width = (window.innerWidth-_desktopElement.offsetLeft) +
"px";
183 if(!_dashboard)
return;
184 _dashboard.redrawDashboard();
185 if(_login) _login.redrawLogin();
186 if(_icons) _icons.redrawIcons();
189 if(_windows.length && _windows[_windows.length-1].isMaximized()) {
190 var w = _windows[_windows.length-1];
191 w.setWindowSizeAndPosition(w.getWindowX(),w.getWindowY(),w.getWindowWidth(),w.getWindowHeight());
201 var _getWindowLayoutStr =
function() {
202 var dw = Desktop.desktop.getDesktopContentWidth()/10000.0;
203 var dh = Desktop.desktop.getDesktopContentHeight()/10000.0;
204 var dx = Desktop.desktop.getDesktopContentX();
205 var dy = Desktop.desktop.getDesktopContentY();
208 for(var i=0;i<_windows.length;++i)
210 if(_windows[i].getWindowName() ==
"Settings")
continue;
212 layout += (i?
",":
"") +
213 encodeURIComponent(_windows[i].getWindowName())
214 +
"," + encodeURIComponent(_windows[i].getWindowSubName())
215 +
"," + encodeURIComponent(_windows[i].getWindowUrl())
216 +
"," + (((_windows[i].getWindowX()-dx)/dw)|0)
217 +
"," + (((_windows[i].getWindowY()-dy)/dh)|0)
218 +
"," + ((_windows[i].getWindowWidth()/dw)|0)
219 +
"," + ((_windows[i].getWindowHeight()/dh)|0)
220 +
"," + (_windows[i].isMinimized()?
"0":(_windows[i].isMaximized()?
"2":
"1"));
228 var _scrambleEggs =
function(u) {
return u; }
230 var _getForeWindow =
function() {
return _windows.length?_windows[_windows.length-1]:0; }
232 var _closeWindow =
function(win) {
233 Desktop.desktop.setForeWindow(win);
234 win.windiv.parentNode.removeChild(win.windiv);
238 _windows.splice(_windows.length-1,1);
241 _dashboard.updateWindows();
249 var _checkMailboxes =
function(win)
253 if(_firstCheckOfMailboxes)
255 Debug.log(
"First check of mailboxes!");
257 Debug.log(
"Checking for any shortcut work from get parameters...",Debug.LOW_PRIORITY);
258 _firstCheckOfMailboxes =
false;
259 Desktop.desktop.actOnParameterAction();
264 if(_blockSystemCheckMailbox.innerHTML ==
"1")
266 Desktop.desktop.login.blackout(
true);
270 Desktop.desktop.login.blackout(
false);
280 if(_openWindowMailbox.innerHTML !=
"")
282 Debug.log(
"_openWindowMailbox.textContent=" + _openWindowMailbox.textContent);
285 var paramsStr = _openWindowMailbox.textContent;
288 var spliti, splitiOld = 0;
289 for(var i=0;i<paramCnt;++i)
293 params.push(paramsStr.substr(splitiOld));
297 spliti = paramsStr.indexOf(
'&', splitiOld);
298 params.push(paramsStr.substr(splitiOld,spliti-splitiOld))
299 splitiOld = spliti+1;
303 var requestingWindowId =
"", windowPath =
"";
304 var windowName, windowSubname, windowUnique;
305 for(var i=0;i<params.length;++i)
307 spliti = params[i].indexOf(
'=');
308 varPair = [params[i].substr(0,spliti),params[i].substr(spliti+1)];
309 if(varPair[0] ==
"requestingWindowId")
310 requestingWindowId = varPair[1];
311 else if(varPair[0] ==
"windowPath")
312 windowPath = varPair[1];
313 else if(varPair[0] ==
"windowName")
314 windowName = varPair[1];
315 else if(varPair[0] ==
"windowSubname")
316 windowSubname = varPair[1];
317 else if(varPair[0] ==
"windowUnique")
318 windowUnique = varPair[1];
320 if(requestingWindowId !=
"" && windowPath !=
"")
324 Debug.log(
"_openWindowMailbox.innerHTML=" + _openWindowMailbox.innerHTML);
325 Debug.log(
"requestingWindowId=" + requestingWindowId);
326 Debug.log(
"windowPath=" + windowPath);
327 Debug.log(
"windowName=" + windowName);
328 Debug.log(
"windowSubname=" + windowSubname);
329 Debug.log(
"windowUnique=" + windowUnique);
335 if(windowSubname ==
"undefined" &&
336 windowUnique ==
"undefined")
338 Debug.log(
"Opening desktop window... " + windowName);
340 var pathUniquePair = Desktop.desktop.icons.iconNameToPathMap[windowName];
341 console.log(
"Desktop.desktop.icons.iconNameToPathMap",
342 Desktop.desktop.icons.iconNameToPathMap);
344 if(pathUniquePair ===
347 Debug.log(
"An error occurred opening the window named '" +
348 windowName +
"' - it was not found in the Desktop icons. " +
349 "Do you have permissions to access this window? Notify admins if the problem persists.",
350 Debug.HIGH_PRIORITY);
353 var str =
"requestingWindowId=" + requestingWindowId;
355 _openWindowMailbox.innerHTML = str;
360 var pathStr = pathUniquePair[0];
362 if(windowPath !=
"undefined")
364 Debug.log(
"Adding parameter path " + windowPath);
365 if(pathStr.indexOf(
'&') > 0)
367 else if(pathStr.length &&
368 pathStr[pathStr.lengh-1] !=
'?')
370 windowPath = pathStr + windowPath;
373 windowPath = pathStr;
375 newWin = Desktop.desktop.addWindow(
379 eval(pathUniquePair[1]));
383 newWin = Desktop.desktop.addWindow(
391 setTimeout(
function(){ Desktop.desktop.setForeWindow(newWin); }, 200);
393 var str =
"requestingWindowId=" + requestingWindowId;
395 _openWindowMailbox.innerHTML = str;
403 if(!Desktop.desktop.login || !Desktop.desktop.login.getCookieCode(
true))
405 if(_needToLoginMailbox.innerHTML ==
"1")
406 _needToLoginMailbox.innerHTML =
"";
412 if(_windowZmailbox.innerHTML > _defaultWindowMaxZindex)
414 Desktop.desktop.setForeWindow(0);
419 if(_needToLoginMailbox.innerHTML ==
"1")
421 _needToLoginMailbox.innerHTML =
"";
422 if(!document.getElementById(
"Desktop-loginDiv") &&
423 !Desktop.desktop.login.isBlackout())
426 Debug.log(
"DesktopContent signaled new login needed!",Debug.HIGH_PRIORITY);
430 Debug.log(
"Ignoring desktop content need for login signal due to blackout.");
434 if(parseInt(_updateTimeMailbox.innerHTML) > parseInt(Desktop.desktop.login.getCookieTime()))
435 Desktop.desktop.login.updateCookieFromContent(parseInt(_updateTimeMailbox.innerHTML));
438 if(_updateSettingsMailbox.innerHTML !=
"")
444 if(_updateSettingsMailbox.innerHTML ==
"LAYOUT")
447 var layout = _getWindowLayoutStr();
448 _settingsLayoutMailbox.innerHTML = layout;
449 Debug.log(
"Desktop _updateSettingsMailbox " + layout,Debug.LOW_PRIORITY);
454 var xml = _updateSettingsMailbox.innerHTML;
456 req.responseXML = (
new window.DOMParser() ).parseFromString(xml,
"text/xml");
457 _login.applyUserPreferences(req);
460 _updateSettingsMailbox.innerHTML =
"";
465 if(_sysMsgCounter == _SYS_MSG_MAX_COUNT)
468 if(_blockSystemCheckMailbox.innerHTML ==
"1" ||
469 Desktop.desktop.login.isBlackout())
471 Debug.log(
"System blackout (likely rebooting)...");
475 Desktop.XMLHttpRequest(
"Request?RequestType=getSystemMessages",
"",_handleSystemMessages);
480 var _lastSystemMessage =
"";
483 var _handleSystemMessages =
function(req) {
491 userLock = Desktop.getXMLValue(req,
"username_with_lock");
492 Desktop.desktop.dashboard.displayUserLock(userLock);
494 var tmp = Desktop.getXMLValue(req,
"systemMessages");
501 if((tmpi = tmp.indexOf(_lastSystemMessage)) >= 0)
503 Debug.log(
"Desktop pretmp " + tmp);
504 Debug.log(
"Desktop _lastSystemMessage " + _lastSystemMessage);
505 Debug.log(
"Desktop tmp " + tmp.substr(tmpi+_lastSystemMessage.length+1));
506 tmp = tmp.substr(tmpi+_lastSystemMessage.length+1);
512 var msgArr = tmp.split(
"|");
513 Debug.log(
"Desktop msgArr.length " + msgArr.length);
515 if(msgArr.length < 2)
return;
517 Debug.log(
"Desktop _handleSystemMessages ========================== " + Desktop.formatTime(msgArr[0]) +
519 ,Debug.LOW_PRIORITY);
522 var sysMsgEl = document.createElement(
"div");
523 sysMsgEl.setAttribute(
"class",
"Desktop-systemMessageBox");
524 sysMsgEl.setAttribute(
"id",
"Desktop-systemMessageBox-" + _sysMsgId);
525 sysMsgEl.style.left = (50 + _sysMsgId % 5 * 10) +
"px";
526 sysMsgEl.style.top = (50 + _sysMsgId % 5 * 10) +
"px";
527 _desktopElement.appendChild(sysMsgEl);
531 for(var i=0;i<msgArr.length;i+=2)
533 str +=
"<div style='font-size:12px'>System Message Received at " + Desktop.formatTime(msgArr[i]) +
"</div>";
534 str +=
"<div>" + msgArr[i+1] +
"</div><br>";
535 _lastSystemMessage = msgArr[i] +
"|" + msgArr[i+1];
539 str +=
"<div style='float:right; margin-left:30px'>";
540 str +=
"<a href='Javascript:Desktop.closeSystemMessage(" + _sysMsgId +
");' " +
541 "title='Click here to dismiss system message'>Dismiss</a></div>";
543 sysMsgEl.innerHTML = str;
545 if(sysMsgEl.clientHeight > 300)
546 sysMsgEl.style.height = 300 +
"px";
556 this.getDesktopWidth =
function() {
return _desktopElement.clientWidth;}
557 this.getDesktopHeight =
function() {
return _desktopElement.clientHeight;}
558 this.getDesktopX =
function() {
return _desktopElement.offsetLeft;}
559 this.getDesktopY =
function() {
return _desktopElement.offsetTop;}
560 this.getDesktopContentX =
function() {
return _desktopElement.offsetLeft+_dashboard.getDashboardWidth();}
561 this.getDesktopContentY =
function() {
return _desktopElement.offsetTop+_dashboard.getDashboardHeight();}
562 this.getDesktopContentWidth =
function() {
return _desktopElement.clientWidth-_dashboard.getDashboardWidth();}
563 this.getDesktopContentHeight =
function() {
return _desktopElement.clientHeight-_dashboard.getDashboardHeight();}
564 this.getNumberOfWindows =
function() {
return _windows.length;}
565 this.getWindowNameByIndex =
function(i) {
return _windows[i].getWindowName();}
566 this.getWindowSubNameByIndex =
function(i) {
return _windows[i].getWindowSubName();}
567 this.getWindowByIndex =
function(i) {
return _windows[i];}
568 this.getForeWindow = _getForeWindow;
569 this.redrawDesktop = _handleDesktopResize;
570 this.getLastFrameMouseX =
function() {
return parseInt(_mouseOverXmailbox.innerHTML);}
571 this.getLastFrameMouseY =
function() {
return parseInt(_mouseOverYmailbox.innerHTML);}
572 this.resetFrameMouse =
function() { _mouseOverXmailbox.innerHTML = -1;_mouseOverYmailbox.innerHTML = -1;}
573 this.getWindowLayoutStr = _getWindowLayoutStr;
587 this.addWindow =
function(name,subname,url,unique,extraStep) {
588 Debug.log(name +
" - " + subname +
" - " + url +
" - " + unique,Debug.LOW_PRIORITY);
591 Debug.log(
"Adding window uniquely",Debug.LOW_PRIORITY);
592 for(var i=0;i<_windows.length;++i)
593 if(_windows[i].getWindowName() == name && _windows[i].getWindowSubName() == subname) {
594 Debug.log(
"Window creation failed. Not unique.",Debug.LOW_PRIORITY);
595 if(_windows[i].isMinimized()) {
596 Debug.log(_windows[i].getWindowSubName() +
"was minimized but will now be restored!");
597 _windows[i].unminimize();
600 Desktop.desktop.setForeWindow(_windows[i]);
605 if(_windows.length + _defaultWindowMinZindex >= _defaultWindowMaxZindex) {
606 Debug.log(
"FAILED -- Desktop Window Added - too many windows!",Debug.HIGH_PRIORITY);
610 if(name ==
"Security Settings") {
614 else if(name ==
"Edit User Data") {
619 window_width = _defaultWidth;
620 window_height = _defaultHeight;
625 var newWin = Desktop.createWindow(_winId++,_windows.length + _defaultWindowMinZindex,name,subname,url,
626 window_width,window_height,_dashboard.getDashboardWidth() + _currentLeft,_currentTop);
629 if(_currentLeft > _defaultLeft+_defaultOffsetTimes*_defaultLeftOffset) {
630 _currentLeft = _defaultLeft;
631 if(_currentTop > _defaultTop + (_defaultOffsetTimes+1)*_defaultTopOffset)
632 _currentTop = _defaultTop;
634 _currentTop = _defaultTop + _defaultTopOffset;
638 _currentLeft += _defaultLeftOffset;
639 _currentTop += _defaultTopOffset;
642 _windows.push(newWin);
644 _desktopElement.appendChild(newWin.windiv);
646 Debug.log(
"Desktop Window Added with id " + _windows[_windows.length-1].getWindowId(),Debug.LOW_PRIORITY);
648 _dashboard.updateWindows();
653 setTimeout(
function(){
654 Desktop.desktop.setForeWindow(newWin);
655 Debug.log(
"extraStep=" + extraStep);
659 Desktop.desktop.dashboard.windowDashboardOrganize();
662 Desktop.desktop.toggleFullScreen();
676 this.getWindowById =
function(id) {
677 for(var i=0;i<_windows.length;++i) {
678 if(_windows[i].getWindowId() == id)
return _windows[i];
689 this.setForeWindow =
function(win) {
693 for(var i=0;i<_windows.length-1;++i) {
695 for(var j=i+1;j<_windows.length;++j)
696 if(_windows[j].getWindowZ() < _windows[min].getWindowZ())
701 _windows[i] = _windows[min];
703 _windows[i].setWindowZ(i+_defaultWindowMinZindex);
705 _windows[_windows.length-1].setWindowZ(_windows.length-1+_defaultWindowMinZindex);
706 _windowZmailbox.innerHTML = _defaultWindowMaxZindex;
711 for(var i=0;win && i<=_windows.length;++i) {
714 var winToMov = i<_windows.length?_windows[i]:win;
715 winToMov.setWindowZ(i-1 + _defaultWindowMinZindex);
716 _windows[i-1] = winToMov;
718 else if(_windows[i] == win) found = 1;
722 Debug.log(
"Desktop Foreground window not Found!! Window: " +
723 win.getWindowSubName());
725 _dashboard.updateWindows();
733 this.closeWindowById =
function(id) {
734 var win = this.getWindowById(
id);
735 if(win == -1)
return -1;
741 this.maximizeWindowById =
function(id) {
742 var win = this.getWindowById(
id);
743 if(win == -1)
return -1;
744 this.setForeWindow(win);
745 this.toggleFullScreen();
750 this.toggleFullScreen =
function(e) {
751 if(!_getForeWindow())
return;
753 _getForeWindow().isMaximized() ? _getForeWindow().unmaximize(): _getForeWindow().maximize();
755 Desktop.desktop.redrawDashboardWindowButtons();
759 Debug.log(
"Full Screen Toggled",Debug.LOW_PRIORITY);
762 this.redrawDashboardWindowButtons =
function() {
763 _dashboard.redrawFullScreenButton();
764 _dashboard.redrawRefreshButton();
765 _dashboard.redrawShowDesktopButton();
768 this.refreshWindowById =
function(id) {
769 var win = this.getWindowById(
id);
770 if(win == -1)
return -1;
772 this.setForeWindow(win);
773 this.refreshWindow();
774 console.log(
"Finished refreshWindow() " +
id);
777 this.refreshWindow =
function(e) {
778 if(!_getForeWindow())
return;
781 var window = _getForeWindow();
782 var
id = window.getWindowId();
783 var z = window.getWindowZ();
784 var name = window.getWindowName();
785 var subname = window.getWindowSubName();
786 var url = window.getWindowUrl();
787 var width = window.getWindowWidth();
788 var height = window.getWindowHeight();
789 var x = window.getWindowX();
790 var y = window.getWindowY();
791 var isMax = window.isMaximized();
792 var isMin = window.isMinimized();
794 _closeWindow(window);
795 console.log(window,
id, z, name, width, height);
797 var newWindow = this.addWindow(name,subname,url);
798 newWindow.setWindowSizeAndPosition(x,y,width,height);
801 newWindow.maximize();
803 newWindow.minimize();
810 this.minimizeWindowById =
function(id) {
811 var win = this.getWindowById(
id);
812 if(win == -1)
return -1;
814 this.setForeWindow(win);
815 this.toggleMinimize();
820 this.toggleMinimize =
function(e) {
821 if(!_getForeWindow())
return;
823 if(_getForeWindow().isMinimized())
824 _getForeWindow().unminimize();
826 _getForeWindow().minimize();
827 Debug.log(
"Minimize Toggled",Debug.LOW_PRIORITY);
833 this.clickedWindowDashboard =
function(id) {
834 var win = this.getWindowById(
id);
835 if(win == -1)
return -1;
836 if(_getForeWindow() != win) {
837 if(_getForeWindow().isMaximized()) this.toggleFullScreen();
838 this.setForeWindow(win);
839 if(_getForeWindow().isMinimized()) this.toggleMinimize();
843 this.toggleMinimize();
848 this.setDefaultWindowColor =
function(color) {
849 this.defaultWindowFrameColor = color;
850 _windowColorPostbox.innerHTML = this.defaultWindowFrameColor;
852 for(var i=0;i<_windows.length;++i)
853 _windows[i].windiv.style.backgroundColor =
this.defaultWindowFrameColor;
861 this.defaultLayoutSelect =
function(i) {
862 Debug.log(
"Desktop defaultLayoutSelect " + i,Debug.LOW_PRIORITY);
865 var numOfUserLayouts = 5;
866 var numOfSystemLayouts = 5;
867 if(i >= numOfSystemLayouts+1 &&
868 i <= numOfSystemLayouts+1+numOfUserLayouts)
869 layoutStr = _login.getUserDefaultLayout(i-(numOfSystemLayouts+1));
870 else if(i >= 0 && i <= numOfSystemLayouts)
871 layoutStr = _login.getSystemDefaultLayout(i);
874 Debug.log(
"Invalid layout index: " + i, Debug.HIGH_PRIORITY);
877 var layoutArr = layoutStr.split(
",");
880 var numOfWins = parseInt(layoutArr.length/numOfFields);
882 Debug.log(
"Desktop defaultLayoutSelect layout numOfFields=" + numOfFields);
883 Debug.log(
"Desktop defaultLayoutSelect layout " + numOfWins +
884 " windows - " + layoutStr);
887 Desktop.desktop.closeAllWindows();
902 var dw = Desktop.desktop.getDesktopContentWidth()/10000.0;
903 var dh = Desktop.desktop.getDesktopContentHeight()/10000.0;
904 var dx = Desktop.desktop.getDesktopContentX();
905 var dy = Desktop.desktop.getDesktopContentY();
906 for(i=0;i<numOfWins;++i)
908 Debug.log(
"adding " + layoutArr[i*numOfFields].substr(1) +
"-" + layoutArr[i*numOfFields+1],Debug.LOW_PRIORITY);
910 decodeURIComponent(layoutArr[i*numOfFields]),
911 decodeURIComponent(layoutArr[i*numOfFields+1]),
912 decodeURIComponent(layoutArr[i*numOfFields+2]),
914 _windows[_windows.length-1].setWindowSizeAndPosition(
915 layoutArr[i*numOfFields+3]*dw + dx,
916 layoutArr[i*numOfFields+4]*dh + dy,
917 layoutArr[i*numOfFields+5]*dw,
918 layoutArr[i*numOfFields+6]*dh);
920 if((layoutArr[i*numOfFields+7]|0) == 0)
921 _windows[_windows.length-1].minimize();
922 else if((layoutArr[i*numOfFields+7]|0) == 2)
923 _windows[_windows.length-1].maximize();
929 this.closeAllWindows =
function() {
930 Debug.log(
"Desktop closeAllWindows",Debug.LOW_PRIORITY);
932 while(_windows.length) _closeWindow(_windows[_windows.length-1]);
937 this.resetDesktop =
function(permissions) {
939 _needToLoginMailbox.innerHTML =
"";
940 _blockSystemCheckMailbox.innerHTML =
"";
943 if(permissions !== undefined)
944 Desktop.desktop.icons.resetWithPermissions(permissions);
947 if(!Desktop.desktop.login || !Desktop.desktop.login.getCookieCode(
true))
949 Desktop.desktop.login.setupLogin();
951 window.clearInterval(Desktop.desktop.checkMailboxTimer);
952 Desktop.desktop.checkMailboxTimer = setInterval(_checkMailboxes,
953 _MAILBOX_TIMER_PERIOD);
965 this.refreshDesktop =
function() {
968 for(var i=0; i<Desktop.desktop.getNumberOfWindows();++i)
970 Desktop.desktop.refreshWindowById(Desktop.desktop.getWindowByIndex(i));
978 this.actOnParameterAction =
function() {
988 var paramsStr = window.parent.window.location.search.substr(1);
990 var paramCnt = 5 + (Desktop.isWizardMode()?1:0);
991 var spliti, splitiOld = 0;
992 for(var i=0;i<paramCnt;++i)
996 params.push(paramsStr.substr(splitiOld));
1000 spliti = paramsStr.indexOf(
'&', splitiOld);
1001 params.push(paramsStr.substr(splitiOld,spliti-splitiOld))
1002 splitiOld = spliti+1;
1006 var requestingWindowId =
"", windowPath =
"";
1007 var windowName, windowSubname, windowUnique, newWindowOps;
1008 for(var i=0;i<params.length;++i)
1010 spliti = params[i].indexOf(
'=');
1011 varPair = [params[i].substr(0,spliti),params[i].substr(spliti+1)];
1012 if(varPair[0] ==
"requestingWindowId")
1013 requestingWindowId = varPair[1];
1014 else if(varPair[0] ==
"windowPath")
1015 windowPath = decodeURIComponent(varPair[1]);
1016 else if(varPair[0] ==
"windowName")
1017 windowName = varPair[1];
1018 else if(varPair[0] ==
"windowSubname")
1019 windowSubname = varPair[1];
1020 else if(varPair[0] ==
"windowUnique")
1021 windowUnique = varPair[1];
1024 if(windowPath.indexOf(
"newWindowOps") >= 0)
1027 newWindowOps = windowPath.split(
'&')[1].split(
'=')[1];
1028 windowPath = windowPath.split(
'&')[0];
1050 if(requestingWindowId !=
"" && windowPath !=
"")
1053 Debug.log(
"_openWindowMailbox.innerHTML=" + _openWindowMailbox.innerHTML);
1054 Debug.log(
"requestingWindowId=" + requestingWindowId);
1055 Debug.log(
"windowPath=" + windowPath);
1056 if(newWindowOps) newWindowOps = newWindowOps.replace(/%22/g,
"\"");
1057 Debug.log(
"newWindowOps=" + newWindowOps);
1058 windowName = windowName.replace(/%20/g,
" ");
1059 Debug.log(
"windowName=" + windowName);
1060 windowSubname = windowSubname.replace(/%20/g,
" ");
1061 Debug.log(
"windowSubname=" + windowSubname);
1062 Debug.log(
"windowUnique=" + windowUnique);
1068 if(windowName.indexOf(
"Desktop.openLayout(") == 0)
1070 var layoutIndex = windowName.substr((
"Desktop.openLayout(").length,
1071 windowName.length-1-(
"Desktop.openLayout(").length) | 0;
1072 Debug.log(
"Opening layout... " + layoutIndex);
1074 if(pathUniquePair ===
1078 if(_firstCheckOfMailboxes)
1080 Debug.log(
"Perhaps user layout preferences have not been setup yet, try again at mailbox check.");
1086 _firstCheckOfMailboxes =
false;
1088 Desktop.desktop.dashboard.toggleWindowDashboard(0,
false);
1089 Desktop.desktop.defaultLayoutSelect(layoutIndex);
1095 if(windowSubname ==
"undefined" &&
1096 windowUnique ==
"undefined")
1098 Debug.log(
"Opening desktop window... " + windowName);
1101 var pathUniquePair = Desktop.desktop.icons.iconNameToPathMap[windowName];
1102 console.log(
"Desktop.desktop.icons.iconNameToPathMap",
1103 Desktop.desktop.icons.iconNameToPathMap);
1105 if(pathUniquePair ===
1109 if(_firstCheckOfMailboxes)
1111 Debug.log(
"Perhaps icons have not been setup yet, try again at mailbox check.");
1115 Debug.log(
"An error occurred opening the window named '" +
1116 windowName +
"' - it was not found in the Desktop icons. " +
1117 "Do you have permissions to access this window? Notify admins if the problem persists.",
1118 Debug.HIGH_PRIORITY);
1122 _openWindowMailbox.innerHTML =
"";
1125 var pathStr = pathUniquePair[0];
1127 if(windowPath !=
"undefined")
1129 Debug.log(
"Adding parameter path " + windowPath);
1130 if(pathStr.indexOf(
'&') > 0)
1132 else if(pathStr.length &&
1133 pathStr[pathStr.lengh-1] !=
'?')
1135 windowPath = pathStr + windowPath;
1138 windowPath = pathStr;
1140 newWin = Desktop.desktop.addWindow(
1144 ((windowPath.indexOf(
'?') < 0)?
"?":
"&") +
1145 ((newWindowOps)?
"newWindowOps=" + newWindowOps:
""),
1146 eval(pathUniquePair[1]));
1150 _firstCheckOfMailboxes =
false;
1151 newWin = Desktop.desktop.addWindow(
1155 ((windowPath.indexOf(
'?') < 0)?
"?":
"&") +
1156 ((newWindowOps)?
"newWindowOps=" + newWindowOps:
""),
1157 eval(windowUnique));
1162 Desktop.desktop.dashboard.toggleWindowDashboard(0,
false);
1166 setTimeout(
function(){
1167 Desktop.desktop.setForeWindow(newWin);
1168 Desktop.desktop.toggleFullScreen();
1172 _openWindowMailbox.innerHTML =
"";
1181 _desktopElement = document.createElement(
"div");
1182 _desktopElement.setAttribute(
"id",
"Desktop");
1183 document.body.appendChild(_desktopElement);
1184 document.body.onmousemove = Desktop.handleBodyMouseMove;
1185 window.onmouseup = Desktop.handleWindowMouseUp;
1186 document.body.addEventListener(
'touchmove',Desktop.handleBodyTouchMove);
1187 document.body.addEventListener(
'touchend',Desktop.handleBodyTouchEnd);
1188 window.onresize = _handleDesktopResize;
1189 Desktop.desktop =
this;
1192 _windowZmailbox = document.createElement(
"div");
1193 _windowZmailbox.setAttribute(
"id",
"Desktop-windowZmailbox");
1194 _windowZmailbox.innerHTML = _defaultWindowMaxZindex;
1195 _windowZmailbox.style.display =
"none";
1196 _desktopElement.appendChild(_windowZmailbox);
1199 _mouseOverXmailbox = document.createElement(
"div");
1200 _mouseOverXmailbox.setAttribute(
"id",
"Desktop-mouseOverXmailbox");
1201 _mouseOverXmailbox.style.display =
"none";
1202 _desktopElement.appendChild(_mouseOverXmailbox);
1205 _mouseOverYmailbox = document.createElement(
"div");
1206 _mouseOverYmailbox.setAttribute(
"id",
"Desktop-mouseOverYmailbox");
1207 _mouseOverYmailbox.style.display =
"none";
1208 _desktopElement.appendChild(_mouseOverYmailbox);
1209 this.resetFrameMouse();
1212 var tmpHiddenDiv = document.createElement(
"div");
1213 tmpHiddenDiv.setAttribute(
"id",
"DesktopContent-cookieCodeMailbox");
1214 tmpHiddenDiv.style.display =
"none";
1215 _desktopElement.appendChild(tmpHiddenDiv);
1216 _updateTimeMailbox = document.createElement(
"div");
1217 _updateTimeMailbox.setAttribute(
"id",
"DesktopContent-updateTimeMailbox");
1218 _updateTimeMailbox.style.display =
"none";
1219 _desktopElement.appendChild(_updateTimeMailbox);
1220 _needToLoginMailbox = document.createElement(
"div");
1221 _needToLoginMailbox.setAttribute(
"id",
"DesktopContent-needToLoginMailbox");
1222 _needToLoginMailbox.style.display =
"none";
1223 _desktopElement.appendChild(_needToLoginMailbox);
1225 _blockSystemCheckMailbox = document.createElement(
"div");
1226 _blockSystemCheckMailbox.setAttribute(
"id",
"DesktopContent-blockSystemCheckMailbox");
1227 _blockSystemCheckMailbox.style.display =
"none";
1228 _desktopElement.appendChild(_blockSystemCheckMailbox);
1233 _openWindowMailbox = document.createElement(
"div");
1234 _openWindowMailbox.setAttribute(
"id",
"DesktopContent-openWindowMailbox");
1235 _openWindowMailbox.style.display =
"none";
1236 _desktopElement.appendChild(_openWindowMailbox);
1239 _updateSettingsMailbox = document.createElement(
"div");
1240 _updateSettingsMailbox.setAttribute(
"id",
"DesktopContent-updateSettingsMailbox");
1241 _updateSettingsMailbox.style.display =
"none";
1242 _updateSettingsMailbox.innerHTML =
"";
1243 _desktopElement.appendChild(_updateSettingsMailbox);
1244 _settingsLayoutMailbox = document.createElement(
"div");
1245 _settingsLayoutMailbox.setAttribute(
"id",
"DesktopContent-settingsLayoutMailbox");
1246 _settingsLayoutMailbox.style.display =
"none";
1247 _settingsLayoutMailbox.innerHTML =
"";
1248 _desktopElement.appendChild(_settingsLayoutMailbox);
1251 _windowColorPostbox = document.createElement(
"div");
1252 _windowColorPostbox.setAttribute(
"id",
"DesktopContent-windowColorPostbox");
1253 _windowColorPostbox.style.display =
"none";
1254 _windowColorPostbox.innerHTML = this.defaultWindowsFrameColor;
1255 _desktopElement.appendChild(_windowColorPostbox);
1259 this.dashboard = _dashboard = Desktop.createDashboard(_defaultDashboardZindex);
1260 _desktopElement.appendChild(_dashboard.dashboardElement);
1263 this.icons = _icons = Desktop.createIcons(0);
1264 _desktopElement.appendChild(_icons.iconsElement);
1266 _handleDesktopResize();
1268 this.checkMailboxTimer = setInterval(_checkMailboxes,_MAILBOX_TIMER_PERIOD);
1271 this.login = _login =
new Desktop.login(!(this.security == Desktop.SECURITY_TYPE_NONE));
1273 _desktopElement.appendChild(_login.loginDiv);
1275 Debug.log(
"Desktop Created",Debug.LOW_PRIORITY);
1277 Debug.log(
"Checking for any shortcut work from get parameters...",Debug.LOW_PRIORITY);
1278 Desktop.desktop.actOnParameterAction();
1287 Desktop.foreWinLastMouse = [-1,-1];
1288 Desktop.winManipMode = -1;
1289 Desktop.stretchAndMoveInterval = 0;
1290 Desktop.disableMouseDown = 0;
1297 Desktop.handleTouchStart =
function(touchEvent) {
1298 Desktop.disableMouseDown = 1;
1299 var touch = touchEvent.targetTouches[0];
1301 var winId = this.
id.split(
'-')[1];
1302 var isDashboard = (winId ==
"windowDashboard");
1305 win = Desktop.desktop.getWindowById(winId);
1306 if(win == -1)
return false;
1307 if(win.isMaximized()) {this.style.cursor =
"default";
return false;}
1310 if(Desktop.desktop.getForeWindow() != win)
1311 Desktop.desktop.setForeWindow(win);
1316 if(Desktop.foreWinLastMouse[0] == -1) {
1317 var locX = touch.pageX - this.offsetLeft;
1318 var locY = touch.pageY - this.offsetTop;
1322 Desktop.desktop.getForeWindow().hideFrame();
1324 Desktop.foreWinLastMouse = [touch.pageX,touch.pageY];
1326 if(locY < win.getWindowHeaderHeight()) {
1327 Desktop.winManipMode = 0;
1336 Desktop.handleBodyTouchEnd =
function(touchEvent) {Desktop.handleTouchEnd(touchEvent);}
1337 Desktop.handleTouchEnd =
function(touchEvent) {
1339 if(Desktop.foreWinLastMouse[0] != -1)
1341 Desktop.foreWinLastMouse = [-1,-1];
1342 Desktop.winManipMode = -1;
1343 if(Desktop.desktop.getForeWindow()) Desktop.desktop.getForeWindow().showFrame();
1350 Desktop.handleBodyTouchMove =
function(touchEvent) {Desktop.handleTouchMove(touchEvent);}
1351 Desktop.handleTouchMove =
function(touchEvent) {
1352 if(Desktop.winManipMode != -1 && Desktop.foreWinLastMouse[0] != -1)
1354 touchEvent.preventDefault();
1355 touchEvent.cancelBubble=
true;
1357 var touch = touchEvent.targetTouches[0];
1358 var delta = [touch.pageX-Desktop.foreWinLastMouse[0], touch.pageY-Desktop.foreWinLastMouse[1]];
1360 Desktop.desktop.getForeWindow().moveWindowByOffset(delta[0],delta[1]);
1361 Desktop.foreWinLastMouse = [touch.pageX,touch.pageY];
1368 Desktop.handleWindowMouseDown =
function(mouseEvent) {
1369 var winId = this.
id.split(
'-')[1];
1370 var isDashboard = (winId ==
"windowDashboard");
1373 win = Desktop.desktop.getWindowById(winId);
1374 if(win == -1)
return false;
1377 if(Desktop.desktop.getForeWindow() != win)
1378 Desktop.desktop.setForeWindow(win);
1382 if(!Desktop.disableMouseDown && Desktop.winManipMode != -1 &&
this.style.cursor !=
"default")
1385 Desktop.foreWinLastMouse = [mouseEvent.clientX,mouseEvent.clientY];
1386 if(!isDashboard) Desktop.desktop.getForeWindow().hideFrame();
1397 Desktop.handleWindowMouseUp =
function(mouseEvent) {
1399 if(Desktop.foreWinLastMouse[0] != -1)
1401 if(Desktop.stretchAndMoveInterval) {
1402 clearInterval(Desktop.stretchAndMoveInterval);
1403 Desktop.stretchAndMoveInterval = 0;
1406 Desktop.foreWinLastMouse = [-1,-1];
1407 Desktop.winManipMode = -1;
1408 if(Desktop.desktop.getForeWindow()) Desktop.desktop.getForeWindow().showFrame();
1412 Desktop.desktop.icons.closeFolder();
1417 Desktop.handleWindowMouseMove =
function(mouseEvent) {
1418 var winId = this.
id.split(
'-')[1];
1419 var isDashboard = (winId ==
"windowDashboard");
1422 win = Desktop.desktop.getWindowById(winId);
1423 if(win == -1)
return false;
1424 if(win.isMaximized()) {this.style.cursor =
"default";
return false;}
1428 if(Desktop.foreWinLastMouse[0] == -1) {
1429 var locX = mouseEvent.clientX - this.offsetLeft;
1430 var locY = mouseEvent.clientY - this.offsetTop;
1432 var hotCornerSz = 7;
1434 if(locX > Desktop.desktop.dashboard.getDashboardWidth() - hotCornerSz) {
1435 this.style.cursor =
"e-resize";
1436 Desktop.winManipMode = 100;
1439 this.style.cursor =
"default";
1442 if((locX < hotCornerSz && locY < hotCornerSz) ||
1443 (locX > win.getWindowWidth() - hotCornerSz && locY > win.getWindowHeight() - hotCornerSz)) {
1444 this.style.cursor =
"nw-resize";
1445 Desktop.winManipMode = locY < hotCornerSz?1:2;
1447 else if((locX > win.getWindowWidth() - hotCornerSz && locY < hotCornerSz) ||
1448 (locX < hotCornerSz && locY > win.getWindowHeight() - hotCornerSz)) {
1449 this.style.cursor =
"ne-resize";
1450 Desktop.winManipMode = locY < hotCornerSz?3:4;
1452 else if(locX < hotCornerSz) {
1453 this.style.cursor =
"w-resize";
1454 Desktop.winManipMode = 5;
1456 else if(locX > win.getWindowWidth() - hotCornerSz) {
1457 this.style.cursor =
"e-resize";
1458 Desktop.winManipMode = 6;
1460 else if(locY < hotCornerSz) {
1461 this.style.cursor =
"n-resize";
1462 Desktop.winManipMode = 7;
1464 else if(locY > win.getWindowHeight() - hotCornerSz) {
1465 this.style.cursor =
"s-resize";
1466 Desktop.winManipMode = 8;
1468 else if(locY < win.getWindowHeaderHeight()) {
1469 this.style.cursor =
"all-scroll";
1470 Desktop.winManipMode = 0;
1473 this.style.cursor =
"default";
1478 Desktop.handleBodyMouseMove(mouseEvent);
1483 Desktop._mouseMoveSubscribers = [];
1485 Desktop.mouseMoveSubscriber =
function(newHandler) {
1486 Desktop._mouseMoveSubscribers.push(newHandler);
1491 Desktop.handleBodyMouseMove =
function(mouseEvent) {
1494 for(var i=0; i<Desktop._mouseMoveSubscribers.length; ++i)
1495 Desktop._mouseMoveSubscribers[i](mouseEvent);
1497 Desktop.desktop.resetFrameMouse();
1500 if(Desktop.foreWinLastMouse[0] != -1 && Desktop.winManipMode == 100) {
1502 if(mouseEvent.which == 0)
1503 return Desktop.handleWindowMouseUp(mouseEvent);
1505 var delta = mouseEvent.clientX-Desktop.foreWinLastMouse[0];
1506 Desktop.desktop.dashboard.setDashboardWidth(Desktop.desktop.dashboard.getDashboardWidth()+delta);
1507 Desktop.foreWinLastMouse = [mouseEvent.clientX,mouseEvent.clientY];
1509 if(Desktop.stretchAndMoveInterval == 0)
1510 Desktop.stretchAndMoveInterval = setInterval(
1512 if(Desktop.desktop.getLastFrameMouseX() == -1)
return;
1514 var delta = Desktop.desktop.getLastFrameMouseX()-Desktop.foreWinLastMouse[0];
1515 Desktop.desktop.dashboard.setDashboardWidth(Desktop.desktop.dashboard.getDashboardWidth()+delta);
1516 Desktop.foreWinLastMouse = [Desktop.desktop.getLastFrameMouseX(),Desktop.desktop.getLastFrameMouseY()];
1523 if(!Desktop.desktop.getForeWindow())
return false;
1525 if(Desktop.foreWinLastMouse[0] != -1)
1527 if(mouseEvent.which == 0)
1528 return Desktop.handleWindowMouseUp(mouseEvent);
1530 var delta = [mouseEvent.clientX-Desktop.foreWinLastMouse[0], mouseEvent.clientY-Desktop.foreWinLastMouse[1]];
1532 Desktop.handleWindowManipulation(delta);
1534 Desktop.foreWinLastMouse = [mouseEvent.clientX,mouseEvent.clientY];
1536 if(Desktop.stretchAndMoveInterval == 0)
1537 Desktop.stretchAndMoveInterval = setInterval(
1539 if(Desktop.desktop.getLastFrameMouseX() == -1)
return;
1541 var delta = [Desktop.desktop.getLastFrameMouseX()-Desktop.foreWinLastMouse[0],
1542 Desktop.desktop.getLastFrameMouseY()-Desktop.foreWinLastMouse[1]];
1543 Desktop.handleWindowManipulation(delta);
1544 Desktop.foreWinLastMouse = [Desktop.desktop.getLastFrameMouseX(),Desktop.desktop.getLastFrameMouseY()];
1554 Desktop.handleWindowManipulation =
function(delta) {
1555 if(!Desktop.desktop.getForeWindow())
return false;
1557 var win = Desktop.desktop.getForeWindow();
1559 switch(Desktop.winManipMode) {
1561 win.moveWindowByOffset(delta[0],delta[1]);
1564 win.resizeAndPositionWindow(
1565 win.getWindowX() + delta[0],
1566 win.getWindowY() + delta[1],
1567 win.getWindowWidth() - delta[0],
1568 win.getWindowHeight() - delta[1]);
1571 win.resizeAndPositionWindow(
1574 win.getWindowWidth() + delta[0],
1575 win.getWindowHeight() + delta[1]);
1578 win.resizeAndPositionWindow(
1580 win.getWindowY() + delta[1],
1581 win.getWindowWidth() + delta[0],
1582 win.getWindowHeight() - delta[1]);
1585 win.resizeAndPositionWindow(
1586 win.getWindowX() + delta[0],
1588 win.getWindowWidth() - delta[0],
1589 win.getWindowHeight() + delta[1]);
1592 win.resizeAndPositionWindow(
1593 win.getWindowX() + delta[0],
1595 win.getWindowWidth() - delta[0],
1596 win.getWindowHeight());
1599 win.resizeAndPositionWindow(
1602 win.getWindowWidth() + delta[0],
1603 win.getWindowHeight());
1606 win.resizeAndPositionWindow(
1608 win.getWindowY() + delta[1],
1609 win.getWindowWidth(),
1610 win.getWindowHeight() - delta[1]);
1613 win.resizeAndPositionWindow(
1616 win.getWindowWidth(),
1617 win.getWindowHeight() + delta[1]);
1623 Desktop.handleWindowButtonDown =
function(mouseEvent) {
1624 mouseEvent.cancelBubble=
true;
1628 Desktop.handleWindowRefresh =
function(mouseEvent){
1629 Debug.log(
"Refresh " + this.
id.split(
'-')[1]);
1630 Desktop.desktop.refreshWindowById(this.
id.split(
'-')[1]);
1635 Desktop.handleFullScreenWindowRefresh =
function(mouseEvent){
1636 Debug.log(
"Refresh Full Screen Window");
1637 Desktop.desktop.resetDesktop();
1638 Desktop.desktop.refreshDesktop();
1642 for(var i = 0; i < Desktop.desktop.getNumberOfWindows(); i++)
1644 var zIndex = Desktop.desktop.getWindowByIndex(i).getWindowZ();
1646 Debug.log(
"I: " + i +
" " + Desktop.desktop.getWindowByIndex(0).getWindowName());
1647 Debug.log(Desktop.desktop.getWindowByIndex(0).getWindowId());
1648 Desktop.desktop.setForeWindow(Desktop.desktop.getWindowByIndex(0));
1649 Desktop.desktop.refreshWindow();
1658 Desktop.handleWindowMinimize =
function(mouseEvent) {
1659 Debug.log(
"minimize " + this.
id.split(
'-')[1]);
1660 Desktop.desktop.minimizeWindowById(this.
id.split(
'-')[1]);
1664 Desktop.handleWindowMaximize =
function(mouseEvent) {
1665 Debug.log(
"maximize " + this.
id.split(
'-')[1]);
1666 Desktop.desktop.maximizeWindowById(this.
id.split(
'-')[1]);
1670 Desktop.handleWindowClose =
function(mouseEvent) {
1672 Desktop.desktop.closeWindowById(this.
id.split(
'-')[1]);
1683 Desktop.XMLHttpRequest =
function(requestURL, data, returnHandler, reqIndex) {
1686 var req =
new XMLHttpRequest();
1688 req.onreadystatechange =
function() {
1689 if (req.readyState==4) {
1694 if(!Desktop.desktop.serverConnected)
1696 Desktop.desktop.serverConnected =
true;
1697 Desktop.desktop.dashboard.displayConnectionStatus(
true);
1699 Desktop.desktop.resetDesktop();
1704 if(req.responseText == Globals.REQ_NO_PERMISSION_RESPONSE)
1706 errStr =
"Request failed do to insufficient account permissions.";
1709 else if(req.responseText == Globals.REQ_NO_LOGIN_RESPONSE)
1711 errStr =
"Login has expired.";
1713 window.clearInterval(Desktop.desktop.checkMailboxTimer);
1724 if(Desktop.desktop.serverConnected)
1726 Desktop.desktop.serverConnected =
false;
1727 Desktop.desktop.dashboard.displayConnectionStatus(
false);
1730 errStr =
"Request Failed - Bad Address:\n" + requestURL;
1731 window.clearInterval(Desktop.desktop.checkMailboxTimer);
1737 errStr +=
"\n\n(Try refreshing the page, or alert ots admins if problem persists.)";
1738 Debug.log(
"Error: " + errStr,Debug.HIGH_PRIORITY);
1742 Debug.log(
"The user interface is disconnected from the ots Gateway server.", Debug.HIGH_PRIORITY);
1744 document.getElementById(
"DesktopDashboard-userWithLock").style.display =
"none";
1746 if(returnHandler) returnHandler(req,reqIndex,errStr);
1750 if(Desktop.desktop.login)
1751 data =
"CookieCode="+Desktop.desktop.login.getCookieCode()+
"&"+data;
1752 requestURL =
"/urn:xdaq-application:lid="+urnLid+
"/"+requestURL;
1754 req.open(
"POST",requestURL,
true);
1756 req.setRequestHeader(
"Content-Type",
"text/plain;charset=UTF-8");
1761 Desktop.getXMLAttributeValue =
function(req, name, attribute) {
1762 if(req && req.responseXML && req.responseXML.getElementsByTagName(name).length > 0)
1763 return req.responseXML.getElementsByTagName(name)[0].getAttribute(attribute);
1770 Desktop.getXMLValue =
function(req, name) {
1771 return Desktop.getXMLAttributeValue(req,name,
"value");
1776 Desktop.logout =
function () {
1777 if(Desktop.desktop && Desktop.desktop.login &&
1778 !Desktop.desktop.login.isBlackout())
1779 Desktop.desktop.login.logout();
1783 Desktop.formatTime =
function(t) {
1784 var date =
new Date(t * 1000);
1785 var mm = date.getMinutes() < 10?
"0"+date.getMinutes():date.getMinutes();
1786 var ss = date.getSeconds() < 10?
"0"+date.getSeconds():date.getSeconds();
1787 return date.getHours() +
":" + mm +
":" + ss;
1791 Desktop.closeSystemMessage =
function(id) {
1792 var el = document.getElementById(
"Desktop-systemMessageBox-" +
id);
1793 el.parentNode.removeChild(el);
1797 Desktop.isWizardMode =
function() {
1799 Debug.log(
"Desktop Security: " + Desktop.desktop.security);
1801 return !(!Desktop.desktop.security ||
1802 Desktop.desktop.security == Desktop.SECURITY_TYPE_DIGEST_ACCESS ||
1803 Desktop.desktop.security == Desktop.SECURITY_TYPE_NONE);
1807 Desktop.openNewBrowserTab =
function(name,subname,windowPath,unique) {
1813 var i = windowPath.indexOf(
"urn:xdaq-application:lid=") + (
"urn:xdaq-application:lid=").length;
1814 var isAllNumbers =
true;
1815 for(i;i<windowPath.length;++i)
1817 Debug.log(windowPath[i]);
1819 if(windowPath[i] <
"0" || windowPath[i] >
"9")
1821 isAllNumbers =
false;
1828 Debug.log(
"DesktopWindow= " + windowPath);
1830 Debug.log(
"name= " + name);
1831 Debug.log(
"subname= " + subname);
1832 Debug.log(
"unique= " + unique);
1833 var search = window.parent.window.location.search;
1834 url = window.parent.window.location.pathname;
1836 var str =
"requestingWindowId=Desktop";
1837 str +=
"&windowName=" + name;
1838 str +=
"&windowSubname=" + subname;
1839 str +=
"&windowUnique=" + unique;
1840 str +=
"&windowPath=" + encodeURIComponent(windowPath);
1845 if(!Desktop.isWizardMode())
1847 var i = url.indexOf(
"urn:xdaq-application:lid=") + (
"urn:xdaq-application:lid=").length;
1848 var isAllNumbers =
true;
1849 for(i;i<url.length;++i)
1853 if(url[i] <
"0" || url[i] >
"9")
1855 isAllNumbers =
false;
1865 url += search.split(
'&')[0] +
"&" + str;
1868 Debug.log(
"DesktopContent.openNewBrowserTab= " + url);
1870 window.open(url,
'_blank');
1875 Desktop.desktopTooltip =
function() {
1877 DesktopContent.tooltip(
"Desktop Introduction",
1878 "Welcome to the <i>otsdaq</i> Desktop environment. This is your portal " +
1879 "to all of the possibilities of <i>otsdaq</i>.\n\n" +
1880 "Briefly, here are the features:" +
1882 "\n\t- <b>Desktop Window Icons:</b> " +
1884 "Click the rounded-square icons on your Desktop to open " +
1885 "a particular window. If you hold down your click (for a second), you " +
1886 "can open the window in fullscreen, or in a new tab, or even open the window " +
1887 "then tile it on the screen with all other open windows!" +
1890 "\n\t- <b>Desktop Dashboard (top pane):</b> " +
1892 "Along the top and left margins of the Desktop, you will find the Desktop " +
1893 "Dashboard - this section is an introduction to the top pane of the Dashboard. " +
1894 "The top pane of the Dashboard " +
1895 "is made of buttons and icons going from left to right:" +
1897 "\n\t- <b>Left Pane Toggler:</b> " +
1899 "The first button you will encounter in the top pane looks like a horizontal double-arrow " +
1900 "icon. This button toggles the display of the left pane of the Dashboard. Note when you " +
1901 "refresh the page, the state of the left pane persists!" +
1904 "\n\t- <b>Layouts Menu:</b> " +
1906 "The next button you will encounter in the top pane reads 'Layouts.' " +
1907 "This button gives you access to your Window Layout Presets. You will see 2 'System' presets there " +
1908 "which can be setup by uesrs with admin privileges. There are also 3 'User' presets which you can setup for " +
1909 "yourself in the User Settings window (get there with " +
1910 "the cog wheel icon in the upper-right of the Desktop)." +
1913 "\n\t- <b>Tile Desktop Windows:</b> " +
1915 "The next button you will encounter in the top pane reads 'Tile.' " +
1916 "This button will automatically tile all open Desktop Windows to fit in your browser window." +
1919 "\n\t- <b>Show Desktop:</b> " +
1921 "The next button you will encounter in the top pane reads 'Show Desktop.' " +
1922 "This button will minimize all open Desktop Windows which is nice " +
1923 "when you want to see all of your Desktop Icons again." +
1926 "\n\t- <b>Full Screen:</b> " +
1928 "The next button you will encounter in the top pane reads 'Full Screen.' " +
1929 "This button will maximize to full screen the Desktop Window that was last used (i.e. the window that has the focus)." +
1933 "\n\t- <b>Desktop Dashboard (left pane):</b> " +
1935 "Along the top and left margins of the Desktop, you will find the Desktop " +
1936 "Dashboard - this section is an introduction to the left pane of the Dashboard. " +
1937 "The left pane of the Dashboard " +
1938 "is a listing of all open Desktop Windows. If you click one of the buttons in the list, " +
1939 "the associated window " +
1940 "will be minimized or restored. If you hold down your click (for one second) you can choose " +
1941 "to minimize, maximize, or close the window!" +
1946 "\n\nRemember, if you would like to take a look at the available online documentation, " +
1947 "click the question mark at the top-right of the Desktop."