diff --git a/lib/phast/client/scripts/System.js b/lib/phast/client/scripts/System.js index de33dbb..bf97797 100644 --- a/lib/phast/client/scripts/System.js +++ b/lib/phast/client/scripts/System.js @@ -831,4 +831,61 @@ if (!String.format) System.AddEventListener(window, "load", function() { System.ClassList.Remove(document.body, "uwt-javascript-disabled"); -}); \ No newline at end of file +}); + +System.EnsureElementVisible = function(element, relativeToElement) +{ + var buttonRect = null; + if (relativeToElement !== null) + { + buttonRect = relativeToElement.getBoundingClientRect(); + + console.log ("button rect: "); + console.log(buttonRect); + + var previewRect = element.getBoundingClientRect(); + console.log ("preview rect: "); + console.log(previewRect); + + element.style.top = buttonRect.bottom + "px"; + element.style.left = buttonRect.right + "px"; + + var offsetBottom = element.offsetTop + previewRect.height; + console.log ("popup bottom: " + offsetBottom); + console.log ("document height: " + document.body.clientHeight); + + element.style.left = buttonRect.right + "px"; + if (offsetBottom > document.body.clientHeight) + { + element.style.top = ""; + element.style.bottom = (document.body.clientHeight - buttonRect.top) + "px"; + } + else + { + element.style.top = buttonRect.bottom + "px"; + element.style.bottom = ""; + } + } + else + { + var previewRect = element.getBoundingClientRect(); + console.log ("preview rect: "); + console.log(previewRect); + + var offsetTop = element.offsetTop; + var offsetBottom = element.offsetTop + previewRect.height; + console.log ("popup bottom: " + offsetBottom); + console.log ("document height: " + document.body.clientHeight); + + if (offsetBottom > document.body.clientHeight) + { + var newBottom = document.body.clientHeight - offsetTop; // (offsetBottom - document.body.clientHeight); + console.log("new bottom: " + newBottom + "px") + element.style.top = ""; + element.style.bottom = newBottom + "px"; + } + else + { + } + } +}; \ No newline at end of file diff --git a/lib/phast/client/scripts/controls/AdditionalDetailWidget.js b/lib/phast/client/scripts/controls/AdditionalDetailWidget.js index c46a31b..5780174 100644 --- a/lib/phast/client/scripts/controls/AdditionalDetailWidget.js +++ b/lib/phast/client/scripts/controls/AdditionalDetailWidget.js @@ -24,32 +24,7 @@ function AdditionalDetailWidget(parent) return; } - var buttonRect = this.ButtonLink.getBoundingClientRect(); - console.log ("button rect: "); - console.log(buttonRect); - - var previewRect = this.PreviewElement.getBoundingClientRect(); - console.log ("preview rect: "); - console.log(previewRect); - - this.PreviewElement.style.top = buttonRect.bottom + "px"; - this.PreviewElement.style.left = buttonRect.right + "px"; - - var offsetBottom = this.PreviewElement.offsetTop + previewRect.height; - console.log ("popup bottom: " + offsetBottom); - console.log ("document height: " + document.body.clientHeight); - - this.PreviewElement.style.left = buttonRect.right + "px"; - if (offsetBottom > document.body.clientHeight) - { - this.PreviewElement.style.top = ""; - this.PreviewElement.style.bottom = (document.body.clientHeight - buttonRect.top) + "px"; - } - else - { - this.PreviewElement.style.top = buttonRect.bottom + "px"; - this.PreviewElement.style.bottom = ""; - } + System.EnsureElementVisible(this.PreviewElement, this.ButtonLink); }; this.Show = function () @@ -121,7 +96,7 @@ function AdditionalDetailWidget(parent) this.TextLink.addEventListener("focus", function(e) { if (e.relatedTarget !== null) - {Show + { var pos = this.compareDocumentPosition(e.relatedTarget); if (pos == Node.DOCUMENT_POSITION_FOLLOWING && e.relatedTarget !== this.NativeObject.ButtonLink) { diff --git a/lib/phast/client/scripts/controls/Menu.js b/lib/phast/client/scripts/controls/Menu.js index bbe0583..19d3b3d 100644 --- a/lib/phast/client/scripts/controls/Menu.js +++ b/lib/phast/client/scripts/controls/Menu.js @@ -70,6 +70,7 @@ function ContextMenu() { if (!System.ClassList.Contains(this, "uwt-visible")) { + System.ClassList.Remove(document.body, "uwt-prevent-scrolling"); this.remove(); } }); @@ -154,11 +155,13 @@ function ContextMenu() if (parent == null) parent = document.body; parent.appendChild(elem); this.ParentElement = elem; + System.ClassList.Add(document.body, "uwt-prevent-scrolling"); } this.ParentElement.className = "uwt-menu uwt-popup"; this.ParentElement.offsetWidth = this.ParentElement.offsetWidth; // thanks https://stackoverflow.com/a/24195559 System.ClassList.Add(this.ParentElement, "uwt-visible"); + System.EnsureElementVisible(this.ParentElement, null); }; this.Hide = function() { diff --git a/lib/phast/server/System.inc.php b/lib/phast/server/System.inc.php index 0e20405..9f18483 100644 --- a/lib/phast/server/System.inc.php +++ b/lib/phast/server/System.inc.php @@ -1016,6 +1016,11 @@ */ public static function Launch() { + if (!session_start()) + { + echo ("session_start didn't work!"); + } + System::Initialize(); if (System::$EnableTenantedHosting) @@ -1123,7 +1128,7 @@ if (!$success) { - $retval = call_user_func(System::$ErrorEventHandler, new ErrorEventArgs("The specified resource is not available on this server. (" . (System::$EnableTenantedHosting ? ("Tenanted - " . System::GetTenantName()) : "Non-Tenanted") . ")")); + $retval = call_user_func(System::$ErrorEventHandler, new ErrorEventArgs("The specified resource is not available on this server. (" . (System::$EnableTenantedHosting ? ("Tenanted - " . System::GetTenantName()) : "Non-Tenanted") . ")
Path: " . $_GET["virtualpath"])); return false; } return true; @@ -1321,9 +1326,4 @@ } \date_default_timezone_set(System::GetConfigurationValue("System.DefaultTimezone", date_default_timezone_get())); - - if (!session_start()) - { - echo ("session_start didn't work!"); - } ?> diff --git a/lib/phast/server/WebControls/AdditionalDetailWidget.inc.php b/lib/phast/server/WebControls/AdditionalDetailWidget.inc.php index d18d790..40a9b1d 100644 --- a/lib/phast/server/WebControls/AdditionalDetailWidget.inc.php +++ b/lib/phast/server/WebControls/AdditionalDetailWidget.inc.php @@ -139,7 +139,7 @@ } else { - echo ("" . $this->Text . ""); + echo ("" . ($this->Text == "" ? " " : $this->Text) . ""); } }