fix some stuff

This commit is contained in:
Michael Becker 2024-01-13 13:43:54 -05:00
parent b633978a0d
commit 0ec7fc4500
6 changed files with 48 additions and 6 deletions

View File

@ -136,9 +136,12 @@ window.addEventListener("load", function()
{
var items = document.getElementsByClassName("uwt-alert");
for (var i = 0; i < items.length; i++)
{
if (!System.ClassList.Contains(items[i], "uwt-alert-sticky"))
{
items[i].style.right = "-2000px";
}
}
}, 5000);
});

View File

@ -40,9 +40,9 @@ class QuickSort
while ($leftIndex <= $rightIndex)
{
while ($arr[$leftIndex] < $pivot)
while ($predicate($arr[$leftIndex], $pivot) < 0)
$leftIndex++;
while ($arr[$rightIndex] > $pivot)
while ($predicate($arr[$rightIndex], $pivot) > 0)
$rightIndex--;
if ($predicate($arr[$leftIndex], $arr[$rightIndex]) <= 0) {
$tmp = $arr[$leftIndex];
@ -74,6 +74,18 @@ class QuickSort
return $array;
}
public function Sort_By($arr, $key_f) {
$values = array_map($key_f, $arr);
asort($values);
$sorted_arr = array();
foreach ($values as $idx => $value) {
$sorted_arr[] = $arr[$idx];
}
return $sorted_arr;
}
}
?>

View File

@ -827,6 +827,7 @@
{
// FIXME : find the "best match" for the given route
$qs = new QuickSort();
/*
$sortedPages = $qs->Sort($actualPages, function($left, $right)
{
$leftStr = System::__ReplaceAny($left->FileName, "{", "}" , "?");
@ -834,6 +835,12 @@
$val = strlen($leftStr) < strlen($rightStr);
return $val;
});
*/
$sortedPages = $qs->Sort_By($actualPages, function($item)
{
$val = System::__ReplaceAny($item->FileName, "{", "}" , "?");
return strlen($val);
});
$actualPage = $actualPages[count($actualPages) - 1];
if ($actualPage->FileName !== null)
{

View File

@ -372,6 +372,24 @@
$guidChars .= "}";
return $guidChars;
}
public function __toStringFormat($includeDashes = false, $prefix = "{", $suffix = "}")
{
$guidChars = $prefix;
$guidChars .= UUID::HexsToChars($this->_a >> 24, $this->_a >> 16);
$guidChars .= UUID::HexsToChars($this->_a >> 8, $this->_a);
if ($includeDashes) $guidChars .= '-';
$guidChars .= UUID::HexsToChars($this->_b >> 8, $this->_b);
if ($includeDashes) $guidChars .= '-';
$guidChars .= UUID::HexsToChars($this->_c >> 8, $this->_c);
if ($includeDashes) $guidChars .= '-';
$guidChars .= UUID::HexsToChars($this->_d, $this->_e);
if ($includeDashes) $guidChars .= '-';
$guidChars .= UUID::HexsToChars($this->_f, $this->_g);
$guidChars .= UUID::HexsToChars($this->_h, $this->_i);
$guidChars .= UUID::HexsToChars($this->_j, $this->_k);
$guidChars .= $suffix;
return $guidChars;
}
private static function format($input)
{

View File

@ -128,7 +128,7 @@
}
else
{
echo ("<span class=\"apb-text\">" . $this->Text . "</span>");
echo ("<a class=\"apb-text apb-empty\" href=\"#\">" . $this->Text . "</span>");
}
}

View File

@ -12,11 +12,13 @@
class WebPageMessage
{
public $Message;
public $Title;
public $Severity;
public function __construct($message, $severity = WebPageMessageSeverity::None)
public function __construct($message, $title = "", $severity = WebPageMessageSeverity::None)
{
$this->Message = $message;
$this->Title = $title;
$this->Severity = $severity;
}
}