4 ViewerRoot.createHud =
function() {
31 var animationTargetTop, isDropDownAnimating, isDropDownDown;
34 var hudAdminSettingsDiv;
37 var displayingControls =
false;
38 var PRE_MADE_ROOT_CFG_DIR =
"Pre-made Views";
39 var adminControlsPath;
41 var DIR_BRW_HDR_MAX_SIZE = 30;
42 var DIR_DISP_TAB_SZ = 16;
43 var TUPLE_TYPE = 0, TUPLE_NAME = 1, TUPLE_CONTENT = 2, TUPLE_PARENT = 3;
44 var TUPLE_TYPE_FILE = 1, TUPLE_TYPE_DIR = 1<<1, TUPLE_TYPE_DIR_EXPANDED = 1<<2;
45 var dirStruct = [[TUPLE_TYPE_DIR,
"",0,0]];
47 var currDirPtr = dirStruct[0];
49 this.handleWindowResize =
function() {
52 if(ViewerRoot.hudAutoHide)
53 this.hudMouseOverDiv.style.left = window.innerWidth - this.hudMouseOverDiv.offsetWidth - ViewerRoot.HUD_MARGIN_RIGHT +
"px";
56 this.hudMouseOverDiv.style.left = window.innerWidth - this.hudMouseOverDiv.offsetWidth +
"px";
57 this.hudMouseOverDiv.style.top = -15 +
"px";
60 hudDirBrowserDiv.style.width = this.hudDiv.offsetWidth - 45 +
"px";
61 hudDirBrowserDiv.style.height = window.innerHeight - 190 +
"px";
63 if(ViewerRoot.userPermissions >= ViewerRoot.ADMIN_PERMISSIONS_THRESHOLD)
64 document.getElementById(
"ViewerRoot-hudControlsIcon").style.display =
"block";
66 document.getElementById(
"ViewerRoot-hudControlsIcon").style.display =
"none";
70 this.checkboxUpdate =
function(i) {
73 chk = document.getElementById(
"hardRefreshCheckbox");
74 ViewerRoot.hardRefresh = chk.checked;
75 console.log(
"checkboxUpdate: hardRefresh: " + chk.checked);
76 DesktopContent.XMLHttpRequest(
"Request?RequestType=setUserPreferences&hardRefresh="+
87 chk = document.getElementById(
"hudCheckbox" + i);
88 Debug.log(
"ViewerRoot Hud checkboxUpdate " + i +
"=" + chk.checked);
92 ViewerRoot.autoRefreshDefault = chk.checked;
94 DesktopContent.XMLHttpRequest(
"Request?RequestType=setUserPreferences&autoRefresh="+
105 ViewerRoot.hudAutoHide = chk.checked;
106 ViewerRoot.handleWindowResize();
108 DesktopContent.XMLHttpRequest(
"Request?RequestType=setUserPreferences&autoHide="+
119 ViewerRoot.pauseRefresh = chk.checked;
123 if(!ViewerRoot.pauseRefresh) ViewerRoot.autoRefreshMatchArr = [];
130 this.handlerRefreshPeriodChange =
function(v) {
132 if(!v || v < 100) v = 100;
133 if(v > 9999999) v = 9999999;
134 Debug.log(
"ViewerRoot Hud handlerRefreshPeriodChange " + v);
135 document.getElementById(
"hudAutoRefreshPeriod").value = v;
136 ViewerRoot.autoRefreshPeriod = v;
137 DesktopContent.XMLHttpRequest(
"Request?RequestType=setUserPreferences&autoRefreshPeriod="+
138 ViewerRoot.autoRefreshPeriod,
145 if(ViewerRoot.autoRefreshTimer) window.clearInterval(ViewerRoot.autoRefreshTimer);
146 ViewerRoot.autoRefreshTimer = window.setInterval(ViewerRoot.autoRefreshTick,
147 ViewerRoot.autoRefreshPeriod);
150 this.radioSelect =
function(i) {
151 Debug.log(
"ViewerRoot Hud radioSelect " + i);
152 ViewerRoot.nextObjectMode = i;
154 DesktopContent.XMLHttpRequest(
"Request?RequestType=setUserPreferences&radioSelect="+i);
157 this.handleDirContents =
function(req) {
158 Debug.log(
"ViewerRoot Hud handleDirContents " + req.responseText);
160 var path = DesktopContent.getXMLValue(req,
'path');
163 Debug.log(
"ViewerRoot Hud handleDirContents no path returned",Debug.HIGH_PRIORITY);
172 var baseDir = findDir(path);
175 Debug.log(
"ViewerRoot Hud handleDirContents path not found");
181 baseDir[TUPLE_CONTENT] = [];
182 baseDir[TUPLE_TYPE] |= TUPLE_TYPE_DIR_EXPANDED;
184 var dirs = req.responseXML.getElementsByTagName(
"dir");
185 var files = req.responseXML.getElementsByTagName(
"file");
187 for(var i=0;i<dirs.length;++i)
188 baseDir[TUPLE_CONTENT][baseDir[TUPLE_CONTENT].length] = [TUPLE_TYPE_DIR,dirs[i].getAttribute(
"value").replace(/[\/]+/g,
''),0,baseDir];
190 for(var i=0;i<files.length;++i)
191 baseDir[TUPLE_CONTENT][baseDir[TUPLE_CONTENT].length] = [TUPLE_TYPE_FILE,files[i].getAttribute(
"value").replace(/[\/]+/g,
''),0,baseDir];
195 redrawDirectoryDisplay();
200 var handleUserPreferences =
function(req) {
201 Debug.log(
"handleUserPreferences");
202 var radioSelect = DesktopContent.getXMLValue(req,
'radioSelect');
203 if(radioSelect && radioSelect !=
"")
205 Debug.log(
"setting radioSelect=" + (radioSelect|0));
206 ViewerRoot.nextObjectMode = radioSelect|0;
207 document.getElementById(
"newRootObjectModeRadio" + (radioSelect|0)).checked =
true;
209 var autoRefresh = DesktopContent.getXMLValue(req,
'autoRefresh');
210 if(autoRefresh && autoRefresh !=
"")
212 Debug.log(
"setting autoRefresh=" + (autoRefresh|0));
213 var chk = document.getElementById(
"hudCheckbox" + 0);
214 chk.checked = (autoRefresh|0)?
true:
false;
215 Debug.log(
"setting autoRefresh=" + chk.checked);
216 ViewerRoot.autoRefreshDefault = chk.checked;
218 var autoHide = DesktopContent.getXMLValue(req,
'autoHide');
219 if(autoHide && autoHide !=
"")
221 Debug.log(
"setting autoHide=" + (autoHide|0));
222 var chk = document.getElementById(
"hudCheckbox" + 1);
223 chk.checked = (autoHide|0)?
true:
false;
224 Debug.log(
"setting autoHide=" + chk.checked);
225 ViewerRoot.hudAutoHide = chk.checked;
226 ViewerRoot.handleWindowResize();
228 var hardRefresh = DesktopContent.getXMLValue(req,
'hardRefresh');
229 if(hardRefresh !== undefined && hardRefresh !==
"")
231 hardRefresh = hardRefresh|0;
232 Debug.log(
"setting hardRefresh=" + hardRefresh);
233 ViewerRoot.hardRefresh = hardRefresh;
235 var autoRefreshPeriod = DesktopContent.getXMLValue(req,
'autoRefreshPeriod') | 0;
236 if(autoRefreshPeriod)
238 Debug.log(
"setting autoRefreshPeriod=" + autoRefreshPeriod);
239 if(autoRefreshPeriod < 100) autoRefreshPeriod = 100;
240 if(autoRefreshPeriod > 9999999) autoRefreshPeriod = 9999999;
241 ViewerRoot.autoRefreshPeriod = autoRefreshPeriod;
242 document.getElementById(
"hudAutoRefreshPeriod").value = ViewerRoot.autoRefreshPeriod;
250 var findDir =
function(path,currDir,currPath) {
253 currDir = dirStruct[0];
254 currPath = currDir[TUPLE_NAME] +
"/";
259 if(currDir[TUPLE_TYPE] & TUPLE_TYPE_DIR == 0)
return 0;
260 if(path == currPath)
return currDir;
261 if(!currDir[TUPLE_CONTENT])
return 0;
265 for(var i=0;i<currDir[TUPLE_CONTENT].length;++i)
267 if(currDir[TUPLE_CONTENT][i][TUPLE_TYPE] & TUPLE_TYPE_DIR == 0)
continue;
269 retVal = findDir(path,currDir[TUPLE_CONTENT][i],currPath + currDir[TUPLE_CONTENT][i][TUPLE_NAME] +
"/");
270 if(retVal)
return retVal;
275 var getPath =
function(tuplePtr) {
276 if(!tuplePtr)
return "/";
277 var path = tuplePtr[TUPLE_NAME] +
"/";
278 while(tuplePtr[TUPLE_PARENT])
280 path = tuplePtr[TUPLE_PARENT][TUPLE_NAME] +
"/" + path;
281 tuplePtr = tuplePtr[TUPLE_PARENT];
290 var redrawDirectoryDisplay =
function(currDir,tabSz,path,str) {
292 var applyStr =
false;
297 hudDirBrowserDiv.innerHTML =
"";
299 currDir = currDirPtr;
301 path = getPath(currDirPtr);
305 locPath = path.length>DIR_BRW_HDR_MAX_SIZE?(
"..." + path.substr(path.length-DIR_BRW_HDR_MAX_SIZE+3)):path;
306 str +=
"<div id='ViewerRoot-hudDirBrowser-header'>";
307 str +=
"<a title='Refresh\n" + path +
"' style='float:left' href='Javascript:ViewerRoot.hud.changeDirectory(\"" +
308 path +
"\");'>" + locPath +
"</a>";
309 str +=
"<a title='Change to Parent Directory' style='float:right' href='Javascript:ViewerRoot.hud.changeDirectory(\"" +
310 getPath(currDirPtr[TUPLE_PARENT]) +
"\");'> cd .. </a>";
312 str +=
"<div style='clear:both'></div>";
315 for(var i=0;currDir[TUPLE_CONTENT] && i<currDir[TUPLE_CONTENT].length;++i)
317 locPath = path + currDir[TUPLE_CONTENT][i][TUPLE_NAME];
318 if(currDir[TUPLE_CONTENT][i][TUPLE_TYPE] & TUPLE_TYPE_DIR) locPath +=
"/";
320 str +=
"<div class='ViewerRoot-hudDirBrowser-item' style='margin-left:" + tabSz +
"px;'>";
322 dirClr = currDir[TUPLE_CONTENT][i][TUPLE_NAME].indexOf(
".root") >= 0?
"#B9E6E6":
"gray";
323 if(currDir[TUPLE_CONTENT][i][TUPLE_TYPE] & TUPLE_TYPE_DIR_EXPANDED)
325 str +=
"<a title='Collapse Directory\n" + locPath +
"' href='Javascript:ViewerRoot.hud.collapseDirectory(\"" + locPath +
"\");'> + </a> ";
327 str +=
"<a title='Change Directory\n" + locPath +
"' style='color:" + dirClr +
"' href='Javascript:ViewerRoot.hud.changeDirectory(\"" + locPath +
"\");'>" + currDir[TUPLE_CONTENT][i][TUPLE_NAME] +
"</a>";
329 else if(currDir[TUPLE_CONTENT][i][TUPLE_TYPE] & TUPLE_TYPE_DIR)
331 str +=
"<a title='Expand Directory\n" + locPath +
"' style='color:gray' href='Javascript:ViewerRoot.getDirectoryContents(\"" + locPath +
"\");'> - </a> ";
333 str +=
"<a title='Change Directory\n" + locPath +
"' style='color:" + dirClr +
"' href='Javascript:ViewerRoot.hud.changeDirectory(\"" + locPath +
"\");'>" + currDir[TUPLE_CONTENT][i][TUPLE_NAME] +
"</a>";
335 else if(currDir[TUPLE_CONTENT][i][TUPLE_TYPE] & TUPLE_TYPE_FILE)
337 if(locPath.indexOf(
".root") > 0)
339 str +=
"<a title='Open Root File\n" + locPath +
"' href='Javascript:ViewerRoot.rootReq(\"" + locPath +
"\");'>" +
340 "<img style='margin:2px 2px -2px 0;' src='/WebPath/js/visualizers_lib/ViewerRoot_lib/img/histo.png'>";
341 str += currDir[TUPLE_CONTENT][i][TUPLE_NAME] +
"</a>";
343 else if(locPath.indexOf(
".rcfg") > 0)
345 str +=
"<a title='Open Root File\n" + locPath +
"' href='Javascript:ViewerRoot.rootConfigReq(\"" + locPath +
"\");'>" +
346 "<img style='margin:2px 2px -2px 0;' src='/WebPath/js/visualizers_lib/ViewerRoot_lib/img/histo3d.png'>";
347 str += currDir[TUPLE_CONTENT][i][TUPLE_NAME] +
"</a>";
350 Debug.log(
"ViewerRoot Hud redrawDirectoryDisplay unknown file extension");
353 alert(
"Impossible DIRECTORY error!! Notify admins");
358 if(currDir[TUPLE_CONTENT][i][TUPLE_TYPE] & TUPLE_TYPE_DIR_EXPANDED)
359 str = redrawDirectoryDisplay(currDir[TUPLE_CONTENT][i],tabSz+DIR_DISP_TAB_SZ,
360 path + currDir[TUPLE_CONTENT][i][TUPLE_NAME] +
"/",str);
364 if(ViewerRoot.userPermissions >= ViewerRoot.ADMIN_PERMISSIONS_THRESHOLD &&
365 path.indexOf(PRE_MADE_ROOT_CFG_DIR) >= 0)
367 Debug.log(
"ViewerRoot Hud redrawDirectoryDisplay path " + path);
369 var iconArr = [
"folderopen",
"page",
"remove"];
370 var captionArr = [
"Make New Directory",
"Save New View",
"Delete Pre-made File/Folder!"];
371 for(var i=0;i<captionArr.length;++i)
373 str +=
"<div class='ViewerRoot-hudDirBrowser-item' style='margin-left:" + tabSz +
"px;'>";
374 str +=
"<a style='color:gray' title='Admin action: " + captionArr[i] +
375 "' href='Javascript:ViewerRoot.hud.toggleAdminControls(" + i +
",\"" + path +
"\");'>" +
376 "<img style='margin:2px 2px -2px 0;' src='/WebPath/js/visualizers_lib/ViewerRoot_lib/img/" + iconArr[i] +
".gif'>";
377 str += captionArr[i] +
"</a>";
383 hudDirBrowserDiv.innerHTML = str;
390 this.collapseDirectory =
function(dirPath) {
391 Debug.log(
"ViewerRoot Hud collapseDirectory " + dirPath);
393 var baseDir = findDir(dirPath);
395 baseDir[TUPLE_CONTENT] = 0;
396 baseDir[TUPLE_TYPE] &= ~TUPLE_TYPE_DIR_EXPANDED;
398 redrawDirectoryDisplay();
401 this.changeDirectory =
function(dirPath) {
402 Debug.log(
"ViewerRoot Hud changeDirectory " + dirPath);
403 currDirPtr = findDir(dirPath);
404 ViewerRoot.getDirectoryContents(dirPath);
409 var animateDropDown =
function() {
410 var dir = (animationTargetTop - hudMouseOverDiv.offsetTop > 0)? 1: -1;
412 var tmpTop = hudMouseOverDiv.offsetTop + dir*ViewerRoot.HUD_DROP_DOWN_SPEED;
413 if(Math.abs(tmpTop - animationTargetTop) <= ViewerRoot.HUD_DROP_DOWN_SPEED)
415 hudMouseOverDiv.style.top = animationTargetTop +
"px";
416 isDropDownAnimating =
false;
420 hudMouseOverDiv.style.top = tmpTop +
"px";
421 window.setTimeout(animateDropDown,30);
425 var mouseOverDropDown =
function() {
427 if(isDropDownAnimating)
return;
429 if(!ViewerRoot.hudAutoHide)
return;
433 isDropDownDown =
true;
434 isDropDownAnimating =
true;
435 animationTargetTop = -15;
436 window.setTimeout(animateDropDown,30);
441 var mouseOutDropDown =
function(event) {
442 if(isDropDownAnimating)
return;
446 var e =
event.toElement ||
event.relatedTarget;
449 if(e ==
this)
return;
454 if(!ViewerRoot.hudAutoHide)
return ViewerRoot.hud.handleWindowResize();
458 isDropDownDown =
false;
459 isDropDownAnimating =
true;
460 animationTargetTop = 15 - hudMouseOverDiv.offsetHeight;
461 window.setTimeout(animateDropDown,30);
466 this.toggleControls =
function() {
467 displayingControls = !displayingControls;
468 Debug.log(
"ViewerRoot Hud toggleControls " + displayingControls);
470 if(displayingControls)
472 hudDirBrowserDiv.innerHTML =
"";
474 if(ViewerRoot.hardRefresh)
475 str +=
"<input type='checkbox' id='hardRefreshCheckbox' checked ";
477 str +=
"<input type='checkbox' id='hardRefreshCheckbox' ";
478 str +=
"onchange='if(this.checked) ViewerRoot.hardRefresh = 1; else ViewerRoot.hardRefresh = 0; ViewerRoot.hud.checkboxUpdate(3);'>Hard Refresh";
480 str +=
"<br><div id='hudAdminControlStatus'></div>";
482 str +=
"<a href='javascript:ViewerRoot.hud.toggleControls();' title='Return to ROOT Browser' " +
483 "<u>Return to Browser</u></a>";
484 hudDirBrowserDiv.innerHTML = str;
487 ViewerRoot.hud.changeDirectory(getPath(currDirPtr));
494 this.toggleAdminControls =
function(type, path) {
495 displayingControls = !displayingControls;
496 Debug.log(
"ViewerRoot Hud toggleAdminControls " + displayingControls);
498 if(displayingControls)
500 Debug.log(
"ViewerRoot Hud toggleAdminControls " + type +
": " + path);
502 adminControlsPath = path;
503 hudDirBrowserDiv.innerHTML =
"";
509 str +=
"Make a new ROOT Viewer<br>Configuration Directory<br>at path:<br><br>" + path +
"<br>";
510 str +=
"<input type='text' id='hudAdminControlField' onkeyup='document.getElementById(\"hudAdminControlStatus\").innerHTML=\"\";' size='20' value=''><br>";
511 str +=
"<input type='button' onmouseup=\"ViewerRoot.hud.popUpVerification(" +
512 "'Are you sure you want to create directory with name "REPLACE"?','ViewerRoot.hud.makeConfigDir');\" value='Make New Directory'>";
516 str +=
"Save a new ROOT Viewer<br>Configuration File for all users <br>based on the current view<br>at path:<br><br>" + path +
"<br>";
517 str +=
"<input type='text' id='hudAdminControlField' size='20' value=''><br>";
519 str +=
"<div ><input type='checkbox' id='hudSaveFileRunWildCardCheckbox'>" +
520 "<label for='hudSaveFileRunWildCardCheckbox' >" +
"Use Wildcard Run #" +
"</label></div>";
522 str +=
"<input type='button' onmouseup=\"ViewerRoot.hud.popUpVerification(" +
523 "'Are you sure you want to save a file with name "REPLACE"?','ViewerRoot.hud.saveConfigFile');\" value='Save New File'>";
527 str +=
"Delete a ROOT Viewer<br>Configuration Directory or File<br>at path:<br><br>" + path +
"<br>";
528 str +=
"<input type='text' id='hudAdminControlField' onkeyup='document.getElementById(\"hudAdminControlStatus\").innerHTML=\"\";' size='20' value=''><br>";
529 str +=
"<input type='button' onmouseup=\"ViewerRoot.hud.popUpVerification(" +
530 "'Are you sure you want to delete file or directory with name "REPLACE"?','ViewerRoot.hud.removeConfigPath');\" value='Delete Path'><br>";
535 Debug.log(
"Unknown admin type " + type);
536 throw(
"Unknown type?");
539 str +=
"<br><div id='hudAdminControlStatus'></div>";
541 str +=
"<a href='javascript:ViewerRoot.hud.toggleAdminControls();' title='Return to ROOT Browser' " +
542 "<u>Return to Browser</u></a>";
543 hudDirBrowserDiv.innerHTML = str;
547 ViewerRoot.hud.changeDirectory(getPath(currDirPtr));
550 this.makeConfigDir =
function() {
551 var dir = document.getElementById(
'hudAdminControlField').value;
552 Debug.log(
"ViewerRoot Hud makeConfigDir " + dir);
554 DesktopContent.XMLHttpRequest(
"Request?RequestType=rootAdminControls&cmd=mkdir",
"path="+adminControlsPath+
"&name="+dir, ViewerRoot.hud.adminControlsReqHandler,
563 this.saveConfigFile =
function() {
566 if(ViewerRoot.numPositionsTiled < 1)
568 document.getElementById(
'hudAdminControlStatus').innerHTML =
"You must have at least 1 Root object in your configuration to save it.";
572 var file = document.getElementById(
'hudAdminControlField').value;
573 var wildcard = document.getElementById(
'hudSaveFileRunWildCardCheckbox').checked;
577 fileStr +=
"<ROOT><DATA>";
578 fileStr +=
"<numPositionsTiled>" + ViewerRoot.numPositionsTiled +
"</numPositionsTiled>";
579 fileStr +=
"<runNumWildcard>" + (wildcard?1:0) +
"</runNumWildcard>";
581 for(var i=0;i<ViewerRoot.rootElArr.length;++i)
583 fileStr +=
"<rootObjName>" + ViewerRoot.rootObjNameArr[i] +
"</rootObjName>";
584 fileStr +=
"<rootPos>" + ViewerRoot.rootPosArr[i] +
"</rootPos>";
585 fileStr +=
"<rootIsTransparent>" + (ViewerRoot.rootIsTransparentArr[i]?1:0) +
"</rootIsTransparent>";
586 fileStr +=
"<rootIsAutoRefresh>" + (ViewerRoot.rootIsAutoRefreshArr[i]?1:0) +
"</rootIsAutoRefresh>";
589 fileStr +=
"</DATA></ROOT>";
590 Debug.log(
"ViewerRoot Hud saveConfigFile fileStr " + fileStr);
592 DesktopContent.XMLHttpRequest(
"Request?RequestType=rootAdminControls&cmd=save",
593 "path="+adminControlsPath+
"&name="+file+
"&config="+fileStr, ViewerRoot.hud.adminControlsReqHandler);
596 this.removeConfigPath =
function() {
598 var target = document.getElementById(
'hudAdminControlField').value;
599 Debug.log(
"ViewerRoot Hud removeConfigPath " + target);
601 DesktopContent.XMLHttpRequest(
"Request?RequestType=rootAdminControls&cmd=delete",
"path="+adminControlsPath+
"&name="+target, ViewerRoot.hud.adminControlsReqHandler);
604 this.adminControlsReqHandler =
function(req) {
605 Debug.log(
"ViewerRoot Hud adminControlsReqHandler " + req.responseText);
607 var status = DesktopContent.getXMLValue(req,
'status');
610 ViewerRoot.hud.toggleAdminControls();
612 document.getElementById(
'hudAdminControlStatus').innerHTML = status;
618 this.popUpVerification =
function(prompt, func) {
620 if(hudPopUpDiv) hudPopUpDiv.parentNode.removeChild(hudPopUpDiv);
622 var path = document.getElementById(
'hudAdminControlField').value;
624 var ptrn = /^([a-zA-Z0-9_-]+)$/;
625 if(path.length < 3 || !ptrn.test(path))
627 document.getElementById(
'hudAdminControlStatus').innerHTML =
"Entry must be at least 3 characters and alpha-numeric with only underscores and dashes.";
632 prompt = prompt.replace(/REPLACE/g, path);
634 var el = this.hudDiv;
635 hudPopUpDiv = document.createElement(
"div");
636 hudPopUpDiv.setAttribute(
"class",
"hudPopUpDiv");
637 var str =
"<div id='hudPopUpText'>" + prompt +
"</div>" +
638 "<input type='submit' onmouseup='ViewerRoot.hud.clearPopUpVerification(" + func +
");' value='Yes'> " +
639 " " +
640 "<input type='submit' onmouseup='ViewerRoot.hud.clearPopUpVerification();' value='Cancel'>";
641 hudPopUpDiv.innerHTML = str;
642 el.appendChild(hudPopUpDiv);
647 this.clearPopUpVerification =
function(func) {
649 if(hudPopUpDiv) hudPopUpDiv.parentNode.removeChild(hudPopUpDiv);
653 document.getElementById(
'hudAdminControlStatus').innerHTML =
"Action was cancelled by user!";
656 hudMouseOverDiv = this.hudMouseOverDiv = document.createElement(
'div');
657 hudMouseOverDiv.setAttribute(
"id",
"ViewerRoot-hudMouseOver");
658 hudMouseOverDiv.style.position =
"absolute";
659 hudMouseOverDiv.style.zIndex = 100;
661 this.hudDiv = document.createElement(
'div');
662 this.hudDiv.setAttribute(
"id",
"ViewerRoot-hud");
669 str +=
"With new Root objects...<br>";
671 var chkLabels = [
"Auto-Refresh"];
672 var chkDefaults = [
""];
673 str +=
"<div style='float:right'>"
674 for(var i=0;i<chkLabels.length;++i)
675 str +=
"<input type='checkbox' id='hudCheckbox" + i +
"' onchange='ViewerRoot.hud.checkboxUpdate(" + i +
676 ");' " + chkDefaults[i] +
"><label for='hudCheckbox" + i +
"' >" + chkLabels[i] +
"</label>";
679 var radioLabels = [
"Tile",
"Replace",
"Superimpose"];
680 var radioDefault = ViewerRoot.nextObjectMode;
681 for(var i=0;i<radioLabels.length;++i)
682 str +=
"<input type='radio' id='newRootObjectModeRadio" + i +
"' " + (i==radioDefault?
"checked":
"") +
683 " onchange='ViewerRoot.hud.radioSelect(" + i +
");'" +
684 " name='newRootObjectModeRadio' value='0' /><label for='newRootObjectModeRadio" + i +
"'>" + radioLabels[i] +
"</label><br>";
688 str +=
"<div id='ViewerRoot-hudDirBrowser'></div>";
694 str +=
"<div id='ViewerRoot-hudControlsIcon' " +
695 "style='float:left;margin: -2px 0 -20px 20px; cursor: pointer;' onmouseup='ViewerRoot.hud.toggleControls();' " +
696 "title='Admin Controls'><img width='18px' src='/WebPath/images/dashboardImages/icon-Settings.png'></div>";
698 str +=
"<div style='float:right; margin:-3px 0 -20px 0;'>";
699 str +=
"Refresh Period: <input type='text' id='hudAutoRefreshPeriod' onchange='ViewerRoot.hud.handlerRefreshPeriodChange(this.value);' size='6' value='" +
700 ViewerRoot.autoRefreshPeriod +
"'> ms</div>";
704 str +=
"<a href='javascript:ViewerRoot.clearAll();' title='Clear ROOT objects from view'>Clear</a>";
706 str +=
"<div style='float:right;' ><input type='checkbox' id='hudCheckbox" + chkLabels.length +
"' onchange='ViewerRoot.hud.checkboxUpdate(" + chkLabels.length +
707 ");' " +
"" +
"><label for='hudCheckbox" + chkLabels.length +
"' >" +
"Auto-Hide" +
"</label></div>";
709 str +=
"<div style='float:right;margin-right:10px;' ><input type='checkbox' id='hudCheckbox" + (chkLabels.length+1) +
"' onchange='ViewerRoot.hud.checkboxUpdate(" + (chkLabels.length+1) +
710 ");' " +
"" +
"><label for='hudCheckbox" + (chkLabels.length+1) +
"' >" +
"Pause Refresh" +
"</label></div>";
712 this.hudDiv.innerHTML = str;
719 hudMouseOverDiv.appendChild(this.hudDiv);
721 hudMouseOverDiv.style.width = ViewerRoot.HUD_WIDTH +
"px";
722 hudMouseOverDiv.onmouseover = mouseOverDropDown;
723 hudMouseOverDiv.onmouseout = mouseOutDropDown;
724 ViewerRoot.omni.appendChild(hudMouseOverDiv);
726 hudDirBrowserDiv = document.getElementById(
'ViewerRoot-hudDirBrowser');
734 if(ViewerRoot.hudAutoHide)
737 hudMouseOverDiv.style.top = 15 - hudMouseOverDiv.offsetHeight +
"px";
739 isDropDownDown =
false;
740 isDropDownAnimating =
true;
741 animationTargetTop = 15 - hudMouseOverDiv.offsetHeight;
742 window.setTimeout(animateDropDown,30);
745 this.handleWindowResize();
748 DesktopContent.XMLHttpRequest(
"Request?RequestType=getUserPreferences",
"",handleUserPreferences);