diff --git a/lib/phast/client/scripts/System.js b/lib/phast/client/scripts/System.js index 597d95e..de33dbb 100644 --- a/lib/phast/client/scripts/System.js +++ b/lib/phast/client/scripts/System.js @@ -174,6 +174,10 @@ MouseEventArgs.FromNativeEventArgs = function(e) function KeyboardKeys() { }; +/** + * The TAB key. + */ +KeyboardKeys.Tab = 9; /** * The ENTER key. */ @@ -446,6 +450,19 @@ System.TerminateIfSenderIs = function(sender, compareTo) } return false; }; +System.CheckIfSenderIsInside = function(sender, compareTo) +{ + while (sender != null) + { + if (sender === compareTo) + { + return true; + } + sender = sender.parentNode; + if (sender == null) break; + } + return false; +}; /** * Enters full screen mode on the specified element. If no element is specified, the entire page becomes full screen. * @param element DOMElement The element with which to fill the screen. If not specified, document.body will be used. @@ -809,4 +826,9 @@ if (!String.format) ; }); }; -} \ No newline at end of file +} + +System.AddEventListener(window, "load", function() +{ + System.ClassList.Remove(document.body, "uwt-javascript-disabled"); +}); \ 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 1a0cd8f..84d93b8 100644 --- a/lib/phast/client/scripts/controls/AdditionalDetailWidget.js +++ b/lib/phast/client/scripts/controls/AdditionalDetailWidget.js @@ -24,14 +24,23 @@ function AdditionalDetailWidget(parent) }; - this.TextLink = parent.childNodes[0]; - this.ButtonLink = parent.childNodes[1]; + if (parent.children[0].tagName === "IMG") + { + this.IconElement = parent.children[0]; + this.TextLink = parent.children[1]; + this.ButtonLink = parent.children[2]; + } + else + { + this.IconElement = null; + this.TextLink = parent.children[0]; + this.ButtonLink = parent.children[1]; + } // aria this.TextLink.NativeObject = this; this.TextLink.addEventListener("keydown", function(e) { - console.log(e); if (e.keyCode == 9) { if (!e.shiftKey) diff --git a/lib/phast/client/scripts/controls/Alert.js b/lib/phast/client/scripts/controls/Alert.js index bae71b7..4ce356f 100644 --- a/lib/phast/client/scripts/controls/Alert.js +++ b/lib/phast/client/scripts/controls/Alert.js @@ -1,16 +1,18 @@ function Alert(parentElement) { - this.ParentElement = parentElement; - this.IconElement = this.ParentElement.children[0]; - this.IconElement.NativeObject = this; - this.IconElement.addEventListener("click", function() + if (parentElement) { - if (System.ClassList.Contains(this.NativeObject.ParentElement, "uwt-collapsible")) + this.ParentElement = parentElement; + this.IconElement = this.ParentElement.children[0]; + this.IconElement.NativeObject = this; + this.IconElement.addEventListener("click", function() { - System.ClassList.Toggle(this.NativeObject.ParentElement, "uwt-collapsed"); - } - }); - + if (System.ClassList.Contains(this.NativeObject.ParentElement, "uwt-collapsible")) + { + System.ClassList.Toggle(this.NativeObject.ParentElement, "uwt-collapsed"); + } + }); + } this.mvarTitle = ""; this.setTitle = function(value) diff --git a/lib/phast/server/System.inc.php b/lib/phast/server/System.inc.php index dfa79e1..620d1c5 100644 --- a/lib/phast/server/System.inc.php +++ b/lib/phast/server/System.inc.php @@ -119,6 +119,12 @@ } System::$SystemPath = $value; } + + public static function ExpandPhysicalPath($path) + { + //! FIXME: THIS DOES NOT SUPPORT APPLICATION IN SUBDIRECTORY YET + return "https://" . $_SERVER["SERVER_NAME"] . $path; + } /** * Array of global application configuration name/value pairs. @@ -535,6 +541,12 @@ } return $ret; } + + public static function GetLoginPageUrl() + { + return System::ReplaceVariables(System::GetConfigurationValue("LoginPageRedirectURL", "~/account/login")); + } + public static function RedirectToLoginPage($forceNonTenanted = false) { if (System::$EnableTenantedHosting) @@ -545,7 +557,7 @@ { $_SESSION["System.LastRedirectURL"] = $_SERVER["REQUEST_URI"]; } - System::Redirect(System::ReplaceVariables(System::GetConfigurationValue("LoginPageRedirectURL", "~/account/login")), $forceNonTenanted); + System::Redirect(System::GetLoginPageUrl(), $forceNonTenanted); return; } public static function RedirectFromLoginPage() diff --git a/lib/phast/server/WebControls/AdditionalDetailWidget.inc.php b/lib/phast/server/WebControls/AdditionalDetailWidget.inc.php index ddce226..bc74c09 100644 --- a/lib/phast/server/WebControls/AdditionalDetailWidget.inc.php +++ b/lib/phast/server/WebControls/AdditionalDetailWidget.inc.php @@ -18,11 +18,15 @@ class AdditionalDetailWidget extends WebControl { + public string $RelatedActionButtonUrl; + public $DisplayStyle; /* AdditionalDetailWidgetDisplayStyle */ public $Text; public $ShowText; /* bool */ public $ShowURL; /* bool */ + + public $ImageUrl; public $TargetFrame; public $TargetURL; @@ -37,12 +41,15 @@ public function __construct($id) { - parent::__construct($id); + parent::__construct(); + + $this->RelatedActionButtonUrl = ""; $this->ClassTitle = ""; $this->DisplayStyle = AdditionalDetailWidgetDisplayStyle::Ellipsis; $this->MenuItemHeaderText = "Available Actions"; $this->MenuItems = array(); $this->ShowText = true; + $this->ImageUrl = null; $this->ShowURL = true; } @@ -104,6 +111,10 @@ private function renderMainLink() { + if ($this->ImageUrl !== null) + { + echo("ImageUrl) . "\" />"); + } if ($this->ShowURL) { echo("renderMainLink(); - - echo(" "); + + $apbButtonUrl = "#"; + if ($this->RelatedActionButtonUrl !== "") + { + $apbButtonUrl = System::ExpandRelativePath($this->RelatedActionButtonUrl); + } + echo(" "); echo("
"); diff --git a/lib/phast/server/WebControls/Menu.inc.php b/lib/phast/server/WebControls/Menu.inc.php index de8a4c5..7bb1375 100644 --- a/lib/phast/server/WebControls/Menu.inc.php +++ b/lib/phast/server/WebControls/Menu.inc.php @@ -32,6 +32,10 @@ use Phast\Phast; class Menu extends WebControl { + /** + * @var bool + */ + public $MultiSelect; /** * Determines whether the menu displays horizontally or vertically. * @var MenuOrientation @@ -47,6 +51,7 @@ use Phast\Phast; { parent::__construct(); + $this->MultiSelect = false; $this->Items = array(); $this->ParseChildElements = true; @@ -80,6 +85,11 @@ use Phast\Phast; { $this->ClassList[] = "Vertical"; } + + if ($this->MultiSelect) + { + $this->ClassList[] = "uwt-multiselect"; + } $this->Controls = array(); foreach ($this->Items as $menuItem) @@ -112,46 +122,87 @@ use Phast\Phast; $li->ClassList[] = "uwt-has-children"; } - $a = new Anchor(); - $a->TargetURL = $menuItem->TargetURL; - if ($menuItem->OnClientClick != null) + if ($menuItem->TargetURL !== null) { - $a->Attributes[] = new WebControlAttribute("onclick", $menuItem->OnClientClick); - } - - if ($menuItem->IconName != "") - { - $iIcon = new HTMLControl(); - $iIcon->TagName = "i"; - $iIcon->ClassList[] = "fa"; - $iIcon->ClassList[] = "fa-" . $menuItem->IconName; - $a->Controls[] = $iIcon; - } - - if ($menuItem->Description != null) - { - $spanTitle = new HTMLControl(); - $spanTitle->TagName = "span"; - $spanTitle->ClassList[] = "uwt-title"; - $spanTitle->InnerHTML = $menuItem->Title; - $a->Controls[] = $spanTitle; + $a = new Anchor(); + $a->TargetURL = $menuItem->TargetURL; + if ($menuItem->OnClientClick != null) + { + $a->Attributes[] = new WebControlAttribute("onclick", $menuItem->OnClientClick); + } - $spanDescription = new HTMLControl(); - $spanDescription->TagName = "span"; - $spanDescription->ClassList[] = "uwt-description"; - $spanDescription->InnerHTML = $menuItem->Description; - $a->Controls[] = $spanDescription; + if ($menuItem->IconName != "") + { + $iIcon = new HTMLControl(); + $iIcon->TagName = "i"; + $iIcon->ClassList[] = "fa"; + $iIcon->ClassList[] = "fa-" . $menuItem->IconName; + $a->Controls[] = $iIcon; + } + + if ($menuItem->Title != null) + { + $spanTitle = new HTMLControl(); + $spanTitle->TagName = "span"; + $spanTitle->ClassList[] = "uwt-title"; + if ($menuItem->Description === null) + { + $spanTitle->ClassList[] = "uwt-description-empty"; + } + $spanTitle->InnerHTML = $menuItem->Title; + $a->Controls[] = $spanTitle; + } + if ($menuItem->Description != null) + { + $spanDescription = new HTMLControl(); + $spanDescription->TagName = "span"; + $spanDescription->ClassList[] = "uwt-description"; + $spanDescription->InnerHTML = $menuItem->Description; + $a->Controls[] = $spanDescription; + } + + $li->Controls[] = $a; } else { - $spanTitle = new HTMLControl(); - $spanTitle->TagName = "span"; - $spanTitle->ClassList[] = "uwt-title uwt-description-empty"; - $spanTitle->InnerHTML = $menuItem->Title; - $a->Controls[] = $spanTitle; - } - $li->Controls[] = $a; + if ($menuItem->IconName != "") + { + $iIcon = new HTMLControl(); + $iIcon->TagName = "i"; + $iIcon->ClassList[] = "fa"; + $iIcon->ClassList[] = "fa-" . $menuItem->IconName; + $li->Controls[] = $iIcon; + } + + if ($menuItem->Title != null) + { + $spanTitle = new HTMLControl(); + $spanTitle->TagName = "span"; + $spanTitle->ClassList[] = "uwt-title"; + if ($menuItem->Description === null) + { + $spanTitle->ClassList[] = "uwt-description-empty"; + } + $spanTitle->InnerHTML = $menuItem->Title; + $li->Controls[] = $spanTitle; + } + if ($menuItem->Description != null) + { + $spanDescription = new HTMLControl(); + $spanDescription->TagName = "span"; + $spanDescription->ClassList[] = "uwt-description"; + $spanDescription->InnerHTML = $menuItem->Description; + $li->Controls[] = $spanDescription; + } + if ($menuItem->Controls != null) + { + foreach ($menuItem->Controls as $ctl) + { + $li->Controls[] = $ctl; + } + } + } if (count($menuItem->Items) > 0) { @@ -231,6 +282,7 @@ use Phast\Phast; public $Items; public $IconName; public $Title; + public $Controls; public $TargetURL; public $OnClientClick; public $Selected; @@ -250,6 +302,8 @@ use Phast\Phast; { parent::__construct(); $this->Title = $title; + $this->Controls = null; + $this->IconName = null; $this->TargetURL = $targetURL; $this->OnClientClick = $onClientClick; $this->Description = $description; diff --git a/lib/phast/server/WebControls/TextBox.inc.php b/lib/phast/server/WebControls/TextBox.inc.php index 64f4b77..f86bfea 100644 --- a/lib/phast/server/WebControls/TextBox.inc.php +++ b/lib/phast/server/WebControls/TextBox.inc.php @@ -64,7 +64,7 @@ $this->Items = array(); $this->TagName = "div"; - $this->ClassList[] = "TextBox"; + $this->ClassList[] = "uwt-textbox"; $this->OpenWhenFocused = true; $this->MultiSelect = false; @@ -82,7 +82,7 @@ if ($this->RequireSelectionFromChoices) { - $this->ClassList[] = "RequireSelection"; + $this->ClassList[] = "uwt-selection-required"; } if ($this->ClearOnFocus) { @@ -90,7 +90,7 @@ } if ($this->MultiSelect) { - $this->ClassList[] = "MultiSelect"; + $this->ClassList[] = "uwt-multiselect"; } if ($this->SuggestionURL != null) { @@ -102,10 +102,10 @@ } $divTextboxContent = new HTMLControl("div"); - $divTextboxContent->ClassList[] = "TextboxContent"; + $divTextboxContent->ClassList[] = "uwt-textbox-content"; $spanTextboxSelectedItems = new HTMLControl("span"); - $spanTextboxSelectedItems->ClassList[] = "TextboxSelectedItems"; + $spanTextboxSelectedItems->ClassList[] = "uwt-textbox-selected-items"; $i = 0; foreach ($this->Items as $item) @@ -113,15 +113,15 @@ if (!$item->Selected) continue; $spanSelectedItem = new HTMLControl("span"); - $spanSelectedItem->ClassList[] = "SelectedItem"; + $spanSelectedItem->ClassList[] = "uwt-textbox-selected-item"; $spanText = new HTMLControl("span"); - $spanText->ClassList[] = "Text"; + $spanText->ClassList[] = "uwt-text"; $spanText->InnerHTML = $item->Title; $spanSelectedItem->Controls[] = $spanText; $aCloseButton = new Anchor(); - $aCloseButton->ClassList[] = "CloseButton"; + $aCloseButton->ClassList[] = "uwt-delete-button"; $spanSelectedItem->Controls[] = $aCloseButton; $spanTextboxSelectedItems->Controls[] = $spanSelectedItem;