// ----------------------------------------------------------- // hdfBannerToolbar: // ----------------------------------------------------------- function hdfBannerToolbar() { require(["dojo/ready", "dojo/dom", "dijit/Toolbar", "dijit/form/DropDownButton", "dijit/TooltipDialog", "dijit/form/TextBox", "dijit/registry"], function(ready, dom, Toolbar, Button, Tooltip, TextBox, registry){ // Create New toolbar Widget var hdwBannerToolbar = new Toolbar({ id: "hdmBannerToolbar" }, "hdmBannerToolbar"); hdfBannerLogin (registry); hdfBannerLogoff (registry); if (dom.byId("hdmLoginSessid").innerHTML == "1") { hdfBannerAboutHugmar(registry); hdfBannerSessions (registry); hdfBannerThemes (registry); } //hdfBannerOptions (registry); hdfBannerSessInfo (registry); hdfBannerSiderbar (registry); }); return; } // ----------------------------------------------------------- // hdfBannerAboutHugmar: Not Used // ----------------------------------------------------------- function hdfBannerAboutHugmar(registry) { require(["dojo/ready", "dijit/form/Button"], function(ready, Button){ var div = document.createElement("div"); div.appendChild(document.createTextNode("AboutHugmar")); var bannerAboutHugmar = new Button({ label: "About Hugmar", id: "hdmBannerAboutHugmar", showLabel: true, iconClass: "gif77", disabled: false, onClick: function(evt) { var features = "menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes"; var url = "http://hugmarwin.com/hugmardpl/inc60/" newWindow = window.open(url,"Hugmar Website", features); if (newWindow != null) { newWindow.focus(); } }, title: "Information About Hugmar"}, div); bannerAboutHugmar.domNode.id = "hdmBannerAboutHugmar" ; registry.byId("hdmBannerToolbar").addChild(bannerAboutHugmar); }); return; } // ----------------------------------------------------------- // hdfBannerLogin: // ----------------------------------------------------------- function hdfBannerLogin(registry) { require(["dojo/ready", "dijit/form/Button"], function(ready, Button){ var div = document.createElement("div"); div.appendChild(document.createTextNode("Login")); var bannerLoginButton = new Button({ label: "Login", id: "hdmBannerLogin1", showLabel: true, iconClass: "gifApps", //style: "font-weight: bold; color: blue;", disabled: false, onClick: function(evt) {hdfBannerLoginWindow(); }, title: "IBM i Login"}, div); bannerLoginButton.domNode.id = "hdmBannerLogin1" ; registry.byId("hdmBannerToolbar").addChild(bannerLoginButton); }); return; } // ----------------------------------------------------------- // hdfBannerSessInfo: // ----------------------------------------------------------- function hdfBannerSessInfo(registry) { require(["dojo/ready", "dojo/dom", "dijit/form/Button"], function(ready, dom, Button){ var div = document.createElement("div"); div.appendChild(document.createTextNode("BannerSessInfo")); var bannerInfoButton = new Button({ label: "Session " + dom.byId("hdmLoginSessid").innerHTML + ": not logged in", id: "hdmBannerSessInfo", showLabel: true, style: "float: right; color: blue; font-style: italic; font-size: 8px; width: 220px;", disabled: false, title: "Banner Session Info"}, div); bannerInfoButton.domNode.id = "hdmBannerSessInfo" ; registry.byId("hdmBannerToolbar").addChild(bannerInfoButton); }); return; } // ----------------------------------------------------------- // hdfBannerLoginTooltip // ----------------------------------------------------------- function hdfBannerLoginTooltip() { require(["dojo/ready", "dijit/TooltipDialog", "dijit/form/TextBox", "dijit/form/Button", "dojo/dom"], function(ready, TooltipDialog, TextBox, Button, dom){ var tooltipDialog = new TooltipDialog({ title: "Login Information", style: "width: 300px", content: dom.byId("hdmLogInArea")}); require(["dijit/focus", "dojo/dom", "dojo/domReady!"], function(focusUtil, dom){ focusUtil.focus(dom.byId("hdmLogInButtonOK")); }); }); return; } // ----------------------------------------------------------- // hdfBannerLoginWindow // ----------------------------------------------------------- function hdfBannerLoginWindow() { require(["dojo/ready", "dijit/Dialog", "dijit/form/TextBox", "dijit/form/Button", "dojo/dom"], function(ready, Dialog, TextBox, Button, dom){ loginDialog = new Dialog({ title: "Login Information", style: "width: 300px", duration: 1000, content: dom.byId("hdmLogInArea")}); loginDialog.show(); }); return; } // ----------------------------------------------------------- // hdfBannerLogoff: // ----------------------------------------------------------- function hdfBannerLogoff(registry) { require(["dojo/ready", "dijit/form/Button"], function(ready, Button){ var div = document.createElement("div"); div.appendChild(document.createTextNode("Logoff")); var bannerLogoffButton = new Button({ label: "Logoff", id: "hdmBannerLogoff", showLabel: true, iconClass: "gifApps", //style: "font-weight: bold; color: blue;", disabled: true, onClick: function(evt) {hdfBannerLogoffConfirm();}, title: "IBM i Logoff"}, div); bannerLogoffButton.domNode.id = "hdmBannerLogoff" ; registry.byId("hdmBannerToolbar").addChild(bannerLogoffButton); }); return; } // ----------------------------------------------------------- // // ----------------------------------------------------------- function hdfBannerLogoffConfirm() { if (hugmarSettings) { console.log("hdfBannerLogoffConfirm hugmarSettings: ", hugmarSettings); } if (!hugmarSettings.host) { //document.location = "desk1.html"; document.location = ""; return; } require(["dojo/ready", "dojo/_base/json", "dijit/registry"], function(ready, dojo, registry){ var jsCaller = "hdfBannerLogoffConfirm"; var jsonObj = hdfiServerSetJsonObj(jsCaller,"LOGOFF","weblogoff"); var jsonString = dojo.toJson(jsonObj); //console.log("hdfBannerLogoffConfirm jsonString: ", jsonString); //alert("hdfBannerLogoffConfirm Debug jsonString: Check Console"); var stdUrl = hugmarSettings.host.pgmdir + "/hwebhtp120.pgm?json=" + jsonString; //console.log("hdfBannerLogoffConfirm (2) stdUrl: ", stdUrl); //alert("hdfBannerLogoffConfirm Debug (2): Check Console"); hdfiServerGet(jsCaller, stdUrl); //setTimeout("document.location = hugmarSettings.nav.path;", 2000) //document.location = hugmarSettings.nav.path; //document.location = "/hugmardpl/dev/std/hdfmain.html"; }); return; } // ----------------------------------------------------------- // hdfBannerOptions: // ----------------------------------------------------------- function hdfBannerOptions(registry) { require(["dojo/ready", "dijit/DropDownMenu", "dijit/MenuItem", "dijit/form/DropDownButton", "dijit/form/ToggleButton"], function(ready, DropDownMenu, MenuItem, DropDownButton, ToggleButton){ ready(function(){ var optionsMenu = new DropDownMenu({ style: "display: none;" }); var div = document.createElement("div"); div.appendChild(document.createTextNode("OptionsDebug")); var hdwBannerDebug = new ToggleButton({ label: "Debug", id: "hdmBannerDebug", iconClass: "dijitCheckBoxIcon", //style: "font-weight: bold; color: blue;", title: "Debug On/Off"}, div); hdwBannerDebug.domNode.id = "hdmBannerDebug"; optionsMenu.addChild(hdwBannerDebug); var div = document.createElement("div"); div.appendChild(document.createTextNode("OptionsMobile")); var hdwBannerMobile = new ToggleButton({ label: "Run as Mobile", id: "hdmBannerMobile", iconClass: "dijitCheckBoxIcon", //style: "font-weight: bold; color: blue;", title: "Run Browser as it was a Mobile Device", checked: false}, div); hdwBannerMobile.domNode.id = "hdmBannerMobile"; optionsMenu.addChild(hdwBannerMobile); var div = document.createElement("div"); div.appendChild(document.createTextNode("BannerOptions")); var optionsButton = new DropDownButton({ label: "Options", iconClass: "gif73", //style: "font-weight: bold; color: blue;", dropDown: optionsMenu, title: "Login Options"}, div); optionsButton.domNode.id = "hdmBannerToolbar_Options"; registry.byId("hdmBannerToolbar").addChild(optionsButton); }); }); return; } // ----------------------------------------------------------- // hdfBannerSiderbar: // ----------------------------------------------------------- function hdfBannerSiderbar(registry) { require(["dojo/ready", "dojo/dom-style", "dojo/dom", "dijit/form/ToggleButton"], function(ready, domStyle, dom, ToggleButton){ var div = document.createElement("div"); div.appendChild(document.createTextNode("Sidebar")); var bannerSidebarButton = new ToggleButton({ label: "Sidebar Open", id: "hdmBannerSidebar", showLabel: true, iconClass: "gif71", checked: true, disabled: true, onChange: function(val) { var computedStyle = domStyle.getComputedStyle(dom.byId("hdmLeftContainer")); console.log("hdfBannerSidebar computedStyle.width: ", computedStyle.width); if (val === true){ this.set("label", "Sidebar Open"); domStyle.set("hdmLeftContainer", { "width": "250px" }); } else { this.set("label", "Sidebar Closed"); domStyle.set("hdmLeftContainer", { "width": "0px" }); } var bc = registry.byId("hdmMainBorderContainer"); bc.resize(); }, title: "Toggle Sidebar Open/Closed"}, div); bannerSidebarButton.domNode.id = "hdmBannerSidebar" ; registry.byId("hdmBannerToolbar").addChild(bannerSidebarButton); }); return; } // ----------------------------------------------------------- // hdfBannerGridbar: // ----------------------------------------------------------- function hdfBannerGridbar(registry) { require(["dojo/ready", "dijit/DropDownMenu", "dijit/MenuItem", "dijit/form/DropDownButton", "dijit/form/ToggleButton"], function(ready, DropDownMenu, MenuItem, DropDownButton, ToggleButton){ ready(function(){ var gridbarMenu = new DropDownMenu({style: "display: none;"}); var div = document.createElement("div"); div.appendChild(document.createTextNode("BannerGridbar")); var gridToolbarButton = new DropDownButton({ label: "Tab Toolbar", iconClass: "gif73", //style: "font-weight: bold; color: blue;", dropDown: gridbarMenu, title: "Tab Toolbar"}, div); gridToolbarButton.domNode.id = "hdmBannerGridbar"; registry.byId("hdmBannerToolbar").addChild(gridToolbarButton); }); }); return; } // ----------------------------------------------------------- // hdfBannerSettings: // ----------------------------------------------------------- function hdfBannerSettings(registry) { var div = document.createElement("div"); div.appendChild(document.createTextNode("Settings")); var bannerSettingsButton = new dijit.form.Button({ label: "Settings", showLabel: true, iconClass: "gifApps", disabled: false, onClick: function(evt) { hdjSettings(); }, title: "User Settings"}, div); bannerSettingsButton.domNode.id = "hdmBannerSettings" ; registry.byId("hdmBannerToolbar").addChild(hdwBannerSettingsButton); return; } // ----------------------------------------------------------- // hdfBannerSessions: // ----------------------------------------------------------- function hdfBannerSessions(registry) { require(["dojo/ready", "dijit/DropDownMenu", "dijit/Menu", "dijit/MenuItem", "dijit/form/DropDownButton", "dijit/form/ToggleButton"], function(ready, DropDownMenu, Menu, MenuItem, DropDownButton, ToggleButton){ var sessMenu = new Menu({style: "display: none;"}); var dojoSessions = {"options": [ {"id": "2", "name": "2", "type": "button", "label": "Session 2", "title": "Multiple Sessions: Session 2"}, {"id": "3", "name": "3", "type": "button", "label": "Session 3", "title": "Multiple Sessions: Session 3"}, {"id": "4", "name": "4", "type": "button", "label": "Session 4", "title": "Multiple Sessions: Session 4"} ] }; var count = 3; for (var i = 0; i < count; i++) { sessMenu.addChild(new MenuItem({ jsId: dojoSessions.options[i].name, label: dojoSessions.options[i].label, onClick: function(evt) { var menuNode = registry.getEnclosingWidget(evt.target); hdfBannerSessionGo(menuNode.jsId); return; } })); } var div = document.createElement("div"); div.appendChild(document.createTextNode("DojoSessions")); var toolButton = new DropDownButton( {label: "Sessions", iconClass: "gifApps", dropDown: sessMenu, title: "Multiple Sessions"}, div); toolButton.domNode.id = "hdmBannerSessions"; registry.byId("hdmBannerToolbar").addChild(toolButton); }); return; } // ----------------------------------------------------------- // // ----------------------------------------------------------- function hdfBannerSessionGo(sessId) { if (sessId == "2") { var windowUrl = "desk2.html"; var windowName = "Hugmar Desktop 2"; var windowFeat = "menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,location=0,dependent=yes" + ",titlebar=no,directories=no,left=160,top=120,height=760,width=1200" } if (sessId == "3") { var windowUrl = "desk3.html"; var windowName = "Hugmar Desktop 3"; var windowFeat = "menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,location=0,dependent=yes" + ",titlebar=no,directories=no,left=180,top=140,height=760,width=1200" } if (sessId == "4") { var windowUrl = "desk4.html"; var windowName = "Hugmar Desktop 4"; var windowFeat = "menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,location=0,dependent=yes" + ",titlebar=no,directories=no,left=200,top=160,height=760,width=1200" } newWindow = window.open(windowUrl,windowName,windowFeat); if (newWindow != null) { newWindow.focus(); } return; } // ----------------------------------------------------------- // hdfBannerThemes: // ----------------------------------------------------------- function hdfBannerThemes(registry) { require(["dojo/ready", "dijit/DropDownMenu", "dijit/Menu", "dijit/MenuItem", "dijit/form/DropDownButton", "dijit/form/ToggleButton"], function(ready, DropDownMenu, Menu, MenuItem, DropDownButton, ToggleButton){ var themesMenu = new Menu({style: "display: none;"}); var dojoThemes = {"options": [ {"id": "0", "name": "claro", "type": "button", "label": "claro", "title": "Dojo Theme: claro"}, {"id": "1", "name": "tundra", "type": "button", "label": "tundra", "title": "Dojo Theme: tundra"}, {"id": "2", "name": "soria", "type": "button", "label": "soria", "title": "Dojo Theme: soria"}, {"id": "3", "name": "nihilo", "type": "button", "label": "nihilo", "title": "Dojo Theme: nihilo"} ] }; var count = 4; for (var i = 0; i < count; i++) { themesMenu.addChild(new MenuItem({ jsId: dojoThemes.options[i].name, label: dojoThemes.options[i].label, onClick: function(evt) { var menuNode = registry.getEnclosingWidget(evt.target); hdfBannerThemesGo(menuNode.jsId); return; } })); } var div = document.createElement("div"); div.appendChild(document.createTextNode("DojoThemes")); var toolButton = new DropDownButton( {label: "Themes", iconClass: "gifApps", dropDown: themesMenu, title: "Dojo Themes"}, div); toolButton.domNode.id = "hdmBannerThemes"; registry.byId("hdmBannerToolbar").addChild(toolButton); }); return; } // ----------------------------------------------------------- // // ----------------------------------------------------------- function hdfBannerThemesGo(theme) { switch (theme) { case 'claro': hdfBannerThemeClaro(); break; case 'tundra': hdfBannerThemeTundra(); break; case 'soria': hdfBannerThemeSoria(); break; default: return; } var bannerDialog = new dijit.Dialog({ title: "Banner Dialog", style: "width: 400px", content: "Theme Has Been Changed To: " + theme}); bannerDialog.show(); return; } // ----------------------------------------------------------- // // ----------------------------------------------------------- function hdfBannerThemeClaro() { dijit.byId("hdwBannerToolbar").set("class", "claro"); dijit.byId("hdwMainAccContainer").set("class", "claro"); dijit.byId("hdwMainBorderContainer").set("class", "claro"); return; } // ----------------------------------------------------------- // // ----------------------------------------------------------- function hdfBannerThemeTundra() { dijit.byId("hdwBannerToolbar").set("class", "tundra"); dijit.byId("hdwMainAccContainer").set("class", "tundra"); dijit.byId("hdwMainBorderContainer").set("class", "tundra"); return; } // ----------------------------------------------------------- // // ----------------------------------------------------------- function hdfBannerThemeSoria() { dijit.byId("hdwBannerToolbar").set("class", "soria"); dijit.byId("hdwMainAccContainer").set("class", "soria"); dijit.byId("hdwMainBorderContainer").set("class", "soria"); return; }