minor fixes and improvements

This commit is contained in:
Michael Becker 2024-02-02 01:46:16 -05:00
parent 413cf121c3
commit 83c02a2773
5 changed files with 70 additions and 35 deletions

View File

@ -831,4 +831,61 @@ if (!String.format)
System.AddEventListener(window, "load", function() System.AddEventListener(window, "load", function()
{ {
System.ClassList.Remove(document.body, "uwt-javascript-disabled"); System.ClassList.Remove(document.body, "uwt-javascript-disabled");
}); });
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
{
}
}
};

View File

@ -24,32 +24,7 @@ function AdditionalDetailWidget(parent)
return; return;
} }
var buttonRect = this.ButtonLink.getBoundingClientRect(); System.EnsureElementVisible(this.PreviewElement, this.ButtonLink);
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 = "";
}
}; };
this.Show = function () this.Show = function ()
@ -121,7 +96,7 @@ function AdditionalDetailWidget(parent)
this.TextLink.addEventListener("focus", function(e) this.TextLink.addEventListener("focus", function(e)
{ {
if (e.relatedTarget !== null) if (e.relatedTarget !== null)
{Show {
var pos = this.compareDocumentPosition(e.relatedTarget); var pos = this.compareDocumentPosition(e.relatedTarget);
if (pos == Node.DOCUMENT_POSITION_FOLLOWING && e.relatedTarget !== this.NativeObject.ButtonLink) if (pos == Node.DOCUMENT_POSITION_FOLLOWING && e.relatedTarget !== this.NativeObject.ButtonLink)
{ {

View File

@ -70,6 +70,7 @@ function ContextMenu()
{ {
if (!System.ClassList.Contains(this, "uwt-visible")) if (!System.ClassList.Contains(this, "uwt-visible"))
{ {
System.ClassList.Remove(document.body, "uwt-prevent-scrolling");
this.remove(); this.remove();
} }
}); });
@ -154,11 +155,13 @@ function ContextMenu()
if (parent == null) parent = document.body; if (parent == null) parent = document.body;
parent.appendChild(elem); parent.appendChild(elem);
this.ParentElement = elem; this.ParentElement = elem;
System.ClassList.Add(document.body, "uwt-prevent-scrolling");
} }
this.ParentElement.className = "uwt-menu uwt-popup"; this.ParentElement.className = "uwt-menu uwt-popup";
this.ParentElement.offsetWidth = this.ParentElement.offsetWidth; // thanks https://stackoverflow.com/a/24195559 this.ParentElement.offsetWidth = this.ParentElement.offsetWidth; // thanks https://stackoverflow.com/a/24195559
System.ClassList.Add(this.ParentElement, "uwt-visible"); System.ClassList.Add(this.ParentElement, "uwt-visible");
System.EnsureElementVisible(this.ParentElement, null);
}; };
this.Hide = function() this.Hide = function()
{ {

View File

@ -1016,6 +1016,11 @@
*/ */
public static function Launch() public static function Launch()
{ {
if (!session_start())
{
echo ("session_start didn't work!");
}
System::Initialize(); System::Initialize();
if (System::$EnableTenantedHosting) if (System::$EnableTenantedHosting)
@ -1123,7 +1128,7 @@
if (!$success) 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") . ")<br />Path: " . $_GET["virtualpath"]));
return false; return false;
} }
return true; return true;
@ -1321,9 +1326,4 @@
} }
\date_default_timezone_set(System::GetConfigurationValue("System.DefaultTimezone", date_default_timezone_get())); \date_default_timezone_set(System::GetConfigurationValue("System.DefaultTimezone", date_default_timezone_get()));
if (!session_start())
{
echo ("session_start didn't work!");
}
?> ?>

View File

@ -139,7 +139,7 @@
} }
else else
{ {
echo ("<a class=\"apb-text apb-empty\" tabindex=\"-1\">" . $this->Text . "</a>"); echo ("<a class=\"apb-text apb-empty\" tabindex=\"-1\">" . ($this->Text == "" ? "&nbsp;" : $this->Text) . "</a>");
} }
} }