00001
00002
00003
00004 ViewerRoot.createHud = function() {
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 var hudMouseOverDiv;
00031 var animationTargetTop, isDropDownAnimating, isDropDownDown;
00032
00033 var hudDirBrowserDiv;
00034 var hudAdminSettingsDiv;
00035 var hudPopUpDiv = 0;
00036
00037 var displayingControls = false;
00038 var PRE_MADE_ROOT_CFG_DIR = "Pre-made Views";
00039 var adminControlsPath;
00040
00041 var DIR_BRW_HDR_MAX_SIZE = 30;
00042 var DIR_DISP_TAB_SZ = 16;
00043 var TUPLE_TYPE = 0, TUPLE_NAME = 1, TUPLE_CONTENT = 2, TUPLE_PARENT = 3;
00044 var TUPLE_TYPE_FILE = 1, TUPLE_TYPE_DIR = 1<<1, TUPLE_TYPE_DIR_EXPANDED = 1<<2;
00045 var dirStruct = [[TUPLE_TYPE_DIR,"",0,0]];
00046
00047 var currDirPtr = dirStruct[0];
00048
00049 this.handleWindowResize = function() {
00050
00051
00052 if(ViewerRoot.hudAutoHide)
00053 this.hudMouseOverDiv.style.left = window.innerWidth - this.hudMouseOverDiv.offsetWidth - ViewerRoot.HUD_MARGIN_RIGHT + "px";
00054 else
00055 {
00056 this.hudMouseOverDiv.style.left = window.innerWidth - this.hudMouseOverDiv.offsetWidth + "px";
00057 this.hudMouseOverDiv.style.top = -15 + "px";
00058 }
00059
00060 hudDirBrowserDiv.style.width = this.hudDiv.offsetWidth - 45 + "px";
00061 hudDirBrowserDiv.style.height = window.innerHeight - 190 + "px";
00062
00063 if(ViewerRoot.userPermissions >= ViewerRoot.ADMIN_PERMISSIONS_THRESHOLD)
00064 document.getElementById("ViewerRoot-hudControlsIcon").style.display = "block";
00065 else
00066 document.getElementById("ViewerRoot-hudControlsIcon").style.display = "none";
00067 }
00068
00069
00070 this.checkboxUpdate = function(i) {
00071 var chk;
00072 if (i == 3) {
00073 chk = document.getElementById("hardRefreshCheckbox");
00074 ViewerRoot.hardRefresh = chk.checked;
00075 console.log("checkboxUpdate: hardRefresh: " + chk.checked);
00076 DesktopContent.XMLHttpRequest("Request?RequestType=setUserPreferences&hardRefresh="+
00077 (chk.checked?1:0));
00078 }
00079 else
00080 {
00081 chk = document.getElementById("hudCheckbox" + i);
00082 Debug.log("ViewerRoot Hud checkboxUpdate " + i + "=" + chk.checked);
00083
00084 if(i==0)
00085 {
00086 ViewerRoot.autoRefreshDefault = chk.checked;
00087
00088 DesktopContent.XMLHttpRequest("Request?RequestType=setUserPreferences&autoRefresh="+
00089 (chk.checked?1:0));
00090 }
00091 else if(i==1)
00092 {
00093 ViewerRoot.hudAutoHide = chk.checked;
00094 ViewerRoot.handleWindowResize();
00095
00096 DesktopContent.XMLHttpRequest("Request?RequestType=setUserPreferences&autoHide="+
00097 (chk.checked?1:0));
00098 }
00099 else if(i==2)
00100 {
00101 ViewerRoot.pauseRefresh = chk.checked;
00102
00103
00104
00105 if(!ViewerRoot.pauseRefresh) ViewerRoot.autoRefreshMatchArr = [];
00106 }
00107
00108 }
00109
00110 }
00111
00112 this.handlerRefreshPeriodChange = function(v) {
00113 v = parseInt(v);
00114 if(!v || v < 1) v = 1;
00115 if(v > 9999999) v = 9999999;
00116 Debug.log("ViewerRoot Hud handlerRefreshPeriodChange " + v);
00117 document.getElementById("hudAutoRefreshPeriod").value = v;
00118 ViewerRoot.autoRefreshPeriod = v;
00119 DesktopContent.XMLHttpRequest("Request?RequestType=setUserPreferences&autoRefreshPeriod="+
00120 ViewerRoot.autoRefreshPeriod);
00121 if(ViewerRoot.autoRefreshTimer) window.clearInterval(ViewerRoot.autoRefreshTimer);
00122 ViewerRoot.autoRefreshTimer = window.setInterval(ViewerRoot.autoRefreshTick,
00123 ViewerRoot.autoRefreshPeriod);
00124 }
00125
00126 this.radioSelect = function(i) {
00127 Debug.log("ViewerRoot Hud radioSelect " + i);
00128 ViewerRoot.nextObjectMode = i;
00129
00130 DesktopContent.XMLHttpRequest("Request?RequestType=setUserPreferences&radioSelect="+i);
00131 }
00132
00133 this.handleDirContents = function(req) {
00134 Debug.log("ViewerRoot Hud handleDirContents " + req.responseText);
00135
00136 var path = DesktopContent.getXMLValue(req,'path');
00137 if(!path)
00138 {
00139 Debug.log("ViewerRoot Hud handleDirContents no path returned",Debug.HIGH_PRIORITY);
00140 return;
00141 }
00142
00143
00144
00145
00146
00147
00148 var baseDir = findDir(path);
00149 if(!baseDir)
00150 {
00151 Debug.log("ViewerRoot Hud handleDirContents path not found");
00152 return;
00153 }
00154
00155
00156
00157 baseDir[TUPLE_CONTENT] = [];
00158 baseDir[TUPLE_TYPE] |= TUPLE_TYPE_DIR_EXPANDED;
00159
00160 var dirs = req.responseXML.getElementsByTagName("dir");
00161 var files = req.responseXML.getElementsByTagName("file");
00162
00163 for(var i=0;i<dirs.length;++i)
00164 baseDir[TUPLE_CONTENT][baseDir[TUPLE_CONTENT].length] = [TUPLE_TYPE_DIR,dirs[i].getAttribute("value").replace(/[\/]+/g, ''),0,baseDir];
00165
00166 for(var i=0;i<files.length;++i)
00167 baseDir[TUPLE_CONTENT][baseDir[TUPLE_CONTENT].length] = [TUPLE_TYPE_FILE,files[i].getAttribute("value").replace(/[\/]+/g, ''),0,baseDir];
00168
00169
00170
00171 redrawDirectoryDisplay();
00172 }
00173
00174
00175
00176 var handleUserPreferences = function(req) {
00177 Debug.log("handleUserPreferences");
00178 var radioSelect = DesktopContent.getXMLValue(req,'radioSelect');
00179 if(radioSelect && radioSelect != "")
00180 {
00181 Debug.log("setting radioSelect=" + (radioSelect|0));
00182 ViewerRoot.nextObjectMode = radioSelect|0;
00183 document.getElementById("newRootObjectModeRadio" + (radioSelect|0)).checked = true;
00184 }
00185 var autoRefresh = DesktopContent.getXMLValue(req,'autoRefresh');
00186 if(autoRefresh && autoRefresh != "")
00187 {
00188 Debug.log("setting autoRefresh=" + (autoRefresh|0));
00189 var chk = document.getElementById("hudCheckbox" + 0);
00190 chk.checked = (autoRefresh|0)?true:false;
00191 Debug.log("setting autoRefresh=" + chk.checked);
00192 ViewerRoot.autoRefreshDefault = chk.checked;
00193 }
00194 var autoHide = DesktopContent.getXMLValue(req,'autoHide');
00195 if(autoHide && autoHide != "")
00196 {
00197 Debug.log("setting autoHide=" + (autoHide|0));
00198 var chk = document.getElementById("hudCheckbox" + 1);
00199 chk.checked = (autoHide|0)?true:false;
00200 Debug.log("setting autoHide=" + chk.checked);
00201 ViewerRoot.hudAutoHide = chk.checked;
00202 ViewerRoot.handleWindowResize();
00203 }
00204 var hardRefresh = DesktopContent.getXMLValue(req,'hardRefresh');
00205 if(hardRefresh !== undefined && hardRefresh !== "")
00206 {
00207 hardRefresh = hardRefresh|0;
00208 Debug.log("setting hardRefresh=" + hardRefresh);
00209 ViewerRoot.hardRefresh = hardRefresh;
00210 }
00211 var autoRefreshPeriod = DesktopContent.getXMLValue(req,'autoRefreshPeriod');
00212 if(autoRefreshPeriod && autoRefreshPeriod !== "")
00213 {
00214 Debug.log("setting autoRefreshPeriod=" + autoRefreshPeriod);
00215 ViewerRoot.autoRefreshPeriod = autoRefreshPeriod;
00216 document.getElementById("hudAutoRefreshPeriod").value = ViewerRoot.autoRefreshPeriod;
00217 }
00218 }
00219
00220
00221
00222
00223
00224 var findDir = function(path,currDir,currPath) {
00225 if(!currDir)
00226 {
00227 currDir = dirStruct[0];
00228 currPath = currDir[TUPLE_NAME] + "/";
00229
00230
00231 }
00232
00233 if(currDir[TUPLE_TYPE] & TUPLE_TYPE_DIR == 0) return 0;
00234 if(path == currPath) return currDir;
00235 if(!currDir[TUPLE_CONTENT]) return 0;
00236
00237
00238 var retVal = 0;
00239 for(var i=0;i<currDir[TUPLE_CONTENT].length;++i)
00240 {
00241 if(currDir[TUPLE_CONTENT][i][TUPLE_TYPE] & TUPLE_TYPE_DIR == 0) continue;
00242
00243 retVal = findDir(path,currDir[TUPLE_CONTENT][i],currPath + currDir[TUPLE_CONTENT][i][TUPLE_NAME] + "/");
00244 if(retVal) return retVal;
00245 }
00246 }
00247
00248
00249 var getPath = function(tuplePtr) {
00250 if(!tuplePtr) return "/";
00251 var path = tuplePtr[TUPLE_NAME] + "/";
00252 while(tuplePtr[TUPLE_PARENT])
00253 {
00254 path = tuplePtr[TUPLE_PARENT][TUPLE_NAME] + "/" + path;
00255 tuplePtr = tuplePtr[TUPLE_PARENT];
00256 }
00257 return path;
00258 }
00259
00260
00261
00262
00263
00264 var redrawDirectoryDisplay = function(currDir,tabSz,path,str) {
00265
00266 var applyStr = false;
00267 var locPath;
00268 var dirClr;
00269 if(!currDir)
00270 {
00271 hudDirBrowserDiv.innerHTML = "";
00272 str = "";
00273 currDir = currDirPtr;
00274 tabSz = 0;
00275 path = getPath(currDirPtr);
00276 applyStr = true;
00277
00278
00279 locPath = path.length>DIR_BRW_HDR_MAX_SIZE?("..." + path.substr(path.length-DIR_BRW_HDR_MAX_SIZE+3)):path;
00280 str += "<div id='ViewerRoot-hudDirBrowser-header'>";
00281 str += "<a title='Refresh\n" + path + "' style='float:left' href='Javascript:ViewerRoot.hud.changeDirectory(\"" +
00282 path + "\");'>" + locPath + "</a>";
00283 str += "<a title='Change to Parent Directory' style='float:right' href='Javascript:ViewerRoot.hud.changeDirectory(\"" +
00284 getPath(currDirPtr[TUPLE_PARENT]) + "\");'> cd .. </a>";
00285 str += "</div>";
00286 str += "<div style='clear:both'></div>";
00287 }
00288
00289 for(var i=0;currDir[TUPLE_CONTENT] && i<currDir[TUPLE_CONTENT].length;++i)
00290 {
00291 locPath = path + currDir[TUPLE_CONTENT][i][TUPLE_NAME];
00292 if(currDir[TUPLE_CONTENT][i][TUPLE_TYPE] & TUPLE_TYPE_DIR) locPath += "/";
00293
00294 str += "<div class='ViewerRoot-hudDirBrowser-item' style='margin-left:" + tabSz + "px;'>";
00295
00296 dirClr = currDir[TUPLE_CONTENT][i][TUPLE_NAME].indexOf(".root") >= 0?"#B9E6E6":"gray";
00297 if(currDir[TUPLE_CONTENT][i][TUPLE_TYPE] & TUPLE_TYPE_DIR_EXPANDED)
00298 {
00299 str += "<a title='Collapse Directory\n" + locPath + "' href='Javascript:ViewerRoot.hud.collapseDirectory(\"" + locPath + "\");'> + </a> ";
00300
00301 str += "<a title='Change Directory\n" + locPath + "' style='color:" + dirClr + "' href='Javascript:ViewerRoot.hud.changeDirectory(\"" + locPath + "\");'>" + currDir[TUPLE_CONTENT][i][TUPLE_NAME] + "</a>";
00302 }
00303 else if(currDir[TUPLE_CONTENT][i][TUPLE_TYPE] & TUPLE_TYPE_DIR)
00304 {
00305 str += "<a title='Expand Directory\n" + locPath + "' style='color:gray' href='Javascript:ViewerRoot.getDirectoryContents(\"" + locPath + "\");'> - </a> ";
00306
00307 str += "<a title='Change Directory\n" + locPath + "' style='color:" + dirClr + "' href='Javascript:ViewerRoot.hud.changeDirectory(\"" + locPath + "\");'>" + currDir[TUPLE_CONTENT][i][TUPLE_NAME] + "</a>";
00308 }
00309 else if(currDir[TUPLE_CONTENT][i][TUPLE_TYPE] & TUPLE_TYPE_FILE)
00310 {
00311 if(locPath.indexOf(".root") > 0)
00312 {
00313 str += "<a title='Open Root File\n" + locPath + "' href='Javascript:ViewerRoot.rootReq(\"" + locPath + "\");'>" +
00314 "<img style='margin:2px 2px -2px 0;' src='/WebPath/js/visualizers_lib/ViewerRoot_lib/img/histo.png'>";
00315 str += currDir[TUPLE_CONTENT][i][TUPLE_NAME] + "</a>";
00316 }
00317 else if(locPath.indexOf(".rcfg") > 0)
00318 {
00319 str += "<a title='Open Root File\n" + locPath + "' href='Javascript:ViewerRoot.rootConfigReq(\"" + locPath + "\");'>" +
00320 "<img style='margin:2px 2px -2px 0;' src='/WebPath/js/visualizers_lib/ViewerRoot_lib/img/histo3d.png'>";
00321 str += currDir[TUPLE_CONTENT][i][TUPLE_NAME] + "</a>";
00322 }
00323 else
00324 Debug.log("ViewerRoot Hud redrawDirectoryDisplay unknown file extension");
00325 }
00326 else
00327 alert("Impossible DIRECTORY error!! Notify admins");
00328
00329 str += "</div>";
00330
00331
00332 if(currDir[TUPLE_CONTENT][i][TUPLE_TYPE] & TUPLE_TYPE_DIR_EXPANDED)
00333 str = redrawDirectoryDisplay(currDir[TUPLE_CONTENT][i],tabSz+DIR_DISP_TAB_SZ,
00334 path + currDir[TUPLE_CONTENT][i][TUPLE_NAME] + "/",str);
00335 }
00336
00337
00338 if(ViewerRoot.userPermissions >= ViewerRoot.ADMIN_PERMISSIONS_THRESHOLD &&
00339 path.indexOf(PRE_MADE_ROOT_CFG_DIR) >= 0)
00340 {
00341 Debug.log("ViewerRoot Hud redrawDirectoryDisplay path " + path);
00342
00343 var iconArr = ["folderopen","page","remove"];
00344 var captionArr = ["Make New Directory","Save New View","Delete Pre-made File/Folder!"];
00345 for(var i=0;i<captionArr.length;++i)
00346 {
00347 str += "<div class='ViewerRoot-hudDirBrowser-item' style='margin-left:" + tabSz + "px;'>";
00348 str += "<a style='color:gray' title='Admin action: " + captionArr[i] +
00349 "' href='Javascript:ViewerRoot.hud.toggleAdminControls(" + i + ",\"" + path + "\");'>" +
00350 "<img style='margin:2px 2px -2px 0;' src='/WebPath/js/visualizers_lib/ViewerRoot_lib/img/" + iconArr[i] + ".gif'>";
00351 str += captionArr[i] + "</a>";
00352 str += "</div>";
00353 }
00354 }
00355
00356 if(applyStr)
00357 hudDirBrowserDiv.innerHTML = str;
00358 else
00359 return str;
00360 }
00361
00362
00363
00364 this.collapseDirectory = function(dirPath) {
00365 Debug.log("ViewerRoot Hud collapseDirectory " + dirPath);
00366
00367 var baseDir = findDir(dirPath);
00368
00369 baseDir[TUPLE_CONTENT] = 0;
00370 baseDir[TUPLE_TYPE] &= ~TUPLE_TYPE_DIR_EXPANDED;
00371
00372 redrawDirectoryDisplay();
00373 }
00374
00375 this.changeDirectory = function(dirPath) {
00376 Debug.log("ViewerRoot Hud changeDirectory " + dirPath);
00377 currDirPtr = findDir(dirPath);
00378 ViewerRoot.getDirectoryContents(dirPath);
00379 }
00380
00381
00382
00383 var animateDropDown = function() {
00384 var dir = (animationTargetTop - hudMouseOverDiv.offsetTop > 0)? 1: -1;
00385
00386 var tmpTop = hudMouseOverDiv.offsetTop + dir*ViewerRoot.HUD_DROP_DOWN_SPEED;
00387 if(Math.abs(tmpTop - animationTargetTop) <= ViewerRoot.HUD_DROP_DOWN_SPEED)
00388 {
00389 hudMouseOverDiv.style.top = animationTargetTop + "px";
00390 isDropDownAnimating = false;
00391 return;
00392 }
00393
00394 hudMouseOverDiv.style.top = tmpTop + "px";
00395 window.setTimeout(animateDropDown,30);
00396 }
00397
00398
00399 var mouseOverDropDown = function() {
00400
00401 if(isDropDownAnimating) return;
00402
00403 if(!ViewerRoot.hudAutoHide) return;
00404
00405 if(!isDropDownDown)
00406 {
00407 isDropDownDown = true;
00408 isDropDownAnimating = true;
00409 animationTargetTop = -15;
00410 window.setTimeout(animateDropDown,30);
00411 }
00412 }
00413
00414
00415 var mouseOutDropDown = function(event) {
00416 if(isDropDownAnimating) return;
00417
00418 if(event)
00419 {
00420 var e = event.toElement || event.relatedTarget;
00421 while(e)
00422 {
00423 if(e == this) return;
00424 e = e.parentNode;
00425 }
00426 }
00427
00428 if(!ViewerRoot.hudAutoHide) return ViewerRoot.hud.handleWindowResize();
00429
00430 if(isDropDownDown)
00431 {
00432 isDropDownDown = false;
00433 isDropDownAnimating = true;
00434 animationTargetTop = 15 - hudMouseOverDiv.offsetHeight;
00435 window.setTimeout(animateDropDown,30);
00436 }
00437 }
00438
00439
00440 this.toggleControls = function() {
00441 displayingControls = !displayingControls;
00442 Debug.log("ViewerRoot Hud toggleControls " + displayingControls);
00443
00444 if(displayingControls)
00445 {
00446 hudDirBrowserDiv.innerHTML = "";
00447 var str = "";
00448 if(ViewerRoot.hardRefresh)
00449 str += "<input type='checkbox' id='hardRefreshCheckbox' checked ";
00450 else
00451 str += "<input type='checkbox' id='hardRefreshCheckbox' ";
00452 str += "onchange='if(this.checked) ViewerRoot.hardRefresh = 1; else ViewerRoot.hardRefresh = 0; ViewerRoot.hud.checkboxUpdate(3);'>Hard Refresh";
00453
00454 str += "<br><div id='hudAdminControlStatus'></div>";
00455 str += "<br>";
00456 str += "<a href='javascript:ViewerRoot.hud.toggleControls();' title='Return to ROOT Browser' " +
00457 "<u>Return to Browser</u></a>";
00458 hudDirBrowserDiv.innerHTML = str;
00459 }
00460 else
00461 ViewerRoot.hud.changeDirectory(getPath(currDirPtr));
00462 }
00463
00464
00465
00466
00467
00468 this.toggleAdminControls = function(type, path) {
00469 displayingControls = !displayingControls;
00470 Debug.log("ViewerRoot Hud toggleAdminControls " + displayingControls);
00471
00472 if(displayingControls)
00473 {
00474 Debug.log("ViewerRoot Hud toggleAdminControls " + type + ": " + path);
00475
00476 adminControlsPath = path;
00477 hudDirBrowserDiv.innerHTML = "";
00478
00479 var str = "";
00480
00481 if(type == 0)
00482 {
00483 str += "Make a new ROOT Viewer<br>Configuration Directory<br>at path:<br><br>" + path + "<br>";
00484 str += "<input type='text' id='hudAdminControlField' onkeyup='document.getElementById(\"hudAdminControlStatus\").innerHTML=\"\";' size='20' value=''><br>";
00485 str += "<input type='button' onmouseup=\"ViewerRoot.hud.popUpVerification(" +
00486 "'Are you sure you want to create directory with name "REPLACE"?','ViewerRoot.hud.makeConfigDir');\" value='Make New Directory'>";
00487 }
00488 else if(type == 1)
00489 {
00490 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>";
00491 str += "<input type='text' id='hudAdminControlField' size='20' value=''><br>";
00492
00493 str += "<div ><input type='checkbox' id='hudSaveFileRunWildCardCheckbox'>" +
00494 "<label for='hudSaveFileRunWildCardCheckbox' >" + "Use Wildcard Run #" + "</label></div>";
00495
00496 str += "<input type='button' onmouseup=\"ViewerRoot.hud.popUpVerification(" +
00497 "'Are you sure you want to save a file with name "REPLACE"?','ViewerRoot.hud.saveConfigFile');\" value='Save New File'>";
00498 }
00499 else if(type == 2)
00500 {
00501 str += "Delete a ROOT Viewer<br>Configuration Directory or File<br>at path:<br><br>" + path + "<br>";
00502 str += "<input type='text' id='hudAdminControlField' onkeyup='document.getElementById(\"hudAdminControlStatus\").innerHTML=\"\";' size='20' value=''><br>";
00503 str += "<input type='button' onmouseup=\"ViewerRoot.hud.popUpVerification(" +
00504 "'Are you sure you want to delete file or directory with name "REPLACE"?','ViewerRoot.hud.removeConfigPath');\" value='Delete Path'><br>";
00505
00506 }
00507 else
00508 {
00509 Debug.log("Unknown admin type " + type);
00510 throw("Unknown type?");
00511 }
00512
00513 str += "<br><div id='hudAdminControlStatus'></div>";
00514 str += "<br>";
00515 str += "<a href='javascript:ViewerRoot.hud.toggleAdminControls();' title='Return to ROOT Browser' " +
00516 "<u>Return to Browser</u></a>";
00517 hudDirBrowserDiv.innerHTML = str;
00518
00519 }
00520 else
00521 ViewerRoot.hud.changeDirectory(getPath(currDirPtr));
00522 }
00523
00524 this.makeConfigDir = function() {
00525 var dir = document.getElementById('hudAdminControlField').value;
00526 Debug.log("ViewerRoot Hud makeConfigDir " + dir);
00527
00528 DesktopContent.XMLHttpRequest("Request?RequestType=rootAdminControls&cmd=mkdir", "path="+adminControlsPath+"&name="+dir, ViewerRoot.hud.adminControlsReqHandler);
00529
00530 }
00531
00532 this.saveConfigFile = function() {
00533
00534
00535 if(ViewerRoot.numPositionsTiled < 1)
00536 {
00537 document.getElementById('hudAdminControlStatus').innerHTML = "You must have at least 1 Root object in your configuration to save it.";
00538 return;
00539 }
00540
00541 var file = document.getElementById('hudAdminControlField').value;
00542 var wildcard = document.getElementById('hudSaveFileRunWildCardCheckbox').checked;
00543
00544 var fileStr = "";
00545
00546 fileStr += "<ROOT><DATA>";
00547 fileStr += "<numPositionsTiled>" + ViewerRoot.numPositionsTiled + "</numPositionsTiled>";
00548 fileStr += "<runNumWildcard>" + (wildcard?1:0) + "</runNumWildcard>";
00549
00550 for(var i=0;i<ViewerRoot.rootElArr.length;++i)
00551 {
00552 fileStr += "<rootObjName>" + ViewerRoot.rootObjNameArr[i] + "</rootObjName>";
00553 fileStr += "<rootPos>" + ViewerRoot.rootPosArr[i] + "</rootPos>";
00554 fileStr += "<rootIsTransparent>" + (ViewerRoot.rootIsTransparentArr[i]?1:0) + "</rootIsTransparent>";
00555 fileStr += "<rootIsAutoRefresh>" + (ViewerRoot.rootIsAutoRefreshArr[i]?1:0) + "</rootIsAutoRefresh>";
00556 }
00557
00558 fileStr += "</DATA></ROOT>";
00559 Debug.log("ViewerRoot Hud saveConfigFile fileStr " + fileStr);
00560
00561 DesktopContent.XMLHttpRequest("Request?RequestType=rootAdminControls&cmd=save",
00562 "path="+adminControlsPath+"&name="+file+"&config="+fileStr, ViewerRoot.hud.adminControlsReqHandler);
00563 }
00564
00565 this.removeConfigPath = function() {
00566
00567 var target = document.getElementById('hudAdminControlField').value;
00568 Debug.log("ViewerRoot Hud removeConfigPath " + target);
00569
00570 DesktopContent.XMLHttpRequest("Request?RequestType=rootAdminControls&cmd=delete", "path="+adminControlsPath+"&name="+target, ViewerRoot.hud.adminControlsReqHandler);
00571 }
00572
00573 this.adminControlsReqHandler = function(req) {
00574 Debug.log("ViewerRoot Hud adminControlsReqHandler " + req.responseText);
00575
00576 var status = DesktopContent.getXMLValue(req,'status');
00577
00578 if(status == "1")
00579 ViewerRoot.hud.toggleAdminControls();
00580 else
00581 document.getElementById('hudAdminControlStatus').innerHTML = status;
00582 }
00583
00584
00585
00586
00587 this.popUpVerification = function(prompt, func) {
00588
00589 if(hudPopUpDiv) hudPopUpDiv.parentNode.removeChild(hudPopUpDiv);
00590
00591 var path = document.getElementById('hudAdminControlField').value;
00592
00593 var ptrn = /^([a-zA-Z0-9_-]+)$/;
00594 if(path.length < 3 || !ptrn.test(path))
00595 {
00596 document.getElementById('hudAdminControlStatus').innerHTML = "Entry must be at least 3 characters and alpha-numeric with only underscores and dashes.";
00597 return;
00598 }
00599
00600
00601 prompt = prompt.replace(/REPLACE/g, path);
00602
00603 var el = this.hudDiv;
00604 hudPopUpDiv = document.createElement("div");
00605 hudPopUpDiv.setAttribute("class", "hudPopUpDiv");
00606 var str = "<div id='hudPopUpText'>" + prompt + "</div>" +
00607 "<input type='submit' onmouseup='ViewerRoot.hud.clearPopUpVerification(" + func + ");' value='Yes'> " +
00608 " " +
00609 "<input type='submit' onmouseup='ViewerRoot.hud.clearPopUpVerification();' value='Cancel'>";
00610 hudPopUpDiv.innerHTML = str;
00611 el.appendChild(hudPopUpDiv);
00612 }
00613
00614
00615
00616 this.clearPopUpVerification = function(func) {
00617
00618 if(hudPopUpDiv) hudPopUpDiv.parentNode.removeChild(hudPopUpDiv);
00619 hudPopUpDiv = 0;
00620 if(func) func();
00621 else
00622 document.getElementById('hudAdminControlStatus').innerHTML = "Action was cancelled by user!";
00623 }
00624
00625 hudMouseOverDiv = this.hudMouseOverDiv = document.createElement('div');
00626 hudMouseOverDiv.setAttribute("id", "ViewerRoot-hudMouseOver");
00627 hudMouseOverDiv.style.position = "absolute";
00628 hudMouseOverDiv.style.zIndex = 100;
00629
00630 this.hudDiv = document.createElement('div');
00631 this.hudDiv.setAttribute("id","ViewerRoot-hud");
00632
00633
00634
00635
00636
00637 var str = "";
00638 str += "With new Root objects...<br>";
00639
00640 var chkLabels = ["Auto-Refresh"];
00641 var chkDefaults = [""];
00642 str += "<div style='float:right'>"
00643 for(var i=0;i<chkLabels.length;++i)
00644 str += "<input type='checkbox' id='hudCheckbox" + i + "' onchange='ViewerRoot.hud.checkboxUpdate(" + i +
00645 ");' " + chkDefaults[i] + "><label for='hudCheckbox" + i + "' >" + chkLabels[i] + "</label>";
00646 str += "</div>";
00647
00648 var radioLabels = ["Tile","Replace", "Superimpose"];
00649 var radioDefault = ViewerRoot.nextObjectMode;
00650 for(var i=0;i<radioLabels.length;++i)
00651 str += "<input type='radio' id='newRootObjectModeRadio" + i + "' " + (i==radioDefault?"checked":"") +
00652 " onchange='ViewerRoot.hud.radioSelect(" + i + ");'" +
00653 " name='newRootObjectModeRadio' value='0' /><label for='newRootObjectModeRadio" + i + "'>" + radioLabels[i] + "</label><br>";
00654
00655 str += "<hr>";
00656
00657 str += "<div id='ViewerRoot-hudDirBrowser'></div>";
00658
00659
00660
00661 str += "<hr>";
00662
00663 str += "<div id='ViewerRoot-hudControlsIcon' " +
00664 "style='float:left;margin: -2px 0 -20px 20px; cursor: pointer;' onmouseup='ViewerRoot.hud.toggleControls();' " +
00665 "title='Admin Controls'><img width='18px' src='/WebPath/images/dashboardImages/icon-Settings.png'></div>";
00666
00667 str += "<div style='float:right; margin:-3px 0 -20px 0;'>";
00668 str += "Refresh Period: <input type='text' id='hudAutoRefreshPeriod' onchange='ViewerRoot.hud.handlerRefreshPeriodChange(this.value);' size='6' value='" +
00669 ViewerRoot.autoRefreshPeriod + "'> ms</div>";
00670
00671 str += "<br>";
00672
00673 str += "<a href='javascript:ViewerRoot.clearAll();' title='Clear ROOT objects from view'>Clear</a>";
00674
00675 str += "<div style='float:right;' ><input type='checkbox' id='hudCheckbox" + chkLabels.length + "' onchange='ViewerRoot.hud.checkboxUpdate(" + chkLabels.length +
00676 ");' " + "" + "><label for='hudCheckbox" + chkLabels.length + "' >" + "Auto-Hide" + "</label></div>";
00677
00678 str += "<div style='float:right;margin-right:10px;' ><input type='checkbox' id='hudCheckbox" + (chkLabels.length+1) + "' onchange='ViewerRoot.hud.checkboxUpdate(" + (chkLabels.length+1) +
00679 ");' " + "" + "><label for='hudCheckbox" + (chkLabels.length+1) + "' >" + "Pause Refresh" + "</label></div>";
00680
00681 this.hudDiv.innerHTML = str;
00682
00683
00684
00685
00686
00687
00688 hudMouseOverDiv.appendChild(this.hudDiv);
00689
00690 hudMouseOverDiv.style.width = ViewerRoot.HUD_WIDTH + "px";
00691 hudMouseOverDiv.onmouseover = mouseOverDropDown;
00692 hudMouseOverDiv.onmouseout = mouseOutDropDown;
00693 ViewerRoot.omni.appendChild(hudMouseOverDiv);
00694
00695 hudDirBrowserDiv = document.getElementById('ViewerRoot-hudDirBrowser');
00696
00697
00698
00699
00700
00701
00702
00703 if(ViewerRoot.hudAutoHide)
00704 {
00705
00706 hudMouseOverDiv.style.top = 15 - hudMouseOverDiv.offsetHeight + "px";
00707
00708 isDropDownDown = false;
00709 isDropDownAnimating = true;
00710 animationTargetTop = 15 - hudMouseOverDiv.offsetHeight;
00711 window.setTimeout(animateDropDown,30);
00712 }
00713 else
00714 this.handleWindowResize();
00715
00716
00717 DesktopContent.XMLHttpRequest("Request?RequestType=getUserPreferences","",handleUserPreferences);
00718 }
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733