various fixes and improvements
This commit is contained in:
parent
ff4c6be547
commit
b12271ce21
@ -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.
|
||||
@ -810,3 +827,8 @@ if (!String.format)
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
System.AddEventListener(window, "load", function()
|
||||
{
|
||||
System.ClassList.Remove(document.body, "uwt-javascript-disabled");
|
||||
});
|
||||
@ -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)
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
function Alert(parentElement)
|
||||
{
|
||||
if (parentElement)
|
||||
{
|
||||
this.ParentElement = parentElement;
|
||||
this.IconElement = this.ParentElement.children[0];
|
||||
@ -10,7 +12,7 @@ function Alert(parentElement)
|
||||
System.ClassList.Toggle(this.NativeObject.ParentElement, "uwt-collapsed");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
this.mvarTitle = "";
|
||||
this.setTitle = function(value)
|
||||
|
||||
@ -120,6 +120,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.
|
||||
* @var array
|
||||
@ -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()
|
||||
|
||||
@ -18,12 +18,16 @@
|
||||
|
||||
class AdditionalDetailWidget extends WebControl
|
||||
{
|
||||
public string $RelatedActionButtonUrl;
|
||||
|
||||
public $DisplayStyle; /* AdditionalDetailWidgetDisplayStyle */
|
||||
public $Text;
|
||||
|
||||
public $ShowText; /* bool */
|
||||
public $ShowURL; /* bool */
|
||||
|
||||
public $ImageUrl;
|
||||
|
||||
public $TargetFrame;
|
||||
public $TargetURL;
|
||||
public $TargetScript;
|
||||
@ -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("<img class=\"apb-icon\" src=\"" . System::ExpandRelativePath($this->ImageUrl) . "\" />");
|
||||
}
|
||||
if ($this->ShowURL)
|
||||
{
|
||||
echo("<a class=\"apb-text\" href=\"");
|
||||
@ -136,7 +147,12 @@
|
||||
{
|
||||
$this->renderMainLink();
|
||||
|
||||
echo("<a class=\"apb-button\" href=\"#\" tabindex=\"-1\"> </a>");
|
||||
$apbButtonUrl = "#";
|
||||
if ($this->RelatedActionButtonUrl !== "")
|
||||
{
|
||||
$apbButtonUrl = System::ExpandRelativePath($this->RelatedActionButtonUrl);
|
||||
}
|
||||
echo("<a class=\"apb-button\" href=\"" . $apbButtonUrl . "\" tabindex=\"-1\"> </a>");
|
||||
|
||||
echo("<div class=\"apb-preview uwt-popup\">");
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -81,6 +86,11 @@ use Phast\Phast;
|
||||
$this->ClassList[] = "Vertical";
|
||||
}
|
||||
|
||||
if ($this->MultiSelect)
|
||||
{
|
||||
$this->ClassList[] = "uwt-multiselect";
|
||||
}
|
||||
|
||||
$this->Controls = array();
|
||||
foreach ($this->Items as $menuItem)
|
||||
{
|
||||
@ -112,6 +122,8 @@ use Phast\Phast;
|
||||
$li->ClassList[] = "uwt-has-children";
|
||||
}
|
||||
|
||||
if ($menuItem->TargetURL !== null)
|
||||
{
|
||||
$a = new Anchor();
|
||||
$a->TargetURL = $menuItem->TargetURL;
|
||||
if ($menuItem->OnClientClick != null)
|
||||
@ -128,30 +140,69 @@ use Phast\Phast;
|
||||
$a->Controls[] = $iIcon;
|
||||
}
|
||||
|
||||
if ($menuItem->Description != null)
|
||||
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
|
||||
{
|
||||
|
||||
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 uwt-description-empty";
|
||||
$spanTitle->InnerHTML = $menuItem->Title;
|
||||
$a->Controls[] = $spanTitle;
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$li->Controls[] = $a;
|
||||
|
||||
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;
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user